edit-icon download-icon

CreatePolicyVersion

Last Updated: Nov 10, 2017

Interface description

Creates an authorization policy version.

Request parameters

Action

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

PolicyName

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

PolicyDocument

  • Type: String
  • Required: Yes
  • Description: Authorization policy content. It consists of a maximum of 2,048 characters.

SetAsDefault

  • Type: String
  • Required: No
  • Description: Whether to set as the default authorization policy. The default value is “false”.

Return parameters

PolicyVersion

  • Type: PolicyVersion Type
  • Description: Information of the newly created authorization policy version.

Required permissions

Action

ram:CreatePolicyVersion

Resource

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

Error messages

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.
LimitExceeded.Policy.Version
  • HTTP Status: 409
  • Error Message: The count of policy version beyond the current limits.

Operation examples

Request example

  1. https://ram.aliyuncs.com/?Action=CreatePolicyVersion
  2. &PolicyName=OSS-Administrator
  3. &PolicyDocument={ "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"}
  4. &<Public request parameters>

Return example

XML format

  1. <CreatePolicyVersionResponse>
  2. <RequestId>9B34724D-54B0-4A51-B34D-4512372FE1BE</RequestId>
  3. <PolicyVersion>
  4. <VersionId>v3</VersionId>
  5. <IsDefaultVersion>false</IsDefaultVersion>
  6. <CreateDate>2015-01-23T12:33:18Z</CreateDate>
  7. </Policy>
  8. </CreatePolicyVersionResponse>

JSON format

  1. {
  2. "RequestId": "9B34724D-54B0-4A51-B34D-4512372FE1BE",
  3. "PolicyVersion": {
  4. "VersionId": "v3",
  5. "IsDefaultVersion": false,
  6. "CreateDate": "2015-01-23T12:33:18Z"
  7. }
  8. }
Thank you! We've received your feedback.