创建事件
功能介绍
创建事件
调用方法
请参见如何调用API。
URI
POST /v1/{project_id}/workspaces/{workspace_id}/soc/incidents
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目id |
workspace_id |
是 |
String |
工作空间id |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值) |
content-type |
是 |
String |
内容类型 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
data_object |
否 |
Incident object |
事件实体信息 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
version |
否 |
String |
事件对象的版本,该字段的值必须为云SSA服务确定的官方发布版本之一 |
id |
否 |
String |
事件唯一标识,UUID格式,最大36个字符 |
domain_id |
否 |
String |
数据投递后,被委托用户的domain_id |
region_id |
否 |
String |
数据投递后,被委托用户的region_id |
workspace_id |
否 |
String |
当前的工作空间id |
labels |
否 |
String |
标签,仅展示 |
environment |
否 |
environment object |
事件产生的环境坐标信息 |
data_source |
否 |
data_source object |
首次上报数据源 |
first_observed_time |
否 |
String |
首次发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
last_observed_time |
否 |
String |
最近发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
create_time |
否 |
String |
记录时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
arrive_time |
否 |
String |
接收时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
title |
否 |
String |
事件标题 |
description |
否 |
String |
事件描述信息 |
source_url |
否 |
String |
事件URL链接,指向数据源产品中有关当前事件说明的页面 |
count |
否 |
Integer |
事件发生次数 |
confidence |
否 |
Integer |
事件的置信度。置信度的定义旨在说明识别的行为或问题的可能性。 取值范围:0-100,0表示置信度为0%,100表示置信度为100% |
severity |
否 |
String |
严重性等级,取值范围:Tips | Low | Medium | High | Fatal 说明: 0: Tips – 未发现任何问题。 1: Low – 无需针对问题执行任何操作。 2: Medium – 问题需要处理,但不紧急。 3: High – 问题必须优先处理。 4: Fatal – 问题必须立即处理,以防止产生进一步的损害 |
criticality |
否 |
Integer |
关键性,是指事件涉及的资源的重要性级别。 取值范围:0-100,0表示资源不关键,100表示最关键资源 |
incident_type |
否 |
incident_type object |
事件分类,详细定义参考《告警事件类型定义》 |
network_list |
否 |
Array of network_list objects |
网络信息 |
resource_list |
否 |
Array of resource_list objects |
受影响资源 |
remediation |
否 |
remediation object |
补救措施 |
verification_state |
否 |
String |
验证状态,标识事件的准确性。可选类型如下: Unknown – 未知 True_Positive – 确认 False_Positive – 误报 默认填写Unknown |
handle_status |
否 |
String |
事件处理状态,可选类型如下: Open – 打开,默认 Block – 阻塞 Closed – 关闭 默认填写Open |
sla |
否 |
Integer |
约束闭环时间:设置风险接受持续时间。单位:小时 |
update_time |
否 |
String |
更新时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
close_time |
否 |
String |
关闭时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
ipdrr_phase |
否 |
String |
周期/处置阶段编号 Prepartion|Detection and Analysis|Containm,Eradication& Recovery|Post-Incident-Activity |
simulation |
否 |
String |
调试字段 |
actor |
否 |
String |
事件调查员 |
owner |
否 |
String |
责任人、服务责任人 |
creator |
否 |
String |
创建人 |
close_reason |
否 |
String |
关闭原因: 误检 - False detection 已解决 - Resolved 重复 - Repeated 其他 - Other |
close_comment |
否 |
String |
关闭评论 |
malware |
否 |
malware object |
恶意软件 |
system_info |
否 |
Object |
系统信息 |
process |
否 |
Array of process objects |
进程信息 |
user_info |
否 |
Array of user_info objects |
用户信息 |
file_info |
否 |
Array of file_info objects |
文件信息 |
system_alert_table |
否 |
Object |
事件管理列表的布局字段 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
vendor_type |
否 |
String |
环境供应商 |
domain_id |
否 |
String |
租户id |
region_id |
否 |
String |
区域id,全局服务global |
cross_workspace_id |
否 |
String |
数据投递前的源工作空间id,在源空间下值为null,投递后为被委托用户的id |
project_id |
否 |
String |
项目id, 全局服务默认null |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
source_type |
否 |
Integer |
数据源类型,取值范围如下: 1 - 云上产品 2 - 第三方产品 3 - 租户私有产品 |
domain_id |
否 |
String |
数据源产品所属账号的id |
project_id |
否 |
String |
数据源产品所属项目的id |
region_id |
否 |
String |
数据源产品所在区域,具体取值范围查看云地区和终端节点定义,例如cn-north-1 |
company_name |
否 |
String |
数据源产品所属公司的名称 |
product_name |
否 |
String |
数据源产品的名称 |
product_feature |
否 |
String |
产品功能特性名称,用来指明检测到当前事件的产品的功能特性 |
product_module |
否 |
String |
检测模块列表 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
direction |
否 |
String |
方向,取值范围:IN | OUT |
protocol |
否 |
String |
协议,包含7层和4层的协议 参考:IANA registered name https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml |
src_ip |
否 |
String |
源IP地址 |
src_port |
否 |
Integer |
源端口,0–65535 |
src_domain |
否 |
String |
源域名 |
src_geo |
否 |
src_geo object |
源IP的地理位置信息 |
dest_ip |
否 |
String |
目的IP地址 |
dest_port |
否 |
String |
目的端口,0–65535 |
dest_domain |
否 |
String |
目的域名 |
dest_geo |
否 |
dest_geo object |
目标IP的地理位置信息 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
latitude |
否 |
Number |
纬度 |
longitude |
否 |
Number |
经度 |
city_code |
否 |
String |
城市编码,Beijing | Shanghai |
country_code |
否 |
String |
国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
latitude |
否 |
Number |
纬度 |
longitude |
否 |
Number |
经度 |
city_code |
否 |
String |
城市编码,Beijing | Shanghai |
country_code |
否 |
String |
国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
id |
否 |
String |
云服务资源id |
name |
否 |
String |
资源名称 |
type |
否 |
String |
资源类型;引用云RMS type字段 |
provider |
否 |
String |
云服务名称;引用云RMS provider字段 |
region_id |
否 |
String |
区域;按照云regionId填写,如cn-north-1等 |
domain_id |
否 |
String |
资源所属账号ID,UUID格式 |
project_id |
否 |
String |
资源所属项目ID,UUID格式 |
ep_id |
否 |
String |
企业项目id |
ep_name |
否 |
String |
企业项目名称 |
tags |
否 |
String |
资源标签 1、最多50个key/values对 2、values:最大255字符,取值范围:字母数字,空格,+, -, =, ., _, :, /,@ |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
recommendation |
否 |
String |
推荐处理方法 |
url |
否 |
String |
链接,指向该事件的一般修复信息。该URL必须可以从公网访问,不需要提供凭证 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
process_name |
否 |
String |
进程名 |
process_path |
否 |
String |
进程执行文件路径 |
process_pid |
否 |
Integer |
进程id |
process_uid |
否 |
Integer |
进程用户id |
process_cmdline |
否 |
String |
进程命令行 |
process_parent_name |
否 |
String |
父进程名称 |
process_parent_path |
否 |
String |
父进程执行文件路径 |
process_parent_pid |
否 |
Integer |
父进程id |
process_parent_uid |
否 |
Integer |
父进程用户id |
process_parent_cmdline |
否 |
String |
父进程命令行 |
process_child_name |
否 |
String |
子进程名称 |
process_child_path |
否 |
String |
子进程执行文件路径 |
process_child_pid |
否 |
Integer |
子进程id |
process_child_uid |
否 |
Integer |
子进程用户id |
process_child_cmdline |
否 |
String |
子进程命令行 |
process_launche_time |
否 |
String |
进程启动时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
process_terminate_time |
否 |
String |
进程结束时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
X-request-id |
String |
请求ID,格式为:request_uuid-timestamp-hostname |
参数 |
参数类型 |
描述 |
---|---|---|
code |
String |
错误码 |
message |
String |
错误信息 |
data |
IncidentDetail object |
事件详情对象 |
参数 |
参数类型 |
描述 |
---|---|---|
create_time |
String |
记录时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
data_object |
Incident object |
事件实体信息 |
dataclass_ref |
dataclass_ref object |
数据类对象 |
format_version |
Integer |
格式版本 |
id |
String |
事件唯一标识,UUID格式,最大36个字符 |
project_id |
String |
当前项目的id |
update_time |
String |
更新时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为告警发生时区,无法解析时区的时间,默认时区填东八区 |
version |
Integer |
版本 |
workspace_id |
String |
当前的工作空间id |
参数 |
参数类型 |
描述 |
---|---|---|
version |
String |
事件对象的版本,该字段的值必须为云SSA服务确定的官方发布版本之一 |
id |
String |
事件唯一标识,UUID格式,最大36个字符 |
domain_id |
String |
数据投递后,被委托用户的domain_id |
region_id |
String |
数据投递后,被委托用户的region_id |
workspace_id |
String |
当前的工作空间id |
labels |
String |
标签,仅展示 |
environment |
environment object |
事件产生的环境坐标信息 |
data_source |
data_source object |
首次上报数据源 |
first_observed_time |
String |
首次发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
last_observed_time |
String |
最近发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
create_time |
String |
记录时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
arrive_time |
String |
接收时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
title |
String |
事件标题 |
description |
String |
事件描述信息 |
source_url |
String |
事件URL链接,指向数据源产品中有关当前事件说明的页面 |
count |
Integer |
事件发生次数 |
confidence |
Integer |
事件的置信度。置信度的定义旨在说明识别的行为或问题的可能性。 取值范围:0-100,0表示置信度为0%,100表示置信度为100% |
severity |
String |
严重性等级,取值范围:Tips | Low | Medium | High | Fatal 说明: 0: Tips – 未发现任何问题。 1: Low – 无需针对问题执行任何操作。 2: Medium – 问题需要处理,但不紧急。 3: High – 问题必须优先处理。 4: Fatal – 问题必须立即处理,以防止产生进一步的损害 |
criticality |
Integer |
关键性,是指事件涉及的资源的重要性级别。 取值范围:0-100,0表示资源不关键,100表示最关键资源 |
incident_type |
incident_type object |
事件分类,详细定义参考《告警事件类型定义》 |
network_list |
Array of network_list objects |
网络信息 |
resource_list |
Array of resource_list objects |
受影响资源 |
remediation |
remediation object |
补救措施 |
verification_state |
String |
验证状态,标识事件的准确性。可选类型如下: Unknown – 未知 True_Positive – 确认 False_Positive – 误报 默认填写Unknown |
handle_status |
String |
事件处理状态,可选类型如下: Open – 打开,默认 Block – 阻塞 Closed – 关闭 默认填写Open |
sla |
Integer |
约束闭环时间:设置风险接受持续时间。单位:小时 |
update_time |
String |
更新时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
close_time |
String |
关闭时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
ipdrr_phase |
String |
周期/处置阶段编号 Prepartion|Detection and Analysis|Containm,Eradication& Recovery|Post-Incident-Activity |
simulation |
String |
调试字段 |
actor |
String |
事件调查员 |
owner |
String |
责任人、服务责任人 |
creator |
String |
创建人 |
close_reason |
String |
关闭原因: 误检 - False detection 已解决 - Resolved 重复 - Repeated 其他 - Other |
close_comment |
String |
关闭评论 |
malware |
malware object |
恶意软件 |
system_info |
Object |
系统信息 |
process |
Array of process objects |
进程信息 |
user_info |
Array of user_info objects |
用户信息 |
file_info |
Array of file_info objects |
文件信息 |
system_alert_table |
Object |
事件管理列表的布局字段 |
参数 |
参数类型 |
描述 |
---|---|---|
vendor_type |
String |
环境供应商 |
domain_id |
String |
租户id |
region_id |
String |
区域id,全局服务global |
cross_workspace_id |
String |
数据投递前的源工作空间id,在源空间下值为null,投递后为被委托用户的id |
project_id |
String |
项目id, 全局服务默认null |
参数 |
参数类型 |
描述 |
---|---|---|
source_type |
Integer |
数据源类型,取值范围如下: 1 - 云上产品 2 - 第三方产品 3 - 租户私有产品 |
domain_id |
String |
数据源产品所属账号的id |
project_id |
String |
数据源产品所属项目的id |
region_id |
String |
数据源产品所在区域,具体取值范围查看云地区和终端节点定义,例如cn-north-1 |
company_name |
String |
数据源产品所属公司的名称 |
product_name |
String |
数据源产品的名称 |
product_feature |
String |
产品功能特性名称,用来指明检测到当前事件的产品的功能特性 |
product_module |
String |
检测模块列表 |
参数 |
参数类型 |
描述 |
---|---|---|
direction |
String |
方向,取值范围:IN | OUT |
protocol |
String |
协议,包含7层和4层的协议 参考:IANA registered name https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml |
src_ip |
String |
源IP地址 |
src_port |
Integer |
源端口,0–65535 |
src_domain |
String |
源域名 |
src_geo |
src_geo object |
源IP的地理位置信息 |
dest_ip |
String |
目的IP地址 |
dest_port |
String |
目的端口,0–65535 |
dest_domain |
String |
目的域名 |
dest_geo |
dest_geo object |
目标IP的地理位置信息 |
参数 |
参数类型 |
描述 |
---|---|---|
latitude |
Number |
纬度 |
longitude |
Number |
经度 |
city_code |
String |
城市编码,Beijing | Shanghai |
country_code |
String |
国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG |
参数 |
参数类型 |
描述 |
---|---|---|
latitude |
Number |
纬度 |
longitude |
Number |
经度 |
city_code |
String |
城市编码,Beijing | Shanghai |
country_code |
String |
国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
云服务资源id |
name |
String |
资源名称 |
type |
String |
资源类型;引用云RMS type字段 |
provider |
String |
云服务名称;引用云RMS provider字段 |
region_id |
String |
区域;按照云regionId填写,如cn-north-1等 |
domain_id |
String |
资源所属账号ID,UUID格式 |
project_id |
String |
资源所属项目ID,UUID格式 |
ep_id |
String |
企业项目id |
ep_name |
String |
企业项目名称 |
tags |
String |
资源标签 1、最多50个key/values对 2、values:最大255字符,取值范围:字母数字,空格,+, -, =, ., _, :, /,@ |
参数 |
参数类型 |
描述 |
---|---|---|
recommendation |
String |
推荐处理方法 |
url |
String |
链接,指向该事件的一般修复信息。该URL必须可以从公网访问,不需要提供凭证 |
参数 |
参数类型 |
描述 |
---|---|---|
process_name |
String |
进程名 |
process_path |
String |
进程执行文件路径 |
process_pid |
Integer |
进程id |
process_uid |
Integer |
进程用户id |
process_cmdline |
String |
进程命令行 |
process_parent_name |
String |
父进程名称 |
process_parent_path |
String |
父进程执行文件路径 |
process_parent_pid |
Integer |
父进程id |
process_parent_uid |
Integer |
父进程用户id |
process_parent_cmdline |
String |
父进程命令行 |
process_child_name |
String |
子进程名称 |
process_child_path |
String |
子进程执行文件路径 |
process_child_pid |
Integer |
子进程id |
process_child_uid |
Integer |
子进程用户id |
process_child_cmdline |
String |
子进程命令行 |
process_launche_time |
String |
进程启动时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
process_terminate_time |
String |
进程结束时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 |
参数 |
参数类型 |
描述 |
---|---|---|
file_path |
String |
文件路径/名称 |
file_content |
String |
文件内容 |
file_new_path |
String |
文件新路径/名称 |
file_hash |
String |
文件hash |
file_md5 |
String |
文件md5 |
file_sha256 |
String |
文件sha256 |
file_attr |
String |
文件属性 |
状态码: 400
参数 |
参数类型 |
描述 |
---|---|---|
X-request-id |
String |
请求ID,格式为:request_uuid-timestamp-hostname |
参数 |
参数类型 |
描述 |
---|---|---|
code |
String |
错误码 |
message |
String |
错误描述 |
请求示例
创建一条事件,事件标题为MyXXX,标签为MyXXX,严重级别为tips,发生次数为4次。
{ "data_object" : { "version" : "1.0", "environment" : { "vendor_type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "data_source" : { "source_type" : 3, "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "product_name" : "test", "product_feature" : "test" }, "first_observed_time" : "2021-01-30T23:00:00Z+0800", "last_observed_time" : "2021-01-30T23:00:00Z+0800", "create_time" : "2021-01-30T23:00:00Z+0800", "arrive_time" : "2021-01-30T23:00:00Z+0800", "title" : "MyXXX", "labels" : "MyXXX", "description" : "This my XXXX", "source_url" : "http://xxx", "count" : 4, "confidence" : 4, "severity" : "TIPS", "criticality" : 4, "incident_type" : { "incident_type" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "category" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "network_list" : [ { "direction" : { "IN" : null }, "protocol" : "TCP", "src_ip" : "192.168.0.1", "src_port" : "1", "src_domain" : "xxx", "dest_ip" : "192.168.0.1", "dest_port" : "1", "dest_domain" : "xxx", "src_geo" : { "latitude" : 90, "longitude" : 180 }, "dest_geo" : { "latitude" : 90, "longitude" : 180 } } ], "resource_list" : [ { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_name" : "MyXXX", "tags" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" } ], "remediation" : { "recommendation" : "MyXXX", "url" : "MyXXX" }, "verification_state" : "Unknown – 未知,True_Positive – 确认,False_Positive – 误报。默认填写Unknown", "handle_status" : "Open – 打开,Block – 阻塞,Closed – 关闭。默认填写Open", "sla" : 60000, "update_time" : "2021-01-30T23:00:00Z+0800", "close_time" : "2021-01-30T23:00:00Z+0800", "ipdrr_phase" : "Prepartion|Detection and Analysis|Containm,Eradication& Recovery| Post-Incident-Activity", "simulation" : "false", "actor" : "刘一博", "owner" : "MyXXX", "creator" : "MyXXX", "close_reason" : "误检;已解决;重复;其他", "close_comment" : "误检;已解决;重复;其他", "malware" : { "malware_family" : "family", "malware_class" : "恶意占用内存" }, "system_info" : { }, "process" : [ { "process_name" : "MyXXX", "process_path" : "MyXXX", "process_pid" : 123, "process_uid" : 123, "process_cmdline" : "MyXXX" } ], "user_info" : [ { "user_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "user_name" : "MyXXX" } ], "file_info" : [ { "file_path" : "MyXXX", "file_content" : "MyXXX", "file_new_path" : "MyXXX", "file_hash" : "MyXXX", "file_md5" : "MyXXX", "file_sha256" : "MyXXX", "file_attr" : "MyXXX" } ], "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca620" } }
响应示例
状态码: 200
创建事件返回body体
{ "code" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "message" : "Error message", "data" : { "data_object" : { "version" : "1.0", "environment" : { "vendor_type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "data_source" : { "source_type" : 3, "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "first_observed_time" : "2021-01-30T23:00:00Z+0800", "last_observed_time" : "2021-01-30T23:00:00Z+0800", "create_time" : "2021-01-30T23:00:00Z+0800", "arrive_time" : "2021-01-30T23:00:00Z+0800", "title" : "MyXXX", "description" : "This my XXXX", "source_url" : "http://xxx", "count" : 4, "confidence" : 4, "severity" : "TIPS", "criticality" : 4, "incident_type" : { }, "network_list" : [ { "direction" : { "IN" : null }, "protocol" : "TCP", "src_ip" : "192.168.0.1", "src_port" : "1", "src_domain" : "xxx", "dest_ip" : "192.168.0.1", "dest_port" : "1", "dest_domain" : "xxx", "src_geo" : { "latitude" : 90, "longitude" : 180 }, "dest_geo" : { "latitude" : 90, "longitude" : 180 } } ], "resource_list" : [ { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_name" : "MyXXX", "tags" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" } ], "remediation" : { "recommendation" : "MyXXX", "url" : "MyXXX" }, "verification_state" : "Unknown – 未知,True_Positive – 确认,False_Positive – 误报。默认填写Unknown", "handle_status" : "Open – 打开,Block – 阻塞,Closed – 关闭。默认填写Open", "sla" : 60000, "update_time" : "2021-01-30T23:00:00Z+0800", "close_time" : "2021-01-30T23:00:00Z+0800", "ipdrr_phase" : "Prepartion|Detection and Analysis|Containm,Eradication& Recovery| Post-Incident-Activity", "simulation" : "false", "actor" : "刘一博", "owner" : "MyXXX", "creator" : "MyXXX", "close_reason" : "误检;已解决;重复;其他", "close_comment" : "误检;已解决;重复;其他", "malware" : { "malware_family" : "family", "malware_class" : "恶意占用内存" }, "system_info" : { }, "process" : [ { "process_name" : "MyXXX", "process_path" : "MyXXX", "process_pid" : 123, "process_uid" : 123, "process_cmdline" : "MyXXX" } ], "user_info" : [ { "user_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "user_name" : "MyXXX" } ], "file_info" : [ { "file_path" : "MyXXX", "file_content" : "MyXXX", "file_new_path" : "MyXXX", "file_hash" : "MyXXX", "file_md5" : "MyXXX", "file_sha256" : "MyXXX", "file_attr" : "MyXXX" } ], "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca620" }, "create_time" : "2021-01-30T23:00:00Z+0800", "update_time" : "2021-01-30T23:00:00Z+0800", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" } }
SDK代码示例
SDK代码示例如下。
Java
创建一条事件,事件标题为MyXXX,标签为MyXXX,严重级别为tips,发生次数为4次。
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
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.v2.region.SecMasterRegion; import com.huaweicloud.sdk.secmaster.v2.*; import com.huaweicloud.sdk.secmaster.v2.model.*; import java.util.List; import java.util.ArrayList; public class CreateIncidentSolution { 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(); CreateIncidentRequest request = new CreateIncidentRequest(); request.withWorkspaceId("{workspace_id}"); CreateIncidentRequestBody body = new CreateIncidentRequestBody(); List<IncidentFileInfo> listDataObjectFileInfo = new ArrayList<>(); listDataObjectFileInfo.add( new IncidentFileInfo() .withFilePath("MyXXX") .withFileContent("MyXXX") .withFileNewPath("MyXXX") .withFileHash("MyXXX") .withFileMd5("MyXXX") .withFileSha256("MyXXX") .withFileAttr("MyXXX") ); List<IncidentUserInfo> listDataObjectUserInfo = new ArrayList<>(); listDataObjectUserInfo.add( new IncidentUserInfo() .withUserId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withUserName("MyXXX") ); List<IncidentProcess> listDataObjectProcess = new ArrayList<>(); listDataObjectProcess.add( new IncidentProcess() .withProcessName("MyXXX") .withProcessPath("MyXXX") .withProcessPid(123) .withProcessUid(123) .withProcessCmdline("MyXXX") ); IncidentMalware malwareDataObject = new IncidentMalware(); malwareDataObject.withMalwareFamily("family") .withMalwareClass("恶意占用内存"); IncidentRemediation remediationDataObject = new IncidentRemediation(); remediationDataObject.withRecommendation("MyXXX") .withUrl("MyXXX"); List<IncidentResourceList> listDataObjectResourceList = new ArrayList<>(); listDataObjectResourceList.add( new IncidentResourceList() .withId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withName("MyXXX") .withType("MyXXX") .withRegionId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withDomainId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withProjectId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withEpId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withEpName("MyXXX") .withTags("909494e3-558e-46b6-a9eb-07a8e18ca62f") ); IncidentDestGeo destGeoNetworkList = new IncidentDestGeo(); destGeoNetworkList.withLatitude(java.math.BigDecimal.valueOf(90)) .withLongitude(java.math.BigDecimal.valueOf(180)); IncidentSrcGeo srcGeoNetworkList = new IncidentSrcGeo(); srcGeoNetworkList.withLatitude(java.math.BigDecimal.valueOf(90)) .withLongitude(java.math.BigDecimal.valueOf(180)); List<IncidentNetworkList> listDataObjectNetworkList = new ArrayList<>(); listDataObjectNetworkList.add( new IncidentNetworkList() .withDirection(IncidentNetworkList.DirectionEnum.fromValue("{}")) .withProtocol("TCP") .withSrcIp("192.168.0.1") .withSrcPort(1) .withSrcDomain("xxx") .withSrcGeo(srcGeoNetworkList) .withDestIp("192.168.0.1") .withDestPort("1") .withDestDomain("xxx") .withDestGeo(destGeoNetworkList) ); IncidentIncidentType incidentTypeDataObject = new IncidentIncidentType(); incidentTypeDataObject.withCategory("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withIncidentType("909494e3-558e-46b6-a9eb-07a8e18ca62f"); IncidentDataSource dataSourceDataObject = new IncidentDataSource(); dataSourceDataObject.withSourceType(3) .withDomainId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withProjectId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withRegionId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withProductName("test") .withProductFeature("test"); IncidentEnvironment environmentDataObject = new IncidentEnvironment(); environmentDataObject.withVendorType("MyXXX") .withDomainId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withRegionId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withProjectId("909494e3-558e-46b6-a9eb-07a8e18ca62f"); Incident dataObjectbody = new Incident(); dataObjectbody.withVersion("1.0") .withId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withWorkspaceId("909494e3-558e-46b6-a9eb-07a8e18ca620") .withLabels("MyXXX") .withEnvironment(environmentDataObject) .withDataSource(dataSourceDataObject) .withFirstObservedTime("2021-01-30T23:00:00Z+0800") .withLastObservedTime("2021-01-30T23:00:00Z+0800") .withCreateTime("2021-01-30T23:00:00Z+0800") .withArriveTime("2021-01-30T23:00:00Z+0800") .withTitle("MyXXX") .withDescription("This my XXXX") .withSourceUrl("http://xxx") .withCount(4) .withConfidence(4) .withSeverity(Incident.SeverityEnum.fromValue("TIPS")) .withCriticality(4) .withIncidentType(incidentTypeDataObject) .withNetworkList(listDataObjectNetworkList) .withResourceList(listDataObjectResourceList) .withRemediation(remediationDataObject) .withVerificationState(Incident.VerificationStateEnum.fromValue("Unknown – 未知,True_Positive – 确认,False_Positive – 误报。默认填写Unknown")) .withHandleStatus(Incident.HandleStatusEnum.fromValue("Open – 打开,Block – 阻塞,Closed – 关闭。默认填写Open")) .withSla(60000) .withUpdateTime("2021-01-30T23:00:00Z+0800") .withCloseTime("2021-01-30T23:00:00Z+0800") .withIpdrrPhase(Incident.IpdrrPhaseEnum.fromValue("Prepartion|Detection and Analysis|Containm,Eradication& Recovery| Post-Incident-Activity")) .withSimulation("false") .withActor("刘一博") .withOwner("MyXXX") .withCreator("MyXXX") .withCloseReason(Incident.CloseReasonEnum.fromValue("误检;已解决;重复;其他")) .withCloseComment("误检;已解决;重复;其他") .withMalware(malwareDataObject) .withSystemInfo(new Object()) .withProcess(listDataObjectProcess) .withUserInfo(listDataObjectUserInfo) .withFileInfo(listDataObjectFileInfo); body.withDataObject(dataObjectbody); request.withBody(body); try { CreateIncidentResponse response = client.createIncident(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
创建一条事件,事件标题为MyXXX,标签为MyXXX,严重级别为tips,发生次数为4次。
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v2.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v2 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 = CreateIncidentRequest() request.workspace_id = "{workspace_id}" listFileInfoDataObject = [ IncidentFileInfo( file_path="MyXXX", file_content="MyXXX", file_new_path="MyXXX", file_hash="MyXXX", file_md5="MyXXX", file_sha256="MyXXX", file_attr="MyXXX" ) ] listUserInfoDataObject = [ IncidentUserInfo( user_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", user_name="MyXXX" ) ] listProcessDataObject = [ IncidentProcess( process_name="MyXXX", process_path="MyXXX", process_pid=123, process_uid=123, process_cmdline="MyXXX" ) ] malwareDataObject = IncidentMalware( malware_family="family", malware_class="恶意占用内存" ) remediationDataObject = IncidentRemediation( recommendation="MyXXX", url="MyXXX" ) listResourceListDataObject = [ IncidentResourceList( id="909494e3-558e-46b6-a9eb-07a8e18ca62f", name="MyXXX", type="MyXXX", region_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", domain_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", project_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", ep_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", ep_name="MyXXX", tags="909494e3-558e-46b6-a9eb-07a8e18ca62f" ) ] destGeoNetworkList = IncidentDestGeo( latitude=90, longitude=180 ) srcGeoNetworkList = IncidentSrcGeo( latitude=90, longitude=180 ) listNetworkListDataObject = [ IncidentNetworkList( direction="{}", protocol="TCP", src_ip="192.168.0.1", src_port=1, src_domain="xxx", src_geo=srcGeoNetworkList, dest_ip="192.168.0.1", dest_port="1", dest_domain="xxx", dest_geo=destGeoNetworkList ) ] incidentTypeDataObject = IncidentIncidentType( category="909494e3-558e-46b6-a9eb-07a8e18ca62f", incident_type="909494e3-558e-46b6-a9eb-07a8e18ca62f" ) dataSourceDataObject = IncidentDataSource( source_type=3, domain_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", project_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", region_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", product_name="test", product_feature="test" ) environmentDataObject = IncidentEnvironment( vendor_type="MyXXX", domain_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", region_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", project_id="909494e3-558e-46b6-a9eb-07a8e18ca62f" ) dataObjectbody = Incident( version="1.0", id="909494e3-558e-46b6-a9eb-07a8e18ca62f", workspace_id="909494e3-558e-46b6-a9eb-07a8e18ca620", labels="MyXXX", environment=environmentDataObject, data_source=dataSourceDataObject, first_observed_time="2021-01-30T23:00:00Z+0800", last_observed_time="2021-01-30T23:00:00Z+0800", create_time="2021-01-30T23:00:00Z+0800", arrive_time="2021-01-30T23:00:00Z+0800", title="MyXXX", description="This my XXXX", source_url="http://xxx", count=4, confidence=4, severity="TIPS", criticality=4, incident_type=incidentTypeDataObject, network_list=listNetworkListDataObject, resource_list=listResourceListDataObject, remediation=remediationDataObject, verification_state="Unknown – 未知,True_Positive – 确认,False_Positive – 误报。默认填写Unknown", handle_status="Open – 打开,Block – 阻塞,Closed – 关闭。默认填写Open", sla=60000, update_time="2021-01-30T23:00:00Z+0800", close_time="2021-01-30T23:00:00Z+0800", ipdrr_phase="Prepartion|Detection and Analysis|Containm,Eradication& Recovery| Post-Incident-Activity", simulation="false", actor="刘一博", owner="MyXXX", creator="MyXXX", close_reason="误检;已解决;重复;其他", close_comment="误检;已解决;重复;其他", malware=malwareDataObject, system_info={}, process=listProcessDataObject, user_info=listUserInfoDataObject, file_info=listFileInfoDataObject ) request.body = CreateIncidentRequestBody( data_object=dataObjectbody ) response = client.create_incident(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
创建一条事件,事件标题为MyXXX,标签为MyXXX,严重级别为tips,发生次数为4次。
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/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.CreateIncidentRequest{} request.WorkspaceId = "{workspace_id}" filePathFileInfo:= "MyXXX" fileContentFileInfo:= "MyXXX" fileNewPathFileInfo:= "MyXXX" fileHashFileInfo:= "MyXXX" fileMd5FileInfo:= "MyXXX" fileSha256FileInfo:= "MyXXX" fileAttrFileInfo:= "MyXXX" var listFileInfoDataObject = []model.IncidentFileInfo{ { FilePath: &filePathFileInfo, FileContent: &fileContentFileInfo, FileNewPath: &fileNewPathFileInfo, FileHash: &fileHashFileInfo, FileMd5: &fileMd5FileInfo, FileSha256: &fileSha256FileInfo, FileAttr: &fileAttrFileInfo, }, } userIdUserInfo:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" userNameUserInfo:= "MyXXX" var listUserInfoDataObject = []model.IncidentUserInfo{ { UserId: &userIdUserInfo, UserName: &userNameUserInfo, }, } processNameProcess:= "MyXXX" processPathProcess:= "MyXXX" processPidProcess:= int32(123) processUidProcess:= int32(123) processCmdlineProcess:= "MyXXX" var listProcessDataObject = []model.IncidentProcess{ { ProcessName: &processNameProcess, ProcessPath: &processPathProcess, ProcessPid: &processPidProcess, ProcessUid: &processUidProcess, ProcessCmdline: &processCmdlineProcess, }, } malwareFamilyMalware:= "family" malwareClassMalware:= "恶意占用内存" malwareDataObject := &model.IncidentMalware{ MalwareFamily: &malwareFamilyMalware, MalwareClass: &malwareClassMalware, } recommendationRemediation:= "MyXXX" urlRemediation:= "MyXXX" remediationDataObject := &model.IncidentRemediation{ Recommendation: &recommendationRemediation, Url: &urlRemediation, } idResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" nameResourceList:= "MyXXX" typeResourceList:= "MyXXX" regionIdResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" domainIdResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" projectIdResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" epIdResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" epNameResourceList:= "MyXXX" tagsResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" var listResourceListDataObject = []model.IncidentResourceList{ { Id: &idResourceList, Name: &nameResourceList, Type: &typeResourceList, RegionId: ®ionIdResourceList, DomainId: &domainIdResourceList, ProjectId: &projectIdResourceList, EpId: &epIdResourceList, EpName: &epNameResourceList, Tags: &tagsResourceList, }, } latitudeDestGeo:= float32(90) longitudeDestGeo:= float32(180) destGeoNetworkList := &model.IncidentDestGeo{ Latitude: &latitudeDestGeo, Longitude: &longitudeDestGeo, } latitudeSrcGeo:= float32(90) longitudeSrcGeo:= float32(180) srcGeoNetworkList := &model.IncidentSrcGeo{ Latitude: &latitudeSrcGeo, Longitude: &longitudeSrcGeo, } directionNetworkList:= model.GetIncidentNetworkListDirectionEnum().{} protocolNetworkList:= "TCP" srcIpNetworkList:= "192.168.0.1" srcPortNetworkList:= int32(1) srcDomainNetworkList:= "xxx" destIpNetworkList:= "192.168.0.1" destPortNetworkList:= "1" destDomainNetworkList:= "xxx" var listNetworkListDataObject = []model.IncidentNetworkList{ { Direction: &directionNetworkList, Protocol: &protocolNetworkList, SrcIp: &srcIpNetworkList, SrcPort: &srcPortNetworkList, SrcDomain: &srcDomainNetworkList, SrcGeo: srcGeoNetworkList, DestIp: &destIpNetworkList, DestPort: &destPortNetworkList, DestDomain: &destDomainNetworkList, DestGeo: destGeoNetworkList, }, } categoryIncidentType:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" incidentTypeIncidentType:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" incidentTypeDataObject := &model.IncidentIncidentType{ Category: &categoryIncidentType, IncidentType: &incidentTypeIncidentType, } sourceTypeDataSource:= int32(3) domainIdDataSource:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" projectIdDataSource:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" regionIdDataSource:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" productNameDataSource:= "test" productFeatureDataSource:= "test" dataSourceDataObject := &model.IncidentDataSource{ SourceType: &sourceTypeDataSource, DomainId: &domainIdDataSource, ProjectId: &projectIdDataSource, RegionId: ®ionIdDataSource, ProductName: &productNameDataSource, ProductFeature: &productFeatureDataSource, } vendorTypeEnvironment:= "MyXXX" domainIdEnvironment:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" regionIdEnvironment:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" projectIdEnvironment:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" environmentDataObject := &model.IncidentEnvironment{ VendorType: &vendorTypeEnvironment, DomainId: &domainIdEnvironment, RegionId: ®ionIdEnvironment, ProjectId: &projectIdEnvironment, } versionDataObject:= "1.0" idDataObject:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" workspaceIdDataObject:= "909494e3-558e-46b6-a9eb-07a8e18ca620" labelsDataObject:= "MyXXX" firstObservedTimeDataObject:= "2021-01-30T23:00:00Z+0800" lastObservedTimeDataObject:= "2021-01-30T23:00:00Z+0800" createTimeDataObject:= "2021-01-30T23:00:00Z+0800" arriveTimeDataObject:= "2021-01-30T23:00:00Z+0800" titleDataObject:= "MyXXX" descriptionDataObject:= "This my XXXX" sourceUrlDataObject:= "http://xxx" countDataObject:= int32(4) confidenceDataObject:= int32(4) severityDataObject:= model.GetIncidentSeverityEnum().TIPS criticalityDataObject:= int32(4) verificationStateDataObject:= model.GetIncidentVerificationStateEnum().UNKNOWN_–_未知,TRUE_POSITIVE_–_确认,FALSE_POSITIVE_–_误报。默认填写UNKNOWN handleStatusDataObject:= model.GetIncidentHandleStatusEnum().OPEN_–_打开,BLOCK_–_阻塞,CLOSED_–_关闭。默认填写OPEN slaDataObject:= int32(60000) updateTimeDataObject:= "2021-01-30T23:00:00Z+0800" closeTimeDataObject:= "2021-01-30T23:00:00Z+0800" ipdrrPhaseDataObject:= model.GetIncidentIpdrrPhaseEnum().PREPARTION|DETECTION_AND_ANALYSIS|CONTAINM,ERADICATION&_RECOVERY|_POST_INCIDENT_ACTIVITY simulationDataObject:= "false" actorDataObject:= "刘一博" ownerDataObject:= "MyXXX" creatorDataObject:= "MyXXX" closeReasonDataObject:= model.GetIncidentCloseReasonEnum().误检;已解决;重复;其他 closeCommentDataObject:= "误检;已解决;重复;其他" var systemInfoDataObject interface{} = make(map[string]string) dataObjectbody := &model.Incident{ Version: &versionDataObject, Id: &idDataObject, WorkspaceId: &workspaceIdDataObject, Labels: &labelsDataObject, Environment: environmentDataObject, DataSource: dataSourceDataObject, FirstObservedTime: &firstObservedTimeDataObject, LastObservedTime: &lastObservedTimeDataObject, CreateTime: &createTimeDataObject, ArriveTime: &arriveTimeDataObject, Title: &titleDataObject, Description: &descriptionDataObject, SourceUrl: &sourceUrlDataObject, Count: &countDataObject, Confidence: &confidenceDataObject, Severity: &severityDataObject, Criticality: &criticalityDataObject, IncidentType: incidentTypeDataObject, NetworkList: &listNetworkListDataObject, ResourceList: &listResourceListDataObject, Remediation: remediationDataObject, VerificationState: &verificationStateDataObject, HandleStatus: &handleStatusDataObject, Sla: &slaDataObject, UpdateTime: &updateTimeDataObject, CloseTime: &closeTimeDataObject, IpdrrPhase: &ipdrrPhaseDataObject, Simulation: &simulationDataObject, Actor: &actorDataObject, Owner: &ownerDataObject, Creator: &creatorDataObject, CloseReason: &closeReasonDataObject, CloseComment: &closeCommentDataObject, Malware: malwareDataObject, SystemInfo: &systemInfoDataObject, Process: &listProcessDataObject, UserInfo: &listUserInfoDataObject, FileInfo: &listFileInfoDataObject, } request.Body = &model.CreateIncidentRequestBody{ DataObject: dataObjectbody, } response, err := client.CreateIncident(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
创建事件返回body体 |
400 |
创建事件错误返回body体 |
错误码
请参见错误码。