huaweicloud-sdk-python-v3/huaweicloud-sdk-sfsturbo/huaweicloudsdksfsturbo/v1/sfsturbo_client.py

740 lines
25 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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 SFSTurboClient(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(SFSTurboClient, self).__init__()
self.model_package = importlib.import_module("huaweicloudsdksfsturbo.v1.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__ != "SFSTurboClient":
raise TypeError("client type error, support client type is SFSTurboClient")
return ClientBuilder(clazz)
def batch_add_shared_tags(self, request):
"""批量添加共享标签
指定共享批量添加标签。
一个共享上最多有10个标签。
一个共享上的多个标签的key不允许重复。
此接口为幂等接口如果要添加的key在共享上已存在则覆盖更新标签。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for BatchAddSharedTags
:type request: :class:`huaweicloudsdksfsturbo.v1.BatchAddSharedTagsRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.BatchAddSharedTagsResponse`
"""
return self.batch_add_shared_tags_with_http_info(request)
def batch_add_shared_tags_with_http_info(self, request):
all_params = ['share_id', 'add_shareed_tags']
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 'share_id' in local_var_params:
path_params['share_id'] = local_var_params['share_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/{project_id}/sfs-turbo/{share_id}/tags/action',
method='POST',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='BatchAddSharedTagsResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def change_security_group(self, request):
"""修改文件系统绑定的安全组
修改SFS Turbo文件系统绑定的安全组。修改安全组为异步任务可以通过“查询单个文件系统”返回的子状态字段“sub_status”来判断是否修改安全组状态子状态为“232”即为修改安全组成功。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for ChangeSecurityGroup
:type request: :class:`huaweicloudsdksfsturbo.v1.ChangeSecurityGroupRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.ChangeSecurityGroupResponse`
"""
return self.change_security_group_with_http_info(request)
def change_security_group_with_http_info(self, request):
all_params = ['share_id', 'change_security_group']
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 'share_id' in local_var_params:
path_params['share_id'] = local_var_params['share_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/{project_id}/sfs-turbo/shares/{share_id}/action',
method='POST',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='ChangeSecurityGroupResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def create_share(self, request):
"""创建文件系统
创建文件系统。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for CreateShare
:type request: :class:`huaweicloudsdksfsturbo.v1.CreateShareRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.CreateShareResponse`
"""
return self.create_share_with_http_info(request)
def create_share_with_http_info(self, request):
all_params = ['share']
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/{project_id}/sfs-turbo/shares',
method='POST',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='CreateShareResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def create_shared_tag(self, request):
"""创建共享标签
指定共享添加一个标签。
一个共享上最多有10个标签。
一个共享上的多个标签的key不允许重复。
此接口为幂等接口如果要添加的key在共享上已存在则覆盖更新标签。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for CreateSharedTag
:type request: :class:`huaweicloudsdksfsturbo.v1.CreateSharedTagRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.CreateSharedTagResponse`
"""
return self.create_shared_tag_with_http_info(request)
def create_shared_tag_with_http_info(self, request):
all_params = ['share_id', 'tag']
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 'share_id' in local_var_params:
path_params['share_id'] = local_var_params['share_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/{project_id}/sfs-turbo/{share_id}/tags',
method='POST',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='CreateSharedTagResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def delete_share(self, request):
"""删除文件系统
删除文件系统。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for DeleteShare
:type request: :class:`huaweicloudsdksfsturbo.v1.DeleteShareRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.DeleteShareResponse`
"""
return self.delete_share_with_http_info(request)
def delete_share_with_http_info(self, request):
all_params = ['share_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 'share_id' in local_var_params:
path_params['share_id'] = local_var_params['share_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/{project_id}/sfs-turbo/shares/{share_id}',
method='DELETE',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='DeleteShareResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def delete_shared_tag(self, request):
"""删除共享标签
指定共享删除一个标签。当共享中不存在指定要删除的key时接口调用将会返回404错误。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for DeleteSharedTag
:type request: :class:`huaweicloudsdksfsturbo.v1.DeleteSharedTagRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.DeleteSharedTagResponse`
"""
return self.delete_shared_tag_with_http_info(request)
def delete_shared_tag_with_http_info(self, request):
all_params = ['share_id', 'key']
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 'share_id' in local_var_params:
path_params['share_id'] = local_var_params['share_id']
if 'key' in local_var_params:
path_params['key'] = local_var_params['key']
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}/sfs-turbo/{share_id}/tags/{key}',
method='DELETE',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='DeleteSharedTagResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def expand_share(self, request):
"""扩容文件系统
扩容文件系统。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for ExpandShare
:type request: :class:`huaweicloudsdksfsturbo.v1.ExpandShareRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.ExpandShareResponse`
"""
return self.expand_share_with_http_info(request)
def expand_share_with_http_info(self, request):
all_params = ['share_id', 'extend']
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 'share_id' in local_var_params:
path_params['share_id'] = local_var_params['share_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/{project_id}/sfs-turbo/shares/{share_id}/action',
method='POST',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='ExpandShareResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def list_shared_tags(self, request):
"""查询租户所有共享的标签
查询租户所有共享的标签集合。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for ListSharedTags
:type request: :class:`huaweicloudsdksfsturbo.v1.ListSharedTagsRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.ListSharedTagsResponse`
"""
return self.list_shared_tags_with_http_info(request)
def list_shared_tags_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='/v1/{project_id}/sfs-turbo/tags',
method='GET',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='ListSharedTagsResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def list_shares(self, request):
"""获取文件系统列表
获取文件系统列表
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for ListShares
:type request: :class:`huaweicloudsdksfsturbo.v1.ListSharesRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.ListSharesResponse`
"""
return self.list_shares_with_http_info(request)
def list_shares_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='/v1/{project_id}/sfs-turbo/shares/detail',
method='GET',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='ListSharesResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def show_share(self, request):
"""查询文件系统详细信息
查询SFS Turbo文件系统详细信息。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for ShowShare
:type request: :class:`huaweicloudsdksfsturbo.v1.ShowShareRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.ShowShareResponse`
"""
return self.show_share_with_http_info(request)
def show_share_with_http_info(self, request):
all_params = ['share_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 'share_id' in local_var_params:
path_params['share_id'] = local_var_params['share_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/{project_id}/sfs-turbo/shares/{share_id}',
method='GET',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='ShowShareResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def show_shared_tags(self, request):
"""查询共享标签
查询指定共享的所有标签信息。
详细说明请参考华为云API Explorer。
Please refer to Huawei cloud API Explorer for details.
:param request: Request instance for ShowSharedTags
:type request: :class:`huaweicloudsdksfsturbo.v1.ShowSharedTagsRequest`
:rtype: :class:`huaweicloudsdksfsturbo.v1.ShowSharedTagsResponse`
"""
return self.show_shared_tags_with_http_info(request)
def show_shared_tags_with_http_info(self, request):
all_params = ['share_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 'share_id' in local_var_params:
path_params['share_id'] = local_var_params['share_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/{project_id}/sfs-turbo/{share_id}/tags',
method='GET',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='ShowSharedTagsResponse',
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)