注1:当需要更新自定义策略的策略文档的内容时需要使用创建新策略版本的功能,任何自定义策略最多拥有5个策略版本;如果策略已经有5个策略版本,需要再次更新自定义策略时,则需要使用DeletePolicyVersion接口删除现存的某个策略版本。
注2:无法为系统策略和非属于自己的自定义策略创建新的策略版本。
名称 | 类型 | 必须 | 长度限制(字符) | 参数格式 | 描述 |
---|---|---|---|---|---|
Action | String | 是 | 确定值 | [a-zA-Z]+ |
操作接口名,系统规定参数,取值:CreatePolicyVersion |
PolicyKrn | String | 是 | 最短是25,最长2048 | 格式:krn:ksc:iam::account-id:policy/policy-name | 待创建新版本的策略的唯一标识 |
PolicyDocument | String | 是 | 最短1,最长5K | [\w\s:"*{}[]/$-]+ |
待创建新策略版本的策略文档内容 |
SetAsDefault | Boolean | 否 | 可选参数,用于设置是否将新创建的策略版本指定为默认策略版本 |
名称 | 类型 | 描述 |
---|---|---|
PolicyVersion | PolicyVersionType | 新创建策略版本的信息 |
错误代码(Code) | 错误消息(Message) | HTTP 状态码 | 中文描述(语义) |
---|---|---|---|
InvalidParameterValue | An value must be supplied for the input parameter %s. | 400 | 输入参数%s的值不能为空,具体参数名在%s说明 |
InvalidParameterValue | An invalid or out-of-range value was supplied for the input parameter %s. | 400 | 输入参数 %s的值无效、不合法或者超出范围,具体参数名在%s说明 |
PolicyVersionLimitExceeded | The request was rejected because it attempted to create policy version beyond the current KSC account limits. | 409 | 请求被拒绝,因其创建的策略版本数量超过当前账户限制(PolicyVersion数量限制为5) |
PolicyNoSuchEntity | The request was rejected because it referenced ‘Policy’ that does not exist. | 404 | 请求被拒绝,因其引用的“策略”不存在 |
PolicyDocumentNotJsonFormat | The ‘PolicyDocument’ is not json format. | 400 | 策略文档不是Json格式 |
PolicyDocumentInvalidVersion | The ‘Verion’ in ‘PolicyDocument’ is invalid. | 400 | 策略文档中的Version元素无效 |
PolicyDocumentInvalidStatement | The ‘Statement’ in ‘PolicyDocument’ is invalid. | 400 | 策略文档中的Statement元素无效 |
PolicyDocumentInvalidEffect | The ‘Effect’ in ‘PolicyDocument’ is invalid. | 400 | 策略文档中的Effect元素无效 |
PolicyDocumentInvalidResource | The ‘Resource’ in ‘PolicyDocument’ is invalid. | 400 | 策略文档中的Resource元素无效 |
PolicyDocumentInvalidAction | The ‘Action’ in ‘PolicyDocument’ is invalid. | 400 | 策略文档中的Action元素无效 |
https://iam.api.ksyun.com/?Action=CreatePolicyVersion
&PolicyKrn=krn:ksc:iam::12345678901234567890:policy/IAMadmin
&PolicyDocument={"Version":"2015-11-01","Statement":[{"Effect":"Allow","Action":"iam:*",
"Resource":"*"}]}
&公共请求参数
<CreatePolicyVersionResponse>
<CreatePolicyVersionResult>
<PolicyVersion>
<IsDefaultVersion>false</IsDefaultVersion>
<VersionId>v2</VersionId>
<CreateDate>2016-05-16T18:01:39.696Z</CreateDate>
</PolicyVersion>
</CreatePolicyVersionResult>
<ResponseMetadata>
<RequestId>253fc36f-e382-47ec-b44c-109553ea7d37</RequestId>
</ResponseMetadata>
</CreatePolicyVersionResponse>
{
"CreatePolicyVersionResult": {
"PolicyVersion": {
"IsDefaultVersion": "false",
"VersionId": "v2",
"CreateDate": "2016-05-16T18:01:39.696Z"
}
},
"ResponseMetadata": {
"RequestId": "3e3dde15-327e-4289-804a-95683f143233"
}
}
文档内容是否对您有帮助?
评价建议不能为空
非常感谢您的反馈,我们会继续努力做到更好!