华为云用户手册

  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:1 最大长度:2097152 content-type 是 String application/json;charset=UTF-8 缺省值:application/json;charset=UTF-8 最小长度:1 最大长度:64 表3 请求Body参数 参数 是否必选 参数类型 描述 rule 否 ConditionInfo object 剧本触发规则详情 表4 ConditionInfo 参数 是否必选 参数类型 描述 expression_type 否 String 表达式类型。默认为common,事件触发剧本必填 最小长度:0 最大长度:64 conditions 否 Array of ConditionItem objects 触发条件。事件触发剧本必填 数组长度:0 - 99 logics 否 Array of strings 条件逻辑组合。事件触发剧本必填 最小长度:0 最大长度:64 数组长度:0 - 99 cron 否 String Cron 表达式(定时任务)。定时触发剧本必填 最小长度:0 最大长度:64 schedule_type 否 String 定时重复类型(second--秒, hour--小时,day--天,week-周)。定时触发剧本必填 最小长度:0 最大长度:64 start_type 否 String 剧本开始执行类型,IMMEDIATELY--创建完成立即执行, CUSTOM--自定义执行时间。定时触发剧本必填 最小长度:0 最大长度:64 end_type 否 String 剧本结束执行类型,FOREVER--一直执行, CUSTOM--自定义结束时间。定时触发剧本必填 最小长度:0 最大长度:64 end_time 否 String 定时结束时间。定时触发剧本必填 最小长度:0 最大长度:64 repeat_range 否 String 执行时间段 2021-01-30T23:00:00Z+0800。定时触发剧本必填 最小长度:0 最大长度:64 only_once 否 Boolean 是否只执行一次。定时触发剧本必填 execution_type 否 String 执行队列类型(PARALLEL-新任务与之前任务并行)。定时触发剧本必填 最小长度:0 最大长度:64 表5 ConditionItem 参数 是否必选 参数类型 描述 name 否 String 条件名称 最小长度:0 最大长度:64 detail 否 String 条件详情 最小长度:0 最大长度:1028 data 否 Array of strings 条件表达式数据 最小长度:0 最大长度:2048 数组长度:0 - 99
  • 响应参数 状态码: 200 表6 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表7 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:1 最大长度:32 message String 错误信息 最小长度:1 最大长度:32 data RuleInfo object 剧本触发规格信息 表8 RuleInfo 参数 参数类型 描述 id String 规则ID 最小长度:32 最大长度:64 project_id String 项目ID 最小长度:32 最大长度:64 rule String 触发规则 最小长度:0 最大长度:128 状态码: 400 表9 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表10 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • URI PUT /v1/{project_id}/workspaces/{workspace_id}/soc/playbooks/versions/{version_id}/rules/{rule_id} 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 最小长度:32 最大长度:36 workspace_id 是 String 工作空间ID 最小长度:32 最大长度:36 version_id 是 String 剧本版本ID 最小长度:32 最大长度:64 rule_id 是 String 剧本规则ID 最小长度:36 最大长度:36
  • Go 模拟一条告警规则,告警规则所属的管道ID为ead2769b-afb0-45dd-b9fa-a2953e6ac82f,查询类型为SQL,严重程度为提示。 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 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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.CreateAlertRuleSimulationRequest{} modeTriggers:= model.GetAlertRuleTriggerModeEnum().COUNT operatorTriggers:= model.GetAlertRuleTriggerOperatorEnum().GT severityTriggers:= model.GetAlertRuleTriggerSeverityEnum().TIPS var listTriggersbody = []model.AlertRuleTrigger{ { Mode: &modeTriggers, Operator: &operatorTriggers, Expression: "10", Severity: &severityTriggers, }, } eventGroupingCreateAlertRuleSimulationRequestBody:= true queryTypeCreateAlertRuleSimulationRequestBody:= model.GetCreateAlertRuleSimulationRequestBodyQueryTypeEnum().SQL request.Body = &model.CreateAlertRuleSimulationRequestBody{ Triggers: listTriggersbody, EventGrouping: &eventGroupingCreateAlertRuleSimulationRequestBody, To: int64(1665546370000), From: int64(1665221214000), QueryType: &queryTypeCreateAlertRuleSimulationRequestBody, Query: "* | select status, count(*) as count group by status", PipeId: "ead2769b-afb0-45dd-b9fa-a2953e6ac82f", } response, err := client.CreateAlertRuleSimulation(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 响应参数 状态码: 200 表5 响应Header参数 参数 参数类型 描述 X-request-id String This field is the request ID number for task tracking. Format is request_uuid-timestamp-hostname. 表6 响应Body参数 参数 参数类型 描述 alert_count Integer 告警数量。Alert count. 最小值:0 最大值:100 severity String 严重程度,提示、低危、中危、高危、致命。Severity. TIPS, LOW, MEDIUM, HIGH, FATAL 最小长度:1 最大长度:64 状态码: 400 表7 响应Header参数 参数 参数类型 描述 X-request-id String This field is the request ID number for task tracking. Format is request_uuid-timestamp-hostname.
  • 请求示例 模拟一条告警规则,告警规则所属的管道ID为ead2769b-afb0-45dd-b9fa-a2953e6ac82f,查询类型为SQL,严重程度为提示。 { "pipe_id" : "ead2769b-afb0-45dd-b9fa-a2953e6ac82f", "query" : "* | select status, count(*) as count group by status", "query_type" : "SQL", "event_grouping" : true, "from" : 1665221214000, "to" : 1665546370000, "triggers" : [ { "mode" : "COUNT", "operator" : "GT", "expression" : 10, "severity" : "TIPS" } ] }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token,通过调用IAM服务获取用户Token接口获取。 IAM user token, fetch from IAM api. 最小长度:1 最大长度:2097152 表3 请求Body参数 参数 是否必选 参数类型 描述 pipe_id 是 String 数据管道 ID。Pipe ID. 最小长度:36 最大长度:36 query 是 String 查询语句。Query. 最小长度:1 最大长度:1024 query_type 否 String 查询语法,SQL。Query type. SQL. 缺省值:SQL 最小长度:1 最大长度:255 枚举值: SQL from 是 Long 开始时间。Start time. 最小值:0 最大值:9223372036854775807 to 是 Long 结束时间。End time. 最小值:0 最大值:9223372036854775807 event_grouping 否 Boolean 告警分组。Event grouping. 缺省值:true triggers 是 Array of AlertRuleTrigger objects 告警触发规则。Alert triggers. 数组长度:1 - 5 表4 AlertRuleTrigger 参数 是否必选 参数类型 描述 mode 否 String 模式,数量。Mode. COUNT. 缺省值:COUNT 最小长度:1 最大长度:255 枚举值: COUNT operator 否 String 操作符,等于、不等于、大于、小于。 operator. EQ equal, NE not equal, GT greater than, LT less than. 缺省值:GT 最小长度:1 最大长度:255 枚举值: EQ NE GT LT expression 是 String expression 最小长度:1 最大长度:255 severity 否 String 严重程度,提示、低危、中危、高危、致命。Severity. TIPS, LOW, MEDIUM, HIGH, FATAL 最小长度:1 最大长度:255 枚举值: TIPS LOW MEDIUM HIGH FATAL accumulated_times 否 Integer accumulated_times 最小值:1 最大值:1000 缺省值:1
  • Python 模拟一条告警规则,告警规则所属的管道ID为ead2769b-afb0-45dd-b9fa-a2953e6ac82f,查询类型为SQL,严重程度为提示。 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 # coding: utf-8 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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("cn-north-4")) \ .build() try: request = CreateAlertRuleSimulationRequest() listTriggersbody = [ AlertRuleTrigger( mode="COUNT", operator="GT", expression="10", severity="TIPS" ) ] request.body = CreateAlertRuleSimulationRequestBody( triggers=listTriggersbody, event_grouping=True, to=1665546370000, _from=1665221214000, query_type="SQL", query="* | select status, count(*) as count group by status", pipe_id="ead2769b-afb0-45dd-b9fa-a2953e6ac82f" ) response = client.create_alert_rule_simulation(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • URI POST /v1/{project_id}/workspaces/{workspace_id}/siem/alert-rules/simulation 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目 ID。Project ID. 最小长度:32 最大长度:36 workspace_id 是 String 工作空间 ID。Workspace ID. 最小长度:32 最大长度:36
  • Token认证 Token的有效期为24小时,需要使用一个Token鉴权时,可以先缓存起来,避免频繁调用。 Token在计算机系统中代表令牌(临时)的意思,拥有Token就代表拥有某种权限。Token认证就是在调用API的时候将Token加到请求消息头,从而通过身份认证,获得操作API的权限。 Token可通过调用获取用户Token接口获取,调用本服务API需要project级别的Token,即调用获取用户Token接口时,请求body中auth.scope的取值需要选择project,如下所示。 { "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", "password": "********", "domain": { "name": "domainname" } } } }, "scope": { "project": { "name": "xxxxxxxx" } } } } 获取Token后,再调用其他接口时,您需要在请求消息头中添加“X-Auth-Token”,其值即为Token。例如Token值为“ABCDEFJ....”,则调用接口时将“X-Auth-Token: ABCDEFJ....”加到请求消息头即可,如下所示。 Content-Type: application/json X-Auth-Token: ABCDEFJ....
  • AK/SK认证 AK/SK签名认证方式仅支持消息体大小12MB以内,12MB以上的请求请使用Token认证。 AK/SK认证就是使用AK/SK对请求进行签名,在请求时将签名信息添加到消息头,从而通过身份认证。 AK(Access Key ID):访问密钥ID。与私有访问密钥关联的唯一标识符;访问密钥ID和私有访问密钥一起使用,对请求进行加密签名。 SK(Secret Access Key):与访问密钥ID结合使用的密钥,对请求进行加密签名,可标识发送方,并防止请求被修改。 使用AK/SK认证时,您可以基于签名算法使用AK/SK对请求进行签名,也可以使用专门的签名SDK对请求进行签名。详细的签名方法和SDK使用方法请参见API签名指南。 签名SDK只提供签名功能,与服务提供的SDK不同,使用时请注意。
  • 响应参数 状态码: 200 表6 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表7 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:1 最大长度:32 message String 错误信息 最小长度:1 最大长度:32 data RuleInfo object 剧本触发规格信息 表8 RuleInfo 参数 参数类型 描述 id String 规则ID 最小长度:32 最大长度:64 project_id String 项目ID 最小长度:32 最大长度:64 rule String 触发规则 最小长度:0 最大长度:128 状态码: 400 表9 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表10 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • 响应示例 状态码: 200 请求成功响应信息 { "code" : 0, "message" : "", "data" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "rule" : "{\"expression_type\":\"common\",\"conditions\":[{\"name\":\"condition_0\",\"data\":[\"ref_order_id\",\"==\",\"123\"],\"detail\":\"123\"}],\"logics\":[\"condition_0\"]}" } }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:1 最大长度:2097152 content-type 是 String application/json;charset=UTF-8 缺省值:application/json;charset=UTF-8 最小长度:1 最大长度:64 表3 请求Body参数 参数 是否必选 参数类型 描述 rule 是 ConditionInfo object 剧本触发规则详情 表4 ConditionInfo 参数 是否必选 参数类型 描述 expression_type 否 String 表达式类型。默认为common,事件触发剧本必填 最小长度:0 最大长度:64 conditions 否 Array of ConditionItem objects 触发条件。事件触发剧本必填 数组长度:0 - 99 logics 否 Array of strings 条件逻辑组合。事件触发剧本必填 最小长度:0 最大长度:64 数组长度:0 - 99 cron 否 String Cron 表达式(定时任务)。定时触发剧本必填 最小长度:0 最大长度:64 schedule_type 否 String 定时重复类型(second--秒, hour--小时,day--天,week-周)。定时触发剧本必填 最小长度:0 最大长度:64 start_type 否 String 剧本开始执行类型,IMMEDIATELY--创建完成立即执行, CUSTOM--自定义执行时间。定时触发剧本必填 最小长度:0 最大长度:64 end_type 否 String 剧本结束执行类型,FOREVER--一直执行, CUSTOM--自定义结束时间。定时触发剧本必填 最小长度:0 最大长度:64 end_time 否 String 定时结束时间。定时触发剧本必填 最小长度:0 最大长度:64 repeat_range 否 String 执行时间段 2021-01-30T23:00:00Z+0800。定时触发剧本必填 最小长度:0 最大长度:64 only_once 否 Boolean 是否只执行一次。定时触发剧本必填 execution_type 否 String 执行队列类型(PARALLEL-新任务与之前任务并行)。定时触发剧本必填 最小长度:0 最大长度:64 表5 ConditionItem 参数 是否必选 参数类型 描述 name 否 String 条件名称 最小长度:0 最大长度:64 detail 否 String 条件详情 最小长度:0 最大长度:1028 data 否 Array of strings 条件表达式数据 最小长度:0 最大长度:2048 数组长度:0 - 99
  • URI POST /v1/{project_id}/workspaces/{workspace_id}/soc/playbooks/versions/{version_id}/rules 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 最小长度:32 最大长度:36 workspace_id 是 String 工作空间ID 最小长度:32 最大长度:36 version_id 是 String 剧本版本ID 最小长度:32 最大长度:64
  • 错误码 当您调用API时,如果遇到“APIGW”开头的错误码,请参见API网关错误码进行处理。 状态码 错误码 错误信息 描述 处理措施 400 sa.00000001 Bad Request 参数错误 请检查请求参数 400 sa.00100004 Forbidden 不存在产品信息 检查产品信息 400 SecMaster.11061001 进程状态有误 -- -- 400 SecMaster.11061002 模型数量超出范围限制 -- -- 400 SecMaster.11061003 schedule参数超出范围 -- -- 400 SecMaster.11061004 告警名称已存在 -- -- 400 SecMaster.20010001 无效的工作空间ID -- -- 400 SecMaster.20030001 无效的参数 -- -- 400 SecMaster.20030002 无效的项目ID -- -- 400 SecMaster.20030003 无效的名称 -- -- 400 SecMaster.20030004 创建数据对象失败 -- -- 400 SecMaster.20030005 获取数据对象失败 -- -- 400 SecMaster.20030009 无效的排序字段 -- -- 400 SecMaster.20030010 无效的排序 -- -- 400 SecMaster.20030011 更新数据对象错误 -- -- 400 SecMaster.20030012 删除数据对象错误 -- -- 400 SecMaster.20030013 搜索数据对象错误 -- -- 400 SecMaster.20030022 查询特定数据类失败 -- -- 400 SecMaster.20030025 验证数据对象失败 -- -- 400 SecMaster.20039999 未知错误 -- -- 400 SecMaster.20040000 未知错误 -- -- 400 SecMaster.20040402 查询数据类失败 -- -- 400 SecMaster.20040516 字段超过最大限制 -- -- 400 SecMaster.20041001 无效的工作空间ID -- -- 400 SecMaster.20041002 无效的参数 -- -- 400 SecMaster.20041003 无效的项目ID -- -- 400 SecMaster.20041031 获取数据对象失败 -- -- 400 SecMaster.20041033 未选择关联数据对象 -- -- 400 SecMaster.20041504 创建事件失败 -- -- 400 SecMaster.20041507 更新事件失败 -- -- 400 SecMaster.20041508 删除事件失败 -- -- 400 SecMaster.20041509 单日事件创建个数超过最大限制 -- -- 400 SecMaster.20041804 告警转事件请求内容错误 -- -- 400 SecMaster.20041805 创建告警失败 -- -- 400 SecMaster.20041808 更新告警失败 -- -- 400 SecMaster.20041809 删除告警失败 -- -- 400 SecMaster.20041810 单日告警创建个数超过最大限制 -- -- 400 SecMaster.20041811 单日告警转事件个数超过最大限制 -- -- 400 SecMaster.20041903 获取数据类失败 -- -- 400 SecMaster.20041904 威胁情报数据不存在 -- -- 400 SecMaster.20041905 创建威胁情报失败 -- -- 400 SecMaster.20041906 更新威胁情报失败 -- -- 400 SecMaster.20041907 删除威胁情报失败 -- -- 400 SecMaster.20042501 单日指标创建个数超过最大限制 -- -- 400 SecMaster.20048001 剧本存在正在运行的实例或存在激活版本不能删除 -- -- 400 SecMaster.20048002 剧本不存在激活版本,不能启用 -- -- 400 SecMaster.20048003 剧本状态错误,不能审核 -- -- 400 SecMaster.20048004 资源不存在 -- -- 400 SecMaster.20048005 剧本审核不通过,不能激活 -- -- 400 SecMaster.20048006 剧本ID错误 -- -- 400 SecMaster.20048007 剧本版本ID错误 -- -- 400 SecMaster.20048008 剧本动作ID错误 -- -- 400 SecMaster.20048009 剧本规则ID错误 -- -- 400 SecMaster.20048013 剧本启用中,不能失活版本 -- -- 400 SecMaster.20048014 剧本已经发布,不能编辑 -- -- 400 SecMaster.20048015 剧本名称重复 -- -- 400 SecMaster.20048016 剧本定时任务时间范围错误 -- -- 400 SecMaster.20048017 剧本定时任务Corn表达式错误 -- -- 400 SecMaster.20048018 版本数量已达到上线 -- -- 400 SecMaster.20048019 剧本存在审核中版本,不能新建版本 -- -- 400 SecMaster.20048020 数据对象ID错误 -- -- 400 SecMaster.20048021 搜索内容无效 -- -- 400 SecMaster.20048022 查询结束时间必需大于查询起始时间 -- -- 400 SecMaster.20048023 注册剧本定时任务失败 -- -- 400 SecMaster.20048024 禁用剧本定时任务失败 -- -- 400 SecMaster.20048025 结束时间必须大于开始时间 -- -- 400 SecMaster.20048026 无效的剧本结束时间 -- -- 400 SecMaster.20048027 数据类ID不能为空 -- -- 400 SecMaster.20048028 存在未启用的匹配流程,不能提交版本 -- -- 400 SecMaster.20048029 剧本数据转换错误 -- -- 400 SecMaster.20048030 剧本个数超过最大限制 -- -- 400 SecMaster.20048031 剧本关联匹配流程个数超过限制 -- -- 400 SecMaster.20048032 无效的剧本调度时间间隔 -- -- 400 SecMaster.20048033 剧本关联的匹配流程不能为空 -- -- 400 SecMaster.20048034 匹配流程与剧本数据类不一致 -- -- 400 SecMaster.20048035 系统内置剧本不允许修改 -- -- 400 SecMaster.20048036 系统内置剧本不允许删除 -- -- 403 sa.00000010 Forbidden 拒绝访问 开通SA权限 403 sa.00000012 Unauthorized 无效的用户TOKEN 重新申请Token 403 sa.00100001 Forbidden 接收权限不存在 检查导入权限 500 sa.00000008 Internal Server Error 系统内部错误 联系管理员 父主题: 附录
  • URI GET /v1/{project_id}/workspaces/{workspace_id}/siem/alert-rules/templates 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目 ID。Project ID. 最小长度:32 最大长度:36 workspace_id 是 String 工作空间 ID。Workspace ID. 最小长度:32 最大长度:36 表2 Query参数 参数 是否必选 参数类型 描述 offset 是 Long 偏移量。Offset. 最小值:0 最大值:9223372036854775807 limit 是 Long 条数。Limit. 最小值:10 最大值:50 sort_key 否 String 排序字段。Sort key 最小长度:1 最大长度:256 sort_dir 否 String 排序顺序,顺序、逆序。Sort direction, asc, desc。 枚举值: asc desc severity 否 Array 严重程度,提示、低危、中危、高危、致命。Severity. TIPS, LOW, MEDIUM, HIGH, FATAL 数组长度:1 - 5 枚举值: TIPS LOW MEDIUM HIGH FATAL
  • 响应示例 状态码: 200 Success { "count" : 9223372036854776000, "records" : [ { "template_id" : "443a0117-1aa4-4595-ad4a-796fad4d4950", "update_time" : 1665221214, "template_name" : "Alert rule template", "data_source" : "sec_hss_vul", "version" : "1.0.0", "query" : "* | select status, count(*) as count group by status", "query_type" : "SQL", "severity" : "TIPS", "custom_properties" : { "references" : "https://localhost/references", "maintainer" : "isap" }, "event_grouping" : true, "schedule" : { "frequency_interval" : 5, "frequency_unit" : "MINUTE", "period_interval" : 5, "period_unit" : "MINUTE", "delay_interval" : 2, "overtime_interval" : 10 }, "triggers" : [ { "mode" : "COUNT", "operator" : "GT", "expression" : 10, "severity" : "TIPS" } ] } ] }
  • Go 创建一条指标,指标名称为“指标名称”,指标版本为1,指标类型为DATA_SOURCE,触发标志为否。 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 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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.CreateIndicatorRequest{} nameDataclass:= "名称" dataclassDataObject := &model.DataClassRefPojo{ Id: "28f61af50fc9452aa0ed5ea25c3cc3d3", Name: &nameDataclass, } valueDataObject:= "ip" dataObjectDataObject := &model.IndicatorDataObjectDetail{ Value: &valueDataObject, } environmentDataObject := &model.CreateIndicatorDetailEnvironment{ VendorType: "MyXXX", DomainId: "909494e3-558e-46b6-a9eb-07a8e18ca62f", RegionId: "909494e3-558e-46b6-a9eb-07a8e18ca62f", ProjectId: "909494e3-558e-46b6-a9eb-07a8e18ca62f", } dataSourceDataObject := &model.CreateIndicatorDetailDataSource{ SourceType: int32(3), DomainId: "909494e3-558e-46b6-a9eb-07a8e18ca62f", ProjectId: "909494e3-558e-46b6-a9eb-07a8e18ca62f", RegionId: "909494e3-558e-46b6-a9eb-07a8e18ca62f", ProductName: "test", ProductFeature: "test", } confidenceDataObject:= int32(4) statusDataObject:= "OPEN" labelsDataObject:= "OPEN" lastReportTimeDataObject:= "2021-01-30T23:00:00Z+0800" idDataObject:= "28f61af50fc9452aa0ed5ea25c3cc3d3" dataclassIdDataObject:= "28f61af50fc9452aa0ed5ea25c3cc3d3" projectIdDataObject:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" layoutIdDataObject:= "28f61af50fc9452aa0ed5ea25c3cc3d3" createTimeDataObject:= "2021-01-30T23:00:00Z+0800" updateTimeDataObject:= "2021-01-30T23:00:00Z+0800" dataObjectbody := &model.CreateIndicatorDetail{ DataSource: dataSourceDataObject, Verdict: "BLACK", Confidence: &confidenceDataObject, Status: &statusDataObject, Labels: &labelsDataObject, Value: "{}", GranularMarking: "1", Environment: environmentDataObject, Defanged: false, FirstReportTime: "2021-01-30T23:00:00Z+0800", LastReportTime: &lastReportTimeDataObject, Id: &idDataObject, Name: "指标名称", DataclassId: &dataclassIdDataObject, DataObject: dataObjectDataObject, WorkspaceId: "909494e3-558e-46b6-a9eb-07a8e18ca620", ProjectId: &projectIdDataObject, LayoutId: &layoutIdDataObject, Dataclass: dataclassDataObject, CreateTime: &createTimeDataObject, UpdateTime: &updateTimeDataObject, } request.Body = &model.IndicatorCreateRequest{ DataObject: dataObjectbody, } response, err := client.CreateIndicator(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • Python 创建一条指标,指标名称为“指标名称”,指标版本为1,指标类型为DATA_SOURCE,触发标志为否。 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 # coding: utf-8 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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("cn-north-4")) \ .build() try: request = CreateIndicatorRequest() dataclassDataObject = DataClassRefPojo( id="28f61af50fc9452aa0ed5ea25c3cc3d3", name="名称" ) dataObjectDataObject = IndicatorDataObjectDetail( value="ip" ) environmentDataObject = CreateIndicatorDetailEnvironment( vendor_type="MyXXX", domain_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", region_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", project_id="909494e3-558e-46b6-a9eb-07a8e18ca62f" ) dataSourceDataObject = CreateIndicatorDetailDataSource( 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" ) dataObjectbody = CreateIndicatorDetail( data_source=dataSourceDataObject, verdict="BLACK", confidence=4, status="OPEN", labels="OPEN", value="{}", granular_marking="1", environment=environmentDataObject, defanged=False, first_report_time="2021-01-30T23:00:00Z+0800", last_report_time="2021-01-30T23:00:00Z+0800", id="28f61af50fc9452aa0ed5ea25c3cc3d3", name="指标名称", dataclass_id="28f61af50fc9452aa0ed5ea25c3cc3d3", data_object=dataObjectDataObject, workspace_id="909494e3-558e-46b6-a9eb-07a8e18ca620", project_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", layout_id="28f61af50fc9452aa0ed5ea25c3cc3d3", dataclass=dataclassDataObject, create_time="2021-01-30T23:00:00Z+0800", update_time="2021-01-30T23:00:00Z+0800" ) request.body = IndicatorCreateRequest( data_object=dataObjectbody ) response = client.create_indicator(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • Java 创建一条指标,指标名称为“指标名称”,指标版本为1,指标类型为DATA_SOURCE,触发标志为否。 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 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.*; public class CreateIndicatorSolution { 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"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); SecMasterClient client = SecMasterClient.newBuilder() .withCredential(auth) .withRegion(SecMasterRegion.valueOf("cn-north-4")) .build(); CreateIndicatorRequest request = new CreateIndicatorRequest(); IndicatorCreateRequest body = new IndicatorCreateRequest(); DataClassRefPojo dataclassDataObject = new DataClassRefPojo(); dataclassDataObject.withId("28f61af50fc9452aa0ed5ea25c3cc3d3") .withName("名称"); IndicatorDataObjectDetail dataObjectDataObject = new IndicatorDataObjectDetail(); dataObjectDataObject.withValue("ip"); CreateIndicatorDetailEnvironment environmentDataObject = new CreateIndicatorDetailEnvironment(); environmentDataObject.withVendorType("MyXXX") .withDomainId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withRegionId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withProjectId("909494e3-558e-46b6-a9eb-07a8e18ca62f"); CreateIndicatorDetailDataSource dataSourceDataObject = new CreateIndicatorDetailDataSource(); 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"); CreateIndicatorDetail dataObjectbody = new CreateIndicatorDetail(); dataObjectbody.withDataSource(dataSourceDataObject) .withVerdict("BLACK") .withConfidence(4) .withStatus("OPEN") .withLabels("OPEN") .withValue("{}") .withGranularMarking("1") .withEnvironment(environmentDataObject) .withDefanged(false) .withFirstReportTime("2021-01-30T23:00:00Z+0800") .withLastReportTime("2021-01-30T23:00:00Z+0800") .withId("28f61af50fc9452aa0ed5ea25c3cc3d3") .withName("指标名称") .withDataclassId("28f61af50fc9452aa0ed5ea25c3cc3d3") .withDataObject(dataObjectDataObject) .withWorkspaceId("909494e3-558e-46b6-a9eb-07a8e18ca620") .withProjectId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withLayoutId("28f61af50fc9452aa0ed5ea25c3cc3d3") .withDataclass(dataclassDataObject) .withCreateTime("2021-01-30T23:00:00Z+0800") .withUpdateTime("2021-01-30T23:00:00Z+0800"); body.withDataObject(dataObjectbody); request.withBody(body); try { CreateIndicatorResponse response = client.createIndicator(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,指标类型为DATA_SOURCE,触发标志为否。 { "data_object" : { "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" }, "verdict" : "BLACK", "confidence" : 4, "status" : "OPEN", "labels" : "OPEN", "value" : "{}", "granular_marking" : "1", "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" }, "defanged" : false, "first_report_time" : "2021-01-30T23:00:00Z+0800", "last_report_time" : "2021-01-30T23:00:00Z+0800", "id" : "28f61af50fc9452aa0ed5ea25c3cc3d3", "indicator_type" : { }, "name" : "指标名称", "dataclass_id" : "28f61af50fc9452aa0ed5ea25c3cc3d3", "data_object" : { "indicator_type" : { }, "value" : "ip" }, "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca620", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "layout_id" : "28f61af50fc9452aa0ed5ea25c3cc3d3", "dataclass" : { "id" : "28f61af50fc9452aa0ed5ea25c3cc3d3", "name" : "名称" }, "create_time" : "2021-01-30T23:00:00Z+0800", "update_time" : "2021-01-30T23:00:00Z+0800" } }
  • 响应参数 状态码: 200 表13 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表14 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:32 最大长度:64 message String 错误信息 最小长度:1 最大长度:32 data IndicatorDetail object 情报详情信息 表15 IndicatorDetail 参数 参数类型 描述 id String 指标ID 最小长度:32 最大长度:64 name String 指标名称 最小长度:0 最大长度:64 data_object IndicatorDataObjectDetail object 情报详情 workspace_id String 工作空间ID 最小长度:32 最大长度:64 project_id String 项目ID 最小长度:32 最大长度:64 dataclass_ref DataClassRefPojo object 数据类对象信息 create_time String 创建时间 最小长度:0 最大长度:64 update_time String 更新时间 最小长度:0 最大长度:64 表16 IndicatorDataObjectDetail 参数 参数类型 描述 indicator_type indicator_type object 情报类型对象 value String 值,如:ip url domain等 最小长度:0 最大长度:256 update_time String 更新时间 最小长度:0 最大长度:64 create_time String 创建时间 最小长度:0 最大长度:64 environment environment object 环境信息 data_source data_source object 数据源信息 first_report_time String 首次发生时间 最小长度:0 最大长度:64 is_deleted Boolean 是否删除 last_report_time String 最近发生时间 最小长度:0 最大长度:64 granular_marking Integer 粒度(保密等级),由高到低:1(首次发现)、2(自产数据)、3(需购买)、4(外网直接查询) 最小值:1 最大值:4 name String 名称 最小长度:1 最大长度:64 id String 情报ID 最小长度:1 最大长度:64 project_id String 项目ID 最小长度:1 最大长度:64 revoked Boolean 是否作废 status String 状态, Open--打开,Closed--关闭, Revoked--作废 最小长度:1 最大长度:64 verdict String 威胁度, Black--黑,White--白,Gray--灰 最小长度:1 最大长度:64 workspace_id String 工作空间ID 最小长度:1 最大长度:64 confidence Integer 置信度,取值范围是80-100 最小值:80 最大值:100 表17 indicator_type 参数 参数类型 描述 indicator_type String 情报类型 最小长度:1 最大长度:32 id String 情报类型ID 最小长度:1 最大长度:64 category String 目录 最小长度:1 最大长度:64 layout_id String 布局ID 最小长度:1 最大长度:64 表18 environment 参数 参数类型 描述 vendor_type String 环境供应商(如HWC,AWS,Azure等) 最小长度:0 最大长度:1024 domain_id String 租户ID 最小长度:32 最大长度:64 region_id String 区域ID 最小长度:1 最大长度:64 project_id String 项目ID 最小长度:32 最大长度:64 表19 data_source 参数 参数类型 描述 source_type Integer 数据源类型,取值范围如下:1 - 华为产品 2 - 第三方产品 3 - 租户私有产品 最小值:0 最大值:9999 domain_id String 租户ID 最小长度:32 最大长度:64 project_id String 项目ID 最小长度:32 最大长度:64 region_id String 区域ID 最小长度:1 最大长度:64 表20 DataClassRefPojo 参数 参数类型 描述 id String 数据类ID 最小长度:32 最大长度:64 name String 数据类名称 最小长度:0 最大长度:64 状态码: 400 表21 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表22 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • 响应示例 状态码: 200 请求成功响应信息 { "code" : 0, "message" : "Error message", "data" : { "id" : "28f61af50fc9452aa0ed5ea25c3cc3d3", "name" : "指标名称", "data_object" : { "indicator_type" : { "layout_id" : "4e2d7f64-a66d-3236-a8c1-704636ced9a7", "indicator_type" : "ipv6", "id" : "ac794b2dfab9fe8c0676587301a636d3", "category" : "ipv6" }, "value" : "ip", "data_source" : { "domain_id" : "ac7438b990ef4a37b741004eb45e8bf4", "project_id" : "5b8bb3c888db498f9eeaf1023f7ba597", "region_id" : "cn-xxx-7", "source_type" : 1 }, "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca620", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "granular_marking" : 1, "first_report_time" : "2023-07-04T16:47:01Z+0800", "status" : "Open" }, "dataclass_ref" : { "id" : "28f61af50fc9452aa0ed5ea25c3cc3d3", "name" : "名称" }, "create_time" : "2021-01-30T23:00:00Z+0800", "update_time" : "2021-01-30T23:00:00Z+0800" } }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 租户的Token 最小长度:32 最大长度:65535 content-type 是 String application/json;charset=UTF-8 缺省值:application/json;charset=UTF-8 最小长度:1 最大长度:64 表3 请求Body参数 参数 是否必选 参数类型 描述 data_object 是 CreateIndicatorDetail object 情报详情信息 表4 CreateIndicatorDetail 参数 是否必选 参数类型 描述 data_source 是 data_source object 数据源信息 verdict 是 String 威胁度 最小长度:1 最大长度:64 confidence 否 Integer 置信度 最小值:0 最大值:99 status 否 String 状态 最小长度:1 最大长度:64 labels 否 String 标签 最小长度:1 最大长度:64 value 是 String 值 最小长度:1 最大长度:128 granular_marking 是 String 粒度(保密等级),由高到低:1(首次发现)、2(自产数据)、3(需购买)、4(外网直接查询) 最小长度:1 最大长度:64 environment 是 environment object 环境信息 defanged 是 Boolean 是否失效 缺省值:false 枚举值: true false first_report_time 是 String 首次发生时间 最小长度:0 最大长度:64 last_report_time 否 String 最近发生时间 最小长度:0 最大长度:64 id 否 String 指标ID 最小长度:32 最大长度:64 indicator_type 是 indicator_type object 指标类型统计数据 name 是 String 指标名称 最小长度:0 最大长度:64 dataclass_id 否 String 数据类ID 最小长度:32 最大长度:64 data_object 否 IndicatorDataObjectDetail object 情报详情 workspace_id 是 String workspace id 最小长度:32 最大长度:64 project_id 否 String Project id value 最小长度:32 最大长度:64 layout_id 否 String 布局ID 最小长度:0 最大长度:64 dataclass 否 DataClassRefPojo object 数据类对象信息 create_time 否 String Create time 最小长度:0 最大长度:64 update_time 否 String Update time 最小长度:0 最大长度:64 表5 data_source 参数 是否必选 参数类型 描述 source_type 是 Integer current page count 最小值:0 最大值:9999 domain_id 是 String Id value 最小长度:32 最大长度:64 project_id 是 String Id value 最小长度:32 最大长度:64 region_id 是 String Id value 最小长度:1 最大长度:64 product_name 是 String Id value 最小长度:1 最大长度:64 product_feature 是 String Id value 最小长度:1 最大长度:64 表6 environment 参数 是否必选 参数类型 描述 vendor_type 是 String 环境供应商,如:HWC/AWS等 最小长度:0 最大长度:1024 domain_id 是 String 租户ID 最小长度:32 最大长度:64 region_id 是 String 区域ID 最小长度:1 最大长度:64 project_id 是 String 项目ID 最小长度:32 最大长度:64 表7 indicator_type 参数 是否必选 参数类型 描述 indicator_type 是 String 指标类型 最小长度:1 最大长度:32 id 是 String 情报类型ID 最小长度:1 最大长度:64 category 是 String 目录 最小长度:1 最大长度:64 layout_id 是 String 布局ID 最小长度:1 最大长度:64 表8 IndicatorDataObjectDetail 参数 是否必选 参数类型 描述 indicator_type 否 indicator_type object 情报类型对象 value 否 String 值,如:ip url domain等 最小长度:0 最大长度:256 update_time 否 String 更新时间 最小长度:0 最大长度:64 create_time 否 String 创建时间 最小长度:0 最大长度:64 environment 否 environment object 环境信息 data_source 否 data_source object 数据源信息 first_report_time 否 String 首次发生时间 最小长度:0 最大长度:64 is_deleted 否 Boolean 是否删除 last_report_time 否 String 最近发生时间 最小长度:0 最大长度:64 granular_marking 否 Integer 粒度(保密等级),由高到低:1(首次发现)、2(自产数据)、3(需购买)、4(外网直接查询) 最小值:1 最大值:4 name 否 String 名称 最小长度:1 最大长度:64 id 否 String 情报ID 最小长度:1 最大长度:64 project_id 否 String 项目ID 最小长度:1 最大长度:64 revoked 否 Boolean 是否作废 status 否 String 状态, Open--打开,Closed--关闭, Revoked--作废 最小长度:1 最大长度:64 verdict 否 String 威胁度, Black--黑,White--白,Gray--灰 最小长度:1 最大长度:64 workspace_id 否 String 工作空间ID 最小长度:1 最大长度:64 confidence 否 Integer 置信度,取值范围是80-100 最小值:80 最大值:100 表9 indicator_type 参数 是否必选 参数类型 描述 indicator_type 否 String 情报类型 最小长度:1 最大长度:32 id 否 String 情报类型ID 最小长度:1 最大长度:64 category 否 String 目录 最小长度:1 最大长度:64 layout_id 否 String 布局ID 最小长度:1 最大长度:64 表10 environment 参数 是否必选 参数类型 描述 vendor_type 否 String 环境供应商(如HWC,AWS,Azure等) 最小长度:0 最大长度:1024 domain_id 否 String 租户ID 最小长度:32 最大长度:64 region_id 否 String 区域ID 最小长度:1 最大长度:64 project_id 否 String 项目ID 最小长度:32 最大长度:64 表11 data_source 参数 是否必选 参数类型 描述 source_type 否 Integer 数据源类型,取值范围如下:1 - 华为产品 2 - 第三方产品 3 - 租户私有产品 最小值:0 最大值:9999 domain_id 否 String 租户ID 最小长度:32 最大长度:64 project_id 否 String 项目ID 最小长度:32 最大长度:64 region_id 否 String 区域ID 最小长度:1 最大长度:64 表12 DataClassRefPojo 参数 是否必选 参数类型 描述 id 是 String 数据类ID 最小长度:32 最大长度:64 name 否 String 数据类名称 最小长度:0 最大长度:64
  • 响应示例 状态码: 200 请求成功响应信息 { "count" : 41, "audit_logs" : [ { "instance_type" : "APP, AOP_WORKFLOW, SCRIPT, PLAYBOOK, TASK, DEBUG", "action_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "action_name" : "DisabledIp", "instance_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "parent_instance_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "log_level" : "DEBUG INFO WARN", "input" : "input", "output" : "output", "error_msg" : "error_msg", "start_time" : "2021-01-30T23:00:00Z", "end_time" : "2021-01-31T23:00:00Z", "status" : "CREATED, RUNNING, FINISHED, RETRYING, TERMINATING, TERMINATED, FAILED", "trigger_type" : "DEBUG, TIMER, EVENT, MANUAL" } ] }
  • 请求示例 查询实例类型为APP, AOP_WORKFLOW, SCRIPT, PLAYBOOK, TASK, DEBUG,动作id为909494e3-558e-46b6-a9eb-07a8e18ca62f,动作名称为DisabledIp,实例id为909494e3-558e-46b6-a9eb-07a8e18ca62f,父实例id为909494e3-558e-46b6-a9eb-07a8e18ca62f,日志等级为DEBUG INFO WARN,输入为input,输出为output,错误信息为error_msg,开始时间2021-01-30 23:00:00,结束时间2021-01-31 23:00:00,状态为CREATED, RUNNING, FINISHED, RETRYING, TERMINATING, TERMINATED, FAILED,触发类型为DEBUG, TIMER, EVENT, MANUAL的剧本实例审计日志 { "instance_type" : "APP, AOP_WORKFLOW, SCRIPT, PLAYBOOK, TASK, DEBUG", "action_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "action_name" : "DisabledIp", "instance_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "parent_instance_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "log_level" : "DEBUG INFO WARN", "input" : "input", "output" : "output", "error_msg" : "error_msg", "start_time" : "2021-01-30T23:00:00Z", "end_time" : "2021-01-31T23:00:00Z", "status" : "CREATED, RUNNING, FINISHED, RETRYING, TERMINATING, TERMINATED, FAILED", "trigger_type" : "DEBUG, TIMER, EVENT, MANUAL" }
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:1 最大长度:2097152 content-type 是 String application/json;charset=UTF-8 缺省值:application/json;charset=UTF-8 最小长度:1 最大长度:64 表4 请求Body参数 参数 是否必选 参数类型 描述 instance_type 否 String 实例类型(AOP_WORKFLOW--流程, SCRIPT--脚本, PLAYBOOK--剧本) 最小长度:0 最大长度:64 action_id 否 String 流程ID 最小长度:0 最大长度:1028 action_name 否 String 流程名称 最小长度:0 最大长度:64 instance_id 否 String 实例ID 最小长度:0 最大长度:1028 parent_instance_id 否 String 父节点实例ID 最小长度:0 最大长度:64 log_level 否 String 日志级别 最小长度:0 最大长度:1028 input 否 String 输入 最小长度:0 最大长度:64 output 否 String 输出 最小长度:0 最大长度:1028 error_msg 否 String 错误信息 最小长度:0 最大长度:64 start_time 否 String 开始时间 最小长度:0 最大长度:1028 end_time 否 String 结束时间 最小长度:0 最大长度:64 status 否 String 状态。(RUNNING--运行中、FINISHED--成功、FAILED--失败、RETRYING--重试中、TERMINATING--终止中、TERMINATED--已终止) 最小长度:0 最大长度:1028 trigger_type 否 String 触发类型. TIMER--定时触发, EVENT--事件触发 最小长度:0 最大长度:1028
  • URI POST /v1/{project_id}/workspaces/{workspace_id}/soc/playbooks/instances/auditlogs 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 最小长度:32 最大长度:36 workspace_id 是 String 工作空间ID 最小长度:32 最大长度:36 表2 Query参数 参数 是否必选 参数类型 描述 offset 是 Long offset 最小值:0 最大值:9223372036854775807 limit 是 Long limit 最小值:10 最大值:50 sort_key 否 String sort_key 最小长度:1 最大长度:256 sort_dir 否 String sort_dir. asc, desc 枚举值: asc desc
  • 响应参数 状态码: 200 表5 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表6 响应Body参数 参数 参数类型 描述 count Integer 总条数 最小值:0 最大值:99999 audit_logs Array of AuditLogInfo objects 审计日志列表信息 数组长度:0 - 100 表7 AuditLogInfo 参数 参数类型 描述 instance_type String 实例类型(AOP_WORKFLOW--流程, SCRIPT--脚本, PLAYBOOK--剧本) 最小长度:0 最大长度:64 action_id String 流程ID 最小长度:0 最大长度:1028 action_name String 流程名称 最小长度:0 最大长度:64 instance_id String 实例ID 最小长度:0 最大长度:1028 parent_instance_id String 父节点实例ID 最小长度:0 最大长度:64 log_level String 日志级别 最小长度:0 最大长度:1028 input String 输入 最小长度:0 最大长度:64 output String 输出 最小长度:0 最大长度:1028 error_msg String 错误信息 最小长度:0 最大长度:64 start_time String 开始时间 最小长度:0 最大长度:1028 end_time String 结束时间 最小长度:0 最大长度:64 status String 状态。(RUNNING--运行中、FINISHED--成功、FAILED--失败、RETRYING--重试中、TERMINATING--终止中、TERMINATED--已终止) 最小长度:0 最大长度:1028 trigger_type String 触发类型. TIMER--定时触发, EVENT--事件触发 最小长度:0 最大长度:1028 状态码: 400 表8 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表9 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
共100000条