文档首页/ 企业主机安全 HSS/ API参考/ API说明/ 事件管理/ 查询具体事件的调查取证信息 - ListEventForensic
更新时间:2026-09-14 GMT+08:00
分享

查询具体事件的调查取证信息 - ListEventForensic

功能介绍

查询具体事件的调查取证信息。

调用方法

请参见如何调用API。

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
  • 如果使用身份策略授权,当前API调用无需身份策略权限。

URI

GET /v5/{project_id}/event/forensic

表1 路径参数

参数

是否必选

参数类型

描述

project_id

是

String

参数解释:

项目ID,用于明确项目归属,配置后可通过该ID查询项目下资产。获取方式请参见获取项目ID。

约束限制:

不涉及

取值范围:

字符长度1-256位

默认取值:

不涉及

表2 Query参数

参数

是否必选

参数类型

描述

enterprise_project_id

否

String

参数解释:

企业项目ID,用于过滤不同企业项目下的资产。获取方式请参见获取企业项目ID。

如需查询所有企业项目下的资产请传参“all_granted_eps”。

约束限制:

开通企业项目功能后才需要配置企业项目ID参数。

取值范围:

字符长度1-256位

默认取值:

0,表示默认企业项目(default)。

event_type

是

Integer

参数解释:

事件类型

约束限制:

不涉及

取值范围:

  • 1001:通用恶意软件

  • 1002:病毒

  • 1003:蠕虫

  • 1004:木马

  • 1005:僵尸网络

  • 1006:后门

  • 1010:Rootkit

  • 1011:勒索软件

  • 1012:黑客工具

  • 1015:Webshell

  • 1016:挖矿

  • 1017:反弹Shell

  • 2001:一般漏洞利用

  • 2012:远程代码执行

  • 2047:Redis漏洞利用

  • 2048:Hadoop漏洞利用

  • 2049:MySQL漏洞利用

  • 3002:文件提权

  • 3003:进程提权

  • 3004:关键文件变更

  • 3005:文件/目录变更

  • 3007:进程异常行为

  • 3015:高危命令执行

  • 3018:异常Shell

  • 3027:Crontab可疑任务

  • 3029:系统安全防护被禁用

  • 3030:备份删除

  • 3031:异常注册表操作

  • 3036:容器镜像阻断

  • 4002:暴力破解

  • 4004:异常登录

  • 4006:非法系统账号

  • 4014:用户账号添加

  • 4020:用户密码窃取

  • 6002:端口扫描

  • 6003:主机扫描

  • 13001:Kubernetes事件删除

  • 13002:Pod异常行为

  • 13003:枚举用户信息

  • 13004:绑定集群用户角色

  • 11001:高级威胁事件

默认取值:

不涉及

event_id

是

String

参数解释:

事件编号

约束限制:

不涉及

取值范围:

字符长度1-128位

默认取值:

不涉及

occur_time

是

Long

参数解释:

事件发生时间

约束限制:

不涉及

取值范围:

不涉及

默认取值:

不涉及

category

否

String

参数解释:

事件类别

约束限制:

不涉及

取值范围:

  • host:主机安全事件

  • container:容器安全事件

  • serverless:serverless场景安全事件

默认取值:

不涉及

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

是

String

参数解释:

用户Token,包含了用户的身份、权限等信息,在调用API接口时,可通过Token进行身份认证。获取方式请参见获取用户Token。

约束限制:

不涉及

取值范围:

字符长度1-32768位

默认取值:

不涉及

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

event_type

Integer

参数解释:

事件类型

取值范围:

  • 1001:通用恶意软件

  • 1002:病毒

  • 1003:蠕虫

  • 1004:木马

  • 1005:僵尸网络

  • 1006:后门

  • 1010:Rootkit

  • 1011:勒索软件

  • 1012 :黑客工具

  • 1015:Webshell

  • 1016:挖矿

  • 1017:反弹Shell

  • 2001:一般漏洞利用

  • 2012:远程代码执行

  • 2047:Redis漏洞利用

  • 2048:Hadoop漏洞利用

  • 2049:MySQL漏洞利用

  • 3002:文件提权

  • 3003:进程提权

  • 3004:关键文件变更

  • 3005:文件/目录变更

  • 3007:进程异常行为

  • 3015:高危命令执行

  • 3018:异常Shell

  • 3027:Crontab可疑任务

  • 3029 :系统安全防护被禁用

  • 3030 :备份删除

  • 3031 :异常注册表操作

  • 3036:容器镜像阻断

  • 4002:暴力破解

  • 4004:异常登录

  • 4006:非法系统账号

  • 4014:用户账号添加

  • 4020:用户密码窃取

  • 6002:端口扫描

  • 6003:主机扫描

  • 13001:Kubernetes事件删除

  • 13002:Pod异常行为

  • 13003:枚举用户信息

  • 13004:绑定集群用户角色

  • 11001:高级威胁事件

event_class_id

String

参数解释:

事件分类

取值范围:

  • container_1001:容器命名空间

  • container_1002:容器开放端口

  • container_1003:容器安全选项

  • container_1004:容器挂载目录

  • containerescape_0001:容器高危系统调用

  • containerescape_0002:Shocker攻击

  • containerescape_0003:DirtCow攻击

  • containerescape_0004:容器文件逃逸攻击

  • dockerfile_001:用户自定义容器保护文件被修改

  • dockerfile_002:容器文件系统可执行文件被修改

  • dockerproc_001:容器进程异常事件上报

  • fileprotect_0001:文件提权

  • fileprotect_0002:关键文件变更

  • fileprotect_0003:关键文件路径变更

  • fileprotect_0004:文件/目录变更

  • av_1002:病毒

  • av_1003:蠕虫

  • av_1004:木马

  • av_1005:僵尸网络

  • av_1006:后门

  • av_1007:间谍软件

  • av_1008:恶意广告软件

  • av_1009:钓鱼

  • av_1010:Rootkit

  • av_1011:勒索软件

  • av_1012:黑客工具

  • av_1013:灰色软件

  • av_1015:Webshell

  • av_1016:挖矿软件

  • login_0001:尝试暴力破解

  • login_0002:爆破成功

  • login_1001:登录成功

  • login_1002:异地登录

  • login_1003:弱口令

  • malware_0001:shell变更事件上报

  • malware_0002:反弹shell事件上报

  • malware_1001:恶意程序

  • procdet_0001:进程异常行为检测

  • procdet_0002:进程提权

  • procreport_0001:危险命令

  • user_1001:账号变更

  • user_1002:风险账号

  • vmescape_0001:虚拟机敏感命令执行

  • vmescape_0002:虚拟化进程访问敏感文件

  • vmescape_0003:虚拟机异常端口访问

  • webshell_0001:网站后门

  • network_1001:恶意挖矿

  • network_1002:对外DDoS攻击

  • network_1003:恶意扫描

  • network_1004:敏感区域攻击

  • ransomware_0001:勒索攻击

  • ransomware_0002:勒索攻击

  • ransomware_0003:勒索攻击

  • fileless_0001:进程注入

  • fileless_0002:动态库注入进程

  • fileless_0003:关键配置变更

  • fileless_0004:环境变量变更

  • fileless_0005:内存文件进程

  • fileless_0006:vdso劫持

  • crontab_1001:Crontab可疑任务

  • vul_exploit_0001:Redis漏洞利用攻击

  • vul_exploit_0002:Hadoop漏洞利用攻击

  • vul_exploit_0003:MySQL漏洞利用攻击

  • rootkit_0001:可疑rootkit文件

  • rootkit_0002:可疑内核模块

  • RASP_0004:上传Webshell

  • RASP_0018:无文件Webshell

  • blockexec_001:已知勒索攻击

  • hips_0001:Windows Defender防护被禁用

  • hips_0002:可疑的黑客工具

  • hips_0003:可疑的勒索加密行为

  • hips_0004:隐藏账号创建

  • hips_0005:读取用户密码凭据

  • hips_0006:可疑的SAM文件导出

  • hips_0007:可疑shadow copy删除操作

  • hips_0008:备份文件删除

  • hips_0009:可疑勒索病毒操作注册表

  • hips_0010:可疑的异常进程行为

  • hips_0011:可疑的扫描探测

  • hips_0012:可疑的勒索病毒脚本运行

  • hips_0013:可疑的挖矿命令执行

  • hips_0014:可疑的禁用windows安全中心

  • hips_0015:可疑的停止防火墙服务行为

  • hips_0016:可疑的系统自动恢复禁用

  • hips_0017:Office 创建可执行文件

  • hips_0018:带宏Office文件异常创建

  • hips_0019:可疑的注册表操作

  • hips_0020:Confluence远程代码执行

  • hips_0021:MSDT远程代码执行

  • portscan_0001:通用端口扫描

  • portscan_0002:秘密端口扫描

  • k8s_1001:Kubernetes事件删除

  • k8s_1002:创建特权Pod

  • k8s_1003:Pod中使用交互式shell

  • k8s_1004:创建敏感目录Pod

  • k8s_1005:创建主机网络的Pod

  • k8s_1006:创建主机Pid空间的Pod

  • k8s_1007:普通pod访问APIserver认证失败

  • k8s_1008:普通Pod通过Curl访问APIServer

  • k8s_1009:系统管理空间执行exec

  • k8s_1010:系统管理空间创建Pod

  • k8s_1011:创建静态Pod

  • k8s_1012:创建DaemonSet

  • k8s_1013:创建集群计划任务

  • k8s_1014:Secrets操作

  • k8s_1015:枚举用户可执行的操作

  • k8s_1016:高权限RoleBinding或ClusterRoleBinding

  • k8s_1017:ServiceAccount创建

  • k8s_1018:创建Cronjob

  • k8s_1019:Pod中exec使用交互式shell

  • k8s_1020:无权限访问Apiserver

  • k8s_1021:使用curl访问APIServer

  • k8s_1022:Ingress漏洞

  • k8s_1023:中间人攻击

  • k8s_1024:蠕虫挖矿木马

  • k8s_1025:K8s事件删除

  • k8s_1026:SelfSubjectRulesReview场景

  • imgblock_0001:镜像白名单阻断

  • imgblock_0002:镜像黑名单阻断

  • imgblock_0003:镜像标签白名单阻断

  • imgblock_0004:镜像标签黑名单阻断

  • imgblock_0005:创建容器白名单阻断

  • imgblock_0006:创建容器黑名单阻断

  • imgblock_0007:容器mount proc阻断

  • imgblock_0008:容器seccomp unconfined阻断

  • imgblock_0009:容器特权阻断

  • imgblock_0010:容器capabilities阻断

  • honeypot_0001:可疑的蜜罐异常访问

support_download_file

Boolean

参数解释:

是否支持告警源文件下载

取值范围:

  • true:支持

  • false:不支持

malware_file_hash

String

参数解释:

恶意文件的hash,当前为sha256

取值范围:

不涉及

event_forensic_info

EventForensicInfo object

参数解释:

事件调查取证信息

取值范围:

不涉及

表5 EventForensicInfo

参数

参数类型

描述

occur_time

Long

参数解释:

发生时间,毫秒

取值范围:

不涉及

file_forensic_list

Array of FileForensicInfo objects

参数解释:

文件取证信息列表

取值范围:

不涉及

process_chain_forensic

Array of ProcessChainList objects

参数解释:

进程链取证信息

取值范围:

不涉及

network_forensic

network_forensic object

参数解释:

网络取证信息

取值范围:

不涉及

user_forensic

user_forensic object

参数解释:

用户调查取证信息

取值范围:

不涉及

registry_forensic

registry_forensic object

参数解释:

注册表取证信息

取值范围:

不涉及

abnormal_login_forensic

abnormal_login_forensic object

参数解释:

异常登录取证信息

取值范围:

不涉及

container_forensic

container_forensic object

参数解释:

容器类型告警取证信息

取值范围:

不涉及

malware_forensic

malware_forensic object

参数解释:

恶意软件取证信息

取值范围:

不涉及

auto_launch_forensic

auto_launch_forensic object

参数解释:

自启动项取证信息

取值范围:

不涉及

kernel_forensic_list

Array of KernelForensicInfo objects

参数解释:

内核取证信息

取值范围:

不涉及

geo_forensic

geo_forensic object

参数解释:

地理位置取证信息

取值范围:

不涉及

stack_forensic

stack_forensic object

参数解释:

堆栈取证信息

取值范围:

不涉及

image_block_forensic

image_block_forensic object

参数解释:

容器镜像阻断取证信息

取值范围:

不涉及

honey_forensic

Array of HoneyForensicInfo objects

参数解释:

蜜罐相关取证信息

取值范围:

不涉及

表6 FileForensicInfo

参数

参数类型

描述

file_path

String

参数解释:

文件路径

取值范围:

不涉及

file_new_path

String

参数解释:

文件新路径

取值范围:

不涉及

file_name

String

参数解释:

文件名称

取值范围:

不涉及

file_sha256

String

参数解释:

文件sha256

取值范围:

不涉及

file_action

String

参数解释:

文件动作

取值范围:

不涉及

file_operation

Integer

参数解释:

文件操作类型

取值范围:

不涉及

file_size

Integer

参数解释:

文件大小

取值范围:

不涉及

file_hash

String

参数解释:

文件hash,当前为sha256

取值范围:

不涉及

file_desc

String

参数解释:

文件描述

取值范围:

不涉及

is_dir

Boolean

参数解释:

是否目录

取值范围:

不涉及

file_mtime

Long

参数解释:

文件最后一次修改时间(毫秒)

取值范围:

不涉及

file_atime

Long

参数解释:

文件最后一次访问时间(毫秒)

取值范围:

不涉及

file_ctime

Long

参数解释:

文件最后一次状态改变时间(毫秒)

取值范围:

不涉及

file_alias

String

参数解释:

文件别名

取值范围:

不涉及

file_md5

String

参数解释:

文件md5

取值范围:

不涉及

file_type

String

参数解释:

文件类型

取值范围:

不涉及

file_key_word

String

参数解释:

文件关键字

取值范围:

不涉及

表7 ProcessChainList

参数

参数类型

描述

[数组元素]

Array of ProcessForensicInfo objects

进程链列表

表8 ProcessForensicInfo

参数

参数类型

描述

process_name

String

参数解释:

进程名称

取值范围:

不涉及

process_path

String

参数解释:

进程文件路径

取值范围:

不涉及

process_pid

Integer

参数解释:

进程id

取值范围:

不涉及

process_uid

Integer

参数解释:

进程用户id

取值范围:

不涉及

process_gid

Integer

参数解释:

进程组id

取值范围:

不涉及

process_egid

Integer

参数解释:

进程有效组id

取值范围:

不涉及

process_euid

Integer

参数解释:

进程有效用户id

取值范围:

不涉及

process_username

String

参数解释:

运行进程的用户名

取值范围:

不涉及

process_cmdline

String

参数解释:

进程文件命令行

取值范围:

不涉及

process_start_time

Long

参数解释:

进程启动时间

取值范围:

不涉及

process_file_hash

String

参数解释:

进程文件hash

取值范围:

不涉及

ancestor_process_pid

Integer

参数解释:

祖父进程id

取值范围:

不涉及

ancestor_process_cmdline

String

参数解释:

祖父进程命令行

取值范围:

不涉及

ancestor_process_path

String

参数解释:

祖父进程路径

取值范围:

不涉及

session_id

Integer

参数解释:

会话id

取值范围:

不涉及

event_num

Integer

参数解释:

威胁事件数

取值范围:

不涉及

type

String

参数解释:

节点类型

取值范围:

  • 0:进程

  • 1:注册表

  • 2:文件

表9 network_forensic

参数

参数类型

描述

local_address

String

参数解释:

本地ip地址

取值范围:

不涉及

local_port

Integer

参数解释:

本地端口

取值范围:

不涉及

src_ip

String

参数解释:

源ip

取值范围:

不涉及

remote_address

String

参数解释:

远端ip地址(攻击者ip)

取值范围:

不涉及

remote_port

Integer

参数解释:

远程端口

取值范围:

不涉及

protocol

String

参数解释:

协议

取值范围:

不涉及

app_protocol

String

参数解释:

应用层协议

取值范围:

不涉及

flow_direction

String

参数解释:

流量方向

取值范围:

不涉及

count

Integer

参数解释:

连接次数

取值范围:

不涉及

first_time

Long

参数解释:

首次连接时间(毫秒)

取值范围:

不涉及

last_time

Long

参数解释:

最后一连接时间(毫秒)

取值范围:

不涉及

request_method

String

参数解释:

请求方法

取值范围:

不涉及

request_url

String

参数解释:

请求地址

取值范围:

不涉及

query_string

String

参数解释:

查询字符串

取值范围:

不涉及

request_params

String

参数解释:

请求参数

取值范围:

不涉及

request_header

String

参数解释:

请求头信息

取值范围:

不涉及

表10 user_forensic

参数

参数类型

描述

user_id

Integer

参数解释:

用户uid

取值范围:

不涉及

user_gid

Integer

参数解释:

用户gid

取值范围:

不涉及

user_name

String

参数解释:

用户名称

取值范围:

不涉及

user_group_name

String

参数解释:

用户组名称

取值范围:

不涉及

user_home_dir

String

参数解释:

用户home目录

取值范围:

不涉及

login_ip

String

参数解释:

用户登录ip

取值范围:

不涉及

service_type

String

参数解释:

登录的服务类型

取值范围:

不涉及

service_port

Integer

参数解释:

登录服务端口

取值范围:

不涉及

login_mode

Integer

参数解释:

登录方式

取值范围:

不涉及

login_last_time

Long

参数解释:

用户最后一次登录时间

取值范围:

不涉及

login_fail_count

Integer

参数解释:

用户登录失败次数

取值范围:

不涉及

表11 registry_forensic

参数

参数类型

描述

reg_key

String

参数解释:

注册表KEY

取值范围:

不涉及

reg_value

String

参数解释:

注册表VALUE

取值范围:

不涉及

reg_new_key

String

参数解释:

注册表新KEY

取值范围:

不涉及

reg_op_type

String

参数解释:

注册表KEY/VALUE操作类型

取值范围:

不涉及

表12 abnormal_login_forensic

参数

参数类型

描述

ip

String

参数解释:

IP

取值范围:

不涉及

user

String

参数解释:

用户

取值范围:

不涉及

country

String

参数解释:

国家

取值范围:

不涉及

sub_division

String

参数解释:

省份

取值范围:

不涉及

city

String

参数解释:

城市

取值范围:

不涉及

city_id

Integer

参数解释:

登录源(映射地名)

取值范围:

不涉及

表13 container_forensic

参数

参数类型

描述

container_id

String

参数解释:

容器ID

取值范围:

不涉及

container_status

String

参数解释:

容器状态

取值范围:

不涉及

pod_uid

String

参数解释:

pod uid

取值范围:

不涉及

pod_name

String

参数解释:

pod name

取值范围:

不涉及

namespace

String

参数解释:

命名空间

取值范围:

不涉及

cluster_id

String

参数解释:

集群id

取值范围:

不涉及

cluster_name

String

参数解释:

集群名称

取值范围:

不涉及

image_id

String

参数解释:

镜像ID

取值范围:

不涉及

image_name

String

参数解释:

镜像名称

取值范围:

不涉及

priviledged

Boolean

参数解释:

容器特权开放

取值范围:

不涉及

pid_mode

String

参数解释:

容器pid命名空间模式

取值范围:

不涉及

ipc_mode

String

参数解释:

容器ipc命名空间模式

取值范围:

不涉及

network_mode

String

参数解释:

容器网络命名空间模式

取值范围:

不涉及

publish_allports

Boolean

参数解释:

容器开放所有端口

取值范围:

不涉及

capabilities

String

参数解释:

容器权限

取值范围:

不涉及

security_opts

String

参数解释:

容器安全选项

取值范围:

不涉及

ports

String

参数解释:

容器开放端口

取值范围:

不涉及

mounts

String

参数解释:

容器挂载目录

取值范围:

不涉及

sys_call

String

参数解释:

系统调用

取值范围:

不涉及

container_name

String

参数解释:

容器名称

取值范围:

不涉及

表14 malware_forensic

参数

参数类型

描述

malware_family

String

参数解释:

恶意软件家族

取值范围:

不涉及

malware_name

String

参数解释:

恶意软件名称

取值范围:

不涉及

malware_type

String

参数解释:

恶意软件类型

取值范围:

不涉及

confidence

Integer

参数解释:

置信度

取值范围:

不涉及

表15 auto_launch_forensic

参数

参数类型

描述

event

Integer

参数解释:

事件

取值范围:

不涉及

type

Integer

参数解释:

类型

取值范围:

不涉及

owner

String

参数解释:

用户

取值范围:

不涉及

name

String

参数解释:

命令

取值范围:

不涉及

run_interval

String

参数解释:

运行间隔

取值范围:

不涉及

hash

String

参数解释:

hash

取值范围:

不涉及

mtime

String

参数解释:

hash

取值范围:

不涉及

description

String

参数解释:

自启动项信息

取值范围:

不涉及

path

String

参数解释:

进程文件命令行

取值范围:

不涉及

表16 KernelForensicInfo

参数

参数类型

描述

read_addr

Integer

参数解释:

地址

取值范围:

不涉及

syscall_num

Integer

参数解释:

系统调用编号

取值范围:

不涉及

function

String

参数解释:

系统函数

取值范围:

不涉及

module

String

参数解释:

内核模块

取值范围:

不涉及

ext_info

String

参数解释:

扩展信息

取值范围:

不涉及

表17 geo_forensic

参数

参数类型

描述

src_country

String

参数解释:

源国家

取值范围:

不涉及

src_city

String

参数解释:

源城市

取值范围:

不涉及

src_latitude

Integer

参数解释:

源纬度

取值范围:

不涉及

src_longitude

Integer

参数解释:

源经度

取值范围:

不涉及

dest_country

String

参数解释:

目的国家

取值范围:

不涉及

dest_city

String

参数解释:

目的城市

取值范围:

不涉及

dest_latitude

Integer

参数解释:

目的纬度

取值范围:

不涉及

dest_longitude

Integer

参数解释:

目的经度

取值范围:

不涉及

表18 stack_forensic

参数

参数类型

描述

attack_input_value

String

参数解释:

攻击载荷

取值范围:

不涉及

app_stack

String

参数解释:

堆栈信息

取值范围:

不涉及

chk_probe

Integer

参数解释:

攻击探针

取值范围:

不涉及

chk_rule

Integer

参数解释:

特性规则

取值范围:

不涉及

plugin_name

Integer

参数解释:

检测规则

取值范围:

不涉及

表19 image_block_forensic

参数

参数类型

描述

type

String

参数解释:

阻断类型

取值范围:

不涉及

msg

String

参数解释:

阻断原因

取值范围:

不涉及

path

String

参数解释:

路径

取值范围:

不涉及

image

String

参数解释:

镜像名称

取值范围:

不涉及

version

Boolean

参数解释:

镜像版本

取值范围:

不涉及

result

String

参数解释:

阻断结果

取值范围:

不涉及

time

String

参数解释:

发生时间

取值范围:

不涉及

表20 HoneyForensicInfo

参数

参数类型

描述

attack_ip

String

参数解释:

攻击源 IP

取值范围:

不涉及

sandbox_name

String

参数解释:

隔离沙箱名称

取值范围:

不涉及

service_name

String

参数解释:

欺骗服务

取值范围:

不涉及

attack_type

String

参数解释:

攻击类型

取值范围:

  • probe:探测

  • invade:入侵

attack_method_desc

String

参数解释:

攻击手法

取值范围:

不涉及

attack_desc

String

参数解释:

攻击行为

取值范围:

不涉及

请求示例

无

响应示例

状态码:200

{
  "event_type" : 1001,
  "event_class_id" : "av_1008",
  "support_download_file" : true,
  "malware_file_hash" : "d36b44b1cd6d5767f788ba326",
  "event_forensic_info" : {
    "occur_time" : 1615564800000,
    "network_forensic" : {
      "local_address" : "1.1.1.1",
      "local_port" : 0,
      "src_ip" : "1.1.1.2",
      "remote_address" : "1.1.1.3",
      "remote_port" : 0,
      "count" : 1,
      "first_time" : 1615564800000,
      "last_time" : 1615564800000
    }
  }
}

SDK代码示例

SDK代码示例如下。

 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
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.hss.v5.region.HssRegion;
import com.huaweicloud.sdk.hss.v5.*;
import com.huaweicloud.sdk.hss.v5.model.*;


public class ListEventForensicSolution {

    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);

        HssClient client = HssClient.newBuilder()
                .withCredential(auth)
                .withRegion(HssRegion.valueOf("<YOUR REGION>"))
                .build();
        ListEventForensicRequest request = new ListEventForensicRequest();
        try {
            ListEventForensicResponse response = client.listEventForensic(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());
        }
    }
}
 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
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkhss.v5.region.hss_region import HssRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkhss.v5 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 = HssClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(HssRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListEventForensicRequest()
        response = client.list_event_forensic(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    hss "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/hss/v5"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/hss/v5/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/hss/v5/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 := hss.HssClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := hss.NewHssClient(hcClient)

    request := &model.ListEventForensicRequest{}
	response, err := client.ListEventForensic(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

请求已成功

错误码

请参见错误码。

相关文档