调用CreateControlPolicy创建自定义管控策略。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
resourcemanager:CreateControlPolicy |
create |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| PolicyName |
string |
是 |
管控策略名称。 长度为 1~128 个字符,必须以英文字母开头,可以包含英文字母、数字和短划线(-)。 |
ExampleControlPolicy |
| Description |
string |
否 |
管控策略描述。 长度为 1~1024 个字符,必须以英文字母开头,可以包含英文字母、数字、下划线(_)和短划线(-)。 |
ExampleControlPolicy |
| EffectScope |
string |
是 |
管控策略的生效范围。 取值:RAM,表示该管控策略仅针对 RAM 用户或 RAM 角色生效。 |
RAM |
| PolicyDocument |
string |
是 |
管控策略内容。 最大长度为 4096 个字符。 管控策略语言,请参见管控策略语言。 管控策略示例,请参见自定义管控策略示例。 |
{"Version":"1","Statement":[{"Effect":"Deny","Action":["ram:UpdateRole","ram:DeleteRole","ram:AttachPolicyToRole","ram:DetachPolicyFromRole"],"Resource":"acs:ram:*:*:role/ResourceDirectoryAccountAccessRole"}]} |
| Tag |
array<object> |
否 |
管控策略的标签。 |
|
|
object |
否 |
管控策略的标签。 |
||
| Key |
string |
否 |
标签键。 |
k1 |
| Value |
string |
否 |
标签值。 |
v1 |
| ControlPolicyType |
string |
否 |
RESOURCE_CONTROL_POLICY |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回结果。 |
||
| ControlPolicy |
object |
管控策略详情。 |
|
| AttachmentCount |
string |
管控策略被引用的次数。 |
0 |
| CreateDate |
string |
管控策略创建时间。 |
2021-03-18T09:24:19Z |
| Description |
string |
管控策略描述。 |
ExampleControlPolicy |
| EffectScope |
string |
管控策略生效范围。 取值:RAM,表示该管控策略仅针对 RAM 用户或 RAM 角色生效。 |
RAM |
| PolicyId |
string |
管控策略 ID。 |
cp-jExXAqIYkwHN**** |
| PolicyName |
string |
管控策略名称。 |
ExampleControlPolicy |
| PolicyType |
string |
管控策略类型。取值:
|
Custom |
| UpdateDate |
string |
管控策略更新时间。 |
2021-03-18T09:24:19Z |
| ControlPolicyType |
string |
RESOURCE_CONTROL_POLICY |
|
| RequestId |
string |
请求 ID。 |
776B05B3-A0B0-464B-A191-F4E1119A94B2 |
示例
正常返回示例
JSON格式
{
"ControlPolicy": {
"AttachmentCount": "0",
"CreateDate": "2021-03-18T09:24:19Z",
"Description": "ExampleControlPolicy",
"EffectScope": "RAM",
"PolicyId": "cp-jExXAqIYkwHN****",
"PolicyName": "ExampleControlPolicy",
"PolicyType": "Custom",
"UpdateDate": "2021-03-18T09:24:19Z",
"ControlPolicyType": "RESOURCE_CONTROL_POLICY"
},
"RequestId": "776B05B3-A0B0-464B-A191-F4E1119A94B2"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 409 | InvalidParameter.PolicyDocument.Length | The maximum length of the policy document is exceeded. It must not exceed 4096 characters. | |
| 409 | ResourceControlPolicyNotEnabled | Resource control policy has not been enabled. | 资源管控策略未处于Enabled状态下。 |
| 409 | InvalidResourceControlPolicyEnablementStatus | The resource control policy enablement status is not valid to perform this operation. | 在当前的资源管控策略启用状态下,无法进行此操作。 |
| 409 | LimitExceeded.ResourceControlPolicy | The resource control policy number exceeds the limit. | 资源管控策略数量超出限制。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。