Add StartTerminalSession.

This commit is contained in:
sdk-team
2021-07-27 02:38:49 +00:00
parent f1425baf72
commit 1ef5aff5c4
18 changed files with 386 additions and 7 deletions

View File

@@ -1,3 +1,6 @@
2021-07-27 Version: 1.36.827
- Add StartTerminalSession.
2021-07-23 Version: 1.36.826
- Export instance relative API.

View File

@@ -1 +1 @@
1.36.826
1.36.827

View File

@@ -675,6 +675,8 @@ set(ecs_public_header_model
include/alibabacloud/ecs/model/StartInstanceResult.h
include/alibabacloud/ecs/model/StartInstancesRequest.h
include/alibabacloud/ecs/model/StartInstancesResult.h
include/alibabacloud/ecs/model/StartTerminalSessionRequest.h
include/alibabacloud/ecs/model/StartTerminalSessionResult.h
include/alibabacloud/ecs/model/StopDiskReplicaPairRequest.h
include/alibabacloud/ecs/model/StopDiskReplicaPairResult.h
include/alibabacloud/ecs/model/StopInstanceRequest.h
@@ -1356,6 +1358,8 @@ set(ecs_src
src/model/StartInstanceResult.cc
src/model/StartInstancesRequest.cc
src/model/StartInstancesResult.cc
src/model/StartTerminalSessionRequest.cc
src/model/StartTerminalSessionResult.cc
src/model/StopDiskReplicaPairRequest.cc
src/model/StopDiskReplicaPairResult.cc
src/model/StopInstanceRequest.cc

View File

@@ -676,6 +676,8 @@
#include "model/StartInstanceResult.h"
#include "model/StartInstancesRequest.h"
#include "model/StartInstancesResult.h"
#include "model/StartTerminalSessionRequest.h"
#include "model/StartTerminalSessionResult.h"
#include "model/StopDiskReplicaPairRequest.h"
#include "model/StopDiskReplicaPairResult.h"
#include "model/StopInstanceRequest.h"
@@ -1690,6 +1692,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::StartInstancesResult> StartInstancesOutcome;
typedef std::future<StartInstancesOutcome> StartInstancesOutcomeCallable;
typedef std::function<void(const EcsClient*, const Model::StartInstancesRequest&, const StartInstancesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> StartInstancesAsyncHandler;
typedef Outcome<Error, Model::StartTerminalSessionResult> StartTerminalSessionOutcome;
typedef std::future<StartTerminalSessionOutcome> StartTerminalSessionOutcomeCallable;
typedef std::function<void(const EcsClient*, const Model::StartTerminalSessionRequest&, const StartTerminalSessionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> StartTerminalSessionAsyncHandler;
typedef Outcome<Error, Model::StopDiskReplicaPairResult> StopDiskReplicaPairOutcome;
typedef std::future<StopDiskReplicaPairOutcome> StopDiskReplicaPairOutcomeCallable;
typedef std::function<void(const EcsClient*, const Model::StopDiskReplicaPairRequest&, const StopDiskReplicaPairOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> StopDiskReplicaPairAsyncHandler;
@@ -2712,6 +2717,9 @@ namespace AlibabaCloud
StartInstancesOutcome startInstances(const Model::StartInstancesRequest &request)const;
void startInstancesAsync(const Model::StartInstancesRequest& request, const StartInstancesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
StartInstancesOutcomeCallable startInstancesCallable(const Model::StartInstancesRequest& request) const;
StartTerminalSessionOutcome startTerminalSession(const Model::StartTerminalSessionRequest &request)const;
void startTerminalSessionAsync(const Model::StartTerminalSessionRequest& request, const StartTerminalSessionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
StartTerminalSessionOutcomeCallable startTerminalSessionCallable(const Model::StartTerminalSessionRequest& request) const;
StopDiskReplicaPairOutcome stopDiskReplicaPair(const Model::StopDiskReplicaPairRequest &request)const;
void stopDiskReplicaPairAsync(const Model::StopDiskReplicaPairRequest& request, const StopDiskReplicaPairAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
StopDiskReplicaPairOutcomeCallable stopDiskReplicaPairCallable(const Model::StopDiskReplicaPairRequest& request) const;

View File

@@ -48,6 +48,8 @@ namespace AlibabaCloud
std::string getActionType()const;
void setActionType(const std::string& actionType);
long getImageOwnerId()const;
void setImageOwnerId(long imageOwnerId);
long getResourceOwnerId()const;
void setResourceOwnerId(long resourceOwnerId);
std::string getImageId()const;
@@ -70,6 +72,8 @@ namespace AlibabaCloud
void setImageName(const std::string& imageName);
bool getIsSupportCloudinit()const;
void setIsSupportCloudinit(bool isSupportCloudinit);
bool getIsPublic()const;
void setIsPublic(bool isPublic);
int getPageSize()const;
void setPageSize(int pageSize);
std::string getInstanceType()const;
@@ -99,6 +103,7 @@ namespace AlibabaCloud
private:
std::string actionType_;
long imageOwnerId_;
long resourceOwnerId_;
std::string imageId_;
std::string snapshotId_;
@@ -110,6 +115,7 @@ namespace AlibabaCloud
std::string regionId_;
std::string imageName_;
bool isSupportCloudinit_;
bool isPublic_;
int pageSize_;
std::string instanceType_;
std::vector<Tag> tag_;

View File

@@ -59,6 +59,7 @@ namespace AlibabaCloud
int size;
bool isSubscribed;
std::string oSName;
bool isPublic;
std::string imageId;
std::vector<Image::Tag> tags;
std::string oSNameEn;
@@ -67,6 +68,7 @@ namespace AlibabaCloud
std::string usage;
std::string architecture;
std::string productCode;
long imageOwnerId;
bool isCopied;
std::string imageFamily;
bool isSupportIoOptimized;

View File

@@ -33,9 +33,9 @@ namespace AlibabaCloud
public:
struct DataDisk
{
std::string performanceLevel;
int size;
std::string category;
std::string performanceLevel;
};
public:

View File

@@ -41,6 +41,8 @@ namespace AlibabaCloud
void setImageId(const std::string& imageId);
std::string getRegionId()const;
void setRegionId(const std::string& regionId);
bool getIsPublic()const;
void setIsPublic(bool isPublic);
std::string getLaunchPermission()const;
void setLaunchPermission(const std::string& launchPermission);
std::string getResourceOwnerAccount()const;
@@ -58,6 +60,7 @@ namespace AlibabaCloud
long resourceOwnerId_;
std::string imageId_;
std::string regionId_;
bool isPublic_;
std::string launchPermission_;
std::string resourceOwnerAccount_;
std::string ownerAccount_;

View File

@@ -0,0 +1,63 @@
/*
* 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_ECS_MODEL_STARTTERMINALSESSIONREQUEST_H_
#define ALIBABACLOUD_ECS_MODEL_STARTTERMINALSESSIONREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/ecs/EcsExport.h>
namespace AlibabaCloud
{
namespace Ecs
{
namespace Model
{
class ALIBABACLOUD_ECS_EXPORT StartTerminalSessionRequest : public RpcServiceRequest
{
public:
StartTerminalSessionRequest();
~StartTerminalSessionRequest();
long getResourceOwnerId()const;
void setResourceOwnerId(long resourceOwnerId);
std::string getRegionId()const;
void setRegionId(const std::string& regionId);
std::string getResourceOwnerAccount()const;
void setResourceOwnerAccount(const std::string& resourceOwnerAccount);
std::string getOwnerAccount()const;
void setOwnerAccount(const std::string& ownerAccount);
long getOwnerId()const;
void setOwnerId(long ownerId);
std::vector<std::string> getInstanceId()const;
void setInstanceId(const std::vector<std::string>& instanceId);
private:
long resourceOwnerId_;
std::string regionId_;
std::string resourceOwnerAccount_;
std::string ownerAccount_;
long ownerId_;
std::vector<std::string> instanceId_;
};
}
}
}
#endif // !ALIBABACLOUD_ECS_MODEL_STARTTERMINALSESSIONREQUEST_H_

View File

@@ -0,0 +1,55 @@
/*
* 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_ECS_MODEL_STARTTERMINALSESSIONRESULT_H_
#define ALIBABACLOUD_ECS_MODEL_STARTTERMINALSESSIONRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/ecs/EcsExport.h>
namespace AlibabaCloud
{
namespace Ecs
{
namespace Model
{
class ALIBABACLOUD_ECS_EXPORT StartTerminalSessionResult : public ServiceResult
{
public:
StartTerminalSessionResult();
explicit StartTerminalSessionResult(const std::string &payload);
~StartTerminalSessionResult();
std::string getSecurityToken()const;
std::string getWebSocketUrl()const;
std::string getSessionId()const;
protected:
void parse(const std::string &payload);
private:
std::string securityToken_;
std::string webSocketUrl_;
std::string sessionId_;
};
}
}
}
#endif // !ALIBABACLOUD_ECS_MODEL_STARTTERMINALSESSIONRESULT_H_

View File

@@ -11823,6 +11823,42 @@ EcsClient::StartInstancesOutcomeCallable EcsClient::startInstancesCallable(const
return task->get_future();
}
EcsClient::StartTerminalSessionOutcome EcsClient::startTerminalSession(const StartTerminalSessionRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return StartTerminalSessionOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return StartTerminalSessionOutcome(StartTerminalSessionResult(outcome.result()));
else
return StartTerminalSessionOutcome(outcome.error());
}
void EcsClient::startTerminalSessionAsync(const StartTerminalSessionRequest& request, const StartTerminalSessionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, startTerminalSession(request), context);
};
asyncExecute(new Runnable(fn));
}
EcsClient::StartTerminalSessionOutcomeCallable EcsClient::startTerminalSessionCallable(const StartTerminalSessionRequest &request) const
{
auto task = std::make_shared<std::packaged_task<StartTerminalSessionOutcome()>>(
[this, request]()
{
return this->startTerminalSession(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EcsClient::StopDiskReplicaPairOutcome EcsClient::stopDiskReplicaPair(const StopDiskReplicaPairRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -38,6 +38,17 @@ void DescribeImagesRequest::setActionType(const std::string& actionType)
setParameter("ActionType", actionType);
}
long DescribeImagesRequest::getImageOwnerId()const
{
return imageOwnerId_;
}
void DescribeImagesRequest::setImageOwnerId(long imageOwnerId)
{
imageOwnerId_ = imageOwnerId;
setParameter("ImageOwnerId", std::to_string(imageOwnerId));
}
long DescribeImagesRequest::getResourceOwnerId()const
{
return resourceOwnerId_;
@@ -159,6 +170,17 @@ void DescribeImagesRequest::setIsSupportCloudinit(bool isSupportCloudinit)
setParameter("IsSupportCloudinit", isSupportCloudinit ? "true" : "false");
}
bool DescribeImagesRequest::getIsPublic()const
{
return isPublic_;
}
void DescribeImagesRequest::setIsPublic(bool isPublic)
{
isPublic_ = isPublic;
setParameter("IsPublic", isPublic ? "true" : "false");
}
int DescribeImagesRequest::getPageSize()const
{
return pageSize_;

View File

@@ -89,6 +89,10 @@ void DescribeImagesResult::parse(const std::string &payload)
imagesObject.productCode = valueImagesImage["ProductCode"].asString();
if(!valueImagesImage["Architecture"].isNull())
imagesObject.architecture = valueImagesImage["Architecture"].asString();
if(!valueImagesImage["IsPublic"].isNull())
imagesObject.isPublic = valueImagesImage["IsPublic"].asString() == "true";
if(!valueImagesImage["ImageOwnerId"].isNull())
imagesObject.imageOwnerId = std::stol(valueImagesImage["ImageOwnerId"].asString());
auto allDiskDeviceMappingsNode = valueImagesImage["DiskDeviceMappings"]["DiskDeviceMapping"];
for (auto valueImagesImageDiskDeviceMappingsDiskDeviceMapping : allDiskDeviceMappingsNode)
{

View File

@@ -115,9 +115,9 @@ void DescribeInstanceModificationPriceRequest::setDataDisk(const std::vector<Dat
for(int dep1 = 0; dep1!= dataDisk.size(); dep1++) {
auto dataDiskObj = dataDisk.at(dep1);
std::string dataDiskObjStr = "DataDisk." + std::to_string(dep1 + 1);
setParameter(dataDiskObjStr + ".PerformanceLevel", dataDiskObj.performanceLevel);
setParameter(dataDiskObjStr + ".Size", std::to_string(dataDiskObj.size));
setParameter(dataDiskObjStr + ".Category", dataDiskObj.category);
setParameter(dataDiskObjStr + ".PerformanceLevel", dataDiskObj.performanceLevel);
}
}

View File

@@ -44,10 +44,10 @@ void DescribeInstanceModificationPriceResult::parse(const std::string &payload)
for (auto priceInfoNodeRulesRule : allRulesNode)
{
PriceInfo::Rule ruleObject;
if(!priceInfoNodeRulesRule["RuleId"].isNull())
ruleObject.ruleId = std::stol(priceInfoNodeRulesRule["RuleId"].asString());
if(!priceInfoNodeRulesRule["Description"].isNull())
ruleObject.description = priceInfoNodeRulesRule["Description"].asString();
if(!priceInfoNodeRulesRule["RuleId"].isNull())
ruleObject.ruleId = std::stol(priceInfoNodeRulesRule["RuleId"].asString());
priceInfo_.rules.push_back(ruleObject);
}
auto priceNode = priceInfoNode["Price"];
@@ -55,10 +55,10 @@ void DescribeInstanceModificationPriceResult::parse(const std::string &payload)
priceInfo_.price.originalPrice = std::stof(priceNode["OriginalPrice"].asString());
if(!priceNode["DiscountPrice"].isNull())
priceInfo_.price.discountPrice = std::stof(priceNode["DiscountPrice"].asString());
if(!priceNode["TradePrice"].isNull())
priceInfo_.price.tradePrice = std::stof(priceNode["TradePrice"].asString());
if(!priceNode["Currency"].isNull())
priceInfo_.price.currency = priceNode["Currency"].asString();
if(!priceNode["TradePrice"].isNull())
priceInfo_.price.tradePrice = std::stof(priceNode["TradePrice"].asString());
}

View File

@@ -60,6 +60,17 @@ void ModifyImageSharePermissionRequest::setRegionId(const std::string& regionId)
setParameter("RegionId", regionId);
}
bool ModifyImageSharePermissionRequest::getIsPublic()const
{
return isPublic_;
}
void ModifyImageSharePermissionRequest::setIsPublic(bool isPublic)
{
isPublic_ = isPublic;
setParameter("IsPublic", isPublic ? "true" : "false");
}
std::string ModifyImageSharePermissionRequest::getLaunchPermission()const
{
return launchPermission_;

View File

@@ -0,0 +1,97 @@
/*
* 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/StartTerminalSessionRequest.h>
using AlibabaCloud::Ecs::Model::StartTerminalSessionRequest;
StartTerminalSessionRequest::StartTerminalSessionRequest() :
RpcServiceRequest("ecs", "2014-05-26", "StartTerminalSession")
{
setMethod(HttpRequest::Method::Post);
}
StartTerminalSessionRequest::~StartTerminalSessionRequest()
{}
long StartTerminalSessionRequest::getResourceOwnerId()const
{
return resourceOwnerId_;
}
void StartTerminalSessionRequest::setResourceOwnerId(long resourceOwnerId)
{
resourceOwnerId_ = resourceOwnerId;
setParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
}
std::string StartTerminalSessionRequest::getRegionId()const
{
return regionId_;
}
void StartTerminalSessionRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
std::string StartTerminalSessionRequest::getResourceOwnerAccount()const
{
return resourceOwnerAccount_;
}
void StartTerminalSessionRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount)
{
resourceOwnerAccount_ = resourceOwnerAccount;
setParameter("ResourceOwnerAccount", resourceOwnerAccount);
}
std::string StartTerminalSessionRequest::getOwnerAccount()const
{
return ownerAccount_;
}
void StartTerminalSessionRequest::setOwnerAccount(const std::string& ownerAccount)
{
ownerAccount_ = ownerAccount;
setParameter("OwnerAccount", ownerAccount);
}
long StartTerminalSessionRequest::getOwnerId()const
{
return ownerId_;
}
void StartTerminalSessionRequest::setOwnerId(long ownerId)
{
ownerId_ = ownerId;
setParameter("OwnerId", std::to_string(ownerId));
}
std::vector<std::string> StartTerminalSessionRequest::getInstanceId()const
{
return instanceId_;
}
void StartTerminalSessionRequest::setInstanceId(const std::vector<std::string>& instanceId)
{
instanceId_ = instanceId;
for(int dep1 = 0; dep1!= instanceId.size(); dep1++) {
setParameter("InstanceId."+ std::to_string(dep1), instanceId.at(dep1));
}
}

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/ecs/model/StartTerminalSessionResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ecs;
using namespace AlibabaCloud::Ecs::Model;
StartTerminalSessionResult::StartTerminalSessionResult() :
ServiceResult()
{}
StartTerminalSessionResult::StartTerminalSessionResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
StartTerminalSessionResult::~StartTerminalSessionResult()
{}
void StartTerminalSessionResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["SessionId"].isNull())
sessionId_ = value["SessionId"].asString();
if(!value["SecurityToken"].isNull())
securityToken_ = value["SecurityToken"].asString();
if(!value["WebSocketUrl"].isNull())
webSocketUrl_ = value["WebSocketUrl"].asString();
}
std::string StartTerminalSessionResult::getSecurityToken()const
{
return securityToken_;
}
std::string StartTerminalSessionResult::getWebSocketUrl()const
{
return webSocketUrl_;
}
std::string StartTerminalSessionResult::getSessionId()const
{
return sessionId_;
}