882 lines
30 KiB
Python
882 lines
30 KiB
Python
# coding: utf-8
|
||
|
||
from __future__ import absolute_import
|
||
|
||
import importlib
|
||
|
||
from huaweicloudsdkcore.client import Client, ClientBuilder
|
||
from huaweicloudsdkcore.utils import http_utils
|
||
from huaweicloudsdkcore.sdk_stream_request import SdkStreamRequest
|
||
|
||
|
||
class AntiDDoSAsyncClient(Client):
|
||
def __init__(self):
|
||
super(AntiDDoSAsyncClient, self).__init__()
|
||
self.model_package = importlib.import_module("huaweicloudsdkantiddos.v1.model")
|
||
|
||
@classmethod
|
||
def new_builder(cls, clazz=None):
|
||
if not clazz:
|
||
client_builder = ClientBuilder(cls)
|
||
else:
|
||
if clazz.__name__ != "AntiDDoSAsyncClient":
|
||
raise TypeError("client type error, support client type is AntiDDoSAsyncClient")
|
||
client_builder = ClientBuilder(clazz)
|
||
|
||
|
||
|
||
return client_builder
|
||
|
||
def create_default_config_async(self, request):
|
||
"""配置Anti-DDoS默认防护策略
|
||
|
||
配置用户的默认防护策略。配置防护策略后,新购买的资源在自动开启防护时,会按照该默认防护策略进行配置。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for CreateDefaultConfig
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.CreateDefaultConfigRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.CreateDefaultConfigResponse`
|
||
"""
|
||
return self._create_default_config_with_http_info(request)
|
||
|
||
def _create_default_config_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if 'body' in local_var_params:
|
||
body_params = local_var_params['body']
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos/default-config',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='CreateDefaultConfigResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def delete_default_config_async(self, request):
|
||
"""删除Ani-DDoS默认防护策略
|
||
|
||
删除用户配置的默认防护策略。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for DeleteDefaultConfig
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.DeleteDefaultConfigRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.DeleteDefaultConfigResponse`
|
||
"""
|
||
return self._delete_default_config_with_http_info(request)
|
||
|
||
def _delete_default_config_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos/default-config',
|
||
method='DELETE',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='DeleteDefaultConfigResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def show_alert_config_async(self, request):
|
||
"""查询告警配置信息
|
||
|
||
查询用户配置信息,用户可以通过此接口查询是否接收某类告警,同时可以配置是手机短信还是电子邮件接收告警信息。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ShowAlertConfig
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ShowAlertConfigRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ShowAlertConfigResponse`
|
||
"""
|
||
return self._show_alert_config_with_http_info(request)
|
||
|
||
def _show_alert_config_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/warnalert/alertconfig/query',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ShowAlertConfigResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def show_default_config_async(self, request):
|
||
"""查询Ani-DDoS默认防护策略
|
||
|
||
查询用户配置的默认防护策略。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ShowDefaultConfig
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ShowDefaultConfigRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ShowDefaultConfigResponse`
|
||
"""
|
||
return self._show_default_config_with_http_info(request)
|
||
|
||
def _show_default_config_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos/default-config',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ShowDefaultConfigResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def update_alert_config_async(self, request):
|
||
"""更新告警配置信息
|
||
|
||
更新用户配置信息,用户可以通过此接口更新是否接收某类告警,同时可以配置是手机短信还是电子邮件接收告警信息。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for UpdateAlertConfig
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.UpdateAlertConfigRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.UpdateAlertConfigResponse`
|
||
"""
|
||
return self._update_alert_config_with_http_info(request)
|
||
|
||
def _update_alert_config_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if 'body' in local_var_params:
|
||
body_params = local_var_params['body']
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/warnalert/alertconfig/update',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='UpdateAlertConfigResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_d_dos_status_async(self, request):
|
||
"""查询EIP防护状态列表
|
||
|
||
查询用户所有EIP的Anti-DDoS防护状态信息,用户的EIP无论是否绑定到云服务器,都可以进行查询。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ListDDosStatus
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ListDDosStatusRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ListDDosStatusResponse`
|
||
"""
|
||
return self._list_d_dos_status_with_http_info(request)
|
||
|
||
def _list_d_dos_status_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
|
||
query_params = []
|
||
if 'status' in local_var_params:
|
||
query_params.append(('status', local_var_params['status']))
|
||
if 'limit' in local_var_params:
|
||
query_params.append(('limit', local_var_params['limit']))
|
||
if 'offset' in local_var_params:
|
||
query_params.append(('offset', local_var_params['offset']))
|
||
if 'ip' in local_var_params:
|
||
query_params.append(('ip', local_var_params['ip']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ListDDosStatusResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_daily_log_async(self, request):
|
||
"""查询指定EIP异常事件
|
||
|
||
查询指定EIP在过去24小时之内的异常事件信息,异常事件包括清洗事件和黑洞事件,查询延迟在5分钟之内。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ListDailyLog
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ListDailyLogRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ListDailyLogResponse`
|
||
"""
|
||
return self._list_daily_log_with_http_info(request)
|
||
|
||
def _list_daily_log_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
if 'floating_ip_id' in local_var_params:
|
||
path_params['floating_ip_id'] = local_var_params['floating_ip_id']
|
||
|
||
query_params = []
|
||
if 'sort_dir' in local_var_params:
|
||
query_params.append(('sort_dir', local_var_params['sort_dir']))
|
||
if 'limit' in local_var_params:
|
||
query_params.append(('limit', local_var_params['limit']))
|
||
if 'offset' in local_var_params:
|
||
query_params.append(('offset', local_var_params['offset']))
|
||
if 'ip' in local_var_params:
|
||
query_params.append(('ip', local_var_params['ip']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos/{floating_ip_id}/logs',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ListDailyLogResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_daily_report_async(self, request):
|
||
"""查询指定EIP防护流量
|
||
|
||
查询指定EIP在过去24小时之内的防护流量信息,流量的间隔时间单位为5分钟。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ListDailyReport
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ListDailyReportRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ListDailyReportResponse`
|
||
"""
|
||
return self._list_daily_report_with_http_info(request)
|
||
|
||
def _list_daily_report_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
if 'floating_ip_id' in local_var_params:
|
||
path_params['floating_ip_id'] = local_var_params['floating_ip_id']
|
||
|
||
query_params = []
|
||
if 'ip' in local_var_params:
|
||
query_params.append(('ip', local_var_params['ip']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos/{floating_ip_id}/daily',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ListDailyReportResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_new_configs_async(self, request):
|
||
"""查询Anti-DDoS配置可选范围
|
||
|
||
查询系统支持的Anti-DDoS防护策略配置的可选范围,用户根据范围列表选择适合自已业务的防护策略进行Anti-DDoS流量清洗。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ListNewConfigs
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ListNewConfigsRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ListNewConfigsResponse`
|
||
"""
|
||
return self._list_new_configs_with_http_info(request)
|
||
|
||
def _list_new_configs_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/antiddos/query-config-list',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ListNewConfigsResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_weekly_reports_async(self, request):
|
||
"""查询周防护统计情况
|
||
|
||
查询用户所有Anti-DDoS防护周统计情况,包括一周内DDoS拦截次数和攻击次数、以及按照被攻击次数进行的排名信息等统计数据。系统支持当前时间之前四周的周统计数据查询,超过这个时间的请求是查询不到统计数据的。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ListWeeklyReports
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ListWeeklyReportsRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ListWeeklyReportsResponse`
|
||
"""
|
||
return self._list_weekly_reports_with_http_info(request)
|
||
|
||
def _list_weekly_reports_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
|
||
query_params = []
|
||
if 'period_start_date' in local_var_params:
|
||
query_params.append(('period_start_date', local_var_params['period_start_date']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos/weekly',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ListWeeklyReportsResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def show_d_dos_async(self, request):
|
||
"""查询Anti-DDoS服务
|
||
|
||
查询配置的Anti-DDoS防护策略,用户可以查询指定EIP的Anti-DDoS防护策略。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ShowDDos
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ShowDDosRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ShowDDosResponse`
|
||
"""
|
||
return self._show_d_dos_with_http_info(request)
|
||
|
||
def _show_d_dos_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
if 'floating_ip_id' in local_var_params:
|
||
path_params['floating_ip_id'] = local_var_params['floating_ip_id']
|
||
|
||
query_params = []
|
||
if 'ip' in local_var_params:
|
||
query_params.append(('ip', local_var_params['ip']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos/{floating_ip_id}',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ShowDDosResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def show_d_dos_status_async(self, request):
|
||
"""查询指定EIP防护状态
|
||
|
||
查询指定EIP的Anti-DDoS防护状态。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ShowDDosStatus
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ShowDDosStatusRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ShowDDosStatusResponse`
|
||
"""
|
||
return self._show_d_dos_status_with_http_info(request)
|
||
|
||
def _show_d_dos_status_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
if 'floating_ip_id' in local_var_params:
|
||
path_params['floating_ip_id'] = local_var_params['floating_ip_id']
|
||
|
||
query_params = []
|
||
if 'ip' in local_var_params:
|
||
query_params.append(('ip', local_var_params['ip']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos/{floating_ip_id}/status',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ShowDDosStatusResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def show_new_task_status_async(self, request):
|
||
"""查询Anti-DDoS任务
|
||
|
||
用户查询指定的Anti-DDoS防护配置任务,得到任务当前执行的状态。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for ShowNewTaskStatus
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.ShowNewTaskStatusRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.ShowNewTaskStatusResponse`
|
||
"""
|
||
return self._show_new_task_status_with_http_info(request)
|
||
|
||
def _show_new_task_status_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
|
||
query_params = []
|
||
if 'task_id' in local_var_params:
|
||
query_params.append(('task_id', local_var_params['task_id']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/query-task-status',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='ShowNewTaskStatusResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def update_d_dos_async(self, request):
|
||
"""更新Anti-DDoS服务
|
||
|
||
更新指定EIP的Anti-DDoS防护策略配置。调用成功,只是说明服务节点收到了关闭更新配置请求,操作是否成功需要通过任务查询接口查询该任务的执行状态,具体请参考查询Anti-DDoS任务。
|
||
|
||
Please refer to HUAWEI cloud API Explorer for details.
|
||
|
||
|
||
:param request: Request instance for UpdateDDos
|
||
:type request: :class:`huaweicloudsdkantiddos.v1.UpdateDDosRequest`
|
||
:rtype: :class:`huaweicloudsdkantiddos.v1.UpdateDDosResponse`
|
||
"""
|
||
return self._update_d_dos_with_http_info(request)
|
||
|
||
def _update_d_dos_with_http_info(self, request):
|
||
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
|
||
|
||
cname = None
|
||
|
||
collection_formats = {}
|
||
|
||
path_params = {}
|
||
if 'floating_ip_id' in local_var_params:
|
||
path_params['floating_ip_id'] = local_var_params['floating_ip_id']
|
||
|
||
query_params = []
|
||
if 'ip' in local_var_params:
|
||
query_params.append(('ip', local_var_params['ip']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if 'body' in local_var_params:
|
||
body_params = local_var_params['body']
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
response_headers = []
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v1/{project_id}/antiddos/{floating_ip_id}',
|
||
method='PUT',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
cname=cname,
|
||
response_type='UpdateDDosResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None,
|
||
post_params=None, cname=None, response_type=None, response_headers=None, auth_settings=None,
|
||
collection_formats=None, request_type=None):
|
||
"""Makes the HTTP request and returns deserialized data.
|
||
|
||
:param resource_path: Path to method endpoint.
|
||
:param method: Method to call.
|
||
:param path_params: Path parameters in the url.
|
||
:param query_params: Query parameters in the url.
|
||
:param header_params: Header parameters to be
|
||
placed in the request header.
|
||
:param body: Request body.
|
||
:param post_params: Request post form parameters,
|
||
for `application/x-www-form-urlencoded`, `multipart/form-data`.
|
||
:param cname: Used for obs endpoint.
|
||
:param auth_settings: Auth Settings names for the request.
|
||
:param response_type: Response data type.
|
||
:param response_headers: Header should be added to response data.
|
||
:param collection_formats: dict of collection formats for path, query,
|
||
header, and post parameters.
|
||
:param request_type: Request data type.
|
||
:return:
|
||
Return the response directly.
|
||
"""
|
||
return self.do_http_request(
|
||
method=method,
|
||
resource_path=resource_path,
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body,
|
||
post_params=post_params,
|
||
cname=cname,
|
||
response_type=response_type,
|
||
response_headers=response_headers,
|
||
collection_formats=collection_formats,
|
||
request_type=request_type,
|
||
async_request=True)
|