Add Emon-Service support.

This commit is contained in:
sdk-team
2021-06-04 03:09:49 +00:00
parent fe0018aad2
commit 77822cfe63
25 changed files with 481 additions and 501 deletions

View File

@@ -663,42 +663,6 @@ ElasticsearchClient::CreatePipelinesOutcomeCallable ElasticsearchClient::createP
return task->get_future();
}
ElasticsearchClient::CreateProjectOutcome ElasticsearchClient::createProject(const CreateProjectRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateProjectOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateProjectOutcome(CreateProjectResult(outcome.result()));
else
return CreateProjectOutcome(outcome.error());
}
void ElasticsearchClient::createProjectAsync(const CreateProjectRequest& request, const CreateProjectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createProject(request), context);
};
asyncExecute(new Runnable(fn));
}
ElasticsearchClient::CreateProjectOutcomeCallable ElasticsearchClient::createProjectCallable(const CreateProjectRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateProjectOutcome()>>(
[this, request]()
{
return this->createProject(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ElasticsearchClient::CreateSnapshotOutcome ElasticsearchClient::createSnapshot(const CreateSnapshotRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -1095,42 +1059,6 @@ ElasticsearchClient::DeletePipelinesOutcomeCallable ElasticsearchClient::deleteP
return task->get_future();
}
ElasticsearchClient::DeleteProjectOutcome ElasticsearchClient::deleteProject(const DeleteProjectRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteProjectOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteProjectOutcome(DeleteProjectResult(outcome.result()));
else
return DeleteProjectOutcome(outcome.error());
}
void ElasticsearchClient::deleteProjectAsync(const DeleteProjectRequest& request, const DeleteProjectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteProject(request), context);
};
asyncExecute(new Runnable(fn));
}
ElasticsearchClient::DeleteProjectOutcomeCallable ElasticsearchClient::deleteProjectCallable(const DeleteProjectRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteProjectOutcome()>>(
[this, request]()
{
return this->deleteProject(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ElasticsearchClient::DeleteSnapshotRepoOutcome ElasticsearchClient::deleteSnapshotRepo(const DeleteSnapshotRepoRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -1959,6 +1887,78 @@ ElasticsearchClient::GetElastictaskOutcomeCallable ElasticsearchClient::getElast
return task->get_future();
}
ElasticsearchClient::GetEmonGrafanaAlertsOutcome ElasticsearchClient::getEmonGrafanaAlerts(const GetEmonGrafanaAlertsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetEmonGrafanaAlertsOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetEmonGrafanaAlertsOutcome(GetEmonGrafanaAlertsResult(outcome.result()));
else
return GetEmonGrafanaAlertsOutcome(outcome.error());
}
void ElasticsearchClient::getEmonGrafanaAlertsAsync(const GetEmonGrafanaAlertsRequest& request, const GetEmonGrafanaAlertsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getEmonGrafanaAlerts(request), context);
};
asyncExecute(new Runnable(fn));
}
ElasticsearchClient::GetEmonGrafanaAlertsOutcomeCallable ElasticsearchClient::getEmonGrafanaAlertsCallable(const GetEmonGrafanaAlertsRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetEmonGrafanaAlertsOutcome()>>(
[this, request]()
{
return this->getEmonGrafanaAlerts(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ElasticsearchClient::GetEmonGrafanaDashboardsOutcome ElasticsearchClient::getEmonGrafanaDashboards(const GetEmonGrafanaDashboardsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetEmonGrafanaDashboardsOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetEmonGrafanaDashboardsOutcome(GetEmonGrafanaDashboardsResult(outcome.result()));
else
return GetEmonGrafanaDashboardsOutcome(outcome.error());
}
void ElasticsearchClient::getEmonGrafanaDashboardsAsync(const GetEmonGrafanaDashboardsRequest& request, const GetEmonGrafanaDashboardsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getEmonGrafanaDashboards(request), context);
};
asyncExecute(new Runnable(fn));
}
ElasticsearchClient::GetEmonGrafanaDashboardsOutcomeCallable ElasticsearchClient::getEmonGrafanaDashboardsCallable(const GetEmonGrafanaDashboardsRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetEmonGrafanaDashboardsOutcome()>>(
[this, request]()
{
return this->getEmonGrafanaDashboards(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ElasticsearchClient::GetEmonMonitorDataOutcome ElasticsearchClient::getEmonMonitorData(const GetEmonMonitorDataRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -3831,6 +3831,42 @@ ElasticsearchClient::OpenHttpsOutcomeCallable ElasticsearchClient::openHttpsCall
return task->get_future();
}
ElasticsearchClient::PostEmonTryAlarmRuleOutcome ElasticsearchClient::postEmonTryAlarmRule(const PostEmonTryAlarmRuleRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return PostEmonTryAlarmRuleOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return PostEmonTryAlarmRuleOutcome(PostEmonTryAlarmRuleResult(outcome.result()));
else
return PostEmonTryAlarmRuleOutcome(outcome.error());
}
void ElasticsearchClient::postEmonTryAlarmRuleAsync(const PostEmonTryAlarmRuleRequest& request, const PostEmonTryAlarmRuleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, postEmonTryAlarmRule(request), context);
};
asyncExecute(new Runnable(fn));
}
ElasticsearchClient::PostEmonTryAlarmRuleOutcomeCallable ElasticsearchClient::postEmonTryAlarmRuleCallable(const PostEmonTryAlarmRuleRequest &request) const
{
auto task = std::make_shared<std::packaged_task<PostEmonTryAlarmRuleOutcome()>>(
[this, request]()
{
return this->postEmonTryAlarmRule(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ElasticsearchClient::RecommendTemplatesOutcome ElasticsearchClient::recommendTemplates(const RecommendTemplatesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -4155,42 +4191,6 @@ ElasticsearchClient::ResumeLogstashTaskOutcomeCallable ElasticsearchClient::resu
return task->get_future();
}
ElasticsearchClient::RollbackInstanceOutcome ElasticsearchClient::rollbackInstance(const RollbackInstanceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RollbackInstanceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RollbackInstanceOutcome(RollbackInstanceResult(outcome.result()));
else
return RollbackInstanceOutcome(outcome.error());
}
void ElasticsearchClient::rollbackInstanceAsync(const RollbackInstanceRequest& request, const RollbackInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, rollbackInstance(request), context);
};
asyncExecute(new Runnable(fn));
}
ElasticsearchClient::RollbackInstanceOutcomeCallable ElasticsearchClient::rollbackInstanceCallable(const RollbackInstanceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RollbackInstanceOutcome()>>(
[this, request]()
{
return this->rollbackInstance(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ElasticsearchClient::RolloverDataStreamOutcome ElasticsearchClient::rolloverDataStream(const RolloverDataStreamRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -1,52 +0,0 @@
/*
* 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/elasticsearch/model/DeleteProjectRequest.h>
using AlibabaCloud::Elasticsearch::Model::DeleteProjectRequest;
DeleteProjectRequest::DeleteProjectRequest() :
RoaServiceRequest("elasticsearch", "2017-06-13")
{
setResourcePath("/openapi/projects/[Id]");
setMethod(HttpRequest::Method::Delete);
}
DeleteProjectRequest::~DeleteProjectRequest()
{}
std::string DeleteProjectRequest::getClientToken()const
{
return clientToken_;
}
void DeleteProjectRequest::setClientToken(const std::string& clientToken)
{
clientToken_ = clientToken;
setParameter("ClientToken", clientToken);
}
std::string DeleteProjectRequest::getId()const
{
return id_;
}
void DeleteProjectRequest::setId(const std::string& id)
{
id_ = id;
setParameter("Id", id);
}

View File

@@ -14,28 +14,28 @@
* limitations under the License.
*/
#include <alibabacloud/elasticsearch/model/CreateProjectRequest.h>
#include <alibabacloud/elasticsearch/model/GetEmonGrafanaAlertsRequest.h>
using AlibabaCloud::Elasticsearch::Model::CreateProjectRequest;
using AlibabaCloud::Elasticsearch::Model::GetEmonGrafanaAlertsRequest;
CreateProjectRequest::CreateProjectRequest() :
GetEmonGrafanaAlertsRequest::GetEmonGrafanaAlertsRequest() :
RoaServiceRequest("elasticsearch", "2017-06-13")
{
setResourcePath("/openapi/projects");
setMethod(HttpRequest::Method::Post);
setResourcePath("/openapi/emon/projects/[ProjectId]/grafana/proxy/api/alerts");
setMethod(HttpRequest::Method::Get);
}
CreateProjectRequest::~CreateProjectRequest()
GetEmonGrafanaAlertsRequest::~GetEmonGrafanaAlertsRequest()
{}
std::string CreateProjectRequest::getClientToken()const
std::string GetEmonGrafanaAlertsRequest::getProjectId()const
{
return clientToken_;
return projectId_;
}
void CreateProjectRequest::setClientToken(const std::string& clientToken)
void GetEmonGrafanaAlertsRequest::setProjectId(const std::string& projectId)
{
clientToken_ = clientToken;
setParameter("ClientToken", clientToken);
projectId_ = projectId;
setParameter("ProjectId", projectId);
}

View File

@@ -14,39 +14,52 @@
* limitations under the License.
*/
#include <alibabacloud/elasticsearch/model/CreateProjectResult.h>
#include <alibabacloud/elasticsearch/model/GetEmonGrafanaAlertsResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Elasticsearch;
using namespace AlibabaCloud::Elasticsearch::Model;
CreateProjectResult::CreateProjectResult() :
GetEmonGrafanaAlertsResult::GetEmonGrafanaAlertsResult() :
ServiceResult()
{}
CreateProjectResult::CreateProjectResult(const std::string &payload) :
GetEmonGrafanaAlertsResult::GetEmonGrafanaAlertsResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
CreateProjectResult::~CreateProjectResult()
GetEmonGrafanaAlertsResult::~GetEmonGrafanaAlertsResult()
{}
void CreateProjectResult::parse(const std::string &payload)
void GetEmonGrafanaAlertsResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto resultNode = value["Result"];
if(!resultNode["id"].isNull())
result_.id = resultNode["id"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
}
CreateProjectResult::Result CreateProjectResult::getResult()const
std::string GetEmonGrafanaAlertsResult::getMessage()const
{
return result_;
return message_;
}
std::string GetEmonGrafanaAlertsResult::getCode()const
{
return code_;
}
bool GetEmonGrafanaAlertsResult::getSuccess()const
{
return success_;
}

View File

@@ -0,0 +1,41 @@
/*
* 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/elasticsearch/model/GetEmonGrafanaDashboardsRequest.h>
using AlibabaCloud::Elasticsearch::Model::GetEmonGrafanaDashboardsRequest;
GetEmonGrafanaDashboardsRequest::GetEmonGrafanaDashboardsRequest() :
RoaServiceRequest("elasticsearch", "2017-06-13")
{
setResourcePath("/openapi/emon/projects/[ProjectId]/grafana/proxy/api/search");
setMethod(HttpRequest::Method::Get);
}
GetEmonGrafanaDashboardsRequest::~GetEmonGrafanaDashboardsRequest()
{}
std::string GetEmonGrafanaDashboardsRequest::getProjectId()const
{
return projectId_;
}
void GetEmonGrafanaDashboardsRequest::setProjectId(const std::string& projectId)
{
projectId_ = projectId;
setParameter("ProjectId", projectId);
}

View File

@@ -0,0 +1,65 @@
/*
* 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/elasticsearch/model/GetEmonGrafanaDashboardsResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Elasticsearch;
using namespace AlibabaCloud::Elasticsearch::Model;
GetEmonGrafanaDashboardsResult::GetEmonGrafanaDashboardsResult() :
ServiceResult()
{}
GetEmonGrafanaDashboardsResult::GetEmonGrafanaDashboardsResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetEmonGrafanaDashboardsResult::~GetEmonGrafanaDashboardsResult()
{}
void GetEmonGrafanaDashboardsResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
}
std::string GetEmonGrafanaDashboardsResult::getMessage()const
{
return message_;
}
std::string GetEmonGrafanaDashboardsResult::getCode()const
{
return code_;
}
bool GetEmonGrafanaDashboardsResult::getSuccess()const
{
return success_;
}

View File

@@ -50,17 +50,6 @@ void ListInstanceRequest::setInstanceCategory(const std::string& instanceCategor
setParameter("InstanceCategory", instanceCategory);
}
std::string ListInstanceRequest::getOwnerId()const
{
return ownerId_;
}
void ListInstanceRequest::setOwnerId(const std::string& ownerId)
{
ownerId_ = ownerId;
setParameter("OwnerId", ownerId);
}
std::string ListInstanceRequest::getTags()const
{
return tags_;

View File

@@ -65,6 +65,8 @@ void ListInstanceResult::parse(const std::string &payload)
resultObject.status = valueResultInstance["status"].asString();
if(!valueResultInstance["updatedAt"].isNull())
resultObject.updatedAt = valueResultInstance["updatedAt"].asString();
if(!valueResultInstance["postpaidServiceStatus"].isNull())
resultObject.postpaidServiceStatus = valueResultInstance["postpaidServiceStatus"].asString();
auto alltagsNode = valueResultInstance["tags"]["Tag"];
for (auto valueResultInstancetagsTag : alltagsNode)
{

View File

@@ -0,0 +1,52 @@
/*
* 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/elasticsearch/model/PostEmonTryAlarmRuleRequest.h>
using AlibabaCloud::Elasticsearch::Model::PostEmonTryAlarmRuleRequest;
PostEmonTryAlarmRuleRequest::PostEmonTryAlarmRuleRequest() :
RoaServiceRequest("elasticsearch", "2017-06-13")
{
setResourcePath("/openapi/emon/projects/[ProjectId]/alarm-groups/[AlarmGroupId]/alarm-rules/_test");
setMethod(HttpRequest::Method::Post);
}
PostEmonTryAlarmRuleRequest::~PostEmonTryAlarmRuleRequest()
{}
std::string PostEmonTryAlarmRuleRequest::getAlarmGroupId()const
{
return alarmGroupId_;
}
void PostEmonTryAlarmRuleRequest::setAlarmGroupId(const std::string& alarmGroupId)
{
alarmGroupId_ = alarmGroupId;
setParameter("AlarmGroupId", alarmGroupId);
}
std::string PostEmonTryAlarmRuleRequest::getProjectId()const
{
return projectId_;
}
void PostEmonTryAlarmRuleRequest::setProjectId(const std::string& projectId)
{
projectId_ = projectId;
setParameter("ProjectId", projectId);
}

View File

@@ -14,31 +14,52 @@
* limitations under the License.
*/
#include <alibabacloud/elasticsearch/model/DeleteProjectResult.h>
#include <alibabacloud/elasticsearch/model/PostEmonTryAlarmRuleResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Elasticsearch;
using namespace AlibabaCloud::Elasticsearch::Model;
DeleteProjectResult::DeleteProjectResult() :
PostEmonTryAlarmRuleResult::PostEmonTryAlarmRuleResult() :
ServiceResult()
{}
DeleteProjectResult::DeleteProjectResult(const std::string &payload) :
PostEmonTryAlarmRuleResult::PostEmonTryAlarmRuleResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DeleteProjectResult::~DeleteProjectResult()
PostEmonTryAlarmRuleResult::~PostEmonTryAlarmRuleResult()
{}
void DeleteProjectResult::parse(const std::string &payload)
void PostEmonTryAlarmRuleResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
}
std::string PostEmonTryAlarmRuleResult::getMessage()const
{
return message_;
}
std::string PostEmonTryAlarmRuleResult::getCode()const
{
return code_;
}
bool PostEmonTryAlarmRuleResult::getSuccess()const
{
return success_;
}

View File

@@ -1,52 +0,0 @@
/*
* 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/elasticsearch/model/RollbackInstanceRequest.h>
using AlibabaCloud::Elasticsearch::Model::RollbackInstanceRequest;
RollbackInstanceRequest::RollbackInstanceRequest() :
RoaServiceRequest("elasticsearch", "2017-06-13")
{
setResourcePath("/openapi/instances/[InstanceId]/actions/rollback");
setMethod(HttpRequest::Method::Post);
}
RollbackInstanceRequest::~RollbackInstanceRequest()
{}
std::string RollbackInstanceRequest::getInstanceId()const
{
return instanceId_;
}
void RollbackInstanceRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}
std::string RollbackInstanceRequest::getClientToken()const
{
return clientToken_;
}
void RollbackInstanceRequest::setClientToken(const std::string& clientToken)
{
clientToken_ = clientToken;
setParameter("ClientToken", clientToken);
}

View File

@@ -1,82 +0,0 @@
/*
* 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/elasticsearch/model/RollbackInstanceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Elasticsearch;
using namespace AlibabaCloud::Elasticsearch::Model;
RollbackInstanceResult::RollbackInstanceResult() :
ServiceResult()
{}
RollbackInstanceResult::RollbackInstanceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RollbackInstanceResult::~RollbackInstanceResult()
{}
void RollbackInstanceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto resultNode = value["Result"];
if(!resultNode["instanceId"].isNull())
result_.instanceId = resultNode["instanceId"].asString();
if(!resultNode["domain"].isNull())
result_.domain = resultNode["domain"].asString();
if(!resultNode["description"].isNull())
result_.description = resultNode["description"].asString();
if(!resultNode["nodeAmount"].isNull())
result_.nodeAmount = std::stoi(resultNode["nodeAmount"].asString());
if(!resultNode["paymentType"].isNull())
result_.paymentType = resultNode["paymentType"].asString();
if(!resultNode["status"].isNull())
result_.status = resultNode["status"].asString();
if(!resultNode["esVersion"].isNull())
result_.esVersion = resultNode["esVersion"].asString();
if(!resultNode["createdAt"].isNull())
result_.createdAt = resultNode["createdAt"].asString();
if(!resultNode["updatedAt"].isNull())
result_.updatedAt = resultNode["updatedAt"].asString();
auto nodeSpecNode = resultNode["nodeSpec"];
if(!nodeSpecNode["spec"].isNull())
result_.nodeSpec.spec = nodeSpecNode["spec"].asString();
if(!nodeSpecNode["disk"].isNull())
result_.nodeSpec.disk = std::stoi(nodeSpecNode["disk"].asString());
auto networkConfigNode = resultNode["networkConfig"];
if(!networkConfigNode["type"].isNull())
result_.networkConfig.type = networkConfigNode["type"].asString();
if(!networkConfigNode["vpcId"].isNull())
result_.networkConfig.vpcId = networkConfigNode["vpcId"].asString();
if(!networkConfigNode["vswitchId"].isNull())
result_.networkConfig.vswitchId = networkConfigNode["vswitchId"].asString();
if(!networkConfigNode["vsArea"].isNull())
result_.networkConfig.vsArea = networkConfigNode["vsArea"].asString();
}
RollbackInstanceResult::Result RollbackInstanceResult::getResult()const
{
return result_;
}