/* * 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.Emr.V20190103 { using Newtonsoft.Json; using System.Threading.Tasks; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Emr.V20190103.Models; public class EmrClient : AbstractClient{ private const string endpoint = "emr.tencentcloudapi.com"; private const string version = "2019-01-03"; /// /// Client constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". public EmrClient(Credential credential, string region) : this(credential, region, new ClientProfile()) { } /// /// Client Constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". /// Client profiles. public EmrClient(Credential credential, string region, ClientProfile profile) : base(endpoint, version, credential, region, profile) { } /// /// 创建EMR实例 /// /// /// public async Task CreateInstance(CreateInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建EMR实例 /// /// /// public CreateInstanceResponse CreateInstanceSync(CreateInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询硬件节点信息 /// /// /// public async Task DescribeClusterNodes(DescribeClusterNodesRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeClusterNodes"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询硬件节点信息 /// /// /// public DescribeClusterNodesResponse DescribeClusterNodesSync(DescribeClusterNodesRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeClusterNodes"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询EMR实例 /// /// /// public async Task DescribeInstances(DescribeInstancesRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeInstances"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询EMR实例 /// /// /// public DescribeInstancesResponse DescribeInstancesSync(DescribeInstancesRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeInstances"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建实例询价 /// /// /// public async Task InquiryPriceCreateInstance(InquiryPriceCreateInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "InquiryPriceCreateInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建实例询价 /// /// /// public InquiryPriceCreateInstanceResponse InquiryPriceCreateInstanceSync(InquiryPriceCreateInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "InquiryPriceCreateInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 续费询价。 /// /// /// public async Task InquiryPriceRenewInstance(InquiryPriceRenewInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "InquiryPriceRenewInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 续费询价。 /// /// /// public InquiryPriceRenewInstanceResponse InquiryPriceRenewInstanceSync(InquiryPriceRenewInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "InquiryPriceRenewInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 扩容询价. 当扩容时候,请通过该接口查询价格。 /// /// /// public async Task InquiryPriceScaleOutInstance(InquiryPriceScaleOutInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "InquiryPriceScaleOutInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 扩容询价. 当扩容时候,请通过该接口查询价格。 /// /// /// public InquiryPriceScaleOutInstanceResponse InquiryPriceScaleOutInstanceSync(InquiryPriceScaleOutInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "InquiryPriceScaleOutInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 变配询价 /// /// /// public async Task InquiryPriceUpdateInstance(InquiryPriceUpdateInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "InquiryPriceUpdateInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 变配询价 /// /// /// public InquiryPriceUpdateInstanceResponse InquiryPriceUpdateInstanceSync(InquiryPriceUpdateInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "InquiryPriceUpdateInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 实例扩容 /// /// /// public async Task ScaleOutInstance(ScaleOutInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ScaleOutInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 实例扩容 /// /// /// public ScaleOutInstanceResponse ScaleOutInstanceSync(ScaleOutInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ScaleOutInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 销毁EMR实例。此接口仅支持弹性MapReduce正式计费版本。 /// /// /// public async Task TerminateInstance(TerminateInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "TerminateInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 销毁EMR实例。此接口仅支持弹性MapReduce正式计费版本。 /// /// /// public TerminateInstanceResponse TerminateInstanceSync(TerminateInstanceRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "TerminateInstance"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 缩容Task节点 /// /// /// public async Task TerminateTasks(TerminateTasksRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "TerminateTasks"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 缩容Task节点 /// /// /// public TerminateTasksResponse TerminateTasksSync(TerminateTasksRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "TerminateTasks"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } } }