接口描述

为授权策略创建新的版本

请求参数

Action
  • 类型:String
  • 必须:是
  • 描述:系统规定参数,取值:CreatePolicyVersion
PolicyName
  • 类型:String
  • 必须:是
  • 描述:授权策略名称
PolicyDocument
  • 类型:String
  • 必须:是
  • 描述:授权策略内容,最大长度2048字节
SetAsDefault
  • 类型:String
  • 必须:否
  • 描述:是否设置为默认授权策略,默认值为"false"

返回参数

PolicyVersion
  • 类型:PolicyVersion
  • 描述:新建的授权策略版本的信息

需要的权限

Action
ram:CreatePolicyVersion
Resource
acs:ram:*:${AccountId}:policy/${PolicyName}

错误信息

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.

请求示例

https://ram.aliyuncs.com/?Action=CreatePolicyVersion
&PolicyName=OSS-Administrator
&PolicyDocument={ "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"}
&<公共请求参数>

返回示例

  • XML格式
    <CreatePolicyVersionResponse>
        <RequestId>9B34724D-54B0-4A51-B34D-4512372FE1BE</RequestId>
        <PolicyVersion>
            <VersionId>v3</VersionId>
            <IsDefaultVersion>false</IsDefaultVersion>
            <CreateDate>2015-01-23T12:33:18Z</CreateDate>
        </Policy>
    </CreatePolicyVersionResponse>
  • JSON格式
    {
        "RequestId": "9B34724D-54B0-4A51-B34D-4512372FE1BE",
        "PolicyVersion": {
            "VersionId": "v3",
            "IsDefaultVersion": false,
            "CreateDate": "2015-01-23T12:33:18Z"
        }
    }