Querying Historical Records by Policy ID
Function
This API is used to query the historical records of a policy by policy ID.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/workspaces/{workspace_id}/soc/policy-records/{policy_id}/search
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition Project ID, which is used to specify the project that a resource belongs to. You can query the resources of a project by project ID. You can obtain the project ID from the API or console. Obtaining the Project ID Constraints N/A Range N/A Default Value N/A |
|
workspace_id |
Yes |
String |
Definition Workspace ID. Constraints N/A Range N/A Default Value N/A |
|
policy_id |
Yes |
String |
Definition Policy ID. Constraints N/A Range N/A Default Value N/A |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token. You can obtain it by calling the IAM API for obtaining a user token. The user token is the value of X-Subject-Token in the response header. Obtaining a User Token Constraints N/A Range N/A Default Value N/A |
|
Content-Type |
Yes |
String |
Definition Content type. Constraints N/A Range Default Value N/A |
|
X-Secmaster-Version |
Yes |
String |
Service version, for example, 25.5.0. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
limit |
No |
Integer |
Number of records on each page. |
|
offset |
No |
Integer |
Offset. |
|
condition |
No |
condition object |
Query condition. |
|
sort |
No |
Array of sort objects |
Sorting criteria. |
|
group_by |
No |
group_by object |
Aggregation condition. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
conditions |
No |
Array of conditions objects |
Query condition. |
|
logics |
No |
Array of strings |
Condition name. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
No |
String |
Condition name. |
|
data |
No |
Array of strings |
Condition key-value pair. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
sort_by |
No |
String |
Sorting field. |
|
order |
No |
String |
Ascending or descending order. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
group_by_fields |
No |
Array of strings |
Aggregation fields. |
|
group_by_hit |
No |
group_by_hit object |
Aggregation result. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
content-type |
String |
Content type. |
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Return code. |
|
data |
Array of objects |
Return data. |
|
message |
String |
Response message. |
|
page |
Integer |
Page. |
|
request_id |
String |
Request ID. |
|
size |
Integer |
Number of records on a page. |
|
success |
Boolean |
Success status. |
|
total |
Integer |
Total volume. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
content-type |
String |
Content type. |
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Definition Error code. Range N/A |
|
message |
String |
Definition Error description. Range N/A |
Example Requests
Query the historical records of a policy.
https://{endpoint}/v1/{project_id}/workspaces/{workspace_id}/soc/policy-records/{policy_id}/search
{
"limit" : 10,
"offset" : 0,
"condition" : {
"conditions" : [ ],
"logics" : [ ]
}
}
Example Responses
Status code: 200
Successful.
{
"code" : "00000000",
"data" : [ {
"aggs_data_objects" : [ {
"policy_id" : "a2039fd4-245d-4197-a0fe-e64fe8ec79ab",
"defense_policy" : {
"target_project_name" : "RegionId",
"defense_connection_name" : "CFW",
"defense_type" : "CFW",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "84b273d3-47a8-3aba-bd00-7bdd1431d635",
"defense_id" : "656e8099-9b72-4d10-b037-560e38d6fd12",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
},
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "72855331-96cc-4879-8581-f6500515a67b",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-25T08:57:14.413+08:00",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "35d4b47a-02d2-4a7c-8d94-740dabcd4152",
"workflow_instance_name" : "35d4b47a-02d2-4a7c-8d94-740dabcd4152",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "334b8f3b-7e1d-40de-9cac-9b7c147d5308",
"policy_direction" : "INGRESS",
"create_time" : "2025-10-25T08:57:10.887+08:00",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-CFW-20251025085710",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
} ],
"create_time" : null,
"data_object" : {
"policy_id" : "a2039fd4-245d-4197-a0fe-e64fe8ec79ab",
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "72855331-96cc-4879-8581-f6500515a67b",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-25T08:57:14.413Z+0800",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "35d4b47a-02d2-4a7c-8d94-740dabcd4152",
"workflow_instance_name" : "35d4b47a-02d2-4a7c-8d94-740dabcd4152",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "334b8f3b-7e1d-40de-9cac-9b7c147d5308",
"policy_direction" : "INGRESS",
"defense_policy_list" : [ {
"target_project_name" : "RegionId",
"defense_connection_name" : "CFW",
"defense_type" : "CFW",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "84b273d3-47a8-3aba-bd00-7bdd1431d635",
"defense_id" : "656e8099-9b72-4d10-b037-560e38d6fd12",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
} ],
"create_time" : "2025-10-25T08:57:10.887Z+0800",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-CFW-20251025085710",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
},
"dataclass_ref" : null,
"format_version" : 0,
"id" : "",
"project_id" : "",
"type" : null,
"update_time" : null,
"version" : 0,
"workspace_id" : ""
}, {
"aggs_data_objects" : [ {
"policy_id" : "e72ec3f2-6e51-4460-9d1a-53c1ff5cef99",
"defense_policy" : {
"target_project_name" : "RegionId",
"defense_connection_name" : "VPC",
"defense_type" : "VPC",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "a960a6c5-bc71-3ca1-ab6d-2e85deca3fe3",
"defense_id" : "04314618-d570-43ae-a631-e9b93db9df3d",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
},
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "c390ff37-a378-4826-9811-2a00542932bb",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-24T16:05:12.104+08:00",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "364a4f39-aca8-46a4-8969-d0573d40aa22",
"workflow_instance_name" : "364a4f39-aca8-46a4-8969-d0573d40aa22",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "33339cdc-fa6a-422b-a124-3c3af4a4e769",
"policy_direction" : "INGRESS",
"create_time" : "2025-10-24T16:05:11.144+08:00",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-VPC-20251024160511",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
} ],
"create_time" : null,
"data_object" : {
"policy_id" : "e72ec3f2-6e51-4460-9d1a-53c1ff5cef99",
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "c390ff37-a378-4826-9811-2a00542932bb",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-24T16:05:12.104Z+0800",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "364a4f39-aca8-46a4-8969-d0573d40aa22",
"workflow_instance_name" : "364a4f39-aca8-46a4-8969-d0573d40aa22",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "33339cdc-fa6a-422b-a124-3c3af4a4e769",
"policy_direction" : "INGRESS",
"defense_policy_list" : [ {
"target_project_name" : "RegionId",
"defense_connection_name" : "VPC",
"defense_type" : "VPC",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "a960a6c5-bc71-3ca1-ab6d-2e85deca3fe3",
"defense_id" : "04314618-d570-43ae-a631-e9b93db9df3d",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
} ],
"create_time" : "2025-10-24T16:05:11.144Z+0800",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-VPC-20251024160511",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
},
"dataclass_ref" : null,
"format_version" : 0,
"id" : "",
"project_id" : "",
"type" : null,
"update_time" : null,
"version" : 0,
"workspace_id" : ""
}, {
"aggs_data_objects" : [ {
"policy_id" : "a2719ca7-8208-4366-959f-e93822ad97a4",
"defense_policy" : {
"target_project_name" : "RegionId",
"defense_connection_name" : "VPC",
"defense_type" : "VPC",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "a960a6c5-bc71-3ca1-ab6d-2e85deca3fe3",
"defense_id" : "e7ce9bb0-4f6b-4cf0-8051-12687001d975",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
},
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "4c8fcde7-7114-417b-b203-2f3bdbe30d21",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-24T16:04:49.710+08:00",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "3e40443d-6f28-431b-b63e-ee4aa14a74b4",
"workflow_instance_name" : "3e40443d-6f28-431b-b63e-ee4aa14a74b4",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "0baaead4-6600-432f-9fb2-c2412e8afd9a",
"policy_direction" : "INGRESS",
"create_time" : "2025-10-24T16:01:34.700+08:00",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-VPC-20251024160134",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
} ],
"create_time" : null,
"data_object" : {
"policy_id" : "a2719ca7-8208-4366-959f-e93822ad97a4",
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "4c8fcde7-7114-417b-b203-2f3bdbe30d21",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-24T16:04:49.710Z+0800",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "3e40443d-6f28-431b-b63e-ee4aa14a74b4",
"workflow_instance_name" : "3e40443d-6f28-431b-b63e-ee4aa14a74b4",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "0baaead4-6600-432f-9fb2-c2412e8afd9a",
"policy_direction" : "INGRESS",
"defense_policy_list" : [ {
"target_project_name" : "RegionId",
"defense_connection_name" : "VPC",
"defense_type" : "VPC",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "a960a6c5-bc71-3ca1-ab6d-2e85deca3fe3",
"defense_id" : "e7ce9bb0-4f6b-4cf0-8051-12687001d975",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
} ],
"create_time" : "2025-10-24T16:01:34.700Z+0800",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-VPC-20251024160134",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
},
"dataclass_ref" : null,
"format_version" : 0,
"id" : "",
"project_id" : "",
"type" : null,
"update_time" : null,
"version" : 0,
"workspace_id" : ""
}, {
"aggs_data_objects" : [ {
"policy_id" : "a33a2f59-ffb0-424a-a239-6cf611c2c929",
"defense_policy" : {
"target_project_name" : "RegionId",
"defense_connection_name" : "VPC",
"defense_type" : "VPC",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "a960a6c5-bc71-3ca1-ab6d-2e85deca3fe3",
"defense_id" : "f9b34f4f-8937-4047-b76a-38f546e3aa7c",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
},
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "d7c5d274-9289-45de-9fde-46444b641114",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-24T15:47:59.440+08:00",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "b64fc709-cc33-4c39-9dee-caec37f21b19",
"workflow_instance_name" : "b64fc709-cc33-4c39-9dee-caec37f21b19",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "5132c3f5-acc0-4e28-bd86-ae180353e0d0",
"policy_direction" : "INGRESS",
"create_time" : "2025-10-24T15:47:58.450+08:00",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-VPC-20251024154758",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
} ],
"create_time" : null,
"data_object" : {
"policy_id" : "a33a2f59-ffb0-424a-a239-6cf611c2c929",
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "d7c5d274-9289-45de-9fde-46444b641114",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-24T15:47:59.440Z+0800",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "b64fc709-cc33-4c39-9dee-caec37f21b19",
"workflow_instance_name" : "b64fc709-cc33-4c39-9dee-caec37f21b19",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "5132c3f5-acc0-4e28-bd86-ae180353e0d0",
"policy_direction" : "INGRESS",
"defense_policy_list" : [ {
"target_project_name" : "RegionId",
"defense_connection_name" : "VPC",
"defense_type" : "VPC",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "a960a6c5-bc71-3ca1-ab6d-2e85deca3fe3",
"defense_id" : "f9b34f4f-8937-4047-b76a-38f546e3aa7c",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
} ],
"create_time" : "2025-10-24T15:47:58.450Z+0800",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-VPC-20251024154758",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
},
"dataclass_ref" : null,
"format_version" : 0,
"id" : "",
"project_id" : "",
"type" : null,
"update_time" : null,
"version" : 0,
"workspace_id" : ""
}, {
"aggs_data_objects" : [ {
"policy_id" : "41eb9024-1fa2-4e43-9721-e09ec426ce00",
"defense_policy" : {
"target_project_name" : "RegionId",
"defense_connection_name" : "CFW",
"defense_type" : "CFW",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "84b273d3-47a8-3aba-bd00-7bdd1431d635",
"defense_id" : "a76ab1ab-faf8-43d6-953c-6bde4d19f6dc",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
},
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "45aa650b-b32c-42ab-acf4-4d156420dff7",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-22T20:18:55.071+08:00",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "1eee9e32-57ea-42fc-973c-6b8d71c62c00",
"workflow_instance_name" : "1eee9e32-57ea-42fc-973c-6b8d71c62c00",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "1ea4045a-4540-4e29-ac41-612d4842e4a0",
"policy_direction" : "INGRESS",
"create_time" : "2025-10-22T20:18:52.701+08:00",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-CFW-20251022201852",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
} ],
"create_time" : null,
"data_object" : {
"policy_id" : "41eb9024-1fa2-4e43-9721-e09ec426ce00",
"block_age" : {
"is_block_ageing" : false,
"block_ageing" : null
},
"description" : "",
"policy_task_id" : "45aa650b-b32c-42ab-acf4-4d156420dff7",
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"workspace_id" : "42713b38-d753-4365-8b4a-50d179e15747",
"domain_name" : "DomainName",
"update_time" : "2025-10-22T20:18:55.071Z+0800",
"is_deleted" : false,
"block_target" : "1.1.1.1",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"workflow_instance" : {
"workflow_instance_id" : "1eee9e32-57ea-42fc-973c-6b8d71c62c00",
"workflow_instance_name" : "1eee9e32-57ea-42fc-973c-6b8d71c62c00",
"workflow_instance_status" : "FAILED"
},
"dataobject_id" : null,
"policy_automation" : "AUTOMATION",
"region_name" : null,
"id" : "1ea4045a-4540-4e29-ac41-612d4842e4a0",
"policy_direction" : "INGRESS",
"defense_policy_list" : [ {
"target_project_name" : "RegionId",
"defense_connection_name" : "CFW",
"defense_type" : "CFW",
"defense_policy_list" : null,
"defense_failure_description" : "Failed to execute the workflow.",
"target_enterprise_id" : "0",
"defense_connection_region_id" : "RegionId",
"defense_creator_id" : "b6566bce94194f3d9dc6d397c72e40b2",
"description" : null,
"defense_policy_name" : null,
"defense_creator_name" : "DomainName",
"defense_connection_id" : "84b273d3-47a8-3aba-bd00-7bdd1431d635",
"defense_id" : "a76ab1ab-faf8-43d6-953c-6bde4d19f6dc",
"defense_connection_region_name" : "RegionId",
"target_enterprise_name" : "default",
"dataobject_id" : null,
"defense_block_status" : "FAILURE",
"defense_block_action" : "BLOCK",
"target_project_id" : "3bb27e024693436da46b5f5aaf499060",
"defense_policy_id" : null
} ],
"create_time" : "2025-10-22T20:18:52.701Z+0800",
"region_id" : "RegionId",
"dataclass_id" : "a110ef4d-b406-3526-a569-745029cc082f",
"policy_task_name" : "DomainName-CFW-20251022201852",
"environment" : {
"domain_id" : "94aee09081c649cfa9eef5d25200ec50",
"domain_name" : "DomainName",
"project_id" : "3bb27e024693436da46b5f5aaf499060",
"region_id" : "RegionId",
"region_name" : "RegionId",
"vendor_type" : "Cloud"
},
"trigger_flag" : true,
"policyrecord_type" : {
"policy_type" : "Source Ip",
"id" : "bc9ea975de7aece562c6029918cdb8e5",
"category" : "defense direction"
},
"policy_category" : "BLOCK"
},
"dataclass_ref" : null,
"format_version" : 0,
"id" : "",
"project_id" : "",
"type" : null,
"update_time" : null,
"version" : 0,
"workspace_id" : ""
} ],
"message" : "",
"page" : 0,
"request_id" : "",
"size" : 10,
"success" : true,
"total" : 5
}
SDK Sample Code
The SDK sample code is as follows.
Query the historical records of a policy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion; import com.huaweicloud.sdk.secmaster.v1.*; import com.huaweicloud.sdk.secmaster.v1.model.*; import java.util.List; import java.util.ArrayList; public class SearchPolicyRecordByPolicyIdSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); SecMasterClient client = SecMasterClient.newBuilder() .withCredential(auth) .withRegion(SecMasterRegion.valueOf("<YOUR REGION>")) .build(); SearchPolicyRecordByPolicyIdRequest request = new SearchPolicyRecordByPolicyIdRequest(); request.withWorkspaceId("{workspace_id}"); request.withPolicyId("{policy_id}"); SearchPolicyRequestBody body = new SearchPolicyRequestBody(); SearchPolicyRequestBodyCondition conditionbody = new SearchPolicyRequestBodyCondition(); conditionbody.withConditions() .withLogics(); body.withCondition(conditionbody); body.withOffset(0); body.withLimit(10); request.withBody(body); try { SearchPolicyRecordByPolicyIdResponse response = client.searchPolicyRecordByPolicyId(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Query the historical records of a policy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \ .build() try: request = SearchPolicyRecordByPolicyIdRequest() request.workspace_id = "{workspace_id}" request.policy_id = "{policy_id}" conditionbody = SearchPolicyRequestBodyCondition( ) request.body = SearchPolicyRequestBody( condition=conditionbody, offset=0, limit=10 ) response = client.search_policy_record_by_policy_id(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Query the historical records of a policy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.SearchPolicyRecordByPolicyIdRequest{} request.WorkspaceId = "{workspace_id}" request.PolicyId = "{policy_id}" conditionbody := &model.SearchPolicyRequestBodyCondition{ } offsetSearchPolicyRequestBody:= int32(0) limitSearchPolicyRequestBody:= int32(10) request.Body = &model.SearchPolicyRequestBody{ Condition: conditionbody, Offset: &offsetSearchPolicyRequestBody, Limit: &limitSearchPolicyRequestBody, } response, err := client.SearchPolicyRecordByPolicyId(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Successful. |
|
400 |
Response body for failed emergency policy history queries. |
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