Updating the Compliance Result
Function
This API is used to update the compliance result of a custom rule.
Calling Method
For details, see Calling APIs.
URI
PUT /v1/resource-manager/domains/{domain_id}/policy-states
Parameter | Mandatory | Type | Description |
|---|---|---|---|
domain_id | Yes | String | Specifies the account ID. Maximum: 36 |
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
X-Auth-Token | No | String | Specifies the invoker's token. |
X-Security-Token | No | String | Specifies a temporary security credential. This parameter is mandatory when you make an API call using a temporary security credential. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
policy_resource | Yes | PolicyResource object | Specifies the resource. |
trigger_type | Yes | String | Specifies the trigger type. |
compliance_state | Yes | String | Specifies the compliance status. |
policy_assignment_id | Yes | String | Specifies the policy rule id. |
policy_assignment_name | No | String | Specifies the policy rule name. |
evaluation_time | Yes | String | Specifies when a rule is used to evaluate the resource compliance. |
evaluation_hash | Yes | String | Specifies the evaluation verification code. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
resource_id | No | String | Specifies the resource ID. |
resource_name | No | String | Specifies the resource name. |
resource_provider | No | String | Specifies the cloud service name. |
resource_type | No | String | Specifies the resource type. |
region_id | No | String | Specifies the region ID. |
domain_id | No | String | Specifies the ID of the user to which the resource belongs. |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
domain_id | String | Specifies the user ID. |
region_id | String | Specifies the ID of the region the resource belongs to. |
resource_id | String | Specifies the resource ID. |
resource_name | String | Specifies the resource name. |
resource_provider | String | Specifies the cloud service name. |
resource_type | String | Specifies the resource type. |
trigger_type | String | Specifies the trigger type. The value can be resource or period. |
compliance_state | String | Specifies the compliance status. |
policy_assignment_id | String | Specifies the rule ID. |
policy_assignment_name | String | Specifies the rule name. |
policy_definition_id | String | Specifies the policy ID. |
evaluation_time | String | Specifies the evaluation time of compliance status. |
Status code: 400
Parameter | Type | Description |
|---|---|---|
error_code | String | Specifies the error code. |
error_msg | String | Specifies the error message. |
Status code: 403
Parameter | Type | Description |
|---|---|---|
error_code | String | Specifies the error code. |
error_msg | String | Specifies the error message. |
Status code: 500
Parameter | Type | Description |
|---|---|---|
error_code | String | Specifies the error code. |
error_msg | String | Specifies the error message. |
Example Requests
The reported compliance result by functionGraph is NonCompliant.
PUT https://{endpoint}/v1/resource-manager/domains/{domain_id}/policy-states
{
"policy_resource" : {
"domain_id" : "d0123456789",
"region_id" : "global",
"resource_id" : "abc0123456789",
"resource_name" : "test_user",
"resource_provider" : "iam",
"resource_type" : "users"
},
"trigger_type" : "resource",
"compliance_state" : "NonCompliant",
"policy_assignment_id" : "abc0123456789abc",
"policy_assignment_name" : "custom_policy",
"evaluation_time" : 1667374060248,
"evaluation_hash" : "89342b8f338165651991afb8bd471396"
} Example Responses
Status code: 200
Operation succeeded.
{
"domain_id" : "d0123456789",
"region_id" : "global",
"resource_id" : "abc0123456789",
"resource_name" : "test_user",
"resource_provider" : "iam",
"resource_type" : "users",
"trigger_type" : "resource",
"compliance_state" : "NonCompliant",
"policy_assignment_id" : "abc0123456789abc",
"policy_assignment_name" : "custom_policy",
"policy_definition_id" : null,
"evaluation_time" : 1667374060248
} Status Codes
Status Code | Description |
|---|---|
200 | Operation succeeded. |
400 | Invalid parameters. |
403 | Authentication failed or you do not have the operation permissions. |
500 | Server error. |
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.

