Enabling a Policy Type for a Root
Function
This API is used to enable a policy type for a root of an organization. After you enable a policy type for the root, you can attach the policies of this type to the root, or any OU or account under the root. This is an asynchronous request executed in the background. You can use ListRoots to view the status of the policy types for the specified root. 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.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
organizations:policies:enable
Write
root *
g:ResourceTag/<tag-key>
-
-
URI
POST /v1/organizations/policies/enable
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Security-Token | No | String | Definition Security token (session token) of your temporary security credentials. If a temporary security credential is used, this header is required. Constraints N/A Range The value contains 0 to 32,768 characters. Default Value No default value |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| policy_type | Yes | String | Definition Name of a policy type. The value can be service_control_policy or tag_policy. Constraints Mandatory Range Enumerated values: service_control_policy and tag_policy. Default Value None |
| root_id | Yes | String | Definition Unique ID of a root. Constraints Mandatory Range The value must comply with the regular expression ^r-[0-9a-z]{4,32}$. The value contains a maximum of 34 characters. Default Value None |
Response Parameters
Status code: 202
| Parameter | Type | Description |
|---|---|---|
| root | RootDto object | Definition Root details. Constraints Mandatory Range N/A Default Value No default value |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Unique ID of a root. Constraints Mandatory Range The value must comply with the regular expression ^r-[0-9a-z]{4,32}$. The value contains 1 to 34 characters. Default Value No default value |
| urn | String | Definition Uniform resource name of the root Constraints Mandatory Range The value contains 1 to 1,500 characters. Default Value No default value |
| name | String | Definition Name of the root. Constraints Mandatory Range The value must comply with the regular expression ^[a-zA-Z][0-9a-zA-Z_-]+$. The value contains 1 to 64 characters. Default Value No default value |
| policy_types | Array of PolicyTypeSummaryDto objects | Definition Policy types that are currently enabled for the root. The policies of these types can be attached to the root or to its OUs or accounts. Constraints Mandatory Range None Default Value No default value |
| created_at | String | Definition Time when a root was created. Constraints Mandatory Range The value must be in ISO 8601 format. Default Value No default value |
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition Status of the policy type associated with a root. To attach a policy of a specified type to a root or an OU or account in the root, the policy must be available in the organization and enabled for the root. It can be enabled, pending_enable, disabled, or pending_disable. Constraints Mandatory Range The value contains 1 to 64 characters. Default Value No default value |
| type | String | Definition Name of a policy type. The value can be service_control_policy or tag_policy. Constraints Mandatory Range The value contains 1 to 64 characters. Default Value No default value |
Example Requests
Enabling a policy type for a root
POST https://{endpoint}/v1/organizations/policies/enable
{
"policy_type" : "service_control_policy",
"root_id" : "r-o1qqtqfo7xl427v7g"
} Example Responses
Status code: 202
Successful.
{
"root" : {
"id" : "r-o1qqtqfo7xl427v7g",
"urn" : "organizations::0a6d25d23900d45c0faac010e0fb4de0:policy:o-fhkmi6mek7wlqdp6nideqhb47qwtjdsv/service_control_policy/p-b4wpejd02o66g0pvfinvsatp4t9krfum",
"name" : "paas_iam_573331",
"policy_types" : [ {
"status" : "enabled",
"type" : "service_control_policy"
} ],
"created_at" : "2022-09-22T02:23:21Z"
}
} Status Codes
| Status Code | Description |
|---|---|
| 202 | 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