Updates a custom access control policy.

Usage notes

In this example, the name of the access control policy whose ID is cp-jExXAqIYkwHN**** is changed to NewControlPolicy.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes UpdateControlPolicy

The operation that you want to perform. Set the value to UpdateControlPolicy.

PolicyId String Yes cp-jExXAqIYkwHN****

The ID of the access control policy.

NewPolicyName String No NewControlPolicy

The new name of the access control policy.

The name must be 1 to 128 characters in length. The name can contain letters, digits, and hyphens (-) and must start with a letter.

NewDescription String No ExampleControlPolicy

The new description of the access control policy.

The description must be 1 to 1,024 characters in length. The description can contain letters, digits, underscores (_), and hyphens (-) and must start with a letter.

NewPolicyDocument String No {"Version":"1","Statement":[{"Effect":"Deny","Action":["ram:UpdateRole","ram:DeleteRole","ram:AttachPolicyToRole","ram:DetachPolicyFromRole"],"Resource":"acs:ram:*:*:role/ResourceDirectoryAccountAccessRole"}]}

The new document of the access control policy.

The document can be a maximum of 4,096 characters in length.

For more information about the languages of access control policies, see Languages of access control policies.

For more information about the examples of access control policies, see Examples of custom access control policies.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
ControlPolicy Object

The details of the access control policy.

UpdateDate String 2021-03-18T10:04:55Z

The time when the access control policy was updated.

Description String ExampleControlPolicy

The description of the access control policy.

EffectScope String RAM

The effective scope of the access control policy. Valid values:

  • All: The access control policy is in effect for Alibaba Cloud accounts, RAM users, and RAM roles.
  • RAM: The access control policy is in effect only for RAM users and RAM roles.
AttachmentCount String 0

The number of times that the access control policy is referenced.

PolicyName String NewControlPolicy

The name of the access control policy.

PolicyId String cp-jExXAqIYkwHN****

The ID of the access control policy.

CreateDate String 2021-03-18T09:24:19Z

The time when the access control policy was created.

PolicyType String Custom

The type of the access control policy. Valid values:

  • System: system access control policy
  • Custom: custom access control policy
RequestId String 2DFCE4C9-04A9-4C83-BB14-FE791275EC53

The ID of the request.

Examples

Sample requests

https://resourcemanager.aliyuncs.com/?Action=UpdateControlPolicy
&PolicyId=cp-jExXAqIYkwHN****
&NewPolicyName=NewControlPolicy
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<UpdateControlPolicyResponse>
	<ControlPolicy>
		<PolicyType>Custom</PolicyType>
		<UpdateDate>2021-03-18T10:04:55Z</UpdateDate>
		<Description>ExampleControlPolicy</Description>
		<AttachmentCount>0</AttachmentCount>
		<PolicyName>NewControlPolicy</PolicyName>
		<CreateDate>2021-03-18T09:24:19Z</CreateDate>
		<PolicyId>cp-jExXAqIYkwHN****</PolicyId>
		<EffectScope>RAM</EffectScope>
	</ControlPolicy>
	<RequestId>2DFCE4C9-04A9-4C83-BB14-FE791275EC53</RequestId>
</UpdateControlPolicyResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "ControlPolicy" : {
    "PolicyType" : "Custom",
    "UpdateDate" : "2021-03-18T10:04:55Z",
    "Description" : "ExampleControlPolicy",
    "AttachmentCount" : 0,
    "PolicyName" : "NewControlPolicy",
    "CreateDate" : "2021-03-18T09:24:19Z",
    "PolicyId" : "cp-jExXAqIYkwHN****",
    "EffectScope" : "RAM"
  },
  "RequestId" : "2DFCE4C9-04A9-4C83-BB14-FE791275EC53"
}

Error codes

For a list of error codes, visit the API Error Center.