Queries policy attachment records.
You can view the following information:
- Policy attachment records under an Alibaba Cloud account or a resource group
- Policies attached to RAM users, RAM user groups, or RAM roles
- RAM users, RAM user groups, or RAM roles to which policies are attached under an Alibaba Cloud account or a resource group
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ListPolicyAttachments |
The operation that you want to perform. Set the value to ListPolicyAttachments. |
ResourceGroupId | String | No | rg-001 |
The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account. |
PolicyType | String | No | System |
The type of the policy. If you do not specify this parameter, the system lists all types of policies. Valid values:
|
PolicyName | String | No | AdministratorAccess |
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-). |
PrincipalType | String | No | IMSUser |
The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values:
|
PrincipalName | String | No | alice@demo.onaliyun.com |
The name of the object to which the policy is attached. |
PageNumber | Integer | No | 1 |
The number of the page to return. Pages start from page 1. Default value: 1. |
PageSize | Integer | No | 10 |
The number of entries to return on each page. Valid values: 1 to 100. Default value: 10. |
Language | String | No | zh-CN |
The language that is used to return the description of the system policy. Valid values:
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
PageNumber | Integer | 1 |
The page number of the returned page. |
PageSize | Integer | 10 |
The number of entries returned per page. |
PolicyAttachments | Array |
The policy attachment records. |
|
PolicyAttachment | |||
AttachDate | String | 2015-01-23T12:33:18Z |
The time when the policy was attached. |
Description | String | Administrator |
The description of the policy. |
PolicyName | String | AdministratorAccess |
The name of the policy. |
PolicyType | String | System |
The type of the policy. Valid values:
|
PrincipalName | String | alice@demo.onaliyun.com |
The name of the object to which the policy is attached. |
PrincipalType | String | IMSUser |
The type of the object to which the policy is attached. Valid values:
|
ResourceGroupId | String | rg-9gLOoK**** |
The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. |
RequestId | String | 7B8A4E7D-6CFF-471D-84DF-195A7A241ECB |
The ID of the request. |
TotalCount | Integer | 2 |
The total number of returned entries. |
Examples
Sample requests
https://resourcemanager.aliyuncs.com/?Action=ListPolicyAttachments
&<Common request parameters>
Sample success responses
XML
format
<ListPolicyAttachmentsResponse>
<RequestId>7B8A4E7D-6CFF-471D-84DF-195A7A241ECB</RequestId>
<PageNumber>1</PageNumber>
<PageSize>10</PageSize>
<TotalCount>2</TotalCount>
<PolicyAttachments>
<PolicyAttachment>
<ResourceGroupId>rg-9gLOoK****</ResourceGroupId>
<PolicyType>System</PolicyType>
<PolicyName>AdministratorAccess</PolicyName>
<PrincipalType>IMSUser</PrincipalType>
<PrincipalName>alice@demo.onaliyun.com</PrincipalName>
<AttachDate>2015-01-23T12:33:18Z</AttachDate>
<Description>Administrator</Description>
</PolicyAttachment>
<PolicyAttachment>
<ResourceGroupId>12983255839348****</ResourceGroupId>
<PolicyType>Custom</PolicyType>
<PolicyName>OSS-Bucket1-Access</PolicyName>
<PrincipalType>ServiceRole</PrincipalType>
<PrincipalName>image-service@role.demo.onaliyunservice.com</PrincipalName>
<AttachDate>2015-01-23T12:33:18Z</AttachDate>
<Description>Access to OSS bucket 1</Description>
</PolicyAttachment>
</PolicyAttachments>
</ListPolicyAttachmentsResponse>
JSON
format
{
"RequestId" : "7B8A4E7D-6CFF-471D-84DF-195A7A241ECB",
"PageNumber": 1,
"PageSize": 10,
"TotalCount": 2,
"PolicyAttachments" : {
"PolicyAttachment" : [
{
"ResourceGroupId": "rg-9gLOoK****",
"PolicyType": "System",
"PolicyName": "AdministratorAccess",
"PrincipalType": "IMSUser",
"PrincipalName": "alice@demo.onaliyun.com",
"AttachDate" : "2015-01-23T12:33:18Z",
"Description": "Administrator"
},
{
"ResourceGroupId": "12983255839348****",
"PolicyType": "Custom",
"PolicyName": "OSS-Bucket1-Access",
"PrincipalType": "ServiceRole",
"PrincipalName": "image-service@role.demo.onaliyunservice.com",
"AttachDate" : "2015-01-23T12:33:18Z",
"Description": "Access to OSS bucket 1"
}
]
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter.PolicyType | The specified policy type is invalid. | The error message returned because the policy type is invalid. |
404 | EntityNotExists.ResourceGroup | The specified resource group does not exist. You must first create a resource group. | The error message returned because the resource group does not exist. Create the resource group first. |
404 | EntityNotExist.Policy | The policy does not exist. | The error message returned because the policy does not exist. |
For a list of error codes, visit the API Error Center.