edit-icon download-icon

GetPolicy

Last Updated: Nov 10, 2017

Interface description

Obtains the information of a specified authorization policy.

Request parameters

Action

  • Type: String
  • Required: Yes
  • Description: Required. The parameter value is “GetPolicy”.

PolicyType

  • Type: String
  • Required: Yes
  • Description: Authorization policy type. Value: “System” or “Custom”.

PolicyName

  • Name: PolicyName
  • Type: String
  • Required: Yes
  • Description: Authorization policy name.

Return parameters

Policy

  • Type: Policy Type
  • Description: Basic information of an authorization policy.

Required permissions

Action

ram:GetPolicy

Resource

acs:ram:*:${AccountId} or system:policy/${PolicyName}

Error messages

InvalidParameter.PolicyType
  • HTTP Status: 400
  • Error Message: The parameter - “PolicyType” is incorrect.
InvalidParameter.PolicyName.InvalidChars
  • HTTP Status: 400
  • Error Message: The parameter - “PolicyNam” contains invalid chars.
InvalidParameter.PolicyName.Length
  • HTTP Status: 400
  • Error Message: The parameter - “PolicyName” beyond the length limit.
EntityNotExist.Policy
  • HTTP Status: 404
  • Error Message: The policy does not exist.

Operation examples

Request example

  1. https://ram.aliyuncs.com/?Action=GetPolicy
  2. &PolicyName=OSS-Administrator
  3. &<Public request parameters>

Return example

XML format

  1. <GetPolicyResponse>
  2. <RequestId>697852FB-50D7-44D9-9774-530C31EAC572</RequestId>
  3. <Policy>
  4. <PolicyName>OSS-Administrator</PolicyName>
  5. <PolicyType>Custom</PolicyType>
  6. <Description>OSS administrator permission</Description>
  7. <DefaultVersion>v1</DefaultVersion>
  8. <CreateDate>2015-01-23T12:33:18Z</CreateDate>
  9. <UpdateDate>2015-01-23T12:33:18Z</UpdateDate>
  10. <AttachmentCount>0</AttachmentCount>
  11. </Policy>
  12. </GetPolicyResponse>

JSON format

  1. {
  2. "RequestId": "697852FB-50D7-44D9-9774-530C31EAC572",
  3. "Policy": {
  4. "PolicyName": "OSS-Administrator",
  5. "PolicyType": "Custom",
  6. "Description": "OSS administrator permission",
  7. "DefaultVersion": "v1",
  8. "CreateDate": "2015-01-23T12:33:18Z",
  9. "UpdateDate": "2015-01-23T12:33:18Z",
  10. "AttachmentCount": 0
  11. }
  12. }
Thank you! We've received your feedback.