华为云用户手册

  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type 缺省值:application/json;charset=utf8 最小长度:1 最大长度:255 表3 请求Body参数 参数 是否必选 参数类型 描述 package_id 是 String 防护包id 最小长度:32 最大长度:64 id_list 是 Array of strings 防护ip的id列表 最小长度:7 最大长度:128 数组长度:0 - 2147483647
  • 请求示例 将ID为“634f346e-a291-4124-a6be-ac57e6152463”的防护包下指定防护策略中绑定的ID为“634f346e-a291-4124-a6be-ac57e6152464”的防护IP解除绑定。 POST https://{endpoint}/v1/cnad/policies/{policy_id}/unbind { "package_id" : "634f346e-a291-4124-a6be-ac57e6152463", "id_list" : [ "634f346e-a291-4124-a6be-ac57e6152464" ] }
  • 响应 要素说明 参数 是否必选 类型 说明 traffic_limited_list 是 列表数据结构 流量限制列表 http_limited_list 是 列表数据结构 HTTP限制列表 connection_limited_list 是 列表数据结构 连接数限制列表 traffic_limited_list字段数据结构说明 参数 是否必选 类型 说明 traffic_pos_id 是 Integer 流量分段ID traffic_per_second 是 Integer 每秒流量(Mbit/s)阈值 packet_per_second 是 Integer 每秒报文数(个/s)阈值 http_limited_list字段数据结构说明 参数 是否必选 类型 说明 http_request_pos_id 是 Integer HTTP请求数分段ID http_packet_per_second 是 Integer 每秒HTTP请求数(个/s)阈值 connection_limited_list字段数据结构说明 参数 是否必选 类型 说明 cleaning_access_pos_id 是 Integer 清洗时访问限制分段ID new_connection_limited 是 Integer 单一源IP新建连接个数 total_connection_limited 是 Integer 单一源IP连接数总个数 响应样例
  • URI GET /v1/{project_id}/antiddos/{floating_ip_id}/status 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目id 最小长度:32 最大长度:64 floating_ip_id 是 String 用户EIP对应的ID 最小长度:32 最大长度:64 表2 Query参数 参数 是否必选 参数类型 描述 ip 否 String 用户EIP 最小长度:7 最大长度:128
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type请求头 缺省值:application/json;charset=utf8 最小长度:1 最大长度:255
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type 缺省值:application/json;charset=utf8 最小长度:1 最大长度:128
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type 缺省值:application/json;charset=utf8 最小长度:1 最大长度:128 表3 请求Body参数 参数 是否必选 参数类型 描述 instance_id 是 String 实例id type 是 String 规则类型。black - 黑名单, white - 白名单 ips 是 Array of strings ip列表
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 total_unblocking_times Integer 总解封次数 最小值:0 最大值:2097152 manual_unblocking_times Integer 人工解封次数 最小值:0 最大值:2097152 automatic_unblocking_times Integer 自动解封次数 最小值:0 最大值:2097152 current_blocked_ip_numbers Integer 当前封堵Ip数 最小值:0 最大值:2097152
  • 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 huaweicloudsdkantiddos.v1.region.antiddos_region import AntiDDoSRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkantiddos.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = AntiDDoSClient.new_builder() \ .with_credentials(credentials) \ .with_region(AntiDDoSRegion.value_of("cn-north-4")) \ .build() try: request = DeleteDefaultConfigRequest() response = client.delete_default_config(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 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" antiddos "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/antiddos/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/antiddos/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/antiddos/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := antiddos.NewAntiDDoSClient( antiddos.AntiDDoSClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.DeleteDefaultConfigRequest{} response, err := client.DeleteDefaultConfig(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 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.antiddos.v1.region.AntiDDoSRegion; import com.huaweicloud.sdk.antiddos.v1.*; import com.huaweicloud.sdk.antiddos.v1.model.*; public class DeleteDefaultConfigSolution { 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); AntiDDoSClient client = AntiDDoSClient.newBuilder() .withCredential(auth) .withRegion(AntiDDoSRegion.valueOf("cn-north-4")) .build(); DeleteDefaultConfigRequest request = new DeleteDefaultConfigRequest(); try { DeleteDefaultConfigResponse response = client.deleteDefaultConfig(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的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type请求头 缺省值:application/json;charset=utf8 最小长度:1 最大长度:255
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type 缺省值:application/json;charset=utf8 最小长度:1 最大长度:255 表3 请求Body参数 参数 是否必选 参数类型 描述 package_id 是 String 防护包id 最小长度:32 最大长度:64 id_list 是 Array of strings 防护ip的id列表 最小长度:7 最大长度:128 数组长度:0 - 2147483647
  • 请求示例 为ID为634f346e-a291-4124-a6be-ac57e6152463的防护包下指定防护策略绑定防护ID为“634f346e-a291-4124-a6be-ac57e6152464”的IP。 POST https://{endpoint}/v1/cnad/policies/{policy_id}/bind { "package_id" : "634f346e-a291-4124-a6be-ac57e6152463", "id_list" : [ "634f346e-a291-4124-a6be-ac57e6152464" ] }
  • 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 huaweicloudsdkantiddos.v1.region.antiddos_region import AntiDDoSRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkantiddos.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = AntiDDoSClient.new_builder() \ .with_credentials(credentials) \ .with_region(AntiDDoSRegion.value_of("cn-north-4")) \ .build() try: request = ShowDefaultConfigRequest() response = client.show_default_config(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 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" antiddos "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/antiddos/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/antiddos/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/antiddos/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := antiddos.NewAntiDDoSClient( antiddos.AntiDDoSClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.ShowDefaultConfigRequest{} response, err := client.ShowDefaultConfig(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type请求头 缺省值:application/json;charset=utf8 最小长度:1 最大长度:255
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 enable_L7 Boolean 是否开启L7层防护,固定值为fasle traffic_pos_id Long 流量分段ID,取值范围:1~9、88、99 最小值:1 最大值:99 http_request_pos_id Long HTTP请求数分段ID,取值范围:1~15 最小值:1 最大值:15 cleaning_access_pos_id Long 清洗时访问限制分段ID,取值范围:1~8、88、99 最小值:1 最大值:99 app_type_id Integer 应用类型ID,可选取值: 0 1
  • 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.antiddos.v1.region.AntiDDoSRegion; import com.huaweicloud.sdk.antiddos.v1.*; import com.huaweicloud.sdk.antiddos.v1.model.*; public class ShowDefaultConfigSolution { 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); AntiDDoSClient client = AntiDDoSClient.newBuilder() .withCredential(auth) .withRegion(AntiDDoSRegion.valueOf("cn-north-4")) .build(); ShowDefaultConfigRequest request = new ShowDefaultConfigRequest(); try { ShowDefaultConfigResponse response = client.showDefaultConfig(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的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type 缺省值:application/json;charset=utf8 最小长度:1 最大长度:128 表3 请求Body参数 参数 是否必选 参数类型 描述 op_type 是 Integer 操作类型。0 - 上传, 1 - 更换 cert_name 是 String 证书名称 cert_file 否 String 证书文件。上传新证书(op_type为0)时必填,更换为已有证书(op_type为1)时置空 cert_key_file 否 String 私钥文件。上传新证书(op_type为0)时必填,更换为已有证书(op_type为1)时置空 domain_id 是 String 域名id
  • 操作步骤 查询默认防护策略。 接口相关信息 URI格式:GET /v1/{project_id}/antiddos/default-config 详情请参见“查询Anti-DDoS默认防护策略”。 请求示例 GET: https://{endpoint}/v1/1858a4e1f99d4454bd6a539d5477f5de/antiddos/default/config {endpoint}信息请从地区和终端节点获取。 Body: { } 响应示例 { "app_type_id": 1, "cleaning_access_pos_id": 8, "enable_L7": false, "http_request_pos_id": 8, "traffic_pos_id": 8 } 配置默认防护策略。 接口相关信息 URI格式:POST /v1/{project_id}/antiddos/default-config 详情请参见“配置Anti-DDoS默认防护策略”。 请求示例 POST: https://{endpoint}/v1/1858a4e1f99d4454bd6a539d5477f5de/antiddos/default-config {endpoint}信息请从地区和终端节点获取。 Body: { "app_type_id": 1, "cleaning_access_pos_id": 8, "enable_L7": false, "http_request_pos_id": 8, "traffic_pos_id": 8 } 响应示例 { }
  • 请求示例 将指定防护包的全量防护对象更改为EIP“1.1.1.1”(ID标识为“0c613ff9-2b63-4aa2-9333-e03541fe0d9a”)。 POST https://{endpoint}/v1/cnad/packages/{package_id}/protected-ips { "protected_ip_list" : [ { "ip" : "1.1.1.1", "id" : "0c613ff9-2b63-4aa2-9333-e03541fe0d9a", "type" : "EIP" } ] }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type 缺省值:application/json;charset=utf8 最小长度:1 最大长度:255 表3 请求Body参数 参数 是否必选 参数类型 描述 protected_ip_list 是 Array of UpdateProtectedIpInPolicyBody objects 全量防护ip列表 数组长度:0 - 2147483647 表4 UpdateProtectedIpInPolicyBody 参数 是否必选 参数类型 描述 id 是 String 防护ip的id 最小长度:32 最大长度:64 ip 是 String 防护ip 最小长度:7 最大长度:128 type 是 String 类型。VPN:VPN;NAT:NAT;VIP:VIP;CCI:CCI;EIP:弹性公网IP;ELB:弹性负载均衡;REROUTING_IP:REROUTING_IP;SubEni:SubEni;NetInterFace:NetInterFace; name 否 String 名字 最小长度:1 最大长度:255
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type 缺省值:application/json;charset=utf8 最小长度:1 最大长度:255 表3 请求Body参数 参数 是否必选 参数类型 描述 name 否 String 策略名 最小长度:1 最大长度:255 threshold 否 Integer 清洗阈值 最小值:100 最大值:1000 description 否 String 描述 最小长度:0 最大长度:255 udp 否 String udp协议封禁。block:封禁,unblock:不封禁
  • Python 设置消息通知的主题为“urn:smn:cn-north-7:2d2d90a56a3243bdb909f6a24a27be8d:cnad-test-intl”,并配置需要告警通知的攻击类型为DDoS攻击 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 huaweicloudsdkantiddos.v1.region.antiddos_region import AntiDDoSRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkantiddos.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = AntiDDoSClient.new_builder() \ .with_credentials(credentials) \ .with_region(AntiDDoSRegion.value_of("cn-north-4")) \ .build() try: request = UpdateAlertConfigRequest() warnConfigbody = UpdateAlertConfigRequestBodyWarnConfig( anti_d_do_s=True, back_doors=False, bruce_force=False, high_privilege=False, remote_login=False, send_frequency=1, waf=False, weak_password=False ) request.body = UpdateAlertConfigRequestBody( warn_config=warnConfigbody, topic_urn="urn:smn:cn-north-7:2d2d90a56a3243bdb909f6a24a27be8d:cnad-test-intl", display_name="" ) response = client.update_alert_config(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 设置消息通知的主题为“urn:smn:cn-north-7:2d2d90a56a3243bdb909f6a24a27be8d:cnad-test-intl”,并配置需要告警通知的攻击类型为DDoS攻击 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" antiddos "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/antiddos/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/antiddos/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/antiddos/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := antiddos.NewAntiDDoSClient( antiddos.AntiDDoSClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.UpdateAlertConfigRequest{} backDoorsWarnConfig:= false bruceForceWarnConfig:= false highPrivilegeWarnConfig:= false remoteLoginWarnConfig:= false sendFrequencyWarnConfig:= int32(1) wafWarnConfig:= false weakPasswordWarnConfig:= false warnConfigbody := &model.UpdateAlertConfigRequestBodyWarnConfig{ AntiDDoS: true, BackDoors: &backDoorsWarnConfig, BruceForce: &bruceForceWarnConfig, HighPrivilege: &highPrivilegeWarnConfig, RemoteLogin: &remoteLoginWarnConfig, SendFrequency: &sendFrequencyWarnConfig, Waf: &wafWarnConfig, WeakPassword: &weakPasswordWarnConfig, } request.Body = &model.UpdateAlertConfigRequestBody{ WarnConfig: warnConfigbody, TopicUrn: "urn:smn:cn-north-7:2d2d90a56a3243bdb909f6a24a27be8d:cnad-test-intl", DisplayName: "", } response, err := client.UpdateAlertConfig(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 请求示例 设置消息通知的主题为“urn:smn:cn-north-7:2d2d90a56a3243bdb909f6a24a27be8d:cnad-test-intl”,并配置需要告警通知的攻击类型为DDoS攻击 POST https://{endpoint}/v2/{project_id}/warnalert/alertconfig/update { "display_name" : "", "topic_urn" : "urn:smn:cn-north-7:2d2d90a56a3243bdb909f6a24a27be8d:cnad-test-intl", "warn_config" : { "antiDDoS" : true, "back_doors" : false, "bruce_force" : false, "high_privilege" : false, "remote_login" : false, "send_frequency" : 1, "waf" : false, "weak_password" : false } }
  • Java 设置消息通知的主题为“urn:smn:cn-north-7:2d2d90a56a3243bdb909f6a24a27be8d:cnad-test-intl”,并配置需要告警通知的攻击类型为DDoS攻击 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 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.antiddos.v1.region.AntiDDoSRegion; import com.huaweicloud.sdk.antiddos.v1.*; import com.huaweicloud.sdk.antiddos.v1.model.*; public class UpdateAlertConfigSolution { 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); AntiDDoSClient client = AntiDDoSClient.newBuilder() .withCredential(auth) .withRegion(AntiDDoSRegion.valueOf("cn-north-4")) .build(); UpdateAlertConfigRequest request = new UpdateAlertConfigRequest(); UpdateAlertConfigRequestBody body = new UpdateAlertConfigRequestBody(); UpdateAlertConfigRequestBodyWarnConfig warnConfigbody = new UpdateAlertConfigRequestBodyWarnConfig(); warnConfigbody.withAntiDDoS(true) .withBackDoors(false) .withBruceForce(false) .withHighPrivilege(false) .withRemoteLogin(false) .withSendFrequency(1) .withWaf(false) .withWeakPassword(false); body.withWarnConfig(warnConfigbody); body.withTopicUrn("urn:smn:cn-north-7:2d2d90a56a3243bdb909f6a24a27be8d:cnad-test-intl"); body.withDisplayName(""); request.withBody(body); try { UpdateAlertConfigResponse response = client.updateAlertConfig(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的值)。 最小长度:32 最大长度:2097152 Content-Type 是 String Content-Type请求头 缺省值:application/json;charset=utf8 最小长度:1 最大长度:255 表3 请求Body参数 参数 是否必选 参数类型 描述 display_name 是 String 告警群组描述。 最小长度:1 最大长度:255 topic_urn 是 String 告警群组的唯一标识。 最小长度:1 最大长度:255 warn_config 是 WarnConfig object 告警配置信息。 表4 WarnConfig 参数 是否必选 参数类型 描述 antiDDoS 是 Boolean DDoS攻击 back_doors 否 Boolean 网页后门 bruce_force 否 Boolean 暴力破解(系统登录,FTP,DB) high_privilege 否 Boolean 数据库进程权限过高 remote_login 否 Boolean 异地登录提醒 send_frequency 否 Integer 取值范围: 0:表示每天一次 1:表示半小时一次 对于HID必选。 waf 否 Boolean 保留字段 weak_password 否 Boolean 弱口令(系统,数据库)
  • 服务集成 服务集成中创建并开放的API,支持如下请求协议:RESTful、SOAP、WebSocket。 服务集成的自定义后端支持的数据源相关信息如表2所示。 表2 自定义后端支持的数据源 数据源类型 支持的版本 DWS 1.3.4 Gauss100 FusionInsight_LibrA_V100R003C20、FusionInsight_LibrA_V300R001C00 HANA 1.0 HIVE 2.3.2 MongoDB 3.4 MySQL 5.7,8.0 MRS HBase MRS 3.*.* MRS Hive MRS 3.*.* Oracle 11.2g(不推荐)、12.1g(不推荐)、12.2g、19c PostgreSQL 11.0 Redis 3.0.7、4.0.11 SQL Server 2014、2019、2022
共100000条