华为云用户手册

  • 响应示例 状态码: 200 请求成功响应信息 { "code" : 0, "message" : "Error message", "data" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "description" : "This my XXXX", "create_time" : "2021-01-30T23:00:00Z+0800", "update_time" : "2021-01-30T23:00:00Z+0800", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "version_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "enabled" : true, "workspace_id" : "string", "approve_role" : "approve", "user_role" : "string", "edit_role" : "editor", "owner_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "version" : "v1.1.1", "dataclass_name" : "string", "dataclass_id" : "string", "unaudited_version_id" : "string", "reject_version_id" : "string" } }
  • Java 创建一个剧本,剧本名称为MyXXX,工作空间ID为string,审批人为approve,启用状态为开启。 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 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 CreatePlaybookSolution { 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(); CreatePlaybookRequest request = new CreatePlaybookRequest(); CreatePlaybookInfo body = new CreatePlaybookInfo(); body.withEnabled(true); body.withWorkspaceId("string"); body.withDescription("This my XXXX"); body.withName("MyXXX"); request.withBody(body); try { CreatePlaybookResponse response = client.createPlaybook(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()); } } }
  • 请求参数 表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参数 参数 是否必选 参数类型 描述 name 是 String 剧本名称 最小长度:0 最大长度:1024 description 否 String 描述 最小长度:0 最大长度:1024 workspace_id 是 String 工作空间ID 最小长度:0 最大长度:2097152 enabled 否 Boolean 是否启用,默认传false
  • Go 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 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.ShowPlaybookVersionRequest{} response, err := client.ShowPlaybookVersion(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • Python 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 # 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 = ShowPlaybookVersionRequest() response = client.show_playbook_version(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • 响应示例 状态码: 200 请求成功响应信息 { "code" : 0, "message" : "Error message", "data" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "description" : "This my XXXX", "create_time" : "2021-01-30T23:00:00Z+0800", "update_time" : "2021-01-30T23:00:00Z+0800", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "creator_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "modifier_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "playbook_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "version" : "v1.1.1", "enabled" : true, "status" : "editing", "action_strategy" : "sync", "actions" : [ { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "description" : "This my XXXX", "action_type" : "Workflow", "action_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "playbook_id" : "string", "playbook_version_id" : "string", "project_id" : "string" } ], "rule_enable" : true, "rules" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "rule" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "dataclass_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "trigger_type" : "event", "dataobject_create" : true, "dataobject_update" : true, "dataobject_delete" : true, "version_type" : 1, "rule_id" : "string", "dataclass_name" : "string", "approve_name" : "string" } }
  • Java 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 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 ShowPlaybookVersionSolution { 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(); ShowPlaybookVersionRequest request = new ShowPlaybookVersionRequest(); try { ShowPlaybookVersionResponse response = client.showPlaybookVersion(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()); } } }
  • 响应参数 状态码: 200 表3 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表4 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:1 最大长度:32 message String Error message 最小长度:1 最大长度:32 data PlaybookVersionInfo object 剧本版本详情信息 表5 PlaybookVersionInfo 参数 参数类型 描述 id String 剧本版本ID 最小长度:32 最大长度:64 description String 描述 最小长度:0 最大长度:1024 create_time String 创建时间 最小长度:0 最大长度:64 update_time String 更新时间 最小长度:0 最大长度:64 project_id String 项目ID 最小长度:32 最大长度:64 creator_id String 创建者ID 最小长度:32 最大长度:64 modifier_id String 修改者ID 最小长度:32 最大长度:64 playbook_id String 剧本ID 最小长度:32 最大长度:64 version String 版本号 最小长度:32 最大长度:64 enabled Boolean 是否启用。(true--已启用,false-未启用) status String 剧本版本状态,编辑中:EDITING 审核中:APPROVING 不通过:UNPASSED 已发布:PUBLISHED 最小长度:0 最大长度:64 action_strategy String 执行策略. 目前仅支持异步并发执行,对应值为ASYNC 最小长度:0 最大长度:64 actions Array of ActionInfo objects 剧本关联流程列表信息 数组长度:0 - 99 rule_enable Boolean 是否启用触发条件过滤器 rules RuleInfo object 剧本触发规格信息 dataclass_id String 数据类ID 最小长度:0 最大长度:64 trigger_type String 剧本触发方式(EVENT--事件触发,TIMER--定时触发) 最小长度:0 最大长度:64 dataobject_create Boolean 标识数据对象是否创建时触发剧本 dataobject_update Boolean 标识数据对象是否更新时触发剧本 dataobject_delete Boolean 标识数据对象是否删除时触发剧本 version_type Integer 版本类型(0--草稿版本,1--正式版本) 最小值:0 最大值:1 rule_id String 过滤规则ID 最小长度:0 最大长度:64 dataclass_name String 数据类名称 最小长度:0 最大长度:64 approve_name String 审核者 最小长度:0 最大长度:64 表6 ActionInfo 参数 参数类型 描述 id String 剧本流程动作ID 最小长度:32 最大长度:64 name String 流程动作名称 最小长度:0 最大长度:1024 description String 描述 最小长度:0 最大长度:1024 action_type String 流程动作类型 最小长度:0 最大长度:64 action_id String 流程ID 最小长度:32 最大长度:64 playbook_id String 剧本ID 最小长度:0 最大长度:64 playbook_version_id String 剧本版本ID 最小长度:0 最大长度:64 project_id String 项目ID 最小长度:0 最大长度:64 表7 RuleInfo 参数 参数类型 描述 id String 规则ID 最小长度:32 最大长度:64 project_id String 项目ID 最小长度:32 最大长度:64 rule String 触发规则 最小长度:0 最大长度:128 状态码: 400 表8 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表9 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • 请求参数 表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
  • URI GET /v1/{project_id}/workspaces/{workspace_id}/soc/playbooks/versions/{version_id} 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 最小长度:32 最大长度:36 workspace_id 是 String 工作空间ID 最小长度:32 最大长度:36 version_id 是 String 剧本版本ID 最小长度:32 最大长度:64
  • API概览 通过使用 安全云脑 提供的接口,您可以完整的使用安全云脑的所有功能。 类型 说明 告警规则API接口 告警规则的接口,包括创建、删除、查看、启用等接口。 告警API接口 告警的接口,包括创建、删除、转事件等接口。 关系API接口 关系的接口,包括查询、创建、删除等接口。 事件API接口 事件的接口,包括创建、更新、获取等接口。 指标API接口 指标的接口,包括查询、创建、删除等接口。 剧本API接口 剧本的接口,包括查询、创建、修改等接口。 剧本版本API接口 剧本版本的接口,包括查询、创建、更新等接口。 剧本审核API接口 剧本审核的接口,包括审核剧本、查询剧本审核结果的接口。 剧本规则API接口 剧本规则的接口,包括创建、查询、删除等接口。 剧本动作API接口 剧本动作的接口,包括查询、创建、更新等接口。 剧本实例API接口 剧本实例的接口,包括查询、操作等接口。
  • Java 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 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 ShowIncidentSolution { 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(); ShowIncidentRequest request = new ShowIncidentRequest(); try { ShowIncidentResponse response = client.showIncident(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()); } } }
  • Go 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 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.ShowIncidentRequest{} response, err := client.ShowIncident(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • Python 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 # 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 = ShowIncidentRequest() response = client.show_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)
  • 响应示例 状态码: 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" } }
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误信息 最小长度:0 最大长度:1024 data IncidentDetail object 表4 IncidentDetail 参数 参数类型 描述 create_time String 记录时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 data_object Incident object 事件实体信息 dataclass_ref dataclass_ref object 数据类对象 format_version Integer 格式版本 最小值:0 最大值:999 id String 事件唯一标识,UUID格式,最大36个字符 最小长度:0 最大长度:36 project_id String 当前项目的id 最小长度:0 最大长度:64 update_time String 更新时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为告警发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 version Integer 版本 最小值:0 最大值:999 workspace_id String 当前的工作空间id 最小长度:0 最大长度:36 表5 Incident 参数 参数类型 描述 version String 事件对象的版本,该字段的值必须为华为云SSA服务确定的官方发布版本之一 最小长度:0 最大长度:64 id String 事件唯一标识,UUID格式,最大36个字符 最小长度:0 最大长度:36 domain_id String 数据投递后,被委托用户的domain_id 最小长度:0 最大长度:36 region_id String 数据投递后,被委托用户的region_id 最小长度:0 最大长度:36 workspace_id String 当前的工作空间id 最小长度:0 最大长度:36 labels String 标签,仅展示 最小长度:0 最大长度:1024 environment environment object 事件产生的环境坐标信息 data_source data_source object 首次上报数据源 first_observed_time String 首次发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 last_observed_time String 最近发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 create_time String 记录时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 arrive_time String 接收时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 title String 事件标题 最小长度:0 最大长度:255 description String 事件描述信息 最小长度:0 最大长度:1024 source_url String 事件URL链接,指向数据源产品中有关当前事件说明的页面 最小长度:0 最大长度:1024 count Integer 事件发生次数 最小值:0 最大值:999 confidence Integer 事件的置信度。置信度的定义旨在说明识别的行为或问题的可能性。 取值范围:0-100,0表示置信度为0%,100表示置信度为100% 最小值:0 最大值:100 severity String 严重性等级,取值范围:Tips | Low | Medium | High | Fatal 说明: 0: Tips – 未发现任何问题。 1: Low – 无需针对问题执行任何操作。 2: Medium – 问题需要处理,但不紧急。 3: High – 问题必须优先处理。 4: Fatal – 问题必须立即处理,以防止产生进一步的损害 最小长度:3 最大长度:6 枚举值: Tips Low Medium High Fatal criticality Integer 关键性,是指事件涉及的资源的重要性级别。 取值范围:0-100,0表示资源不关键,100表示最关键资源 最小值:0 最大值:100 incident_type incident_type object 事件分类,详细定义参考《告警事件类型定义》 network_list Array of network_list objects 网络信息 数组长度:0 - 999 resource_list Array of resource_list objects 受影响资源 数组长度:0 - 999 remediation remediation object 补救措施 verification_state String 验证状态,标识事件的准确性。可选类型如下: Unknown – 未知 True_Positive – 确认 False_Positive – 误报 默认填写Unknown 最小长度:32 最大长度:64 枚举值: Unknown True_Positive False_Positive handle_status String 事件处理状态,可选类型如下: Open – 打开,默认 Block – 阻塞 Closed – 关闭 默认填写Open 最小长度:4 最大长度:5 枚举值: Open Block Closed sla Integer 约束闭环时间:设置风险接受持续时间。单位:小时 最小值:0 最大值:999 update_time String 更新时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 close_time String 关闭时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 ipdrr_phase String 周期/处置阶段编号 Prepartion|Detection and Analysis|Containm,Eradication& Recovery|Post-Incident-Activity 最小长度:0 最大长度:64 枚举值: Prepartion Detection and Analysis Containm,Eradication& Recovery Post-Incident-Activity simulation String 调试字段 最小长度:0 最大长度:64 actor String 事件调查员 最小长度:0 最大长度:64 owner String 责任人、服务责任人 最小长度:0 最大长度:64 creator String 创建人 最小长度:0 最大长度:64 close_reason String 关闭原因: 误检 - False detection 已解决 - Resolved 重复 - Repeated 其他 - Other 最小长度:0 最大长度:64 枚举值: False detection Resolved Repeated Other close_comment String 关闭评论 最小长度:0 最大长度:1024 malware malware object 恶意软件 system_info Object 系统信息 process Array of process objects 进程信息 数组长度:0 - 999 user_info Array of user_info objects 用户信息 数组长度:0 - 999 file_info Array of file_info objects 文件信息 数组长度:0 - 999 system_alert_table Object 事件管理列表的布局字段 表6 environment 参数 参数类型 描述 vendor_type String 环境供应商:HWCP/HWC/AWS/Azure/GCP 最小长度:0 最大长度:64 domain_id String 租户id 最小长度:0 最大长度:64 region_id String 区域id,全局服务global 最小长度:0 最大长度:64 cross_workspace_id String 数据投递前的源工作空间id,在源空间下值为null,投递后为被委托用户的id 最小长度:0 最大长度:64 project_id String 项目id, 全局服务默认null 最小长度:0 最大长度:64 表7 data_source 参数 参数类型 描述 source_type Integer 数据源类型,取值范围如下: 1 - 华为产品 2 - 第三方产品 3 - 租户私有产品 最小值:1 最大值:3 枚举值: 1 2 3 domain_id String 数据源产品所属账号的id 最小长度:0 最大长度:36 project_id String 数据源产品所属项目的id 最小长度:0 最大长度:64 region_id String 数据源产品所在区域,具体取值范围查看华为云地区和终端节点定义,例如cn-north-1 最小长度:0 最大长度:64 company_name String 数据源产品所属公司的名称 最小长度:0 最大长度:16 product_name String 数据源产品的名称 最小长度:0 最大长度:24 product_feature String 产品功能特性名称,用来指明检测到当前事件的产品的功能特性 最小长度:0 最大长度:24 product_module String 检测模块列表 最小长度:0 最大长度:1024 表8 incident_type 参数 参数类型 描述 category String 类别 最小长度:0 最大长度:1024 incident_type String 事件类型 最小长度:0 最大长度:1024 表9 network_list 参数 参数类型 描述 direction String 方向,取值范围:IN | OUT 最小长度:0 最大长度:3 枚举值: IN OUT protocol String 协议,包含7层和4层的协议 参考:IANA registered name https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml 最小长度:0 最大长度:64 src_ip String 源IP地址 最小长度:0 最大长度:64 src_port Integer 源端口,0–65535 最小值:0 最大值:65535 src_domain String 源域名 最小长度:0 最大长度:128 src_geo src_geo object 源IP的地理位置信息 dest_ip String 目的IP地址 最小长度:32 最大长度:64 dest_port String 目的端口,0–65535 最小长度:0 最大长度:65535 dest_domain String 目的域名 最小长度:0 最大长度:128 dest_geo dest_geo object 目标IP的地理位置信息 表10 src_geo 参数 参数类型 描述 latitude Number 纬度 最小值:0 最大值:90 longitude Number 经度 最小值:0 最大值:180 city_code String 城市编码,Beijing | Shanghai 最小长度:0 最大长度:64 country_code String 国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG 最小长度:0 最大长度:64 表11 dest_geo 参数 参数类型 描述 latitude Number 纬度 最小值:0 最大值:90 longitude Number 经度 最小值:0 最大值:180 city_code String 城市编码,Beijing | Shanghai 最小长度:0 最大长度:64 country_code String 国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG 最小长度:0 最大长度:64 表12 resource_list 参数 参数类型 描述 id String 云服务资源id 最小长度:0 最大长度:36 name String 资源名称 最小长度:0 最大长度:255 type String 资源类型;引用华为云 RMS type字段 最小长度:0 最大长度:64 provider String 云服务名称;引用华为云RMS provider字段 最小长度:0 最大长度:64 region_id String 区域;按照华为云regionId填写,如cn-north-1等 最小长度:0 最大长度:36 domain_id String 资源所属账号ID,UUID格式 最小长度:0 最大长度:36 project_id String 资源所属项目ID,UUID格式 最小长度:0 最大长度:36 ep_id String 企业项目id 最小长度:0 最大长度:128 ep_name String 企业项目名称 最小长度:0 最大长度:128 tags String 资源标签 1、最多50个key/values对 2、values:最大255字符,取值范围:字母数字,空格,+, -, =, ., _, :, /,@ 最小长度:0 最大长度:2048 表13 remediation 参数 参数类型 描述 recommendation String 推荐处理方法 最小长度:0 最大长度:128 url String 链接,指向该事件的一般修复信息。该URL必须可以从公网访问,不需要提供凭证 最小长度:0 最大长度:2048 表14 malware 参数 参数类型 描述 malware_family String 恶意家族 最小长度:0 最大长度:64 malware_class String 恶意软件分类 最小长度:0 最大长度:64 表15 process 参数 参数类型 描述 process_name String 进程名 最小长度:0 最大长度:64 process_path String 进程执行文件路径 最小长度:0 最大长度:512 process_pid Integer 进程id 最小值:0 最大值:65535 process_uid Integer 进程用户id 最小值:0 最大值:655350 process_cmdline String 进程命令行 最小长度:0 最大长度:128 process_parent_name String 父进程名称 最小长度:0 最大长度:64 process_parent_path String 父进程执行文件路径 最小长度:0 最大长度:512 process_parent_pid Integer 父进程id 最小值:0 最大值:65535 process_parent_uid Integer 父进程用户id 最小值:0 最大值:655350 process_parent_cmdline String 父进程命令行 最小长度:0 最大长度:128 process_child_name String 子进程名称 最小长度:0 最大长度:64 process_child_path String 子进程执行文件路径 最小长度:0 最大长度:512 process_child_pid Integer 子进程id 最小值:0 最大值:65535 process_child_uid Integer 子进程用户id 最小值:0 最大值:655350 process_child_cmdline String 子进程命令行 最小长度:0 最大长度:128 process_launche_time String 进程启动时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 process_terminate_time String 进程结束时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 表16 user_info 参数 参数类型 描述 user_id String 用户uid 最小长度:0 最大长度:36 user_name String 用户名称 最小长度:32 最大长度:64 表17 file_info 参数 参数类型 描述 file_path String 文件路径/名称 最小长度:0 最大长度:128 file_content String 文件内容 最小长度:0 最大长度:1024 file_new_path String 文件新路径/名称 最小长度:32 最大长度:64 file_hash String 文件hash 最小长度:0 最大长度:128 file_md5 String 文件md5 最小长度:0 最大长度:128 file_sha256 String 文件sha256 最小长度:0 最大长度:128 file_attr String 文件属性 最小长度:0 最大长度:1024 表18 dataclass_ref 参数 参数类型 描述 id String 数据类唯一标识,UUID格式,最大36个字符 最小长度:0 最大长度:36 name String 数据类名称 最小长度:0 最大长度:36 状态码: 400 表19 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值) 最小长度:0 最大长度:2097152 content-type 是 String 内容类型 缺省值:application/json;charset=UTF-8 最小长度:0 最大长度:64
  • URI GET /v1/{project_id}/workspaces/{workspace_id}/soc/incidents/{incident_id} 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目id 最小长度:32 最大长度:36 workspace_id 是 String 工作空间id 最小长度:32 最大长度:36 incident_id 是 String 事件ID 最小长度:32 最大长度:36
  • 调用API获取项目ID 项目ID可以通过调用查询指定条件下的项目信息API获取。 获取项目ID的接口为“GET https://{Endpoint}/v3/projects”,其中{Endpoint}为IAM的终端节点,可以从地区和终端节点获取。接口的认证鉴权请参见认证鉴权。 响应示例如下,其中projects下的“id”即为项目ID。 { "projects": [ { "domain_id": "65382450e8f64ac0870cd180d14e684b", "is_domain": false, "parent_id": "65382450e8f64ac0870cd180d14e684b", "name": "xxxxxxxx", "description": "", "links": { "next": null, "previous": null, "self": "https://www.example.com/v3/projects/a4a5d4098fb4474fa22cd05f897d6b99" }, "id": "a4a5d4098fb4474fa22cd05f897d6b99", "enabled": true } ], "links": { "next": null, "previous": null, "self": "https://www.example.com/v3/projects" } }
  • 响应示例 状态码: 200 请求成功响应信息 { "count" : 41, "instances" : [ { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "playbook" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "version_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "version" : "v1.1.1" }, "dataclass" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "dataobject" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "status" : "TERMINATED", "trigger_type" : "string", "start_time" : "2021-01-30T23:00:00Z+0800", "end_time" : "2021-01-30T23:00:00Z+0800" } ] }
  • 响应参数 状态码: 200 表4 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表5 响应Body参数 参数 参数类型 描述 count Integer 总数 最小值:0 最大值:99999 instances Array of PlaybookInstanceInfo objects 剧本实例列表信息 数组长度:0 - 100 表6 PlaybookInstanceInfo 参数 参数类型 描述 id String 剧本实例ID 最小长度:32 最大长度:64 name String 剧本实例名称 最小长度:0 最大长度:1024 project_id String 项目ID 最小长度:32 最大长度:64 playbook PlaybookInfoRef object 剧本信息 dataclass DataclassInfoRef object 数据类信息 dataobject DataobjectInfo object 数据对象详情 status String 剧本实例状态. (RUNNING--运行中、FINISHED--成功、FAILED--失败、RETRYING--重试中、TERMINATING--终止中、TERMINATED--已终止) 最小长度:32 最大长度:64 trigger_type String 触发类型. TIMER--定时触发, EVENT--事件触发 最小长度:0 最大长度:64 start_time String 创建时间 最小长度:0 最大长度:64 end_time String 更新时间 最小长度:0 最大长度:64 表7 PlaybookInfoRef 参数 参数类型 描述 id String 剧本ID 最小长度:32 最大长度:64 version_id String 剧本版本ID 最小长度:32 最大长度:64 name String 名称 最小长度:32 最大长度:64 version String 版本 最小长度:32 最大长度:64 表8 DataclassInfoRef 参数 参数类型 描述 id String 数据类ID 最小长度:32 最大长度:64 name String 数据类名称 最小长度:32 最大长度:64 表9 DataobjectInfo 参数 参数类型 描述 id String ID值 最小长度:32 最大长度:64 create_time String 创建时间 最小长度:0 最大长度:64 update_time String 更新时间 最小长度:0 最大长度:64 project_id String 项目ID 最小长度:32 最大长度:64 dataclass_id String 数据类ID 最小长度:32 最大长度:64 name String 名称 最小长度:0 最大长度:1024 content String 数据内容 最小长度:0 最大长度:4096 状态码: 400 表10 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表11 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • 请求参数 表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
  • URI GET /v1/{project_id}/workspaces/{workspace_id}/soc/playbooks/instances 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 最小长度:32 最大长度:36 workspace_id 是 String 工作空间ID 最小长度:32 最大长度:36 表2 Query参数 参数 是否必选 参数类型 描述 status 否 String 剧本实例状态. (RUNNING--运行中、FINISHED--成功、FAILED--失败、RETRYING--重试中、TERMINATING--终止中、TERMINATED--已终止) 最小长度:0 最大长度:64 name 否 String 实例名称 最小长度:0 最大长度:64 playbook_name 否 String 剧本名称 最小长度:0 最大长度:64 dataclass_name 否 String 数据类名称 最小长度:0 最大长度:64 dataobject_name 否 String 数据对象名称 最小长度:0 最大长度:64 trigger_type 否 String 触发类型. TIMER--定时触发, EVENT--事件触发 最小长度:0 最大长度:64 from_date 否 String 查询起始时间 最小长度:32 最大长度:36 to_date 否 String 查询结束时间 最小长度:32 最大长度:36 limit 是 Integer 分页查询参数,用于指定一次查询最多的结果数,从1开始 最小值:1 最大值:999999 offset 是 Integer 分页查询参数。用于指定查询结果的起始位置,从0开始 最小值:0 最大值:999999
  • Python 更新一个剧本版本,剧本版本所属工作空间ID为string,剧本ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,数据类ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,剧本状态为已启用。 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 # 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 = UpdatePlaybookVersionRequest() request.body = ModifyPlaybookVersionInfo( action_strategy="sync", dataobject_delete=True, dataobject_update=True, dataobject_create=True, trigger_type="event", rule_id="4185bbd2-9d18-4362-92cb-46df0b24fe4e", status="UNPASSED", enabled=True, rule_enable=True, dataclass_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", playbook_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", workspace_id="string", description="This my XXXX" ) response = client.update_playbook_version(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 更新一个剧本版本,剧本版本所属工作空间ID为string,剧本ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,数据类ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,剧本状态为已启用。 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 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.UpdatePlaybookVersionRequest{} actionStrategyModifyPlaybookVersionInfo:= "sync" dataobjectDeleteModifyPlaybookVersionInfo:= true dataobjectUpdateModifyPlaybookVersionInfo:= true dataobjectCreateModifyPlaybookVersionInfo:= true triggerTypeModifyPlaybookVersionInfo:= "event" ruleIdModifyPlaybookVersionInfo:= "4185bbd2-9d18-4362-92cb-46df0b24fe4e" statusModifyPlaybookVersionInfo:= "UNPASSED" enabledModifyPlaybookVersionInfo:= true ruleEnableModifyPlaybookVersionInfo:= true dataclassIdModifyPlaybookVersionInfo:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" playbookIdModifyPlaybookVersionInfo:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" workspaceIdModifyPlaybookVersionInfo:= "string" descriptionModifyPlaybookVersionInfo:= "This my XXXX" request.Body = &model.ModifyPlaybookVersionInfo{ ActionStrategy: &actionStrategyModifyPlaybookVersionInfo, DataobjectDelete: &dataobjectDeleteModifyPlaybookVersionInfo, DataobjectUpdate: &dataobjectUpdateModifyPlaybookVersionInfo, DataobjectCreate: &dataobjectCreateModifyPlaybookVersionInfo, TriggerType: &triggerTypeModifyPlaybookVersionInfo, RuleId: &ruleIdModifyPlaybookVersionInfo, Status: &statusModifyPlaybookVersionInfo, Enabled: &enabledModifyPlaybookVersionInfo, RuleEnable: &ruleEnableModifyPlaybookVersionInfo, DataclassId: &dataclassIdModifyPlaybookVersionInfo, PlaybookId: &playbookIdModifyPlaybookVersionInfo, WorkspaceId: &workspaceIdModifyPlaybookVersionInfo, Description: &descriptionModifyPlaybookVersionInfo, } response, err := client.UpdatePlaybookVersion(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 请求示例 更新一个剧本版本,剧本版本所属工作空间ID为string,剧本ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,数据类ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,剧本状态为已启用。 { "description" : "This my XXXX", "workspace_id" : "string", "playbook_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "dataclass_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "rule_enable" : true, "enabled" : true, "status" : "UNPASSED", "rule_id" : "4185bbd2-9d18-4362-92cb-46df0b24fe4e", "trigger_type" : "event", "dataobject_create" : true, "dataobject_update" : true, "dataobject_delete" : true, "action_strategy" : "sync" }
  • Java 更新一个剧本版本,剧本版本所属工作空间ID为string,剧本ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,数据类ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,剧本状态为已启用。 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 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 UpdatePlaybookVersionSolution { 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(); UpdatePlaybookVersionRequest request = new UpdatePlaybookVersionRequest(); ModifyPlaybookVersionInfo body = new ModifyPlaybookVersionInfo(); body.withActionStrategy("sync"); body.withDataobjectDelete(true); body.withDataobjectUpdate(true); body.withDataobjectCreate(true); body.withTriggerType("event"); body.withRuleId("4185bbd2-9d18-4362-92cb-46df0b24fe4e"); body.withStatus("UNPASSED"); body.withEnabled(true); body.withRuleEnable(true); body.withDataclassId("909494e3-558e-46b6-a9eb-07a8e18ca62f"); body.withPlaybookId("909494e3-558e-46b6-a9eb-07a8e18ca62f"); body.withWorkspaceId("string"); body.withDescription("This my XXXX"); request.withBody(body); try { UpdatePlaybookVersionResponse response = client.updatePlaybookVersion(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()); } } }
  • 响应示例 状态码: 200 请求成功响应信息 { "code" : 0, "message" : "Error message", "data" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "description" : "This my XXXX", "create_time" : "2021-01-30T23:00:00Z+0800", "update_time" : "2021-01-30T23:00:00Z+0800", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "creator_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "modifier_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "playbook_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "version" : "v1.1.1", "enabled" : true, "status" : "editing", "action_strategy" : "sync", "actions" : [ { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "description" : "This my XXXX", "action_type" : "Workflow", "action_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "playbook_id" : "string", "playbook_version_id" : "string", "project_id" : "string" } ], "rule_enable" : true, "rules" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "rule" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "dataclass_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "trigger_type" : "event", "dataobject_create" : true, "dataobject_update" : true, "dataobject_delete" : true, "version_type" : 1, "rule_id" : "string", "dataclass_name" : "string", "approve_name" : "string" } }
  • 响应参数 状态码: 200 表4 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表5 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:1 最大长度:32 message String Error message 最小长度:1 最大长度:32 data PlaybookVersionInfo object 剧本版本详情信息 表6 PlaybookVersionInfo 参数 参数类型 描述 id String 剧本版本ID 最小长度:32 最大长度:64 description String 描述 最小长度:0 最大长度:1024 create_time String 创建时间 最小长度:0 最大长度:64 update_time String 更新时间 最小长度:0 最大长度:64 project_id String 项目ID 最小长度:32 最大长度:64 creator_id String 创建者ID 最小长度:32 最大长度:64 modifier_id String 修改者ID 最小长度:32 最大长度:64 playbook_id String 剧本ID 最小长度:32 最大长度:64 version String 版本号 最小长度:32 最大长度:64 enabled Boolean 是否启用。(true--已启用,false-未启用) status String 剧本版本状态,编辑中:EDITING 审核中:APPROVING 不通过:UNPASSED 已发布:PUBLISHED 最小长度:0 最大长度:64 action_strategy String 执行策略. 目前仅支持异步并发执行,对应值为ASYNC 最小长度:0 最大长度:64 actions Array of ActionInfo objects 剧本关联流程列表信息 数组长度:0 - 99 rule_enable Boolean 是否启用触发条件过滤器 rules RuleInfo object 剧本触发规格信息 dataclass_id String 数据类ID 最小长度:0 最大长度:64 trigger_type String 剧本触发方式(EVENT--事件触发,TIMER--定时触发) 最小长度:0 最大长度:64 dataobject_create Boolean 标识数据对象是否创建时触发剧本 dataobject_update Boolean 标识数据对象是否更新时触发剧本 dataobject_delete Boolean 标识数据对象是否删除时触发剧本 version_type Integer 版本类型(0--草稿版本,1--正式版本) 最小值:0 最大值:1 rule_id String 过滤规则ID 最小长度:0 最大长度:64 dataclass_name String 数据类名称 最小长度:0 最大长度:64 approve_name String 审核者 最小长度:0 最大长度:64 表7 ActionInfo 参数 参数类型 描述 id String 剧本流程动作ID 最小长度:32 最大长度:64 name String 流程动作名称 最小长度:0 最大长度:1024 description String 描述 最小长度:0 最大长度:1024 action_type String 流程动作类型 最小长度:0 最大长度:64 action_id String 流程ID 最小长度:32 最大长度:64 playbook_id String 剧本ID 最小长度:0 最大长度:64 playbook_version_id String 剧本版本ID 最小长度:0 最大长度:64 project_id String 项目ID 最小长度:0 最大长度:64 表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
  • 请求参数 表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参数 参数 是否必选 参数类型 描述 description 否 String 描述 最小长度:0 最大长度:1024 workspace_id 否 String 工作空间ID 最小长度:0 最大长度:2097152 playbook_id 否 String 剧本ID 最小长度:32 最大长度:64 dataclass_id 否 String 数据类ID 最小长度:32 最大长度:64 rule_enable 否 Boolean 是否启用触发条件过滤器 enabled 否 Boolean 是否激活。(false:未激活, true:已激活) status 否 String 状态(APPROVING:审核中,EDITING-编辑中,UNPASSED-审核未通过,PUBLISHED-已发布) 最小长度:0 最大长度:64 rule_id 否 String 规则ID 最小长度:0 最大长度:64 trigger_type 否 String 触发方式. EVENT--事件触发, TIMER--定时触发 最小长度:0 最大长度:64 dataobject_create 否 Boolean 数据对象是否创建时触发剧本 dataobject_update 否 Boolean 数据对象是否更新时触发剧本 dataobject_delete 否 Boolean 数据对象是否删除时触发剧本 action_strategy 否 String 执行策略. 目前仅支持异步并发执行,对应值为ASYNC 最小长度:0 最大长度:64
共100000条