Add Emon route-API support.
This commit is contained in:
@@ -1491,6 +1491,42 @@ ElasticsearchClient::GetElastictaskOutcomeCallable ElasticsearchClient::getElast
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
ElasticsearchClient::GetEmonMonitorDataOutcome ElasticsearchClient::getEmonMonitorData(const GetEmonMonitorDataRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetEmonMonitorDataOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetEmonMonitorDataOutcome(GetEmonMonitorDataResult(outcome.result()));
|
||||
else
|
||||
return GetEmonMonitorDataOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void ElasticsearchClient::getEmonMonitorDataAsync(const GetEmonMonitorDataRequest& request, const GetEmonMonitorDataAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getEmonMonitorData(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
ElasticsearchClient::GetEmonMonitorDataOutcomeCallable ElasticsearchClient::getEmonMonitorDataCallable(const GetEmonMonitorDataRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetEmonMonitorDataOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getEmonMonitorData(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
ElasticsearchClient::GetRegionConfigurationOutcome ElasticsearchClient::getRegionConfiguration(const GetRegionConfigurationRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -240,6 +240,9 @@ void DescribeInstanceResult::parse(const std::string &payload)
|
||||
auto allKibanaPrivateIPWhitelist = resultNode["kibanaPrivateIPWhitelist"]["WhiteIP"];
|
||||
for (auto value : allKibanaPrivateIPWhitelist)
|
||||
result_.kibanaPrivateIPWhitelist.push_back(value.asString());
|
||||
auto allExtendConfigs = resultNode["extendConfigs"]["extendConfigs"];
|
||||
for (auto value : allExtendConfigs)
|
||||
result_.extendConfigs.push_back(value.asString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ void DescribeLogstashResult::parse(const std::string &payload)
|
||||
result_.vpcInstanceId = resultNode["vpcInstanceId"].asString();
|
||||
if(!resultNode["config"].isNull())
|
||||
result_.config = resultNode["config"].asString();
|
||||
if(!resultNode["ResourceGroupId"].isNull())
|
||||
result_.resourceGroupId = resultNode["ResourceGroupId"].asString();
|
||||
auto allendpointListNode = resultNode["endpointList"]["endpoint"];
|
||||
for (auto resultNodeendpointListendpoint : allendpointListNode)
|
||||
{
|
||||
@@ -68,8 +70,30 @@ void DescribeLogstashResult::parse(const std::string &payload)
|
||||
endpointObject.host = resultNodeendpointListendpoint["host"].asString();
|
||||
if(!resultNodeendpointListendpoint["port"].isNull())
|
||||
endpointObject.port = resultNodeendpointListendpoint["port"].asString();
|
||||
if(!resultNodeendpointListendpoint["zoneId"].isNull())
|
||||
endpointObject.zoneId = resultNodeendpointListendpoint["zoneId"].asString();
|
||||
result_.endpointList.push_back(endpointObject);
|
||||
}
|
||||
auto allTagsNode = resultNode["Tags"]["tagsItem"];
|
||||
for (auto resultNodeTagstagsItem : allTagsNode)
|
||||
{
|
||||
Result::TagsItem tagsItemObject;
|
||||
if(!resultNodeTagstagsItem["tagKey"].isNull())
|
||||
tagsItemObject.tagKey = resultNodeTagstagsItem["tagKey"].asString();
|
||||
if(!resultNodeTagstagsItem["tagValue"].isNull())
|
||||
tagsItemObject.tagValue = resultNodeTagstagsItem["tagValue"].asString();
|
||||
result_.tags.push_back(tagsItemObject);
|
||||
}
|
||||
auto allZoneInfosNode = resultNode["ZoneInfos"]["zoneInfosItem"];
|
||||
for (auto resultNodeZoneInfoszoneInfosItem : allZoneInfosNode)
|
||||
{
|
||||
Result::ZoneInfosItem zoneInfosItemObject;
|
||||
if(!resultNodeZoneInfoszoneInfosItem["zoneId"].isNull())
|
||||
zoneInfosItemObject.zoneId = resultNodeZoneInfoszoneInfosItem["zoneId"].asString();
|
||||
if(!resultNodeZoneInfoszoneInfosItem["status"].isNull())
|
||||
zoneInfosItemObject.status = resultNodeZoneInfoszoneInfosItem["status"].asString();
|
||||
result_.zoneInfos.push_back(zoneInfosItemObject);
|
||||
}
|
||||
auto nodeSpecNode = resultNode["nodeSpec"];
|
||||
if(!nodeSpecNode["spec"].isNull())
|
||||
result_.nodeSpec.spec = nodeSpecNode["spec"].asString();
|
||||
@@ -77,6 +101,8 @@ void DescribeLogstashResult::parse(const std::string &payload)
|
||||
result_.nodeSpec.disk = std::stoi(nodeSpecNode["disk"].asString());
|
||||
if(!nodeSpecNode["diskType"].isNull())
|
||||
result_.nodeSpec.diskType = nodeSpecNode["diskType"].asString();
|
||||
if(!nodeSpecNode["diskEncryption"].isNull())
|
||||
result_.nodeSpec.diskEncryption = nodeSpecNode["diskEncryption"].asString() == "true";
|
||||
auto networkConfigNode = resultNode["networkConfig"];
|
||||
if(!networkConfigNode["type"].isNull())
|
||||
result_.networkConfig.type = networkConfigNode["type"].asString();
|
||||
@@ -86,6 +112,9 @@ void DescribeLogstashResult::parse(const std::string &payload)
|
||||
result_.networkConfig.vswitchId = networkConfigNode["vswitchId"].asString();
|
||||
if(!networkConfigNode["vsArea"].isNull())
|
||||
result_.networkConfig.vsArea = networkConfigNode["vsArea"].asString();
|
||||
auto allExtendConfigs = resultNode["ExtendConfigs"]["extendConfigs"];
|
||||
for (auto value : allExtendConfigs)
|
||||
result_.extendConfigs.push_back(value.asString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
41
elasticsearch/src/model/GetEmonMonitorDataRequest.cc
Normal file
41
elasticsearch/src/model/GetEmonMonitorDataRequest.cc
Normal 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/GetEmonMonitorDataRequest.h>
|
||||
|
||||
using AlibabaCloud::Elasticsearch::Model::GetEmonMonitorDataRequest;
|
||||
|
||||
GetEmonMonitorDataRequest::GetEmonMonitorDataRequest() :
|
||||
RoaServiceRequest("elasticsearch", "2017-06-13")
|
||||
{
|
||||
setResourcePath("/openapi/emon/projects/[ProjectId]/metrics/query");
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetEmonMonitorDataRequest::~GetEmonMonitorDataRequest()
|
||||
{}
|
||||
|
||||
std::string GetEmonMonitorDataRequest::getProjectId()const
|
||||
{
|
||||
return projectId_;
|
||||
}
|
||||
|
||||
void GetEmonMonitorDataRequest::setProjectId(const std::string& projectId)
|
||||
{
|
||||
projectId_ = projectId;
|
||||
setParameter("ProjectId", projectId);
|
||||
}
|
||||
|
||||
88
elasticsearch/src/model/GetEmonMonitorDataResult.cc
Normal file
88
elasticsearch/src/model/GetEmonMonitorDataResult.cc
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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/GetEmonMonitorDataResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Elasticsearch;
|
||||
using namespace AlibabaCloud::Elasticsearch::Model;
|
||||
|
||||
GetEmonMonitorDataResult::GetEmonMonitorDataResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetEmonMonitorDataResult::GetEmonMonitorDataResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetEmonMonitorDataResult::~GetEmonMonitorDataResult()
|
||||
{}
|
||||
|
||||
void GetEmonMonitorDataResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allResultNode = value["Result"]["resultItem"];
|
||||
for (auto valueResultresultItem : allResultNode)
|
||||
{
|
||||
ResultItem resultObject;
|
||||
if(!valueResultresultItem["dps"].isNull())
|
||||
resultObject.dps = valueResultresultItem["dps"].asString();
|
||||
if(!valueResultresultItem["integrity"].isNull())
|
||||
resultObject.integrity = std::stof(valueResultresultItem["integrity"].asString());
|
||||
if(!valueResultresultItem["messageWatermark"].isNull())
|
||||
resultObject.messageWatermark = std::stol(valueResultresultItem["messageWatermark"].asString());
|
||||
if(!valueResultresultItem["metric"].isNull())
|
||||
resultObject.metric = valueResultresultItem["metric"].asString();
|
||||
if(!valueResultresultItem["summary"].isNull())
|
||||
resultObject.summary = std::stof(valueResultresultItem["summary"].asString());
|
||||
if(!valueResultresultItem["tags"].isNull())
|
||||
resultObject.tags = valueResultresultItem["tags"].asString();
|
||||
result_.push_back(resultObject);
|
||||
}
|
||||
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 GetEmonMonitorDataResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
std::string GetEmonMonitorDataResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
bool GetEmonMonitorDataResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
std::vector<GetEmonMonitorDataResult::ResultItem> GetEmonMonitorDataResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@ void ListInstanceResult::parse(const std::string &payload)
|
||||
resultObject.nodeSpec.disk = std::stoi(nodeSpecNode["disk"].asString());
|
||||
if(!nodeSpecNode["diskType"].isNull())
|
||||
resultObject.nodeSpec.diskType = nodeSpecNode["diskType"].asString();
|
||||
if(!nodeSpecNode["diskEncryption"].isNull())
|
||||
resultObject.nodeSpec.diskEncryption = nodeSpecNode["diskEncryption"].asString() == "true";
|
||||
auto networkConfigNode = value["networkConfig"];
|
||||
if(!networkConfigNode["type"].isNull())
|
||||
resultObject.networkConfig.type = networkConfigNode["type"].asString();
|
||||
@@ -129,6 +131,9 @@ void ListInstanceResult::parse(const std::string &payload)
|
||||
resultObject.clientNodeConfiguration.diskType = clientNodeConfigurationNode["diskType"].asString();
|
||||
if(!clientNodeConfigurationNode["disk"].isNull())
|
||||
resultObject.clientNodeConfiguration.disk = std::stoi(clientNodeConfigurationNode["disk"].asString());
|
||||
auto allExtendConfigs = value["extendConfigs"]["extendConfigs"];
|
||||
for (auto value : allExtendConfigs)
|
||||
resultObject.extendConfigs.push_back(value.asString());
|
||||
result_.push_back(resultObject);
|
||||
}
|
||||
auto headersNode = value["Headers"];
|
||||
|
||||
@@ -59,6 +59,16 @@ void ListLogstashResult::parse(const std::string &payload)
|
||||
resultObject.createdAt = valueResultInstance["createdAt"].asString();
|
||||
if(!valueResultInstance["updatedAt"].isNull())
|
||||
resultObject.updatedAt = valueResultInstance["updatedAt"].asString();
|
||||
auto allTagsNode = valueResultInstance["Tags"]["tagsItem"];
|
||||
for (auto valueResultInstanceTagstagsItem : allTagsNode)
|
||||
{
|
||||
Instance::TagsItem tagsObject;
|
||||
if(!valueResultInstanceTagstagsItem["TagKey"].isNull())
|
||||
tagsObject.tagKey = valueResultInstanceTagstagsItem["TagKey"].asString();
|
||||
if(!valueResultInstanceTagstagsItem["TagValue"].isNull())
|
||||
tagsObject.tagValue = valueResultInstanceTagstagsItem["TagValue"].asString();
|
||||
resultObject.tags.push_back(tagsObject);
|
||||
}
|
||||
auto nodeSpecNode = value["nodeSpec"];
|
||||
if(!nodeSpecNode["spec"].isNull())
|
||||
resultObject.nodeSpec.spec = nodeSpecNode["spec"].asString();
|
||||
@@ -66,6 +76,8 @@ void ListLogstashResult::parse(const std::string &payload)
|
||||
resultObject.nodeSpec.disk = std::stoi(nodeSpecNode["disk"].asString());
|
||||
if(!nodeSpecNode["diskType"].isNull())
|
||||
resultObject.nodeSpec.diskType = nodeSpecNode["diskType"].asString();
|
||||
if(!nodeSpecNode["diskEncryption"].isNull())
|
||||
resultObject.nodeSpec.diskEncryption = nodeSpecNode["diskEncryption"].asString() == "true";
|
||||
auto networkConfigNode = value["networkConfig"];
|
||||
if(!networkConfigNode["type"].isNull())
|
||||
resultObject.networkConfig.type = networkConfigNode["type"].asString();
|
||||
@@ -77,9 +89,17 @@ void ListLogstashResult::parse(const std::string &payload)
|
||||
resultObject.networkConfig.vsArea = networkConfigNode["vsArea"].asString();
|
||||
result_.push_back(resultObject);
|
||||
}
|
||||
auto headersNode = value["Headers"];
|
||||
if(!headersNode["X-Total-Count"].isNull())
|
||||
headers_.xTotalCount = std::stoi(headersNode["X-Total-Count"].asString());
|
||||
|
||||
}
|
||||
|
||||
ListLogstashResult::Headers ListLogstashResult::getHeaders()const
|
||||
{
|
||||
return headers_;
|
||||
}
|
||||
|
||||
std::vector<ListLogstashResult::Instance> ListLogstashResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
|
||||
@@ -39,6 +39,17 @@ void ModifyWhiteIpsRequest::setInstanceId(const std::string& instanceId)
|
||||
setParameter("InstanceId", instanceId);
|
||||
}
|
||||
|
||||
std::string ModifyWhiteIpsRequest::getNodeType()const
|
||||
{
|
||||
return nodeType_;
|
||||
}
|
||||
|
||||
void ModifyWhiteIpsRequest::setNodeType(const std::string& nodeType)
|
||||
{
|
||||
nodeType_ = nodeType;
|
||||
setBodyParameter("NodeType", nodeType);
|
||||
}
|
||||
|
||||
std::string ModifyWhiteIpsRequest::getClientToken()const
|
||||
{
|
||||
return clientToken_;
|
||||
@@ -50,3 +61,14 @@ void ModifyWhiteIpsRequest::setClientToken(const std::string& clientToken)
|
||||
setParameter("ClientToken", clientToken);
|
||||
}
|
||||
|
||||
std::string ModifyWhiteIpsRequest::getNetworkType()const
|
||||
{
|
||||
return networkType_;
|
||||
}
|
||||
|
||||
void ModifyWhiteIpsRequest::setNetworkType(const std::string& networkType)
|
||||
{
|
||||
networkType_ = networkType;
|
||||
setBodyParameter("NetworkType", networkType);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,17 @@ TriggerNetworkRequest::TriggerNetworkRequest() :
|
||||
TriggerNetworkRequest::~TriggerNetworkRequest()
|
||||
{}
|
||||
|
||||
std::string TriggerNetworkRequest::getActionType()const
|
||||
{
|
||||
return actionType_;
|
||||
}
|
||||
|
||||
void TriggerNetworkRequest::setActionType(const std::string& actionType)
|
||||
{
|
||||
actionType_ = actionType;
|
||||
setBodyParameter("ActionType", actionType);
|
||||
}
|
||||
|
||||
std::string TriggerNetworkRequest::getInstanceId()const
|
||||
{
|
||||
return instanceId_;
|
||||
@@ -39,6 +50,17 @@ void TriggerNetworkRequest::setInstanceId(const std::string& instanceId)
|
||||
setParameter("InstanceId", instanceId);
|
||||
}
|
||||
|
||||
std::string TriggerNetworkRequest::getNodeType()const
|
||||
{
|
||||
return nodeType_;
|
||||
}
|
||||
|
||||
void TriggerNetworkRequest::setNodeType(const std::string& nodeType)
|
||||
{
|
||||
nodeType_ = nodeType;
|
||||
setBodyParameter("NodeType", nodeType);
|
||||
}
|
||||
|
||||
std::string TriggerNetworkRequest::getClientToken()const
|
||||
{
|
||||
return clientToken_;
|
||||
@@ -50,3 +72,14 @@ void TriggerNetworkRequest::setClientToken(const std::string& clientToken)
|
||||
setParameter("ClientToken", clientToken);
|
||||
}
|
||||
|
||||
std::string TriggerNetworkRequest::getNetworkType()const
|
||||
{
|
||||
return networkType_;
|
||||
}
|
||||
|
||||
void TriggerNetworkRequest::setNetworkType(const std::string& networkType)
|
||||
{
|
||||
networkType_ = networkType;
|
||||
setBodyParameter("NetworkType", networkType);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,3 +50,14 @@ void UpdateDescriptionRequest::setClientToken(const std::string& clientToken)
|
||||
setParameter("ClientToken", clientToken);
|
||||
}
|
||||
|
||||
std::string UpdateDescriptionRequest::getDescription()const
|
||||
{
|
||||
return description_;
|
||||
}
|
||||
|
||||
void UpdateDescriptionRequest::setDescription(const std::string& description)
|
||||
{
|
||||
description_ = description;
|
||||
setBodyParameter("Description", description);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,3 +61,25 @@ void UpgradeEngineVersionRequest::setClientToken(const std::string& clientToken)
|
||||
setParameter("ClientToken", clientToken);
|
||||
}
|
||||
|
||||
std::string UpgradeEngineVersionRequest::getType()const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
void UpgradeEngineVersionRequest::setType(const std::string& type)
|
||||
{
|
||||
type_ = type;
|
||||
setBodyParameter("Type", type);
|
||||
}
|
||||
|
||||
std::string UpgradeEngineVersionRequest::getVersion()const
|
||||
{
|
||||
return version_;
|
||||
}
|
||||
|
||||
void UpgradeEngineVersionRequest::setVersion(const std::string& version)
|
||||
{
|
||||
version_ = version;
|
||||
setBodyParameter("Version", version);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user