Add prometheus api AddGrafana and AddIntegration.

This commit is contained in:
sdk-team
2020-04-09 21:22:01 +08:00
parent abfdc41f3b
commit 485d712ddd
15 changed files with 604 additions and 69 deletions

View File

@@ -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`.

View File

@@ -1 +1 @@
1.36.347
1.36.348

View File

@@ -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

View File

@@ -22,6 +22,10 @@
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#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<Error, Model::AddGrafanaResult> AddGrafanaOutcome;
typedef std::future<AddGrafanaOutcome> AddGrafanaOutcomeCallable;
typedef std::function<void(const ARMSClient*, const Model::AddGrafanaRequest&, const AddGrafanaOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> AddGrafanaAsyncHandler;
typedef Outcome<Error, Model::AddIntegrationResult> AddIntegrationOutcome;
typedef std::future<AddIntegrationOutcome> AddIntegrationOutcomeCallable;
typedef std::function<void(const ARMSClient*, const Model::AddIntegrationRequest&, const AddIntegrationOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> AddIntegrationAsyncHandler;
typedef Outcome<Error, Model::CreateAlertContactResult> CreateAlertContactOutcome;
typedef std::future<CreateAlertContactOutcome> CreateAlertContactOutcomeCallable;
typedef std::function<void(const ARMSClient*, const Model::CreateAlertContactRequest&, const CreateAlertContactOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateAlertContactAsyncHandler;
@@ -201,6 +211,12 @@ namespace AlibabaCloud
ARMSClient(const std::shared_ptr<CredentialsProvider> &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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
CreateAlertContactOutcomeCallable createAlertContactCallable(const Model::CreateAlertContactRequest& request) const;

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/arms/ARMSExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/arms/ARMSExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/arms/ARMSExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/arms/ARMSExport.h>
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_

View File

@@ -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<AlertRule> alertRules;
std::vector<AlertRuleEntity> alertRules;
int pageNumber;
};

View File

@@ -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<const AsyncCallerContext>& 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<std::packaged_task<AddGrafanaOutcome()>>(
[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<const AsyncCallerContext>& 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<std::packaged_task<AddIntegrationOutcome()>>(
[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();

View File

@@ -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 <alibabacloud/arms/model/AddGrafanaRequest.h>
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);
}

View File

@@ -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 <alibabacloud/arms/model/AddGrafanaResult.h>
#include <json/json.h>
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_;
}

View File

@@ -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 <alibabacloud/arms/model/AddIntegrationRequest.h>
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);
}

View File

@@ -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 <alibabacloud/arms/model/AddIntegrationResult.h>
#include <json/json.h>
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_;
}

View File

@@ -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);
}
}