/* * 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.Monitor.V20180724 { using Newtonsoft.Json; using System.Threading.Tasks; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Monitor.V20180724.Models; public class MonitorClient : AbstractClient{ private const string endpoint = "monitor.tencentcloudapi.com"; private const string version = "2018-07-24"; /// /// Client constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". public MonitorClient(Credential credential, string region) : this(credential, region, new ClientProfile()) { } /// /// Client Constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". /// Client profiles. public MonitorClient(Credential credential, string region, ClientProfile profile) : base(endpoint, version, credential, region, profile) { } /// /// 将告警策略绑定到特定对象 /// /// /// public async Task BindingPolicyObject(BindingPolicyObjectRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "BindingPolicyObject"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 将告警策略绑定到特定对象 /// /// /// public BindingPolicyObjectResponse BindingPolicyObjectSync(BindingPolicyObjectRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "BindingPolicyObject"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 增加策略组 /// /// /// public async Task CreatePolicyGroup(CreatePolicyGroupRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreatePolicyGroup"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 增加策略组 /// /// /// public CreatePolicyGroupResponse CreatePolicyGroupSync(CreatePolicyGroupRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreatePolicyGroup"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除告警策略组 /// /// /// public async Task DeletePolicyGroup(DeletePolicyGroupRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeletePolicyGroup"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除告警策略组 /// /// /// public DeletePolicyGroupResponse DeletePolicyGroupSync(DeletePolicyGroupRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeletePolicyGroup"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取平台事件列表 /// /// /// public async Task DescribeAccidentEventList(DescribeAccidentEventListRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeAccidentEventList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取平台事件列表 /// /// /// public DescribeAccidentEventListResponse DescribeAccidentEventListSync(DescribeAccidentEventListRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeAccidentEventList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础指标详情 /// /// /// public async Task DescribeBaseMetrics(DescribeBaseMetricsRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeBaseMetrics"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础指标详情 /// /// /// public DescribeBaseMetricsResponse DescribeBaseMetricsSync(DescribeBaseMetricsRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeBaseMetrics"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础告警列表 /// /// /// public async Task DescribeBasicAlarmList(DescribeBasicAlarmListRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeBasicAlarmList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础告警列表 /// /// /// public DescribeBasicAlarmListResponse DescribeBasicAlarmListSync(DescribeBasicAlarmListRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeBasicAlarmList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取已绑定对象列表 /// /// /// public async Task DescribeBindingPolicyObjectList(DescribeBindingPolicyObjectListRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeBindingPolicyObjectList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取已绑定对象列表 /// /// /// public DescribeBindingPolicyObjectListResponse DescribeBindingPolicyObjectListSync(DescribeBindingPolicyObjectListRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeBindingPolicyObjectList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础告警策略条件 /// /// /// public async Task DescribePolicyConditionList(DescribePolicyConditionListRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribePolicyConditionList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础告警策略条件 /// /// /// public DescribePolicyConditionListResponse DescribePolicyConditionListSync(DescribePolicyConditionListRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribePolicyConditionList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础策略组详情 /// /// /// public async Task DescribePolicyGroupInfo(DescribePolicyGroupInfoRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribePolicyGroupInfo"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础策略组详情 /// /// /// public DescribePolicyGroupInfoResponse DescribePolicyGroupInfoSync(DescribePolicyGroupInfoRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribePolicyGroupInfo"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础策略告警组列表 /// /// /// public async Task DescribePolicyGroupList(DescribePolicyGroupListRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribePolicyGroupList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取基础策略告警组列表 /// /// /// public DescribePolicyGroupListResponse DescribePolicyGroupListSync(DescribePolicyGroupListRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribePolicyGroupList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 分页获取产品事件的列表 /// /// /// public async Task DescribeProductEventList(DescribeProductEventListRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeProductEventList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 分页获取产品事件的列表 /// /// /// public DescribeProductEventListResponse DescribeProductEventListSync(DescribeProductEventListRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeProductEventList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取云产品的监控数据。传入产品的命名空间、对象维度描述和监控指标即可获得相应的监控数据。 /// 接口调用频率限制为:20次/秒,1200次/分钟。 /// 若您需要调用的指标、对象较多,可能存在因限频出现拉取失败的情况,建议尽量将请求按时间维度均摊。 /// /// /// public async Task GetMonitorData(GetMonitorDataRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetMonitorData"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取云产品的监控数据。传入产品的命名空间、对象维度描述和监控指标即可获得相应的监控数据。 /// 接口调用频率限制为:20次/秒,1200次/分钟。 /// 若您需要调用的指标、对象较多,可能存在因限频出现拉取失败的情况,建议尽量将请求按时间维度均摊。 /// /// /// public GetMonitorDataResponse GetMonitorDataSync(GetMonitorDataRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetMonitorData"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改告警接收人 /// /// /// public async Task ModifyAlarmReceivers(ModifyAlarmReceiversRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ModifyAlarmReceivers"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改告警接收人 /// /// /// public ModifyAlarmReceiversResponse ModifyAlarmReceiversSync(ModifyAlarmReceiversRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ModifyAlarmReceivers"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 默认接口请求频率限制:50次/秒。 /// 默认单租户指标上限:100个。 /// 单次上报最多 30 个指标/值对,请求返回错误时,请求中所有的指标/值均不会被保存。 /// /// 上报的时间戳为期望保存的时间戳,建议构造整数分钟时刻的时间戳。 /// 时间戳时间范围必须为当前时间到 300 秒前之间。 /// 同一 IP 指标对的数据需按分钟先后顺序上报。 /// /// /// public async Task PutMonitorData(PutMonitorDataRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "PutMonitorData"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 默认接口请求频率限制:50次/秒。 /// 默认单租户指标上限:100个。 /// 单次上报最多 30 个指标/值对,请求返回错误时,请求中所有的指标/值均不会被保存。 /// /// 上报的时间戳为期望保存的时间戳,建议构造整数分钟时刻的时间戳。 /// 时间戳时间范围必须为当前时间到 300 秒前之间。 /// 同一 IP 指标对的数据需按分钟先后顺序上报。 /// /// /// public PutMonitorDataResponse PutMonitorDataSync(PutMonitorDataRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "PutMonitorData"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 发送自定义消息告警 /// /// /// public async Task SendCustomAlarmMsg(SendCustomAlarmMsgRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "SendCustomAlarmMsg"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 发送自定义消息告警 /// /// /// public SendCustomAlarmMsgResponse SendCustomAlarmMsgSync(SendCustomAlarmMsgRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "SendCustomAlarmMsg"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除全部的关联对象 /// /// /// public async Task UnBindingAllPolicyObject(UnBindingAllPolicyObjectRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "UnBindingAllPolicyObject"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除全部的关联对象 /// /// /// public UnBindingAllPolicyObjectResponse UnBindingAllPolicyObjectSync(UnBindingAllPolicyObjectRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "UnBindingAllPolicyObject"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除策略的关联对象 /// /// /// public async Task UnBindingPolicyObject(UnBindingPolicyObjectRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "UnBindingPolicyObject"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除策略的关联对象 /// /// /// public UnBindingPolicyObjectResponse UnBindingPolicyObjectSync(UnBindingPolicyObjectRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "UnBindingPolicyObject"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } } }