更新组织合规规则
功能介绍
更新组织合规规则
调用方法
请参见如何调用API。
URI
PUT /v1/resource-manager/organizations/{organization_id}/policy-assignments/{organization_policy_assignment_id}
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| organization_id | 是 | String | 组织ID。 最大长度:34 |
| organization_policy_assignment_id | 是 | String | 组织合规规则ID。 最大长度:32 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| excluded_accounts | 否 | Array of strings | 需要排除配置规则的账号。 最大长度:32 |
| organization_policy_assignment_name | 是 | String | 组织合规规则名称。 最大长度:60 |
| managed_policy_assignment_metadata | 否 | 托管规则元数据。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| description | 否 | String | 规则描述。 最大长度:512 |
| period | 否 | String | 触发周期。 |
| parameters | 否 | Map<String,PolicyParameterValue> | 输入参数。 |
| policy_filter | 否 | PolicyFilterDefinition object | 规则过滤器。 |
| policy_definition_id | 是 | String | 预定义策略标识符。 最大长度:36 |
响应参数
状态码: 200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| owner_id | String | 组织合规规则创建者。 |
| organization_id | String | 组织ID。 |
| organization_policy_assignment_urn | String | 组织合规规则资源唯一标识。 |
| organization_policy_assignment_id | String | 组织合规规则ID。 |
| organization_policy_assignment_name | String | 组织合规规则名称。 |
| description | String | 描述信息。 |
| period | String | 触发周期。 |
| policy_filter | PolicyFilterDefinition object | 规则过滤器。 |
| parameters | Map<String,PolicyParameterValue> | 规则参数。 |
| policy_definition_id | String | 策略ID。 |
| created_at | String | 创建时间。 |
| updated_at | String | 更新时间。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| region_id | String | 区域ID。 最大长度:128 |
| resource_provider | String | 云服务名称。 最大长度:128 |
| resource_type | String | 资源类型。 最大长度:128 |
| resource_id | String | 资源ID。 最大长度:512 |
| tag_key | String | 标签键。 最大长度:128 |
| tag_value | String | 标签值。 最大长度:256 |
状态码: 400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误消息内容。 |
状态码: 403
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误消息内容。 |
状态码: 500
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误消息内容。 |
请求示例
更新组织合规规则。
PUT https://{endpoint}/v1/resource-manager/organizations/{organization_id}/policy-assignments/{organization_policy_assignment_id}
{
"organization_policy_assignment_name" : "allowed-images-by-id",
"managed_policy_assignment_metadata" : {
"description" : "The ECS resource is non-compliant if the image it used is not in the allowed list.",
"parameters" : {
"listOfAllowedImages" : {
"value" : [ "ea0d6e0e-99c3-406d-a873-3bb45462b624" ]
}
},
"policy_filter" : {
"resource_provider" : "ecs",
"resource_type" : "cloudservers"
},
"policy_definition_id" : "5fa265c0aa1e6afc05a0ff07"
}
} 响应示例
状态码: 200
操作成功
{
"owner_id" : "e74e043fab784a45ad88f5ef6a4bcffc",
"organization_id" : "o-doxbpkzqsdd51ti1k27w2y8fitakrknp",
"organization_policy_assignment_urn" : "rms::e74e043fab784a45ad88f5ef6a4bcffc:organizationPolicyAssignment:o-doxbpkzqsdd51ti1k27w2y8fitakrknp/d02b7fa9d5a74e638c1402d0868f71fd",
"organization_policy_assignment_id" : "d02b7fa9d5a74e638c1402d0868f71fd",
"organization_policy_assignment_name" : "allowed-images-by-id",
"description" : "The ECS resource is non-compliant if the image it used is not in the allowed list.",
"period" : null,
"policy_filter" : {
"region_id" : null,
"resource_provider" : "evs",
"resource_type" : "volumes",
"resource_id" : null,
"tag_key" : null,
"tag_value" : null
},
"policy_definition_id" : "5fa265c0aa1e6afc05a0ff07",
"parameters" : { },
"created_at" : "2022-01-18T06:37:54.432Z",
"updated_at" : "2022-01-18T06:37:54.432Z"
} 状态码
| 状态码 | 描述 |
|---|---|
| 200 | 操作成功 |
| 400 | 输入参数不合法 |
| 403 | 用户认证失败或无操作权限 |
| 500 | 服务器内部错误 |
错误码
请参见错误码。