1353 lines
43 KiB
Python
1353 lines
43 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 FgsClient(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(FgsClient, self).__init__()
|
||
self.model_package = importlib.import_module("huaweicloudsdkfgs.v2.model")
|
||
self.preset_headers = {'User-Agent': 'HuaweiCloud-SDK-Python'}
|
||
|
||
@staticmethod
|
||
def new_builder(clazz):
|
||
return ClientBuilder(clazz)
|
||
|
||
def async_invoke_function(self, request):
|
||
"""异步执行函数。
|
||
|
||
异步执行函数。
|
||
|
||
:param AsyncInvokeFunctionRequest request
|
||
:return: AsyncInvokeFunctionResponse
|
||
"""
|
||
return self.async_invoke_function_with_http_info(request)
|
||
|
||
def async_invoke_function_with_http_info(self, request):
|
||
"""异步执行函数。
|
||
|
||
异步执行函数。
|
||
|
||
:param AsyncInvokeFunctionRequest request
|
||
:return: AsyncInvokeFunctionResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'async_invoke_function_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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
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()
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/invocations-async',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='AsyncInvokeFunctionResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def create_function(self, request):
|
||
"""创建函数。
|
||
|
||
创建指定的函数。
|
||
|
||
:param CreateFunctionRequest request
|
||
:return: CreateFunctionResponse
|
||
"""
|
||
return self.create_function_with_http_info(request)
|
||
|
||
def create_function_with_http_info(self, request):
|
||
"""创建函数。
|
||
|
||
创建指定的函数。
|
||
|
||
:param CreateFunctionRequest request
|
||
:return: CreateFunctionResponse
|
||
"""
|
||
|
||
all_params = ['create_function_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()
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='CreateFunctionResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def create_function_version(self, request):
|
||
"""发布函数版本。
|
||
|
||
发布函数版本。
|
||
|
||
:param CreateFunctionVersionRequest request
|
||
:return: CreateFunctionVersionResponse
|
||
"""
|
||
return self.create_function_version_with_http_info(request)
|
||
|
||
def create_function_version_with_http_info(self, request):
|
||
"""发布函数版本。
|
||
|
||
发布函数版本。
|
||
|
||
:param CreateFunctionVersionRequest request
|
||
:return: CreateFunctionVersionResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'create_function_version_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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
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()
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/versions',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='CreateFunctionVersionResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def create_version_alias(self, request):
|
||
"""创建函数版本别名。
|
||
|
||
创建函数灰度版本别名。
|
||
|
||
:param CreateVersionAliasRequest request
|
||
:return: CreateVersionAliasResponse
|
||
"""
|
||
return self.create_version_alias_with_http_info(request)
|
||
|
||
def create_version_alias_with_http_info(self, request):
|
||
"""创建函数版本别名。
|
||
|
||
创建函数灰度版本别名。
|
||
|
||
:param CreateVersionAliasRequest request
|
||
:return: CreateVersionAliasResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'create_version_alias_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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
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()
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/aliases',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='CreateVersionAliasResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def delete_function(self, request):
|
||
"""删除函数/版本。
|
||
|
||
删除指定的函数或者特定的版本(不允许删除latest版本)。 如果URN中包含函数版本或者别名,则删除特定的函数版本或者别名指向的版本以及该版本关联的trigger。 如果URN中不包含版本或者别名,则删除整个函数,包含所有版本以及别名,触发器。
|
||
|
||
:param DeleteFunctionRequest request
|
||
:return: DeleteFunctionResponse
|
||
"""
|
||
return self.delete_function_with_http_info(request)
|
||
|
||
def delete_function_with_http_info(self, request):
|
||
"""删除函数/版本。
|
||
|
||
删除指定的函数或者特定的版本(不允许删除latest版本)。 如果URN中包含函数版本或者别名,则删除特定的函数版本或者别名指向的版本以及该版本关联的trigger。 如果URN中不包含版本或者别名,则删除整个函数,包含所有版本以及别名,触发器。
|
||
|
||
:param DeleteFunctionRequest request
|
||
:return: DeleteFunctionResponse
|
||
"""
|
||
|
||
all_params = ['function_urn']
|
||
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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}',
|
||
method='DELETE',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='DeleteFunctionResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def delete_version_alias(self, request):
|
||
"""删除函数版本别名。
|
||
|
||
删除函数版本别名。
|
||
|
||
:param DeleteVersionAliasRequest request
|
||
:return: DeleteVersionAliasResponse
|
||
"""
|
||
return self.delete_version_alias_with_http_info(request)
|
||
|
||
def delete_version_alias_with_http_info(self, request):
|
||
"""删除函数版本别名。
|
||
|
||
删除函数版本别名。
|
||
|
||
:param DeleteVersionAliasRequest request
|
||
:return: DeleteVersionAliasResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', '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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
if 'name' in local_var_params:
|
||
path_params['name'] = local_var_params['name']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/aliases/{name}',
|
||
method='DELETE',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='DeleteVersionAliasResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def invoke_function(self, request):
|
||
"""同步执行函数。
|
||
|
||
同步调用指的是客户端请求需要明确等到响应结果,也就是说这样的请求必须得调用到用户的函数,并且等到调用完成才返回。
|
||
|
||
:param InvokeFunctionRequest request
|
||
:return: InvokeFunctionResponse
|
||
"""
|
||
return self.invoke_function_with_http_info(request)
|
||
|
||
def invoke_function_with_http_info(self, request):
|
||
"""同步执行函数。
|
||
|
||
同步调用指的是客户端请求需要明确等到响应结果,也就是说这样的请求必须得调用到用户的函数,并且等到调用完成才返回。
|
||
|
||
:param InvokeFunctionRequest request
|
||
:return: InvokeFunctionResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'invoke_function_request_body', 'x_cff_log_type', 'x_cff_request_version']
|
||
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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
if 'x_cff_log_type' in local_var_params:
|
||
header_params['X-Cff-Log-Type'] = local_var_params['x_cff_log_type']
|
||
if 'x_cff_request_version' in local_var_params:
|
||
header_params['X-CFF-Request-Version'] = local_var_params['x_cff_request_version']
|
||
|
||
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()
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/invocations',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='InvokeFunctionResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def list_function_versions(self, request):
|
||
"""获取指定函数的版本列表。
|
||
|
||
获取指定函数的版本列表。
|
||
|
||
:param ListFunctionVersionsRequest request
|
||
:return: ListFunctionVersionsResponse
|
||
"""
|
||
return self.list_function_versions_with_http_info(request)
|
||
|
||
def list_function_versions_with_http_info(self, request):
|
||
"""获取指定函数的版本列表。
|
||
|
||
获取指定函数的版本列表。
|
||
|
||
:param ListFunctionVersionsRequest request
|
||
:return: ListFunctionVersionsResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'marker', 'maxitems']
|
||
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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
query_params = []
|
||
if 'marker' in local_var_params:
|
||
query_params.append(('marker', local_var_params['marker']))
|
||
if 'maxitems' in local_var_params:
|
||
query_params.append(('maxitems', local_var_params['maxitems']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/versions',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ListFunctionVersionsResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def list_functions(self, request):
|
||
"""获取函数列表
|
||
|
||
获取函数列表
|
||
|
||
:param ListFunctionsRequest request
|
||
:return: ListFunctionsResponse
|
||
"""
|
||
return self.list_functions_with_http_info(request)
|
||
|
||
def list_functions_with_http_info(self, request):
|
||
"""获取函数列表
|
||
|
||
获取函数列表
|
||
|
||
:param ListFunctionsRequest request
|
||
:return: ListFunctionsResponse
|
||
"""
|
||
|
||
all_params = ['marker', 'maxitems']
|
||
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 'marker' in local_var_params:
|
||
query_params.append(('marker', local_var_params['marker']))
|
||
if 'maxitems' in local_var_params:
|
||
query_params.append(('maxitems', local_var_params['maxitems']))
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ListFunctionsResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def list_version_aliases(self, request):
|
||
"""获取指定函数所有版本别名列表。
|
||
|
||
获取函数版本别名列表。
|
||
|
||
:param ListVersionAliasesRequest request
|
||
:return: ListVersionAliasesResponse
|
||
"""
|
||
return self.list_version_aliases_with_http_info(request)
|
||
|
||
def list_version_aliases_with_http_info(self, request):
|
||
"""获取指定函数所有版本别名列表。
|
||
|
||
获取函数版本别名列表。
|
||
|
||
:param ListVersionAliasesRequest request
|
||
:return: ListVersionAliasesResponse
|
||
"""
|
||
|
||
all_params = ['function_urn']
|
||
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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/aliases',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ListVersionAliasesResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def show_function_code(self, request):
|
||
"""获取指定函数代码。
|
||
|
||
获取指定函数的代码。
|
||
|
||
:param ShowFunctionCodeRequest request
|
||
:return: ShowFunctionCodeResponse
|
||
"""
|
||
return self.show_function_code_with_http_info(request)
|
||
|
||
def show_function_code_with_http_info(self, request):
|
||
"""获取指定函数代码。
|
||
|
||
获取指定函数的代码。
|
||
|
||
:param ShowFunctionCodeRequest request
|
||
:return: ShowFunctionCodeResponse
|
||
"""
|
||
|
||
all_params = ['function_urn']
|
||
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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/code',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ShowFunctionCodeResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def show_function_config(self, request):
|
||
"""获取函数的metadata。
|
||
|
||
获取指定函数的metadata。
|
||
|
||
:param ShowFunctionConfigRequest request
|
||
:return: ShowFunctionConfigResponse
|
||
"""
|
||
return self.show_function_config_with_http_info(request)
|
||
|
||
def show_function_config_with_http_info(self, request):
|
||
"""获取函数的metadata。
|
||
|
||
获取指定函数的metadata。
|
||
|
||
:param ShowFunctionConfigRequest request
|
||
:return: ShowFunctionConfigResponse
|
||
"""
|
||
|
||
all_params = ['function_urn']
|
||
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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/config',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ShowFunctionConfigResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def show_version_alias(self, request):
|
||
"""获取函数版本的指定别名信息。
|
||
|
||
获取函数指定的版本别名信息。
|
||
|
||
:param ShowVersionAliasRequest request
|
||
:return: ShowVersionAliasResponse
|
||
"""
|
||
return self.show_version_alias_with_http_info(request)
|
||
|
||
def show_version_alias_with_http_info(self, request):
|
||
"""获取函数版本的指定别名信息。
|
||
|
||
获取函数指定的版本别名信息。
|
||
|
||
:param ShowVersionAliasRequest request
|
||
:return: ShowVersionAliasResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', '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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
if 'name' in local_var_params:
|
||
path_params['name'] = local_var_params['name']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/aliases/{name}',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ShowVersionAliasResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def update_function_code(self, request):
|
||
"""修改函数代码。
|
||
|
||
修改指定的函数的代码。
|
||
|
||
:param UpdateFunctionCodeRequest request
|
||
:return: UpdateFunctionCodeResponse
|
||
"""
|
||
return self.update_function_code_with_http_info(request)
|
||
|
||
def update_function_code_with_http_info(self, request):
|
||
"""修改函数代码。
|
||
|
||
修改指定的函数的代码。
|
||
|
||
:param UpdateFunctionCodeRequest request
|
||
:return: UpdateFunctionCodeResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'update_function_code_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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
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()
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/code',
|
||
method='PUT',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='UpdateFunctionCodeResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def update_function_config(self, request):
|
||
"""修改函数的metadata信息。
|
||
|
||
修改指定的函数的metadata信息。
|
||
|
||
:param UpdateFunctionConfigRequest request
|
||
:return: UpdateFunctionConfigResponse
|
||
"""
|
||
return self.update_function_config_with_http_info(request)
|
||
|
||
def update_function_config_with_http_info(self, request):
|
||
"""修改函数的metadata信息。
|
||
|
||
修改指定的函数的metadata信息。
|
||
|
||
:param UpdateFunctionConfigRequest request
|
||
:return: UpdateFunctionConfigResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'update_function_config_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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
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()
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/config',
|
||
method='PUT',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='UpdateFunctionConfigResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def update_version_alias(self, request):
|
||
"""修改函数版本别名信息。
|
||
|
||
修改函数版本别名信息。
|
||
|
||
:param UpdateVersionAliasRequest request
|
||
:return: UpdateVersionAliasResponse
|
||
"""
|
||
return self.update_version_alias_with_http_info(request)
|
||
|
||
def update_version_alias_with_http_info(self, request):
|
||
"""修改函数版本别名信息。
|
||
|
||
修改函数版本别名信息。
|
||
|
||
:param UpdateVersionAliasRequest request
|
||
:return: UpdateVersionAliasResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'name', 'update_version_alias_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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
if 'name' in local_var_params:
|
||
path_params['name'] = local_var_params['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()
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/functions/{function_urn}/aliases/{name}',
|
||
method='PUT',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='UpdateVersionAliasResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def batch_delete_function_triggers(self, request):
|
||
"""删除指定函数的所有触发器。
|
||
|
||
删除指定函数所有触发器设置。 在提供函数版本且非latest的情况下,删除对应函数版本的触发器。 在提供函数别名的情况下,删除对应函数别名的触发器。 在不提供函数版本(也不提供别名)或版本为latest的情况下,删除该函数所有的触发器(包括所有版本和别名)。
|
||
|
||
:param BatchDeleteFunctionTriggersRequest request
|
||
:return: BatchDeleteFunctionTriggersResponse
|
||
"""
|
||
return self.batch_delete_function_triggers_with_http_info(request)
|
||
|
||
def batch_delete_function_triggers_with_http_info(self, request):
|
||
"""删除指定函数的所有触发器。
|
||
|
||
删除指定函数所有触发器设置。 在提供函数版本且非latest的情况下,删除对应函数版本的触发器。 在提供函数别名的情况下,删除对应函数别名的触发器。 在不提供函数版本(也不提供别名)或版本为latest的情况下,删除该函数所有的触发器(包括所有版本和别名)。
|
||
|
||
:param BatchDeleteFunctionTriggersRequest request
|
||
:return: BatchDeleteFunctionTriggersResponse
|
||
"""
|
||
|
||
all_params = ['function_urn']
|
||
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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/triggers/{function_urn}',
|
||
method='DELETE',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='BatchDeleteFunctionTriggersResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def create_function_trigger(self, request):
|
||
"""创建触发器。
|
||
|
||
创建触发器。 - 可以创建的触发器类型包括TIMER、APIG、CTS、DDS、DMS、DIS、LTS、OBS、SMN、KAFKA。 - DDS和KAFKA触发器创建时默认为DISABLE状态,其他触发器默认为ACTIVE状态。 - TIMER、DDS、DMS、KAFKA、LTS触发器支持禁用,其他触发器不支持。
|
||
|
||
:param CreateFunctionTriggerRequest request
|
||
:return: CreateFunctionTriggerResponse
|
||
"""
|
||
return self.create_function_trigger_with_http_info(request)
|
||
|
||
def create_function_trigger_with_http_info(self, request):
|
||
"""创建触发器。
|
||
|
||
创建触发器。 - 可以创建的触发器类型包括TIMER、APIG、CTS、DDS、DMS、DIS、LTS、OBS、SMN、KAFKA。 - DDS和KAFKA触发器创建时默认为DISABLE状态,其他触发器默认为ACTIVE状态。 - TIMER、DDS、DMS、KAFKA、LTS触发器支持禁用,其他触发器不支持。
|
||
|
||
:param CreateFunctionTriggerRequest request
|
||
:return: CreateFunctionTriggerResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'create_function_trigger_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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
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()
|
||
|
||
header_params['Content-Type'] = http_utils.select_header_content_type(
|
||
['application/json'])
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/triggers/{function_urn}',
|
||
method='POST',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='CreateFunctionTriggerResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def delete_function_trigger(self, request):
|
||
"""删除触发器。
|
||
|
||
删除触发器。
|
||
|
||
:param DeleteFunctionTriggerRequest request
|
||
:return: DeleteFunctionTriggerResponse
|
||
"""
|
||
return self.delete_function_trigger_with_http_info(request)
|
||
|
||
def delete_function_trigger_with_http_info(self, request):
|
||
"""删除触发器。
|
||
|
||
删除触发器。
|
||
|
||
:param DeleteFunctionTriggerRequest request
|
||
:return: DeleteFunctionTriggerResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'trigger_type_code', 'trigger_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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
if 'trigger_type_code' in local_var_params:
|
||
path_params['trigger_type_code'] = local_var_params['trigger_type_code']
|
||
if 'trigger_id' in local_var_params:
|
||
path_params['triggerId'] = local_var_params['trigger_id']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/triggers/{function_urn}/{trigger_type_code}/{triggerId}',
|
||
method='DELETE',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='DeleteFunctionTriggerResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def list_function_triggers(self, request):
|
||
"""获取指定函数的所有触发器。
|
||
|
||
获取指定函数的所有触发器设置。
|
||
|
||
:param ListFunctionTriggersRequest request
|
||
:return: ListFunctionTriggersResponse
|
||
"""
|
||
return self.list_function_triggers_with_http_info(request)
|
||
|
||
def list_function_triggers_with_http_info(self, request):
|
||
"""获取指定函数的所有触发器。
|
||
|
||
获取指定函数的所有触发器设置。
|
||
|
||
:param ListFunctionTriggersRequest request
|
||
:return: ListFunctionTriggersResponse
|
||
"""
|
||
|
||
all_params = ['function_urn']
|
||
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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/triggers/{function_urn}',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ListFunctionTriggersResponse',
|
||
auth_settings=auth_settings,
|
||
collection_formats=collection_formats,
|
||
request_type=request.__class__.__name__)
|
||
|
||
|
||
def show_function_trigger(self, request):
|
||
"""获取指定触发器的信息。
|
||
|
||
获取特定触发器的信息。
|
||
|
||
:param ShowFunctionTriggerRequest request
|
||
:return: ShowFunctionTriggerResponse
|
||
"""
|
||
return self.show_function_trigger_with_http_info(request)
|
||
|
||
def show_function_trigger_with_http_info(self, request):
|
||
"""获取指定触发器的信息。
|
||
|
||
获取特定触发器的信息。
|
||
|
||
:param ShowFunctionTriggerRequest request
|
||
:return: ShowFunctionTriggerResponse
|
||
"""
|
||
|
||
all_params = ['function_urn', 'trigger_type_code', 'trigger_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 'function_urn' in local_var_params:
|
||
path_params['function_urn'] = local_var_params['function_urn']
|
||
if 'trigger_type_code' in local_var_params:
|
||
path_params['trigger_type_code'] = local_var_params['trigger_type_code']
|
||
if 'trigger_id' in local_var_params:
|
||
path_params['triggerId'] = local_var_params['trigger_id']
|
||
|
||
query_params = []
|
||
|
||
header_params = {}
|
||
|
||
form_params = {}
|
||
|
||
body_params = None
|
||
if isinstance(request, SdkStreamRequest):
|
||
body_params = request.get_file_stream()
|
||
|
||
|
||
auth_settings = []
|
||
|
||
return self.call_api(
|
||
resource_path='/v2/{project_id}/fgs/triggers/{function_urn}/{trigger_type_code}/{triggerId}',
|
||
method='GET',
|
||
path_params=path_params,
|
||
query_params=query_params,
|
||
header_params=header_params,
|
||
body=body_params,
|
||
post_params=form_params,
|
||
response_type='ShowFunctionTriggerResponse',
|
||
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, 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 collection_formats: dict of collection formats for path, query,
|
||
header, and post parameters.
|
||
: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,
|
||
collection_formats=collection_formats,
|
||
request_type=request_type)
|