Updating a Policy
Function
This API is used to update the name, description, or content of a policy. If no parameter is provided, the policy remains unchanged. A policy's type cannot be changed. This API can be called only from the organization's management account.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
PATCH https://{endpoint}/v1/organizations/policies/{policy_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
policy_id |
Yes |
String |
Unique ID of the policy. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Security-Token |
No |
String |
Security token (session token) of your temporary security credentials. If a temporary security credential is used, this header is required. |
X-Language |
No |
String |
Language of the returned results. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
content |
No |
String |
Policy text content to be added to the new policy. |
description |
No |
String |
Optional description to be assigned to the policy. |
name |
No |
String |
Name to be assigned to the policy. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
policy |
PolicyDto object |
Details about a policy. |
Parameter |
Type |
Description |
---|---|---|
content |
String |
Text content of the policy. |
policy_summary |
PolicySummaryDto object |
Information about a policy (policy content not included). |
Parameter |
Type |
Description |
---|---|---|
is_builtin |
Boolean |
A boolean value indicating whether the specified policy is a system policy. If the value is true, the policy is a system policy. You can attach the policy to roots, OUs, or accounts, but you cannot edit it. |
description |
String |
Description of the policy. |
id |
String |
Unique ID of the policy. |
urn |
String |
Uniform resource name of the policy. |
name |
String |
Name of the policy. |
type |
String |
Policy type. It can be service_control_policy or tag_policy. |
Example Requests
Updating a policy
PATCH https://{endpoint}/v1/organizations/policies/{policy_id} { "content" : "{\"Version\":\"5.0\",\"Statement\":[{\"Sid\":\"Statement1\",\"Effect\":\"Allow\",\"Action\":[\"*\"],\"Resource\":[\"*\"]}]}", "description" : "newdesc", "name" : "auto09231619598990t1HPolicyName" }
Example Responses
Status code: 200
Successful.
{ "policy" : { "content" : "{\"Version\":\"5.0\",\"Statement\":[{\"Sid\":\"Statement1\",\"Effect\":\"Allow\",\"Action\":[\"*\"],\"Resource\":[\"*\"]}]}", "policy_summary" : { "is_builtin" : false, "description" : "newdesc", "id" : "p-xce633owqm0o1c929wno7l850z2rdr4m", "urn" : "organizations::0a6d25d23900d45c0faac010e0fb4de0:policy:o-fhkmi6mek7wlqdp6nideqhb47qwtjdsv/service_control_policy/p-b4wpejd02o66g0pvfinvsatp4t9krfum", "name" : "auto09231619598990t1HPolicyName", "type" : "service_control_policy" } } }
Status Codes
Status Code |
Description |
---|---|
200 |
Successful. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot