906 lines
27 KiB
Python
906 lines
27 KiB
Python
# coding: utf-8
|
|
|
|
from __future__ import absolute_import
|
|
|
|
import datetime
|
|
import re
|
|
import importlib
|
|
|
|
import six
|
|
|
|
from huaweicloudsdkcore.client import Client, ClientBuilder
|
|
from huaweicloudsdkcore.exceptions import exceptions
|
|
from huaweicloudsdkcore.utils import http_utils
|
|
from huaweicloudsdkcore.sdk_stream_request import SdkStreamRequest
|
|
|
|
|
|
class DwsClient(Client):
|
|
"""
|
|
:param configuration: .Configuration object for this client
|
|
:param pool_threads: The number of threads to use for async requests
|
|
to the API. More threads means more concurrent API requests.
|
|
"""
|
|
|
|
PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
|
|
NATIVE_TYPES_MAPPING = {
|
|
'int': int,
|
|
'long': int if six.PY3 else long,
|
|
'float': float,
|
|
'str': str,
|
|
'bool': bool,
|
|
'date': datetime.date,
|
|
'datetime': datetime.datetime,
|
|
'object': object,
|
|
}
|
|
|
|
def __init__(self):
|
|
super(DwsClient, self).__init__()
|
|
self.model_package = importlib.import_module("huaweicloudsdkdws.v2.model")
|
|
self.preset_headers = {'User-Agent': 'HuaweiCloud-SDK-Python'}
|
|
|
|
@classmethod
|
|
def new_builder(cls, clazz=None):
|
|
if clazz is None:
|
|
return ClientBuilder(cls)
|
|
|
|
if clazz.__name__ != "DwsClient":
|
|
raise TypeError("client type error, support client type is DwsClient")
|
|
|
|
return ClientBuilder(clazz)
|
|
|
|
def create_cluster(self, request):
|
|
"""创建集群
|
|
|
|
该接口用于创建集群
|
|
|
|
:param CreateClusterRequest request
|
|
:return: CreateClusterResponse
|
|
"""
|
|
return self.create_cluster_with_http_info(request)
|
|
|
|
def create_cluster_with_http_info(self, request):
|
|
"""创建集群
|
|
|
|
该接口用于创建集群
|
|
|
|
:param CreateClusterRequest request
|
|
:return: CreateClusterResponse
|
|
"""
|
|
|
|
all_params = ['create_cluster_request_body']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
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;charset=UTF-8'])
|
|
|
|
auth_settings = []
|
|
|
|
return self.call_api(
|
|
resource_path='/v1.0/{project_id}/clusters',
|
|
method='POST',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='CreateClusterResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def create_snapshot(self, request):
|
|
"""创建快照
|
|
|
|
该接口用于为指定集群创建快照。
|
|
|
|
:param CreateSnapshotRequest request
|
|
:return: CreateSnapshotResponse
|
|
"""
|
|
return self.create_snapshot_with_http_info(request)
|
|
|
|
def create_snapshot_with_http_info(self, request):
|
|
"""创建快照
|
|
|
|
该接口用于为指定集群创建快照。
|
|
|
|
:param CreateSnapshotRequest request
|
|
:return: CreateSnapshotResponse
|
|
"""
|
|
|
|
all_params = ['create_snapshot_request_body']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
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;charset=UTF-8'])
|
|
|
|
auth_settings = []
|
|
|
|
return self.call_api(
|
|
resource_path='/v1.0/{project_id}/snapshots',
|
|
method='POST',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='CreateSnapshotResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def delete_cluster(self, request):
|
|
"""删除集群
|
|
|
|
此接口用于删除集群。集群删除后将释放此集群的所有资源,包括客户数据。为了安全起见,请在删除集群前为这个集群创建快照。
|
|
|
|
:param DeleteClusterRequest request
|
|
:return: DeleteClusterResponse
|
|
"""
|
|
return self.delete_cluster_with_http_info(request)
|
|
|
|
def delete_cluster_with_http_info(self, request):
|
|
"""删除集群
|
|
|
|
此接口用于删除集群。集群删除后将释放此集群的所有资源,包括客户数据。为了安全起见,请在删除集群前为这个集群创建快照。
|
|
|
|
:param DeleteClusterRequest request
|
|
:return: DeleteClusterResponse
|
|
"""
|
|
|
|
all_params = ['cluster_id', 'delete_cluster_request_body']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'cluster_id' in local_var_params:
|
|
path_params['cluster_id'] = local_var_params['cluster_id']
|
|
|
|
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;charset=UTF-8'])
|
|
|
|
auth_settings = []
|
|
|
|
return self.call_api(
|
|
resource_path='/v1.0/{project_id}/clusters/{cluster_id}',
|
|
method='DELETE',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='DeleteClusterResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def delete_snapshot(self, request):
|
|
"""删除快照
|
|
|
|
该接口用于删除一个指定快照。
|
|
|
|
:param DeleteSnapshotRequest request
|
|
:return: DeleteSnapshotResponse
|
|
"""
|
|
return self.delete_snapshot_with_http_info(request)
|
|
|
|
def delete_snapshot_with_http_info(self, request):
|
|
"""删除快照
|
|
|
|
该接口用于删除一个指定快照。
|
|
|
|
:param DeleteSnapshotRequest request
|
|
:return: DeleteSnapshotResponse
|
|
"""
|
|
|
|
all_params = ['snapshot_id']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'snapshot_id' in local_var_params:
|
|
path_params['snapshot_id'] = local_var_params['snapshot_id']
|
|
|
|
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.0/{project_id}/snapshots/{snapshot_id}',
|
|
method='DELETE',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='DeleteSnapshotResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def list_cluster_details(self, request):
|
|
"""查询集群详情
|
|
|
|
该接口用于查询集群详情
|
|
|
|
:param ListClusterDetailsRequest request
|
|
:return: ListClusterDetailsResponse
|
|
"""
|
|
return self.list_cluster_details_with_http_info(request)
|
|
|
|
def list_cluster_details_with_http_info(self, request):
|
|
"""查询集群详情
|
|
|
|
该接口用于查询集群详情
|
|
|
|
:param ListClusterDetailsRequest request
|
|
:return: ListClusterDetailsResponse
|
|
"""
|
|
|
|
all_params = ['cluster_id']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'cluster_id' in local_var_params:
|
|
path_params['cluster_id'] = local_var_params['cluster_id']
|
|
|
|
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.0/{project_id}/clusters/{cluster_id}',
|
|
method='GET',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='ListClusterDetailsResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def list_clusters(self, request):
|
|
"""查询集群列表
|
|
|
|
该接口用于查询并显示集群列表
|
|
|
|
:param ListClustersRequest request
|
|
:return: ListClustersResponse
|
|
"""
|
|
return self.list_clusters_with_http_info(request)
|
|
|
|
def list_clusters_with_http_info(self, request):
|
|
"""查询集群列表
|
|
|
|
该接口用于查询并显示集群列表
|
|
|
|
:param ListClustersRequest request
|
|
:return: ListClustersResponse
|
|
"""
|
|
|
|
all_params = []
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
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.0/{project_id}/clusters',
|
|
method='GET',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='ListClustersResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def list_node_types(self, request):
|
|
"""查询节点类型
|
|
|
|
该接口用于查询所有DWS服务支持的节点类型。
|
|
|
|
:param ListNodeTypesRequest request
|
|
:return: ListNodeTypesResponse
|
|
"""
|
|
return self.list_node_types_with_http_info(request)
|
|
|
|
def list_node_types_with_http_info(self, request):
|
|
"""查询节点类型
|
|
|
|
该接口用于查询所有DWS服务支持的节点类型。
|
|
|
|
:param ListNodeTypesRequest request
|
|
:return: ListNodeTypesResponse
|
|
"""
|
|
|
|
all_params = []
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
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}/node-types',
|
|
method='GET',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='ListNodeTypesResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def list_snapshot_details(self, request):
|
|
"""查询快照详情
|
|
|
|
该接口用于使用快照ID查询快照详情。
|
|
|
|
:param ListSnapshotDetailsRequest request
|
|
:return: ListSnapshotDetailsResponse
|
|
"""
|
|
return self.list_snapshot_details_with_http_info(request)
|
|
|
|
def list_snapshot_details_with_http_info(self, request):
|
|
"""查询快照详情
|
|
|
|
该接口用于使用快照ID查询快照详情。
|
|
|
|
:param ListSnapshotDetailsRequest request
|
|
:return: ListSnapshotDetailsResponse
|
|
"""
|
|
|
|
all_params = ['snapshot_id']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'snapshot_id' in local_var_params:
|
|
path_params['snapshot_id'] = local_var_params['snapshot_id']
|
|
|
|
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.0/{project_id}/snapshots/{snapshot_id}',
|
|
method='GET',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='ListSnapshotDetailsResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def list_snapshots(self, request):
|
|
"""查询快照列表
|
|
|
|
该接口用于查询快照列表。
|
|
|
|
:param ListSnapshotsRequest request
|
|
:return: ListSnapshotsResponse
|
|
"""
|
|
return self.list_snapshots_with_http_info(request)
|
|
|
|
def list_snapshots_with_http_info(self, request):
|
|
"""查询快照列表
|
|
|
|
该接口用于查询快照列表。
|
|
|
|
:param ListSnapshotsRequest request
|
|
:return: ListSnapshotsResponse
|
|
"""
|
|
|
|
all_params = []
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
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.0/{project_id}/snapshots',
|
|
method='GET',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='ListSnapshotsResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def reset_password(self, request):
|
|
"""重置密码
|
|
|
|
|
|
:param ResetPasswordRequest request
|
|
:return: ResetPasswordResponse
|
|
"""
|
|
return self.reset_password_with_http_info(request)
|
|
|
|
def reset_password_with_http_info(self, request):
|
|
"""重置密码
|
|
|
|
|
|
:param ResetPasswordRequest request
|
|
:return: ResetPasswordResponse
|
|
"""
|
|
|
|
all_params = ['cluster_id', 'reset_password_request_body']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'cluster_id' in local_var_params:
|
|
path_params['cluster_id'] = local_var_params['cluster_id']
|
|
|
|
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;charset=UTF-8'])
|
|
|
|
auth_settings = []
|
|
|
|
return self.call_api(
|
|
resource_path='/v1.0/{project_id}/clusters/{cluster_id}/reset-password',
|
|
method='POST',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='ResetPasswordResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def resize_cluster(self, request):
|
|
"""扩容集群调整集群大小
|
|
|
|
此接口用于扩容集群调整集群大小。
|
|
|
|
:param ResizeClusterRequest request
|
|
:return: ResizeClusterResponse
|
|
"""
|
|
return self.resize_cluster_with_http_info(request)
|
|
|
|
def resize_cluster_with_http_info(self, request):
|
|
"""扩容集群调整集群大小
|
|
|
|
此接口用于扩容集群调整集群大小。
|
|
|
|
:param ResizeClusterRequest request
|
|
:return: ResizeClusterResponse
|
|
"""
|
|
|
|
all_params = ['cluster_id', 'resize_cluster_request_body']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'cluster_id' in local_var_params:
|
|
path_params['cluster_id'] = local_var_params['cluster_id']
|
|
|
|
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;charset=UTF-8'])
|
|
|
|
auth_settings = []
|
|
|
|
return self.call_api(
|
|
resource_path='/v1.0/{project_id}/clusters/{cluster_id}/resize',
|
|
method='POST',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='ResizeClusterResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def restart_cluster(self, request):
|
|
"""重启集群
|
|
|
|
此接口用于重启集群。
|
|
|
|
:param RestartClusterRequest request
|
|
:return: RestartClusterResponse
|
|
"""
|
|
return self.restart_cluster_with_http_info(request)
|
|
|
|
def restart_cluster_with_http_info(self, request):
|
|
"""重启集群
|
|
|
|
此接口用于重启集群。
|
|
|
|
:param RestartClusterRequest request
|
|
:return: RestartClusterResponse
|
|
"""
|
|
|
|
all_params = ['cluster_id', 'restart_cluster_request_body']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'cluster_id' in local_var_params:
|
|
path_params['cluster_id'] = local_var_params['cluster_id']
|
|
|
|
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;charset=UTF-8'])
|
|
|
|
auth_settings = []
|
|
|
|
return self.call_api(
|
|
resource_path='/v1.0/{project_id}/clusters/{cluster_id}/restart',
|
|
method='POST',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='RestartClusterResponse',
|
|
response_headers=response_headers,
|
|
auth_settings=auth_settings,
|
|
collection_formats=collection_formats,
|
|
request_type=request.__class__.__name__)
|
|
|
|
|
|
def restore_cluster(self, request):
|
|
"""恢复集群
|
|
|
|
该接口用于使用快照恢复集群。
|
|
|
|
:param RestoreClusterRequest request
|
|
:return: RestoreClusterResponse
|
|
"""
|
|
return self.restore_cluster_with_http_info(request)
|
|
|
|
def restore_cluster_with_http_info(self, request):
|
|
"""恢复集群
|
|
|
|
该接口用于使用快照恢复集群。
|
|
|
|
:param RestoreClusterRequest request
|
|
:return: RestoreClusterResponse
|
|
"""
|
|
|
|
all_params = ['snapshot_id', 'restore_cluster_request_body']
|
|
local_var_params = {}
|
|
for attr in request.attribute_map:
|
|
if hasattr(request, attr):
|
|
local_var_params[attr] = getattr(request, attr)
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'snapshot_id' in local_var_params:
|
|
path_params['snapshot_id'] = local_var_params['snapshot_id']
|
|
|
|
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;charset=UTF-8'])
|
|
|
|
auth_settings = []
|
|
|
|
return self.call_api(
|
|
resource_path='/v1.0/{project_id}/snapshots/{snapshot_id}/actions',
|
|
method='POST',
|
|
path_params=path_params,
|
|
query_params=query_params,
|
|
header_params=header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
response_type='RestoreClusterResponse',
|
|
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, 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 dict: Request post form parameters,
|
|
for `application/x-www-form-urlencoded`, `multipart/form-data`.
|
|
:param auth_settings list: 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,
|
|
response_type=response_type,
|
|
response_headers=response_headers,
|
|
collection_formats=collection_formats,
|
|
request_type=request_type)
|