787 lines
26 KiB
Python
787 lines
26 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 KpsClient(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(KpsClient, self).__init__()
|
||
self.model_package = importlib.import_module("huaweicloudsdkkps.v3.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__ != "KpsClient":
|
||
raise TypeError("client type error, support client type is KpsClient")
|
||
|
||
return ClientBuilder(clazz)
|
||
|
||
def associate_keypair(self, request):
|
||
"""绑定SSH密钥对
|
||
|
||
给指定的虚拟机绑定(替换或重置,替换需提供虚拟机已配置的SSH密钥对私钥;重置不需要提供虚拟机的SSH密钥对私钥)新的SSH密钥对。
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for AssociateKeypair
|
||
:type request: :class:`huaweicloudsdkkps.v3.AssociateKeypairRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.AssociateKeypairResponse`
|
||
"""
|
||
return self.associate_keypair_with_http_info(request)
|
||
|
||
def associate_keypair_with_http_info(self, request):
|
||
all_params = ['associate_keypair_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='/v3/{project_id}/keypairs/associate',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='AssociateKeypairResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def create_keypair(self, request):
|
||
"""创建和导入SSH密钥对
|
||
|
||
创建和导入SSH密钥对
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for CreateKeypair
|
||
:type request: :class:`huaweicloudsdkkps.v3.CreateKeypairRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.CreateKeypairResponse`
|
||
"""
|
||
return self.create_keypair_with_http_info(request)
|
||
|
||
def create_keypair_with_http_info(self, request):
|
||
all_params = ['create_keypair_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='/v3/{project_id}/keypairs',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='CreateKeypairResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def delete_all_failed_task(self, request):
|
||
"""删除所有失败的任务
|
||
|
||
删除操作失败的任务信息。
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for DeleteAllFailedTask
|
||
:type request: :class:`huaweicloudsdkkps.v3.DeleteAllFailedTaskRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.DeleteAllFailedTaskResponse`
|
||
"""
|
||
return self.delete_all_failed_task_with_http_info(request)
|
||
|
||
def delete_all_failed_task_with_http_info(self, request):
|
||
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='/v3/{project_id}/failed-tasks',
|
||
method='DELETE',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='DeleteAllFailedTaskResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def delete_failed_task(self, request):
|
||
"""删除失败的任务
|
||
|
||
删除失败的任务。
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for DeleteFailedTask
|
||
:type request: :class:`huaweicloudsdkkps.v3.DeleteFailedTaskRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.DeleteFailedTaskResponse`
|
||
"""
|
||
return self.delete_failed_task_with_http_info(request)
|
||
|
||
def delete_failed_task_with_http_info(self, request):
|
||
all_params = ['task_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 'task_id' in local_var_params:
|
||
path_params['task_id'] = local_var_params['task_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='/v3/{project_id}/failed-tasks/{task_id}',
|
||
method='DELETE',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='DeleteFailedTaskResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def delete_keypair(self, request):
|
||
"""删除SSH密钥对
|
||
|
||
删除SSH密钥对。
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for DeleteKeypair
|
||
:type request: :class:`huaweicloudsdkkps.v3.DeleteKeypairRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.DeleteKeypairResponse`
|
||
"""
|
||
return self.delete_keypair_with_http_info(request)
|
||
|
||
def delete_keypair_with_http_info(self, request):
|
||
all_params = ['keypair_name']
|
||
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 'keypair_name' in local_var_params:
|
||
path_params['keypair_name'] = local_var_params['keypair_name']
|
||
|
||
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='/v3/{project_id}/keypairs/{keypair_name}',
|
||
method='DELETE',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='DeleteKeypairResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def disassociate_keypair(self, request):
|
||
"""解绑SSH密钥对
|
||
|
||
给指定的虚拟机解除绑定SSH密钥对并恢复SSH密码登录。
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for DisassociateKeypair
|
||
:type request: :class:`huaweicloudsdkkps.v3.DisassociateKeypairRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.DisassociateKeypairResponse`
|
||
"""
|
||
return self.disassociate_keypair_with_http_info(request)
|
||
|
||
def disassociate_keypair_with_http_info(self, request):
|
||
all_params = ['disassociate_keypair_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='/v3/{project_id}/keypairs/disassociate',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='DisassociateKeypairResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_failed_task(self, request):
|
||
"""查询失败的任务信息
|
||
|
||
查询绑定、解绑等操作失败的任务信息。
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for ListFailedTask
|
||
:type request: :class:`huaweicloudsdkkps.v3.ListFailedTaskRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.ListFailedTaskResponse`
|
||
"""
|
||
return self.list_failed_task_with_http_info(request)
|
||
|
||
def list_failed_task_with_http_info(self, request):
|
||
all_params = ['limit', 'offset']
|
||
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 = []
|
||
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']))
|
||
|
||
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='/v3/{project_id}/failed-tasks',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ListFailedTaskResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_keypair_detail(self, request):
|
||
"""查询SSH密钥对详细信息
|
||
|
||
查询SSH密钥对详细信息
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for ListKeypairDetail
|
||
:type request: :class:`huaweicloudsdkkps.v3.ListKeypairDetailRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.ListKeypairDetailResponse`
|
||
"""
|
||
return self.list_keypair_detail_with_http_info(request)
|
||
|
||
def list_keypair_detail_with_http_info(self, request):
|
||
all_params = ['keypair_name']
|
||
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 'keypair_name' in local_var_params:
|
||
path_params['keypair_name'] = local_var_params['keypair_name']
|
||
|
||
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='/v3/{project_id}/keypairs/{keypair_name}',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ListKeypairDetailResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_keypair_task(self, request):
|
||
"""查询任务信息
|
||
|
||
根据SSH密钥对接口返回的task_id,查询SSH密钥对当前任务的执行状态。
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for ListKeypairTask
|
||
:type request: :class:`huaweicloudsdkkps.v3.ListKeypairTaskRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.ListKeypairTaskResponse`
|
||
"""
|
||
return self.list_keypair_task_with_http_info(request)
|
||
|
||
def list_keypair_task_with_http_info(self, request):
|
||
all_params = ['task_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 'task_id' in local_var_params:
|
||
path_params['task_id'] = local_var_params['task_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='/v3/{project_id}/tasks/{task_id}',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ListKeypairTaskResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_keypairs(self, request):
|
||
"""查询SSH密钥对列表
|
||
|
||
查询SSH密钥对列表
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for ListKeypairs
|
||
:type request: :class:`huaweicloudsdkkps.v3.ListKeypairsRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.ListKeypairsResponse`
|
||
"""
|
||
return self.list_keypairs_with_http_info(request)
|
||
|
||
def list_keypairs_with_http_info(self, request):
|
||
all_params = ['limit', 'marker']
|
||
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 = []
|
||
if 'limit' in local_var_params:
|
||
query_params.append(('limit', local_var_params['limit']))
|
||
if 'marker' in local_var_params:
|
||
query_params.append(('marker', local_var_params['marker']))
|
||
|
||
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='/v3/{project_id}/keypairs',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ListKeypairsResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def list_running_task(self, request):
|
||
"""查询正在处理的任务信息
|
||
|
||
查询正在处理的任务信息。
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for ListRunningTask
|
||
:type request: :class:`huaweicloudsdkkps.v3.ListRunningTaskRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.ListRunningTaskResponse`
|
||
"""
|
||
return self.list_running_task_with_http_info(request)
|
||
|
||
def list_running_task_with_http_info(self, request):
|
||
all_params = ['limit', 'offset']
|
||
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 = []
|
||
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']))
|
||
|
||
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='/v3/{project_id}/running-tasks',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ListRunningTaskResponse',
|
||
response_headers=response_headers,
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
def update_keypair_description(self, request):
|
||
"""更新SSH密钥对描述
|
||
|
||
更新SSH密钥对描述。
|
||
|
||
详细说明请参考华为云API Explorer。
|
||
Please refer to Huawei cloud API Explorer for details.
|
||
|
||
:param request: Request instance for UpdateKeypairDescription
|
||
:type request: :class:`huaweicloudsdkkps.v3.UpdateKeypairDescriptionRequest`
|
||
:rtype: :class:`huaweicloudsdkkps.v3.UpdateKeypairDescriptionResponse`
|
||
"""
|
||
return self.update_keypair_description_with_http_info(request)
|
||
|
||
def update_keypair_description_with_http_info(self, request):
|
||
all_params = ['keypair_name', 'update_keypair_description_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 'keypair_name' in local_var_params:
|
||
path_params['keypair_name'] = local_var_params['keypair_name']
|
||
|
||
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='/v3/{project_id}/keypairs/{keypair_name}',
|
||
method='PUT',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='UpdateKeypairDescriptionResponse',
|
||
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)
|