Queries the control policies that are attached to a folder or member account.

In this example, the control policies that are attached to the folder fd-ZDNPiT**** are queried.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListControlPolicyAttachmentsForTarget

The operation that you want to perform. Set the value to ListControlPolicyAttachmentsForTarget.

TargetId String Yes fd-ZDNPiT****

The ID of the object whose control policies you want to query. Control policies can be attached to the following objects:

  • Root folder
  • Child folders of the Root folder
  • Member accounts
Language String No zh-CN

The language that is used to return the descriptions of the control policies. Valid values:

  • zh-CN: Chinese (default value)
  • en: English
  • ja: Japanese

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
ControlPolicyAttachments Array of ControlPolicyAttachment

The list of attached control policies.

ControlPolicyAttachment
AttachDate String 2021-03-19T02:56:24Z

The time when the control policy was attached.

Description String ExampleControlPolicy

The description of the control policy.

PolicyId String cp-jExXAqIYkwHN****

The ID of the control policy.

PolicyName String ExampleControlPolicy

The name of the control policy.

PolicyType String Custom

The type of the control policy. Valid values:

  • System: system control policy
  • Custom: custom control policy
RequestId String C276B600-7B7A-49E8-938C-E16CFA955A82

The ID of the request.

Examples

Sample requests

https://resourcemanager.aliyuncs.com/?Action=ListControlPolicyAttachmentsForTarget
&TargetId=fd-ZDNPiT****
&<Common request parameters>

Sample success responses

XML format

<ListControlPolicyAttachmentsForTargetResponse>
	  <RequestId>C276B600-7B7A-49E8-938C-E16CFA955A82</RequestId>
	  <ControlPolicyAttachments>
		    <ControlPolicyAttachment>
			      <PolicyType>System</PolicyType>
			      <Description>System control policy available for all operations on the cloud</Description>
			      <AttachDate>2021-03-18T07:27:59Z</AttachDate>
			      <PolicyName>FullAliyunAccess</PolicyName>
			      <PolicyId>cp-FullAliyunAccess</PolicyId>
		    </ControlPolicyAttachment>
		    <ControlPolicyAttachment>
			      <PolicyType>Custom</PolicyType>
			      <Description>ExampleControlPolicy</Description>
			      <AttachDate>2021-03-19T02:56:24Z</AttachDate>
			      <PolicyName>ExampleControlPolicy</PolicyName>
			      <PolicyId>cp-jExXAqIYkwHN****</PolicyId>
		    </ControlPolicyAttachment>
	  </ControlPolicyAttachments>
</ListControlPolicyAttachmentsForTargetResponse>

JSON format

{
  "RequestId": "C276B600-7B7A-49E8-938C-E16CFA955A82",
  "ControlPolicyAttachments": {
    "ControlPolicyAttachment": [
      {
        "PolicyType": "System",
        "Description": "System control policy available for all operations on the cloud",
        "AttachDate": "2021-03-18T07:27:59Z",
        "PolicyName": "FullAliyunAccess",
        "PolicyId": "cp-FullAliyunAccess"
      },
      {
        "PolicyType": "Custom",
        "Description": "ExampleControlPolicy",
        "AttachDate": "2021-03-19T02:56:24Z",
        "PolicyName": "ExampleControlPolicy",
        "PolicyId": "cp-jExXAqIYkwHN****"
      }
    ]
  }
}

Error codes

HTTP status code Error code Error message Description
404 EntityNotExists.Target The specified target does not exist in the resource directory. The error message returned because the specified object does not exist in the resource directory.

For a list of error codes, visit the API Error Center.