GetCollectionPolicy

Updated at:

Retrieves the specified collection policy.

Operation description

This operation is available only at the following endpoints: China (Shanghai), Singapore, and cn-heyuan-acdr-1 (Heyuan Chinese Automotive Compliance Cloud).

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

log:GetCollectionPolicy

get

*CollectionPolicy

acs:log::{#accountId}:collectionpolicy/{#policyName}

  • log:TLSVersion
None

Request syntax

GET /collectionpolicy/{policyName} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

policyName

string

Yes

The name of the policy.

your_log_policy

Request parameters

Parameter

Type

Required

Description

Example

productCode

string

No

The product code.

oss

dataCode

string

No

The log type code.

access_log

Response elements

Element

Type

Description

Example

object

The response struct.

collectionPolicy

object

The collection policy.

centralizeConfig

object

The centralized delivery configuration.

destLogstore

string

The destination Logstore for centralized delivery.

your-sls-logstore-in-beijing

destProject

string

The destination project for centralized delivery.

your-sls-project-in-beijing

destRegion

string

The destination region for centralized delivery.

cn-beijing

destTTL

integer

The data retention period in days for centralized delivery.

0

centralizeEnabled

boolean

Indicates whether centralized storage is enabled.

false

dataCode

string

The log type code.

access_log

dataConfig

object

The configuration that is supported only when the log type is a global log type, such as when productCode is set to sls. Otherwise, this parameter is empty.

dataProject

string

This parameter is valid only when the log type is a global log type, such as when productCode is set to sls. If this parameter is empty, logs are collected to the default dedicated project of the account in the specified dataRegion.

""

dataRegion

string

The configuration that is supported only when the log type is a global log type, such as when productCode is set to sls. This parameter specifies the region to which global logs are collected during initial configuration.

cn-beijing

enabled

boolean

Indicates whether the policy is enabled.

true

internalPolicy

boolean

Indicates whether the policy is a built-in policy. Built-in policies cannot be modified or deleted.

false

policyConfig

object

The collection policy configuration.

instanceIds

array

The list of instance IDs.

string

The instance ID.

your-test-bucket1

regions

array

The list of regions to which the instances belong. Wildcards are supported.

string

The region ID.

cn-hangzhou

resourceMode

string

The resource collection mode.

all

resourceTags

object

The resource tags.

{"tag1":"value1","tag2":"value2"}

policyName

string

The name of the policy.

your_log_policy

policyUid

string

The Alibaba Cloud account ID of the account to which the policy belongs. If the policy is created by a resource directory administrator or a resource directory delegated administrator, this parameter is set to the Alibaba Cloud account ID of that administrator.

148***********50

productCode

string

The product code.

oss

resourceDirectory

object

The resource directory configuration. This parameter is empty if no resource directory is configured.

accountGroupType

string

The account group type in the resource directory. Valid values:

  • all: all accounts.

  • custom: custom accounts.

all,custom

members

array

The list of member accounts when the resource directory configuration is set to custom mode.

string

The Alibaba Cloud account ID.

165***********50

Examples

Success response

JSON format

{
  "collectionPolicy": {
    "centralizeConfig": {
      "destLogstore": "your-sls-logstore-in-beijing\n",
      "destProject": "your-sls-project-in-beijing\n",
      "destRegion": "cn-beijing\n",
      "destTTL": 0
    },
    "centralizeEnabled": false,
    "dataCode": "access_log",
    "dataConfig": {
      "dataProject": "\"\"",
      "dataRegion": "cn-beijing"
    },
    "enabled": true,
    "internalPolicy": false,
    "policyConfig": {
      "instanceIds": [
        "your-test-bucket1\n"
      ],
      "regions": [
        "cn-hangzhou"
      ],
      "resourceMode": "all",
      "resourceTags": {
        "tag1": "value1",
        "tag2": "value2"
      }
    },
    "policyName": "your_log_policy",
    "policyUid": "148***********50\n",
    "productCode": "oss",
    "resourceDirectory": {
      "accountGroupType": "all,custom",
      "members": [
        "165***********50"
      ]
    }
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.