Creates a version for a policy.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreatePolicyVersion |
The operation that you want to perform. Set the value to CreatePolicyVersion. |
PolicyDocument | String | Yes | { "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"} |
The document of the policy. The document must be 1 to 2,048 characters in length. |
PolicyName | String | Yes | OSS-Administrator |
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-). |
SetAsDefault | Boolean | No | false |
Specifies whether to set the policy version as the default version. Valid values:
Default value: false. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
PolicyVersion | Struct |
The information of the policy version. |
|
CreateDate | String | 2015-01-23T12:33:18 |
The time when the policy version was created. |
IsDefaultVersion | Boolean | false |
Indicates whether the policy version is the default version. |
VersionId | String | v3 |
The ID of the policy version. |
RequestId | String | 9B34724D-54B0-4A51-B34D-4512372FE1BE |
The ID of the request. |
Examples
Sample requests
https://resourcemanager.aliyuncs.com/?Action=CreatePolicyVersion
&PolicyDocument={ "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"}
&PolicyName=OSS-Administrator
&<Common request parameters>
Sample success responses
XML
format
<CreatePolicyVersionResponse>
<RequestId>9B34724D-54B0-4A51-B34D-4512372FE1BE</RequestId>
<PolicyVersion>
<VersionId>v3</VersionId>
<IsDefaultVersion>false</IsDefaultVersion>
<CreateDate>2015-01-23T12:33:18Z</CreateDate>
</PolicyVersion>
</CreatePolicyVersionResponse>
JSON
format
{
"RequestId": "9B34724D-54B0-4A51-B34D-4512372FE1BE",
"PolicyVersion": {
"VersionId": "v3",
"IsDefaultVersion": false,
"CreateDate": "2015-01-23T12:33:18Z"
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter.PolicyName.InvalidChars | The policy name contains invalid characters. It must only contain upper or lower case letters, numbers, and dash (-). | The error message returned because the policy name contains invalid characters. The policy name can only contain letters, digits, and hyphens (-). |
400 | InvalidParameter.PolicyName.Length | The length of the policy name is invalid. It must be 1 to 64 characters in length. | The error message returned because the length of the policy name is invalid. The policy name must be 1 to 64 characters in length. |
404 | EntityNotExist.Policy | The policy does not exist. | The error message returned because the policy does not exist. |
409 | LimitExceeded.Policy.Version | The maximum number of policy versions is exceeded. | The error message returned because the maximum number of policy versions has been reached. |
For a list of error codes, visit the API Error Center.