Updates a custom control policy.

In this example, the name of a control policy is changed from cp-jExXAqIYkwHN**** 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 control policy.

NewPolicyName String No NewControlPolicy

The new name of the control policy.

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

NewDescription String No ExampleControlPolicy

The new description of the control policy.

The description must be 1 to 1,024 characters in length and can contain letters, digits, underscores (_), and hyphens (-). It 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 control policy.

The document can be a maximum of 2,048 characters in length.

For more information about the languages of control policies, see Control policy languages.

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

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

Response parameters

Parameter Type Example Description
ControlPolicy Struct

The details of the control policy.

AttachmentCount String 0

The number of times that the control policy is referenced.

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

The time when the control policy was created.

Description String ExampleControlPolicy

The description of the control policy.

EffectScope String RAM

The effective scope of the control policy. Valid values:

  • All: The control policy is in effect for Alibaba Cloud accounts, RAM users, and RAM roles.
  • RAM: The control policy is in effect for RAM users and RAM roles.
PolicyId String cp-jExXAqIYkwHN****

The ID of the control policy.

PolicyName String NewControlPolicy

The name of the control policy.

PolicyType String Custom

The type of the control policy. Valid values:

  • System: system control policy
  • Custom: custom control policy
UpdateDate String 2021-03-18T10:04:55Z

The time when the control policy was updated.

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

<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

{
  "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.