Add param, DescribePrice supprot ReservedInstance.
This commit is contained in:
@@ -9411,6 +9411,42 @@ EcsClient::RevokeSecurityGroupEgressOutcomeCallable EcsClient::revokeSecurityGro
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
EcsClient::RunCommandOutcome EcsClient::runCommand(const RunCommandRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RunCommandOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RunCommandOutcome(RunCommandResult(outcome.result()));
|
||||
else
|
||||
return RunCommandOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void EcsClient::runCommandAsync(const RunCommandRequest& request, const RunCommandAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, runCommand(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
EcsClient::RunCommandOutcomeCallable EcsClient::runCommandCallable(const RunCommandRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RunCommandOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->runCommand(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
EcsClient::RunInstancesOutcome EcsClient::runInstances(const RunInstancesRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -91,6 +91,17 @@ void DescribeCommandsRequest::setRegionId(const std::string& regionId)
|
||||
setCoreParameter("RegionId", regionId);
|
||||
}
|
||||
|
||||
std::string DescribeCommandsRequest::getContentEncoding()const
|
||||
{
|
||||
return contentEncoding_;
|
||||
}
|
||||
|
||||
void DescribeCommandsRequest::setContentEncoding(const std::string& contentEncoding)
|
||||
{
|
||||
contentEncoding_ = contentEncoding;
|
||||
setCoreParameter("ContentEncoding", contentEncoding);
|
||||
}
|
||||
|
||||
long DescribeCommandsRequest::getPageSize()const
|
||||
{
|
||||
return pageSize_;
|
||||
|
||||
@@ -80,6 +80,17 @@ void DescribeInvocationsRequest::setRegionId(const std::string& regionId)
|
||||
setCoreParameter("RegionId", regionId);
|
||||
}
|
||||
|
||||
std::string DescribeInvocationsRequest::getContentEncoding()const
|
||||
{
|
||||
return contentEncoding_;
|
||||
}
|
||||
|
||||
void DescribeInvocationsRequest::setContentEncoding(const std::string& contentEncoding)
|
||||
{
|
||||
contentEncoding_ = contentEncoding;
|
||||
setCoreParameter("ContentEncoding", contentEncoding);
|
||||
}
|
||||
|
||||
long DescribeInvocationsRequest::getPageSize()const
|
||||
{
|
||||
return pageSize_;
|
||||
|
||||
@@ -135,6 +135,17 @@ void DescribePriceRequest::setInstanceNetworkType(const std::string& instanceNet
|
||||
setCoreParameter("InstanceNetworkType", instanceNetworkType);
|
||||
}
|
||||
|
||||
int DescribePriceRequest::getInstanceAmount()const
|
||||
{
|
||||
return instanceAmount_;
|
||||
}
|
||||
|
||||
void DescribePriceRequest::setInstanceAmount(int instanceAmount)
|
||||
{
|
||||
instanceAmount_ = instanceAmount;
|
||||
setCoreParameter("InstanceAmount", std::to_string(instanceAmount));
|
||||
}
|
||||
|
||||
std::string DescribePriceRequest::getDataDisk3PerformanceLevel()const
|
||||
{
|
||||
return dataDisk3PerformanceLevel_;
|
||||
@@ -190,6 +201,17 @@ void DescribePriceRequest::setSystemDiskCategory(const std::string& systemDiskCa
|
||||
setCoreParameter("SystemDiskCategory", systemDiskCategory);
|
||||
}
|
||||
|
||||
std::string DescribePriceRequest::getPlatform()const
|
||||
{
|
||||
return platform_;
|
||||
}
|
||||
|
||||
void DescribePriceRequest::setPlatform(const std::string& platform)
|
||||
{
|
||||
platform_ = platform;
|
||||
setCoreParameter("Platform", platform);
|
||||
}
|
||||
|
||||
std::string DescribePriceRequest::getSystemDiskPerformanceLevel()const
|
||||
{
|
||||
return systemDiskPerformanceLevel_;
|
||||
@@ -234,6 +256,17 @@ void DescribePriceRequest::setRegionId(const std::string& regionId)
|
||||
setCoreParameter("RegionId", regionId);
|
||||
}
|
||||
|
||||
std::string DescribePriceRequest::getScope()const
|
||||
{
|
||||
return scope_;
|
||||
}
|
||||
|
||||
void DescribePriceRequest::setScope(const std::string& scope)
|
||||
{
|
||||
scope_ = scope;
|
||||
setCoreParameter("Scope", scope);
|
||||
}
|
||||
|
||||
std::string DescribePriceRequest::getInstanceType()const
|
||||
{
|
||||
return instanceType_;
|
||||
@@ -355,3 +388,14 @@ void DescribePriceRequest::setSystemDiskSize(int systemDiskSize)
|
||||
setCoreParameter("SystemDiskSize", std::to_string(systemDiskSize));
|
||||
}
|
||||
|
||||
std::string DescribePriceRequest::getOfferingType()const
|
||||
{
|
||||
return offeringType_;
|
||||
}
|
||||
|
||||
void DescribePriceRequest::setOfferingType(const std::string& offeringType)
|
||||
{
|
||||
offeringType_ = offeringType;
|
||||
setCoreParameter("OfferingType", offeringType);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,8 @@ void DescribePriceResult::parse(const std::string &payload)
|
||||
priceInfo_.price.discountPrice = std::stof(priceNode["DiscountPrice"].asString());
|
||||
if(!priceNode["TradePrice"].isNull())
|
||||
priceInfo_.price.tradePrice = std::stof(priceNode["TradePrice"].asString());
|
||||
if(!priceNode["ReservedInstanceHourPrice"].isNull())
|
||||
priceInfo_.price.reservedInstanceHourPrice = std::stof(priceNode["ReservedInstanceHourPrice"].asString());
|
||||
if(!priceNode["Currency"].isNull())
|
||||
priceInfo_.price.currency = priceNode["Currency"].asString();
|
||||
auto allDetailInfosNode = priceNode["DetailInfos"]["ResourcePriceModel"];
|
||||
|
||||
226
ecs/src/model/RunCommandRequest.cc
Normal file
226
ecs/src/model/RunCommandRequest.cc
Normal file
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* 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/ecs/model/RunCommandRequest.h>
|
||||
|
||||
using AlibabaCloud::Ecs::Model::RunCommandRequest;
|
||||
|
||||
RunCommandRequest::RunCommandRequest() :
|
||||
RpcServiceRequest("ecs", "2014-05-26", "RunCommand")
|
||||
{}
|
||||
|
||||
RunCommandRequest::~RunCommandRequest()
|
||||
{}
|
||||
|
||||
long RunCommandRequest::getResourceOwnerId()const
|
||||
{
|
||||
return resourceOwnerId_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setResourceOwnerId(long resourceOwnerId)
|
||||
{
|
||||
resourceOwnerId_ = resourceOwnerId;
|
||||
setCoreParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getWorkingDir()const
|
||||
{
|
||||
return workingDir_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setWorkingDir(const std::string& workingDir)
|
||||
{
|
||||
workingDir_ = workingDir;
|
||||
setCoreParameter("WorkingDir", workingDir);
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getDescription()const
|
||||
{
|
||||
return description_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setDescription(const std::string& description)
|
||||
{
|
||||
description_ = description;
|
||||
setCoreParameter("Description", description);
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getType()const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setType(const std::string& type)
|
||||
{
|
||||
type_ = type;
|
||||
setCoreParameter("Type", type);
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getCommandContent()const
|
||||
{
|
||||
return commandContent_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setCommandContent(const std::string& commandContent)
|
||||
{
|
||||
commandContent_ = commandContent;
|
||||
setCoreParameter("CommandContent", commandContent);
|
||||
}
|
||||
|
||||
long RunCommandRequest::getTimeout()const
|
||||
{
|
||||
return timeout_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setTimeout(long timeout)
|
||||
{
|
||||
timeout_ = timeout;
|
||||
setCoreParameter("Timeout", std::to_string(timeout));
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getFrequency()const
|
||||
{
|
||||
return frequency_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setFrequency(const std::string& frequency)
|
||||
{
|
||||
frequency_ = frequency;
|
||||
setCoreParameter("Frequency", frequency);
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getRegionId()const
|
||||
{
|
||||
return regionId_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setRegionId(const std::string& regionId)
|
||||
{
|
||||
regionId_ = regionId;
|
||||
setCoreParameter("RegionId", regionId);
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getContentEncoding()const
|
||||
{
|
||||
return contentEncoding_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setContentEncoding(const std::string& contentEncoding)
|
||||
{
|
||||
contentEncoding_ = contentEncoding;
|
||||
setCoreParameter("ContentEncoding", contentEncoding);
|
||||
}
|
||||
|
||||
bool RunCommandRequest::getKeepCommand()const
|
||||
{
|
||||
return keepCommand_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setKeepCommand(bool keepCommand)
|
||||
{
|
||||
keepCommand_ = keepCommand;
|
||||
setCoreParameter("KeepCommand", keepCommand ? "true" : "false");
|
||||
}
|
||||
|
||||
bool RunCommandRequest::getTimed()const
|
||||
{
|
||||
return timed_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setTimed(bool timed)
|
||||
{
|
||||
timed_ = timed;
|
||||
setCoreParameter("Timed", timed ? "true" : "false");
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getResourceOwnerAccount()const
|
||||
{
|
||||
return resourceOwnerAccount_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount)
|
||||
{
|
||||
resourceOwnerAccount_ = resourceOwnerAccount;
|
||||
setCoreParameter("ResourceOwnerAccount", resourceOwnerAccount);
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getOwnerAccount()const
|
||||
{
|
||||
return ownerAccount_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setOwnerAccount(const std::string& ownerAccount)
|
||||
{
|
||||
ownerAccount_ = ownerAccount;
|
||||
setCoreParameter("OwnerAccount", ownerAccount);
|
||||
}
|
||||
|
||||
long RunCommandRequest::getOwnerId()const
|
||||
{
|
||||
return ownerId_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setOwnerId(long ownerId)
|
||||
{
|
||||
ownerId_ = ownerId;
|
||||
setCoreParameter("OwnerId", std::to_string(ownerId));
|
||||
}
|
||||
|
||||
std::vector<std::string> RunCommandRequest::getInstanceId()const
|
||||
{
|
||||
return instanceId_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setInstanceId(const std::vector<std::string>& instanceId)
|
||||
{
|
||||
instanceId_ = instanceId;
|
||||
for(int i = 0; i!= instanceId.size(); i++)
|
||||
setCoreParameter("InstanceId."+ std::to_string(i), instanceId.at(i));
|
||||
}
|
||||
|
||||
std::string RunCommandRequest::getName()const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setName(const std::string& name)
|
||||
{
|
||||
name_ = name;
|
||||
setCoreParameter("Name", name);
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> RunCommandRequest::getParameters()const
|
||||
{
|
||||
return parameters_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setParameters(const std::map<std::string, std::string>& parameters)
|
||||
{
|
||||
parameters_ = parameters;
|
||||
setJsonParameters("Parameters", parameters);
|
||||
}
|
||||
|
||||
bool RunCommandRequest::getEnableParameter()const
|
||||
{
|
||||
return enableParameter_;
|
||||
}
|
||||
|
||||
void RunCommandRequest::setEnableParameter(bool enableParameter)
|
||||
{
|
||||
enableParameter_ = enableParameter;
|
||||
setCoreParameter("EnableParameter", enableParameter ? "true" : "false");
|
||||
}
|
||||
|
||||
58
ecs/src/model/RunCommandResult.cc
Normal file
58
ecs/src/model/RunCommandResult.cc
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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/ecs/model/RunCommandResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ecs;
|
||||
using namespace AlibabaCloud::Ecs::Model;
|
||||
|
||||
RunCommandResult::RunCommandResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RunCommandResult::RunCommandResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RunCommandResult::~RunCommandResult()
|
||||
{}
|
||||
|
||||
void RunCommandResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["CommandId"].isNull())
|
||||
commandId_ = value["CommandId"].asString();
|
||||
if(!value["InvokeId"].isNull())
|
||||
invokeId_ = value["InvokeId"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string RunCommandResult::getCommandId()const
|
||||
{
|
||||
return commandId_;
|
||||
}
|
||||
|
||||
std::string RunCommandResult::getInvokeId()const
|
||||
{
|
||||
return invokeId_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user