
# 根据策略ID查询历史记录列表 - SearchPolicyRecordByPolicyId
#### 功能介绍
根据策略ID查询历史记录列表
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-secmaster/secmaster_03_0008.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-secmaster/secmaster_03_0023.html)。
#### URI
POST /v1/{project_id}/workspaces/{workspace_id}/soc/policy-records/{policy_id}/search
表1路径参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| project_id   | 是    | String | **参数解释：** 项目ID，用于明确项目归属，配置后可通过该ID查询项目下资产，可以通过调用API获取，也可以从控制台获取。[获取项目ID](https://support.huaweicloud.com/api-secmaster/secmaster_03_0014.html) **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及 |
| workspace_id | 是    | String | **参数解释：** 工作空间id。 **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及                                                                                                                             |
| policy_id    | 是    | String | **参数解释：** 策略id **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及                                                                                                                                |
   
#### 请求参数
表2请求Header参数 
| 参数                  | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|:---|:---|:---|:---|
| X-Auth-Token        | 是    | String | **参数解释：** 用户Token，通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。[获取用户Token](https://support.huaweicloud.com/api-secmaster/secmaster_03_0010.html) **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及                                                                                                                                                                                                                                                                                                                               |
| Content-Type        | 是    | String | **参数解释：** 内容类型 - application/json;charset=UTF-8 普通API请求的类型    **约束限制：** 不涉及 **取值范围：** - application/json;charset=UTF-8    **默认取值：** 不涉及 |
| X-Secmaster-Version | 是    | String | 服务版本，例如25.5.0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
   
表3请求Body参数 
| 参数        | 是否必选 | 参数类型                                                                 | 描述   |
|:---|:---|:---|:---|
| limit     | 否    | Integer                                                              | 分页数量 |
| offset    | 否    | Integer                                                              | 偏移量  |
| condition | 否    | [condition] object | 查询条件 |
| sort      | 否    | Array of [sort] objects | 排序条件 |
| group_by  | 否    | [group_by] object   | 聚合条件 |
   
 表4condition 
| 参数         | 是否必选 | 参数类型                                                                             | 描述   |
|:---|:---|:---|:---|
| conditions | 否    | Array of [conditions] objects | 查询条件 |
| logics     | 否    | Array of strings                                                                 | 条件名称 |
   
 表5conditions 
| 参数   | 是否必选 | 参数类型             | 描述    |
|:---|:---|:---|:---|
| name | 否    | String           | 条件名称  |
| data | 否    | Array of strings | 条件键值对 |
   
 表6sort 
| 参数      | 是否必选 | 参数类型   | 描述    |
|:---|:---|:---|:---|
| sort_by | 否    | String | 排序字段  |
| order   | 否    | String | 顺序或倒序 |
   
 表7group_by 
| 参数              | 是否必选 | 参数类型                                                                       | 描述   |
|:---|:---|:---|:---|
| group_by_fields | 否    | Array of strings                                                           | 聚合字段 |
| group_by_hit    | 否    | [group_by_hit] object | 聚合结果 |
   
 表8group_by_hit 
| 参数     | 是否必选 | 参数类型   | 描述   |
|:---|:---|:---|:---|
| source | 否    | String | 源字段  |
| dest   | 否    | String | 目标字段 |
   
#### 响应参数
**状态码：200**
表9响应Header参数 
| 参数           | 参数类型   | 描述   |
|:---|:---|:---|
| content-type | String | 内容类型 |
   
表10响应Body参数 
| 参数         | 参数类型             | 描述   |
|:---|:---|:---|
| code       | String           | 返回编码 |
| data       | Array of objects | 返回数据 |
| message    | String           | 返回消息 |
| page       | Integer          | 页码   |
| request_id | String           | 请求ID |
| size       | Integer          | 单页数量 |
| success    | Boolean          | 成功状态 |
| total      | Integer          | 总量   |
   
**状态码：400**
表11响应Header参数 
| 参数           | 参数类型   | 描述   |
|:---|:---|:---|
| content-type | String | 内容类型 |
   
表12响应Body参数 
| 参数      | 参数类型   | 描述                                                                                                                                                                           |
|:---|:---|:---|
| code    | String | **参数解释**: 错误码 **取值范围**: 不涉及  |
| message | String | **参数解释**: 错误描述 **取值范围**: 不涉及 |
   
#### 请求示例
请求单条policy的历史记录
```
https://{endpoint}/v1/{project_id}/workspaces/{workspace_id}/soc/policy-records/{policy_id}/search
{
  "limit" : 10,
  "offset" : 0,
  "condition" : {
    "conditions" : [ ],
    "logics" : [ ]
  }
}
```
#### 响应示例
**状态码：200**
成功
```
{
  "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代码示例
SDK代码示例如下。
- [Java]
  请求单条policy的历史记录
  ```
  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());
          }
      }
  }
  ```
- [Python]
  请求单条policy的历史记录
  ```
  # 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)
  ```
- [Go]
  请求单条policy的历史记录
  ```
  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, err := basic.NewCredentialsBuilder().
          WithAk(ak).
          WithSk(sk).
          WithProjectId(projectId).
          SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      hcClient, err := secmaster.SecMasterClientBuilder().
           WithRegion(region.ValueOf("<YOUR REGION>")).
           WithCredential(auth).
           SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      client := secmaster.NewSecMasterClient(hcClient)
      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)
      }
  }
  ```
- [更多]
  更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/SecMaster/sdk?api=SearchPolicyRecordByPolicyId&version=v1)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述                  |
|:---|:---|
| 200 | 成功                  |
| 400 | 查询应急策略历史记录错误返回body体 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-secmaster/ErrorCode.html)。
