Add new apis.
This commit is contained in:
@@ -139,6 +139,8 @@ set(swas-open_public_header_model
|
||||
include/alibabacloud/swas-open/model/StartInstanceResult.h
|
||||
include/alibabacloud/swas-open/model/StartInstancesRequest.h
|
||||
include/alibabacloud/swas-open/model/StartInstancesResult.h
|
||||
include/alibabacloud/swas-open/model/StartTerminalSessionRequest.h
|
||||
include/alibabacloud/swas-open/model/StartTerminalSessionResult.h
|
||||
include/alibabacloud/swas-open/model/StopDatabaseInstanceRequest.h
|
||||
include/alibabacloud/swas-open/model/StopDatabaseInstanceResult.h
|
||||
include/alibabacloud/swas-open/model/StopInstanceRequest.h
|
||||
@@ -276,6 +278,8 @@ set(swas-open_src
|
||||
src/model/StartInstanceResult.cc
|
||||
src/model/StartInstancesRequest.cc
|
||||
src/model/StartInstancesResult.cc
|
||||
src/model/StartTerminalSessionRequest.cc
|
||||
src/model/StartTerminalSessionResult.cc
|
||||
src/model/StopDatabaseInstanceRequest.cc
|
||||
src/model/StopDatabaseInstanceResult.cc
|
||||
src/model/StopInstanceRequest.cc
|
||||
|
||||
@@ -140,6 +140,8 @@
|
||||
#include "model/StartInstanceResult.h"
|
||||
#include "model/StartInstancesRequest.h"
|
||||
#include "model/StartInstancesResult.h"
|
||||
#include "model/StartTerminalSessionRequest.h"
|
||||
#include "model/StartTerminalSessionResult.h"
|
||||
#include "model/StopDatabaseInstanceRequest.h"
|
||||
#include "model/StopDatabaseInstanceResult.h"
|
||||
#include "model/StopInstanceRequest.h"
|
||||
@@ -342,6 +344,9 @@ namespace AlibabaCloud
|
||||
typedef Outcome<Error, Model::StartInstancesResult> StartInstancesOutcome;
|
||||
typedef std::future<StartInstancesOutcome> StartInstancesOutcomeCallable;
|
||||
typedef std::function<void(const SWAS_OPENClient*, 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 SWAS_OPENClient*, const Model::StartTerminalSessionRequest&, const StartTerminalSessionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> StartTerminalSessionAsyncHandler;
|
||||
typedef Outcome<Error, Model::StopDatabaseInstanceResult> StopDatabaseInstanceOutcome;
|
||||
typedef std::future<StopDatabaseInstanceOutcome> StopDatabaseInstanceOutcomeCallable;
|
||||
typedef std::function<void(const SWAS_OPENClient*, const Model::StopDatabaseInstanceRequest&, const StopDatabaseInstanceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> StopDatabaseInstanceAsyncHandler;
|
||||
@@ -548,6 +553,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;
|
||||
StopDatabaseInstanceOutcome stopDatabaseInstance(const Model::StopDatabaseInstanceRequest &request)const;
|
||||
void stopDatabaseInstanceAsync(const Model::StopDatabaseInstanceRequest& request, const StopDatabaseInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
StopDatabaseInstanceOutcomeCallable stopDatabaseInstanceCallable(const Model::StopDatabaseInstanceRequest& request) const;
|
||||
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
void setPublicIpAddresses(const std::string &publicIpAddresses);
|
||||
std::string getChargeType() const;
|
||||
void setChargeType(const std::string &chargeType);
|
||||
std::string getStatus() const;
|
||||
void setStatus(const std::string &status);
|
||||
|
||||
private:
|
||||
int pageNumber_;
|
||||
@@ -50,6 +52,7 @@ private:
|
||||
int pageSize_;
|
||||
std::string publicIpAddresses_;
|
||||
std::string chargeType_;
|
||||
std::string status_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace SWAS_OPEN
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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_SWAS_OPEN_MODEL_STARTTERMINALSESSIONREQUEST_H_
|
||||
#define ALIBABACLOUD_SWAS_OPEN_MODEL_STARTTERMINALSESSIONREQUEST_H_
|
||||
|
||||
#include <alibabacloud/swas-open/SWAS_OPENExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace SWAS_OPEN {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_SWAS_OPEN_EXPORT StartTerminalSessionRequest : public RpcServiceRequest {
|
||||
public:
|
||||
StartTerminalSessionRequest();
|
||||
~StartTerminalSessionRequest();
|
||||
std::string getInstanceId() const;
|
||||
void setInstanceId(const std::string &instanceId);
|
||||
std::string getRegionId() const;
|
||||
void setRegionId(const std::string ®ionId);
|
||||
|
||||
private:
|
||||
std::string instanceId_;
|
||||
std::string regionId_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace SWAS_OPEN
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_SWAS_OPEN_MODEL_STARTTERMINALSESSIONREQUEST_H_
|
||||
@@ -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_SWAS_OPEN_MODEL_STARTTERMINALSESSIONRESULT_H_
|
||||
#define ALIBABACLOUD_SWAS_OPEN_MODEL_STARTTERMINALSESSIONRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/swas-open/SWAS_OPENExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace SWAS_OPEN
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_SWAS_OPEN_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_SWAS_OPEN_MODEL_STARTTERMINALSESSIONRESULT_H_
|
||||
@@ -2175,6 +2175,42 @@ SWAS_OPENClient::StartInstancesOutcomeCallable SWAS_OPENClient::startInstancesCa
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
SWAS_OPENClient::StartTerminalSessionOutcome SWAS_OPENClient::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 SWAS_OPENClient::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));
|
||||
}
|
||||
|
||||
SWAS_OPENClient::StartTerminalSessionOutcomeCallable SWAS_OPENClient::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();
|
||||
}
|
||||
|
||||
SWAS_OPENClient::StopDatabaseInstanceOutcome SWAS_OPENClient::stopDatabaseInstance(const StopDatabaseInstanceRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -79,3 +79,12 @@ void ListInstancesRequest::setChargeType(const std::string &chargeType) {
|
||||
setParameter(std::string("ChargeType"), chargeType);
|
||||
}
|
||||
|
||||
std::string ListInstancesRequest::getStatus() const {
|
||||
return status_;
|
||||
}
|
||||
|
||||
void ListInstancesRequest::setStatus(const std::string &status) {
|
||||
status_ = status;
|
||||
setParameter(std::string("Status"), status);
|
||||
}
|
||||
|
||||
|
||||
45
swas-open/src/model/StartTerminalSessionRequest.cc
Normal file
45
swas-open/src/model/StartTerminalSessionRequest.cc
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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/swas-open/model/StartTerminalSessionRequest.h>
|
||||
|
||||
using AlibabaCloud::SWAS_OPEN::Model::StartTerminalSessionRequest;
|
||||
|
||||
StartTerminalSessionRequest::StartTerminalSessionRequest()
|
||||
: RpcServiceRequest("swas-open", "2020-06-01", "StartTerminalSession") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
StartTerminalSessionRequest::~StartTerminalSessionRequest() {}
|
||||
|
||||
std::string StartTerminalSessionRequest::getInstanceId() const {
|
||||
return instanceId_;
|
||||
}
|
||||
|
||||
void StartTerminalSessionRequest::setInstanceId(const std::string &instanceId) {
|
||||
instanceId_ = instanceId;
|
||||
setParameter(std::string("InstanceId"), instanceId);
|
||||
}
|
||||
|
||||
std::string StartTerminalSessionRequest::getRegionId() const {
|
||||
return regionId_;
|
||||
}
|
||||
|
||||
void StartTerminalSessionRequest::setRegionId(const std::string ®ionId) {
|
||||
regionId_ = regionId;
|
||||
setParameter(std::string("RegionId"), regionId);
|
||||
}
|
||||
|
||||
65
swas-open/src/model/StartTerminalSessionResult.cc
Normal file
65
swas-open/src/model/StartTerminalSessionResult.cc
Normal 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/swas-open/model/StartTerminalSessionResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::SWAS_OPEN;
|
||||
using namespace AlibabaCloud::SWAS_OPEN::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_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user