diff --git a/CHANGELOG b/CHANGELOG index ef0dd03a3..65a3085d2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-04-09 Version: 1.36.348 +- Add prometheus api AddGrafana and AddIntegration. + 2020-04-09 Version: 1.36.347 - Generated 2018-03-13 for `retailcloud`. diff --git a/VERSION b/VERSION index 81a8b4acb..cf2818ac3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.347 \ No newline at end of file +1.36.348 \ No newline at end of file diff --git a/arms/CMakeLists.txt b/arms/CMakeLists.txt index d6853b0a0..131d43a6b 100644 --- a/arms/CMakeLists.txt +++ b/arms/CMakeLists.txt @@ -21,6 +21,10 @@ set(arms_public_header include/alibabacloud/arms/ARMSExport.h ) set(arms_public_header_model + include/alibabacloud/arms/model/AddGrafanaRequest.h + include/alibabacloud/arms/model/AddGrafanaResult.h + include/alibabacloud/arms/model/AddIntegrationRequest.h + include/alibabacloud/arms/model/AddIntegrationResult.h include/alibabacloud/arms/model/CreateAlertContactRequest.h include/alibabacloud/arms/model/CreateAlertContactResult.h include/alibabacloud/arms/model/CreateAlertContactGroupRequest.h @@ -90,6 +94,10 @@ set(arms_public_header_model set(arms_src src/ARMSClient.cc + src/model/AddGrafanaRequest.cc + src/model/AddGrafanaResult.cc + src/model/AddIntegrationRequest.cc + src/model/AddIntegrationResult.cc src/model/CreateAlertContactRequest.cc src/model/CreateAlertContactResult.cc src/model/CreateAlertContactGroupRequest.cc diff --git a/arms/include/alibabacloud/arms/ARMSClient.h b/arms/include/alibabacloud/arms/ARMSClient.h index fe94e9182..5ce929da1 100644 --- a/arms/include/alibabacloud/arms/ARMSClient.h +++ b/arms/include/alibabacloud/arms/ARMSClient.h @@ -22,6 +22,10 @@ #include #include #include "ARMSExport.h" +#include "model/AddGrafanaRequest.h" +#include "model/AddGrafanaResult.h" +#include "model/AddIntegrationRequest.h" +#include "model/AddIntegrationResult.h" #include "model/CreateAlertContactRequest.h" #include "model/CreateAlertContactResult.h" #include "model/CreateAlertContactGroupRequest.h" @@ -97,6 +101,12 @@ namespace AlibabaCloud class ALIBABACLOUD_ARMS_EXPORT ARMSClient : public RpcServiceClient { public: + typedef Outcome AddGrafanaOutcome; + typedef std::future AddGrafanaOutcomeCallable; + typedef std::function&)> AddGrafanaAsyncHandler; + typedef Outcome AddIntegrationOutcome; + typedef std::future AddIntegrationOutcomeCallable; + typedef std::function&)> AddIntegrationAsyncHandler; typedef Outcome CreateAlertContactOutcome; typedef std::future CreateAlertContactOutcomeCallable; typedef std::function&)> CreateAlertContactAsyncHandler; @@ -201,6 +211,12 @@ namespace AlibabaCloud ARMSClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); ARMSClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); ~ARMSClient(); + AddGrafanaOutcome addGrafana(const Model::AddGrafanaRequest &request)const; + void addGrafanaAsync(const Model::AddGrafanaRequest& request, const AddGrafanaAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + AddGrafanaOutcomeCallable addGrafanaCallable(const Model::AddGrafanaRequest& request) const; + AddIntegrationOutcome addIntegration(const Model::AddIntegrationRequest &request)const; + void addIntegrationAsync(const Model::AddIntegrationRequest& request, const AddIntegrationAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + AddIntegrationOutcomeCallable addIntegrationCallable(const Model::AddIntegrationRequest& request) const; CreateAlertContactOutcome createAlertContact(const Model::CreateAlertContactRequest &request)const; void createAlertContactAsync(const Model::CreateAlertContactRequest& request, const CreateAlertContactAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; CreateAlertContactOutcomeCallable createAlertContactCallable(const Model::CreateAlertContactRequest& request) const; diff --git a/arms/include/alibabacloud/arms/model/AddGrafanaRequest.h b/arms/include/alibabacloud/arms/model/AddGrafanaRequest.h new file mode 100644 index 000000000..7de6fb42c --- /dev/null +++ b/arms/include/alibabacloud/arms/model/AddGrafanaRequest.h @@ -0,0 +1,54 @@ +/* + * Copyright 2009-2017 Alibaba Cloud 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. + */ + +#ifndef ALIBABACLOUD_ARMS_MODEL_ADDGRAFANAREQUEST_H_ +#define ALIBABACLOUD_ARMS_MODEL_ADDGRAFANAREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT AddGrafanaRequest : public RpcServiceRequest + { + + public: + AddGrafanaRequest(); + ~AddGrafanaRequest(); + + std::string getRegionId()const; + void setRegionId(const std::string& regionId); + std::string getIntegration()const; + void setIntegration(const std::string& integration); + std::string getClusterId()const; + void setClusterId(const std::string& clusterId); + + private: + std::string regionId_; + std::string integration_; + std::string clusterId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_ADDGRAFANAREQUEST_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/AddGrafanaResult.h b/arms/include/alibabacloud/arms/model/AddGrafanaResult.h new file mode 100644 index 000000000..5ef384873 --- /dev/null +++ b/arms/include/alibabacloud/arms/model/AddGrafanaResult.h @@ -0,0 +1,51 @@ +/* + * Copyright 2009-2017 Alibaba Cloud 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. + */ + +#ifndef ALIBABACLOUD_ARMS_MODEL_ADDGRAFANARESULT_H_ +#define ALIBABACLOUD_ARMS_MODEL_ADDGRAFANARESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT AddGrafanaResult : public ServiceResult + { + public: + + + AddGrafanaResult(); + explicit AddGrafanaResult(const std::string &payload); + ~AddGrafanaResult(); + std::string getData()const; + + protected: + void parse(const std::string &payload); + private: + std::string data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_ADDGRAFANARESULT_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/AddIntegrationRequest.h b/arms/include/alibabacloud/arms/model/AddIntegrationRequest.h new file mode 100644 index 000000000..1f7a0332c --- /dev/null +++ b/arms/include/alibabacloud/arms/model/AddIntegrationRequest.h @@ -0,0 +1,54 @@ +/* + * Copyright 2009-2017 Alibaba Cloud 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. + */ + +#ifndef ALIBABACLOUD_ARMS_MODEL_ADDINTEGRATIONREQUEST_H_ +#define ALIBABACLOUD_ARMS_MODEL_ADDINTEGRATIONREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT AddIntegrationRequest : public RpcServiceRequest + { + + public: + AddIntegrationRequest(); + ~AddIntegrationRequest(); + + std::string getRegionId()const; + void setRegionId(const std::string& regionId); + std::string getIntegration()const; + void setIntegration(const std::string& integration); + std::string getClusterId()const; + void setClusterId(const std::string& clusterId); + + private: + std::string regionId_; + std::string integration_; + std::string clusterId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_ADDINTEGRATIONREQUEST_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/AddIntegrationResult.h b/arms/include/alibabacloud/arms/model/AddIntegrationResult.h new file mode 100644 index 000000000..c0b127acf --- /dev/null +++ b/arms/include/alibabacloud/arms/model/AddIntegrationResult.h @@ -0,0 +1,51 @@ +/* + * Copyright 2009-2017 Alibaba Cloud 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. + */ + +#ifndef ALIBABACLOUD_ARMS_MODEL_ADDINTEGRATIONRESULT_H_ +#define ALIBABACLOUD_ARMS_MODEL_ADDINTEGRATIONRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ARMS + { + namespace Model + { + class ALIBABACLOUD_ARMS_EXPORT AddIntegrationResult : public ServiceResult + { + public: + + + AddIntegrationResult(); + explicit AddIntegrationResult(const std::string &payload); + ~AddIntegrationResult(); + std::string getData()const; + + protected: + void parse(const std::string &payload); + private: + std::string data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_ARMS_MODEL_ADDINTEGRATIONRESULT_H_ \ No newline at end of file diff --git a/arms/include/alibabacloud/arms/model/SearchAlertRulesResult.h b/arms/include/alibabacloud/arms/model/SearchAlertRulesResult.h index 176d4f7e0..2e3745fa6 100644 --- a/arms/include/alibabacloud/arms/model/SearchAlertRulesResult.h +++ b/arms/include/alibabacloud/arms/model/SearchAlertRulesResult.h @@ -34,14 +34,14 @@ namespace AlibabaCloud public: struct PageBean { - struct AlertRule + struct AlertRuleEntity { struct AlarmContext { std::string alarmContentTemplate; std::string alarmContentSubTitle; }; - struct AlertRule1 + struct AlertRule { struct Rule { @@ -89,16 +89,16 @@ namespace AlibabaCloud std::string contactGroupIdList; Notice notice; std::string userId; - AlertRule1 alertRule1; std::string alertTitle; long updateTime; std::string alertLevel; long id; std::string regionId; + AlertRule alertRule; }; int totalCount; int pageSize; - std::vector alertRules; + std::vector alertRules; int pageNumber; }; diff --git a/arms/src/ARMSClient.cc b/arms/src/ARMSClient.cc index 9fd4e2cd9..26d23d2cf 100644 --- a/arms/src/ARMSClient.cc +++ b/arms/src/ARMSClient.cc @@ -51,6 +51,78 @@ ARMSClient::ARMSClient(const std::string & accessKeyId, const std::string & acce ARMSClient::~ARMSClient() {} +ARMSClient::AddGrafanaOutcome ARMSClient::addGrafana(const AddGrafanaRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return AddGrafanaOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return AddGrafanaOutcome(AddGrafanaResult(outcome.result())); + else + return AddGrafanaOutcome(outcome.error()); +} + +void ARMSClient::addGrafanaAsync(const AddGrafanaRequest& request, const AddGrafanaAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, addGrafana(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ARMSClient::AddGrafanaOutcomeCallable ARMSClient::addGrafanaCallable(const AddGrafanaRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->addGrafana(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +ARMSClient::AddIntegrationOutcome ARMSClient::addIntegration(const AddIntegrationRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return AddIntegrationOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return AddIntegrationOutcome(AddIntegrationResult(outcome.result())); + else + return AddIntegrationOutcome(outcome.error()); +} + +void ARMSClient::addIntegrationAsync(const AddIntegrationRequest& request, const AddIntegrationAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, addIntegration(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ARMSClient::AddIntegrationOutcomeCallable ARMSClient::addIntegrationCallable(const AddIntegrationRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->addIntegration(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ARMSClient::CreateAlertContactOutcome ARMSClient::createAlertContact(const CreateAlertContactRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/arms/src/model/AddGrafanaRequest.cc b/arms/src/model/AddGrafanaRequest.cc new file mode 100644 index 000000000..cc7935da9 --- /dev/null +++ b/arms/src/model/AddGrafanaRequest.cc @@ -0,0 +1,62 @@ +/* + * Copyright 2009-2017 Alibaba Cloud 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. + */ + +#include + +using AlibabaCloud::ARMS::Model::AddGrafanaRequest; + +AddGrafanaRequest::AddGrafanaRequest() : + RpcServiceRequest("arms", "2019-08-08", "AddGrafana") +{ + setMethod(HttpRequest::Method::Post); +} + +AddGrafanaRequest::~AddGrafanaRequest() +{} + +std::string AddGrafanaRequest::getRegionId()const +{ + return regionId_; +} + +void AddGrafanaRequest::setRegionId(const std::string& regionId) +{ + regionId_ = regionId; + setParameter("RegionId", regionId); +} + +std::string AddGrafanaRequest::getIntegration()const +{ + return integration_; +} + +void AddGrafanaRequest::setIntegration(const std::string& integration) +{ + integration_ = integration; + setParameter("Integration", integration); +} + +std::string AddGrafanaRequest::getClusterId()const +{ + return clusterId_; +} + +void AddGrafanaRequest::setClusterId(const std::string& clusterId) +{ + clusterId_ = clusterId; + setParameter("ClusterId", clusterId); +} + diff --git a/arms/src/model/AddGrafanaResult.cc b/arms/src/model/AddGrafanaResult.cc new file mode 100644 index 000000000..eb10a2082 --- /dev/null +++ b/arms/src/model/AddGrafanaResult.cc @@ -0,0 +1,51 @@ +/* + * Copyright 2009-2017 Alibaba Cloud 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. + */ + +#include +#include + +using namespace AlibabaCloud::ARMS; +using namespace AlibabaCloud::ARMS::Model; + +AddGrafanaResult::AddGrafanaResult() : + ServiceResult() +{} + +AddGrafanaResult::AddGrafanaResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +AddGrafanaResult::~AddGrafanaResult() +{} + +void AddGrafanaResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["Data"].isNull()) + data_ = value["Data"].asString(); + +} + +std::string AddGrafanaResult::getData()const +{ + return data_; +} + diff --git a/arms/src/model/AddIntegrationRequest.cc b/arms/src/model/AddIntegrationRequest.cc new file mode 100644 index 000000000..f98356324 --- /dev/null +++ b/arms/src/model/AddIntegrationRequest.cc @@ -0,0 +1,62 @@ +/* + * Copyright 2009-2017 Alibaba Cloud 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. + */ + +#include + +using AlibabaCloud::ARMS::Model::AddIntegrationRequest; + +AddIntegrationRequest::AddIntegrationRequest() : + RpcServiceRequest("arms", "2019-08-08", "AddIntegration") +{ + setMethod(HttpRequest::Method::Post); +} + +AddIntegrationRequest::~AddIntegrationRequest() +{} + +std::string AddIntegrationRequest::getRegionId()const +{ + return regionId_; +} + +void AddIntegrationRequest::setRegionId(const std::string& regionId) +{ + regionId_ = regionId; + setParameter("RegionId", regionId); +} + +std::string AddIntegrationRequest::getIntegration()const +{ + return integration_; +} + +void AddIntegrationRequest::setIntegration(const std::string& integration) +{ + integration_ = integration; + setParameter("Integration", integration); +} + +std::string AddIntegrationRequest::getClusterId()const +{ + return clusterId_; +} + +void AddIntegrationRequest::setClusterId(const std::string& clusterId) +{ + clusterId_ = clusterId; + setParameter("ClusterId", clusterId); +} + diff --git a/arms/src/model/AddIntegrationResult.cc b/arms/src/model/AddIntegrationResult.cc new file mode 100644 index 000000000..8f67d7c53 --- /dev/null +++ b/arms/src/model/AddIntegrationResult.cc @@ -0,0 +1,51 @@ +/* + * Copyright 2009-2017 Alibaba Cloud 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. + */ + +#include +#include + +using namespace AlibabaCloud::ARMS; +using namespace AlibabaCloud::ARMS::Model; + +AddIntegrationResult::AddIntegrationResult() : + ServiceResult() +{} + +AddIntegrationResult::AddIntegrationResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +AddIntegrationResult::~AddIntegrationResult() +{} + +void AddIntegrationResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["Data"].isNull()) + data_ = value["Data"].asString(); + +} + +std::string AddIntegrationResult::getData()const +{ + return data_; +} + diff --git a/arms/src/model/SearchAlertRulesResult.cc b/arms/src/model/SearchAlertRulesResult.cc index 3703c7631..b868421fa 100644 --- a/arms/src/model/SearchAlertRulesResult.cc +++ b/arms/src/model/SearchAlertRulesResult.cc @@ -46,98 +46,98 @@ void SearchAlertRulesResult::parse(const std::string &payload) pageBean_.pageNumber = std::stoi(pageBeanNode["PageNumber"].asString()); if(!pageBeanNode["PageSize"].isNull()) pageBean_.pageSize = std::stoi(pageBeanNode["PageSize"].asString()); - auto allAlertRulesNode = pageBeanNode["AlertRules"]["AlertRule"]; - for (auto pageBeanNodeAlertRulesAlertRule : allAlertRulesNode) + auto allAlertRulesNode = pageBeanNode["AlertRules"]["AlertRuleEntity"]; + for (auto pageBeanNodeAlertRulesAlertRuleEntity : allAlertRulesNode) { - PageBean::AlertRule alertRuleObject; - if(!pageBeanNodeAlertRulesAlertRule["AlertTitle"].isNull()) - alertRuleObject.alertTitle = pageBeanNodeAlertRulesAlertRule["AlertTitle"].asString(); - if(!pageBeanNodeAlertRulesAlertRule["AlertLevel"].isNull()) - alertRuleObject.alertLevel = pageBeanNodeAlertRulesAlertRule["AlertLevel"].asString(); - if(!pageBeanNodeAlertRulesAlertRule["AlertType"].isNull()) - alertRuleObject.alertType = std::stoi(pageBeanNodeAlertRulesAlertRule["AlertType"].asString()); - if(!pageBeanNodeAlertRulesAlertRule["AlertVersion"].isNull()) - alertRuleObject.alertVersion = std::stoi(pageBeanNodeAlertRulesAlertRule["AlertVersion"].asString()); - if(!pageBeanNodeAlertRulesAlertRule["Config"].isNull()) - alertRuleObject.config = pageBeanNodeAlertRulesAlertRule["Config"].asString(); - if(!pageBeanNodeAlertRulesAlertRule["ContactGroupIdList"].isNull()) - alertRuleObject.contactGroupIdList = pageBeanNodeAlertRulesAlertRule["ContactGroupIdList"].asString(); - if(!pageBeanNodeAlertRulesAlertRule["CreateTime"].isNull()) - alertRuleObject.createTime = std::stol(pageBeanNodeAlertRulesAlertRule["CreateTime"].asString()); - if(!pageBeanNodeAlertRulesAlertRule["Id"].isNull()) - alertRuleObject.id = std::stol(pageBeanNodeAlertRulesAlertRule["Id"].asString()); - if(!pageBeanNodeAlertRulesAlertRule["RegionId"].isNull()) - alertRuleObject.regionId = pageBeanNodeAlertRulesAlertRule["RegionId"].asString(); - if(!pageBeanNodeAlertRulesAlertRule["Status"].isNull()) - alertRuleObject.status = pageBeanNodeAlertRulesAlertRule["Status"].asString(); - if(!pageBeanNodeAlertRulesAlertRule["TaskId"].isNull()) - alertRuleObject.taskId = std::stol(pageBeanNodeAlertRulesAlertRule["TaskId"].asString()); - if(!pageBeanNodeAlertRulesAlertRule["TaskStatus"].isNull()) - alertRuleObject.taskStatus = pageBeanNodeAlertRulesAlertRule["TaskStatus"].asString(); - if(!pageBeanNodeAlertRulesAlertRule["UpdateTime"].isNull()) - alertRuleObject.updateTime = std::stol(pageBeanNodeAlertRulesAlertRule["UpdateTime"].asString()); - if(!pageBeanNodeAlertRulesAlertRule["UserId"].isNull()) - alertRuleObject.userId = pageBeanNodeAlertRulesAlertRule["UserId"].asString(); + PageBean::AlertRuleEntity alertRuleEntityObject; + if(!pageBeanNodeAlertRulesAlertRuleEntity["AlertTitle"].isNull()) + alertRuleEntityObject.alertTitle = pageBeanNodeAlertRulesAlertRuleEntity["AlertTitle"].asString(); + if(!pageBeanNodeAlertRulesAlertRuleEntity["AlertLevel"].isNull()) + alertRuleEntityObject.alertLevel = pageBeanNodeAlertRulesAlertRuleEntity["AlertLevel"].asString(); + if(!pageBeanNodeAlertRulesAlertRuleEntity["AlertType"].isNull()) + alertRuleEntityObject.alertType = std::stoi(pageBeanNodeAlertRulesAlertRuleEntity["AlertType"].asString()); + if(!pageBeanNodeAlertRulesAlertRuleEntity["AlertVersion"].isNull()) + alertRuleEntityObject.alertVersion = std::stoi(pageBeanNodeAlertRulesAlertRuleEntity["AlertVersion"].asString()); + if(!pageBeanNodeAlertRulesAlertRuleEntity["Config"].isNull()) + alertRuleEntityObject.config = pageBeanNodeAlertRulesAlertRuleEntity["Config"].asString(); + if(!pageBeanNodeAlertRulesAlertRuleEntity["ContactGroupIdList"].isNull()) + alertRuleEntityObject.contactGroupIdList = pageBeanNodeAlertRulesAlertRuleEntity["ContactGroupIdList"].asString(); + if(!pageBeanNodeAlertRulesAlertRuleEntity["CreateTime"].isNull()) + alertRuleEntityObject.createTime = std::stol(pageBeanNodeAlertRulesAlertRuleEntity["CreateTime"].asString()); + if(!pageBeanNodeAlertRulesAlertRuleEntity["Id"].isNull()) + alertRuleEntityObject.id = std::stol(pageBeanNodeAlertRulesAlertRuleEntity["Id"].asString()); + if(!pageBeanNodeAlertRulesAlertRuleEntity["RegionId"].isNull()) + alertRuleEntityObject.regionId = pageBeanNodeAlertRulesAlertRuleEntity["RegionId"].asString(); + if(!pageBeanNodeAlertRulesAlertRuleEntity["Status"].isNull()) + alertRuleEntityObject.status = pageBeanNodeAlertRulesAlertRuleEntity["Status"].asString(); + if(!pageBeanNodeAlertRulesAlertRuleEntity["TaskId"].isNull()) + alertRuleEntityObject.taskId = std::stol(pageBeanNodeAlertRulesAlertRuleEntity["TaskId"].asString()); + if(!pageBeanNodeAlertRulesAlertRuleEntity["TaskStatus"].isNull()) + alertRuleEntityObject.taskStatus = pageBeanNodeAlertRulesAlertRuleEntity["TaskStatus"].asString(); + if(!pageBeanNodeAlertRulesAlertRuleEntity["UpdateTime"].isNull()) + alertRuleEntityObject.updateTime = std::stol(pageBeanNodeAlertRulesAlertRuleEntity["UpdateTime"].asString()); + if(!pageBeanNodeAlertRulesAlertRuleEntity["UserId"].isNull()) + alertRuleEntityObject.userId = pageBeanNodeAlertRulesAlertRuleEntity["UserId"].asString(); auto alarmContextNode = value["AlarmContext"]; if(!alarmContextNode["AlarmContentTemplate"].isNull()) - alertRuleObject.alarmContext.alarmContentTemplate = alarmContextNode["AlarmContentTemplate"].asString(); + alertRuleEntityObject.alarmContext.alarmContentTemplate = alarmContextNode["AlarmContentTemplate"].asString(); if(!alarmContextNode["AlarmContentSubTitle"].isNull()) - alertRuleObject.alarmContext.alarmContentSubTitle = alarmContextNode["AlarmContentSubTitle"].asString(); - auto alertRule1Node = value["AlertRule"]; - if(!alertRule1Node["Operator"].isNull()) - alertRuleObject.alertRule1._operator = alertRule1Node["Operator"].asString(); - auto allRulesNode = alertRule1Node["Rules"]["Rule"]; - for (auto alertRule1NodeRulesRule : allRulesNode) + alertRuleEntityObject.alarmContext.alarmContentSubTitle = alarmContextNode["AlarmContentSubTitle"].asString(); + auto alertRuleNode = value["AlertRule"]; + if(!alertRuleNode["Operator"].isNull()) + alertRuleEntityObject.alertRule._operator = alertRuleNode["Operator"].asString(); + auto allRulesNode = alertRuleNode["Rules"]["Rule"]; + for (auto alertRuleNodeRulesRule : allRulesNode) { - PageBean::AlertRule::AlertRule1::Rule ruleObject; - if(!alertRule1NodeRulesRule["Aggregates"].isNull()) - ruleObject.aggregates = alertRule1NodeRulesRule["Aggregates"].asString(); - if(!alertRule1NodeRulesRule["Alias"].isNull()) - ruleObject.alias = alertRule1NodeRulesRule["Alias"].asString(); - if(!alertRule1NodeRulesRule["Measure"].isNull()) - ruleObject.measure = alertRule1NodeRulesRule["Measure"].asString(); - if(!alertRule1NodeRulesRule["NValue"].isNull()) - ruleObject.nValue = std::stoi(alertRule1NodeRulesRule["NValue"].asString()); - if(!alertRule1NodeRulesRule["Operator"].isNull()) - ruleObject._operator = alertRule1NodeRulesRule["Operator"].asString(); - if(!alertRule1NodeRulesRule["Value"].isNull()) - ruleObject.value = std::stof(alertRule1NodeRulesRule["Value"].asString()); - alertRuleObject.alertRule1.rules.push_back(ruleObject); + PageBean::AlertRuleEntity::AlertRule::Rule ruleObject; + if(!alertRuleNodeRulesRule["Aggregates"].isNull()) + ruleObject.aggregates = alertRuleNodeRulesRule["Aggregates"].asString(); + if(!alertRuleNodeRulesRule["Alias"].isNull()) + ruleObject.alias = alertRuleNodeRulesRule["Alias"].asString(); + if(!alertRuleNodeRulesRule["Measure"].isNull()) + ruleObject.measure = alertRuleNodeRulesRule["Measure"].asString(); + if(!alertRuleNodeRulesRule["NValue"].isNull()) + ruleObject.nValue = std::stoi(alertRuleNodeRulesRule["NValue"].asString()); + if(!alertRuleNodeRulesRule["Operator"].isNull()) + ruleObject._operator = alertRuleNodeRulesRule["Operator"].asString(); + if(!alertRuleNodeRulesRule["Value"].isNull()) + ruleObject.value = std::stof(alertRuleNodeRulesRule["Value"].asString()); + alertRuleEntityObject.alertRule.rules.push_back(ruleObject); } auto metricParamNode = value["MetricParam"]; if(!metricParamNode["AppGroupId"].isNull()) - alertRuleObject.metricParam.appGroupId = metricParamNode["AppGroupId"].asString(); + alertRuleEntityObject.metricParam.appGroupId = metricParamNode["AppGroupId"].asString(); if(!metricParamNode["AppId"].isNull()) - alertRuleObject.metricParam.appId = metricParamNode["AppId"].asString(); + alertRuleEntityObject.metricParam.appId = metricParamNode["AppId"].asString(); if(!metricParamNode["Pid"].isNull()) - alertRuleObject.metricParam.pid = metricParamNode["Pid"].asString(); + alertRuleEntityObject.metricParam.pid = metricParamNode["Pid"].asString(); if(!metricParamNode["Type"].isNull()) - alertRuleObject.metricParam.type = metricParamNode["Type"].asString(); + alertRuleEntityObject.metricParam.type = metricParamNode["Type"].asString(); auto allDimensionsNode = metricParamNode["Dimensions"]["Dimension"]; for (auto metricParamNodeDimensionsDimension : allDimensionsNode) { - PageBean::AlertRule::MetricParam::Dimension dimensionObject; + PageBean::AlertRuleEntity::MetricParam::Dimension dimensionObject; if(!metricParamNodeDimensionsDimension["Key"].isNull()) dimensionObject.key = metricParamNodeDimensionsDimension["Key"].asString(); if(!metricParamNodeDimensionsDimension["Type"].isNull()) dimensionObject.type = metricParamNodeDimensionsDimension["Type"].asString(); if(!metricParamNodeDimensionsDimension["Value"].isNull()) dimensionObject.value = metricParamNodeDimensionsDimension["Value"].asString(); - alertRuleObject.metricParam.dimensions.push_back(dimensionObject); + alertRuleEntityObject.metricParam.dimensions.push_back(dimensionObject); } auto noticeNode = value["Notice"]; if(!noticeNode["EndTime"].isNull()) - alertRuleObject.notice.endTime = std::stol(noticeNode["EndTime"].asString()); + alertRuleEntityObject.notice.endTime = std::stol(noticeNode["EndTime"].asString()); if(!noticeNode["NoticeEndTime"].isNull()) - alertRuleObject.notice.noticeEndTime = std::stol(noticeNode["NoticeEndTime"].asString()); + alertRuleEntityObject.notice.noticeEndTime = std::stol(noticeNode["NoticeEndTime"].asString()); if(!noticeNode["NoticeStartTime"].isNull()) - alertRuleObject.notice.noticeStartTime = std::stol(noticeNode["NoticeStartTime"].asString()); + alertRuleEntityObject.notice.noticeStartTime = std::stol(noticeNode["NoticeStartTime"].asString()); if(!noticeNode["StartTime"].isNull()) - alertRuleObject.notice.startTime = std::stol(noticeNode["StartTime"].asString()); + alertRuleEntityObject.notice.startTime = std::stol(noticeNode["StartTime"].asString()); auto allAlertWays = value["AlertWays"]["AlertWay"]; for (auto value : allAlertWays) - alertRuleObject.alertWays.push_back(value.asString()); - pageBean_.alertRules.push_back(alertRuleObject); + alertRuleEntityObject.alertWays.push_back(value.asString()); + pageBean_.alertRules.push_back(alertRuleEntityObject); } }