/* * Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ namespace TencentCloud.Scf.V20180416 { using Newtonsoft.Json; using System.Threading.Tasks; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Scf.V20180416.Models; public class ScfClient : AbstractClient{ private const string endpoint = "scf.tencentcloudapi.com"; private const string version = "2018-04-16"; /// /// Client constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". public ScfClient(Credential credential, string region) : this(credential, region, new ClientProfile()) { } /// /// Client Constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". /// Client profiles. public ScfClient(Credential credential, string region, ClientProfile profile) : base(endpoint, version, credential, region, profile) { } /// /// 复制一个函数,您可以选择将复制出的新函数放置在特定的Region和Namespace。 /// 注:本接口**不会**复制函数的以下对象或属性: /// 1. 函数的触发器 /// 2. 除了$LATEST以外的其它版本 /// 3. 函数配置的日志投递到的CLS目标。 /// /// 如有需要,您可以在复制后手动配置新函数。 /// /// /// public async Task CopyFunction(CopyFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CopyFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 复制一个函数,您可以选择将复制出的新函数放置在特定的Region和Namespace。 /// 注:本接口**不会**复制函数的以下对象或属性: /// 1. 函数的触发器 /// 2. 除了$LATEST以外的其它版本 /// 3. 函数配置的日志投递到的CLS目标。 /// /// 如有需要,您可以在复制后手动配置新函数。 /// /// /// public CopyFunctionResponse CopyFunctionSync(CopyFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CopyFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入参数创建新的函数。 /// /// /// public async Task CreateFunction(CreateFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入参数创建新的函数。 /// /// /// public CreateFunctionResponse CreateFunctionSync(CreateFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入的参数创建命名空间。 /// /// /// public async Task CreateNamespace(CreateNamespaceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateNamespace"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入的参数创建命名空间。 /// /// /// public CreateNamespaceResponse CreateNamespaceSync(CreateNamespaceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateNamespace"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据参数输入设置新的触发方式。 /// /// /// public async Task CreateTrigger(CreateTriggerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateTrigger"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据参数输入设置新的触发方式。 /// /// /// public CreateTriggerResponse CreateTriggerSync(CreateTriggerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateTrigger"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入参数删除函数。 /// /// /// public async Task DeleteFunction(DeleteFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeleteFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入参数删除函数。 /// /// /// public DeleteFunctionResponse DeleteFunctionSync(DeleteFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除指定层的指定版本,被删除的版本无法再关联到函数上,但不会影响正在引用这个层的函数。 /// /// /// public async Task DeleteLayerVersion(DeleteLayerVersionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeleteLayerVersion"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除指定层的指定版本,被删除的版本无法再关联到函数上,但不会影响正在引用这个层的函数。 /// /// /// public DeleteLayerVersionResponse DeleteLayerVersionSync(DeleteLayerVersionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteLayerVersion"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入的参数创建命名空间。 /// /// /// public async Task DeleteNamespace(DeleteNamespaceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeleteNamespace"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入的参数创建命名空间。 /// /// /// public DeleteNamespaceResponse DeleteNamespaceSync(DeleteNamespaceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteNamespace"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据参数传入删除已有的触发方式。 /// /// /// public async Task DeleteTrigger(DeleteTriggerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeleteTrigger"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据参数传入删除已有的触发方式。 /// /// /// public DeleteTriggerResponse DeleteTriggerSync(DeleteTriggerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteTrigger"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口获取某个函数的详细信息,包括名称、代码、处理方法、关联触发器和超时时间等字段。 /// /// /// public async Task GetFunction(GetFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口获取某个函数的详细信息,包括名称、代码、处理方法、关联触发器和超时时间等字段。 /// /// /// public GetFunctionResponse GetFunctionSync(GetFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用于获取函数代码包的下载地址。 /// /// /// public async Task GetFunctionAddress(GetFunctionAddressRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetFunctionAddress"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用于获取函数代码包的下载地址。 /// /// /// public GetFunctionAddressResponse GetFunctionAddressSync(GetFunctionAddressRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetFunctionAddress"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据指定的日志查询条件返回函数运行日志。 /// /// /// public async Task GetFunctionLogs(GetFunctionLogsRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetFunctionLogs"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据指定的日志查询条件返回函数运行日志。 /// /// /// public GetFunctionLogsResponse GetFunctionLogsSync(GetFunctionLogsRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetFunctionLogs"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取层版本详细信息,包括用于下载层中文件的链接。 /// /// /// public async Task GetLayerVersion(GetLayerVersionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetLayerVersion"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取层版本详细信息,包括用于下载层中文件的链接。 /// /// /// public GetLayerVersionResponse GetLayerVersionSync(GetLayerVersionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetLayerVersion"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用于运行函数。 /// /// /// public async Task Invoke(InvokeRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "Invoke"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用于运行函数。 /// /// /// public InvokeResponse InvokeSync(InvokeRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "Invoke"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入的查询参数返回相关函数信息。 /// /// /// public async Task ListFunctions(ListFunctionsRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ListFunctions"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入的查询参数返回相关函数信息。 /// /// /// public ListFunctionsResponse ListFunctionsSync(ListFunctionsRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ListFunctions"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 返回指定层的全部版本的信息 /// /// /// public async Task ListLayerVersions(ListLayerVersionsRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ListLayerVersions"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 返回指定层的全部版本的信息 /// /// /// public ListLayerVersionsResponse ListLayerVersionsSync(ListLayerVersionsRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ListLayerVersions"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 返回全部层的列表,其中包含了每个层最新版本的信息,可以通过适配运行时进行过滤。 /// /// /// public async Task ListLayers(ListLayersRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ListLayers"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 返回全部层的列表,其中包含了每个层最新版本的信息,可以通过适配运行时进行过滤。 /// /// /// public ListLayersResponse ListLayersSync(ListLayersRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ListLayers"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 列出命名空间列表 /// /// /// public async Task ListNamespaces(ListNamespacesRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ListNamespaces"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 列出命名空间列表 /// /// /// public ListNamespacesResponse ListNamespacesSync(ListNamespacesRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ListNamespaces"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入的参数查询函数的版本。 /// /// /// public async Task ListVersionByFunction(ListVersionByFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ListVersionByFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入的参数查询函数的版本。 /// /// /// public ListVersionByFunctionResponse ListVersionByFunctionSync(ListVersionByFunctionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ListVersionByFunction"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 使用给定的zip文件或cos对象创建一个层的新版本,每次使用相同的层的名称调用本接口,都会生成一个新版本。 /// /// /// public async Task PublishLayerVersion(PublishLayerVersionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "PublishLayerVersion"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 使用给定的zip文件或cos对象创建一个层的新版本,每次使用相同的层的名称调用本接口,都会生成一个新版本。 /// /// /// public PublishLayerVersionResponse PublishLayerVersionSync(PublishLayerVersionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "PublishLayerVersion"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用于用户发布新版本函数。 /// /// /// public async Task PublishVersion(PublishVersionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "PublishVersion"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用于用户发布新版本函数。 /// /// /// public PublishVersionResponse PublishVersionSync(PublishVersionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "PublishVersion"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入参数更新函数代码。 /// /// /// public async Task UpdateFunctionCode(UpdateFunctionCodeRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "UpdateFunctionCode"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入参数更新函数代码。 /// /// /// public UpdateFunctionCodeResponse UpdateFunctionCodeSync(UpdateFunctionCodeRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "UpdateFunctionCode"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入参数更新函数配置。 /// /// /// public async Task UpdateFunctionConfiguration(UpdateFunctionConfigurationRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "UpdateFunctionConfiguration"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口根据传入参数更新函数配置。 /// /// /// public UpdateFunctionConfigurationResponse UpdateFunctionConfigurationSync(UpdateFunctionConfigurationRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "UpdateFunctionConfiguration"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 更新命名空间 /// /// /// public async Task UpdateNamespace(UpdateNamespaceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "UpdateNamespace"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 更新命名空间 /// /// /// public UpdateNamespaceResponse UpdateNamespaceSync(UpdateNamespaceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "UpdateNamespace"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } } }