Add SwitchInstanceHA API.
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2021-01-13 Version: patch
|
||||
- Add SwitchInstanceHA API.
|
||||
- ModifyInstanceSpec add SourceBiz param.
|
||||
|
||||
2021-01-13 Version: patch
|
||||
- Add support for IoT jobs, including job management and query APIs like CreateJob, UpdateJob, QueryJob, CancelJob, ListTask, QueryTask, QueryJobStatistics etc.
|
||||
|
||||
|
||||
@@ -187,6 +187,8 @@ set(r-kvstore_public_header_model
|
||||
include/alibabacloud/r-kvstore/model/RestartInstanceResult.h
|
||||
include/alibabacloud/r-kvstore/model/RestoreInstanceRequest.h
|
||||
include/alibabacloud/r-kvstore/model/RestoreInstanceResult.h
|
||||
include/alibabacloud/r-kvstore/model/SwitchInstanceHARequest.h
|
||||
include/alibabacloud/r-kvstore/model/SwitchInstanceHAResult.h
|
||||
include/alibabacloud/r-kvstore/model/SwitchNetworkRequest.h
|
||||
include/alibabacloud/r-kvstore/model/SwitchNetworkResult.h
|
||||
include/alibabacloud/r-kvstore/model/SyncDtsStatusRequest.h
|
||||
@@ -366,6 +368,8 @@ set(r-kvstore_src
|
||||
src/model/RestartInstanceResult.cc
|
||||
src/model/RestoreInstanceRequest.cc
|
||||
src/model/RestoreInstanceResult.cc
|
||||
src/model/SwitchInstanceHARequest.cc
|
||||
src/model/SwitchInstanceHAResult.cc
|
||||
src/model/SwitchNetworkRequest.cc
|
||||
src/model/SwitchNetworkResult.cc
|
||||
src/model/SyncDtsStatusRequest.cc
|
||||
|
||||
@@ -188,6 +188,8 @@
|
||||
#include "model/RestartInstanceResult.h"
|
||||
#include "model/RestoreInstanceRequest.h"
|
||||
#include "model/RestoreInstanceResult.h"
|
||||
#include "model/SwitchInstanceHARequest.h"
|
||||
#include "model/SwitchInstanceHAResult.h"
|
||||
#include "model/SwitchNetworkRequest.h"
|
||||
#include "model/SwitchNetworkResult.h"
|
||||
#include "model/SyncDtsStatusRequest.h"
|
||||
@@ -456,6 +458,9 @@ namespace AlibabaCloud
|
||||
typedef Outcome<Error, Model::RestoreInstanceResult> RestoreInstanceOutcome;
|
||||
typedef std::future<RestoreInstanceOutcome> RestoreInstanceOutcomeCallable;
|
||||
typedef std::function<void(const R_kvstoreClient*, const Model::RestoreInstanceRequest&, const RestoreInstanceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RestoreInstanceAsyncHandler;
|
||||
typedef Outcome<Error, Model::SwitchInstanceHAResult> SwitchInstanceHAOutcome;
|
||||
typedef std::future<SwitchInstanceHAOutcome> SwitchInstanceHAOutcomeCallable;
|
||||
typedef std::function<void(const R_kvstoreClient*, const Model::SwitchInstanceHARequest&, const SwitchInstanceHAOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SwitchInstanceHAAsyncHandler;
|
||||
typedef Outcome<Error, Model::SwitchNetworkResult> SwitchNetworkOutcome;
|
||||
typedef std::future<SwitchNetworkOutcome> SwitchNetworkOutcomeCallable;
|
||||
typedef std::function<void(const R_kvstoreClient*, const Model::SwitchNetworkRequest&, const SwitchNetworkOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SwitchNetworkAsyncHandler;
|
||||
@@ -725,6 +730,9 @@ namespace AlibabaCloud
|
||||
RestoreInstanceOutcome restoreInstance(const Model::RestoreInstanceRequest &request)const;
|
||||
void restoreInstanceAsync(const Model::RestoreInstanceRequest& request, const RestoreInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
RestoreInstanceOutcomeCallable restoreInstanceCallable(const Model::RestoreInstanceRequest& request) const;
|
||||
SwitchInstanceHAOutcome switchInstanceHA(const Model::SwitchInstanceHARequest &request)const;
|
||||
void switchInstanceHAAsync(const Model::SwitchInstanceHARequest& request, const SwitchInstanceHAAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
SwitchInstanceHAOutcomeCallable switchInstanceHACallable(const Model::SwitchInstanceHARequest& request) const;
|
||||
SwitchNetworkOutcome switchNetwork(const Model::SwitchNetworkRequest &request)const;
|
||||
void switchNetworkAsync(const Model::SwitchNetworkRequest& request, const SwitchNetworkAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
SwitchNetworkOutcomeCallable switchNetworkCallable(const Model::SwitchNetworkRequest& request) const;
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace AlibabaCloud
|
||||
void setSecurityToken(const std::string& securityToken);
|
||||
std::string getEffectiveTime()const;
|
||||
void setEffectiveTime(const std::string& effectiveTime);
|
||||
std::string getSourceBiz()const;
|
||||
void setSourceBiz(const std::string& sourceBiz);
|
||||
std::string getBusinessInfo()const;
|
||||
void setBusinessInfo(const std::string& businessInfo);
|
||||
bool getAutoPay()const;
|
||||
@@ -78,6 +80,7 @@ namespace AlibabaCloud
|
||||
std::string accessKeyId_;
|
||||
std::string securityToken_;
|
||||
std::string effectiveTime_;
|
||||
std::string sourceBiz_;
|
||||
std::string businessInfo_;
|
||||
bool autoPay_;
|
||||
std::string fromApp_;
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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_R_KVSTORE_MODEL_SWITCHINSTANCEHAREQUEST_H_
|
||||
#define ALIBABACLOUD_R_KVSTORE_MODEL_SWITCHINSTANCEHAREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/r-kvstore/R_kvstoreExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace R_kvstore
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_R_KVSTORE_EXPORT SwitchInstanceHARequest : public RpcServiceRequest
|
||||
{
|
||||
|
||||
public:
|
||||
SwitchInstanceHARequest();
|
||||
~SwitchInstanceHARequest();
|
||||
|
||||
long getResourceOwnerId()const;
|
||||
void setResourceOwnerId(long resourceOwnerId);
|
||||
std::string getAccessKeyId()const;
|
||||
void setAccessKeyId(const std::string& accessKeyId);
|
||||
int getSwitchMode()const;
|
||||
void setSwitchMode(int switchMode);
|
||||
std::string getSecurityToken()const;
|
||||
void setSecurityToken(const std::string& securityToken);
|
||||
std::string getNodeId()const;
|
||||
void setNodeId(const std::string& nodeId);
|
||||
std::string getProduct()const;
|
||||
void setProduct(const std::string& product);
|
||||
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::string getInstanceId()const;
|
||||
void setInstanceId(const std::string& instanceId);
|
||||
std::string getSwitchType()const;
|
||||
void setSwitchType(const std::string& switchType);
|
||||
std::string getCategory()const;
|
||||
void setCategory(const std::string& category);
|
||||
|
||||
private:
|
||||
long resourceOwnerId_;
|
||||
std::string accessKeyId_;
|
||||
int switchMode_;
|
||||
std::string securityToken_;
|
||||
std::string nodeId_;
|
||||
std::string product_;
|
||||
std::string resourceOwnerAccount_;
|
||||
std::string ownerAccount_;
|
||||
long ownerId_;
|
||||
std::string instanceId_;
|
||||
std::string switchType_;
|
||||
std::string category_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_R_KVSTORE_MODEL_SWITCHINSTANCEHAREQUEST_H_
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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_R_KVSTORE_MODEL_SWITCHINSTANCEHARESULT_H_
|
||||
#define ALIBABACLOUD_R_KVSTORE_MODEL_SWITCHINSTANCEHARESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/r-kvstore/R_kvstoreExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace R_kvstore
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_R_KVSTORE_EXPORT SwitchInstanceHAResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
SwitchInstanceHAResult();
|
||||
explicit SwitchInstanceHAResult(const std::string &payload);
|
||||
~SwitchInstanceHAResult();
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_R_KVSTORE_MODEL_SWITCHINSTANCEHARESULT_H_
|
||||
@@ -3039,6 +3039,42 @@ R_kvstoreClient::RestoreInstanceOutcomeCallable R_kvstoreClient::restoreInstance
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
R_kvstoreClient::SwitchInstanceHAOutcome R_kvstoreClient::switchInstanceHA(const SwitchInstanceHARequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return SwitchInstanceHAOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return SwitchInstanceHAOutcome(SwitchInstanceHAResult(outcome.result()));
|
||||
else
|
||||
return SwitchInstanceHAOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void R_kvstoreClient::switchInstanceHAAsync(const SwitchInstanceHARequest& request, const SwitchInstanceHAAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, switchInstanceHA(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
R_kvstoreClient::SwitchInstanceHAOutcomeCallable R_kvstoreClient::switchInstanceHACallable(const SwitchInstanceHARequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<SwitchInstanceHAOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->switchInstanceHA(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
R_kvstoreClient::SwitchNetworkOutcome R_kvstoreClient::switchNetwork(const SwitchNetworkRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -104,6 +104,17 @@ void ModifyInstanceSpecRequest::setEffectiveTime(const std::string& effectiveTim
|
||||
setParameter("EffectiveTime", effectiveTime);
|
||||
}
|
||||
|
||||
std::string ModifyInstanceSpecRequest::getSourceBiz()const
|
||||
{
|
||||
return sourceBiz_;
|
||||
}
|
||||
|
||||
void ModifyInstanceSpecRequest::setSourceBiz(const std::string& sourceBiz)
|
||||
{
|
||||
sourceBiz_ = sourceBiz;
|
||||
setParameter("SourceBiz", sourceBiz);
|
||||
}
|
||||
|
||||
std::string ModifyInstanceSpecRequest::getBusinessInfo()const
|
||||
{
|
||||
return businessInfo_;
|
||||
|
||||
161
r-kvstore/src/model/SwitchInstanceHARequest.cc
Normal file
161
r-kvstore/src/model/SwitchInstanceHARequest.cc
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* 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/r-kvstore/model/SwitchInstanceHARequest.h>
|
||||
|
||||
using AlibabaCloud::R_kvstore::Model::SwitchInstanceHARequest;
|
||||
|
||||
SwitchInstanceHARequest::SwitchInstanceHARequest() :
|
||||
RpcServiceRequest("r-kvstore", "2015-01-01", "SwitchInstanceHA")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
SwitchInstanceHARequest::~SwitchInstanceHARequest()
|
||||
{}
|
||||
|
||||
long SwitchInstanceHARequest::getResourceOwnerId()const
|
||||
{
|
||||
return resourceOwnerId_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setResourceOwnerId(long resourceOwnerId)
|
||||
{
|
||||
resourceOwnerId_ = resourceOwnerId;
|
||||
setParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
|
||||
}
|
||||
|
||||
std::string SwitchInstanceHARequest::getAccessKeyId()const
|
||||
{
|
||||
return accessKeyId_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setAccessKeyId(const std::string& accessKeyId)
|
||||
{
|
||||
accessKeyId_ = accessKeyId;
|
||||
setParameter("AccessKeyId", accessKeyId);
|
||||
}
|
||||
|
||||
int SwitchInstanceHARequest::getSwitchMode()const
|
||||
{
|
||||
return switchMode_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setSwitchMode(int switchMode)
|
||||
{
|
||||
switchMode_ = switchMode;
|
||||
setParameter("SwitchMode", std::to_string(switchMode));
|
||||
}
|
||||
|
||||
std::string SwitchInstanceHARequest::getSecurityToken()const
|
||||
{
|
||||
return securityToken_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setSecurityToken(const std::string& securityToken)
|
||||
{
|
||||
securityToken_ = securityToken;
|
||||
setParameter("SecurityToken", securityToken);
|
||||
}
|
||||
|
||||
std::string SwitchInstanceHARequest::getNodeId()const
|
||||
{
|
||||
return nodeId_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setNodeId(const std::string& nodeId)
|
||||
{
|
||||
nodeId_ = nodeId;
|
||||
setParameter("NodeId", nodeId);
|
||||
}
|
||||
|
||||
std::string SwitchInstanceHARequest::getProduct()const
|
||||
{
|
||||
return product_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setProduct(const std::string& product)
|
||||
{
|
||||
product_ = product;
|
||||
setParameter("Product", product);
|
||||
}
|
||||
|
||||
std::string SwitchInstanceHARequest::getResourceOwnerAccount()const
|
||||
{
|
||||
return resourceOwnerAccount_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount)
|
||||
{
|
||||
resourceOwnerAccount_ = resourceOwnerAccount;
|
||||
setParameter("ResourceOwnerAccount", resourceOwnerAccount);
|
||||
}
|
||||
|
||||
std::string SwitchInstanceHARequest::getOwnerAccount()const
|
||||
{
|
||||
return ownerAccount_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setOwnerAccount(const std::string& ownerAccount)
|
||||
{
|
||||
ownerAccount_ = ownerAccount;
|
||||
setParameter("OwnerAccount", ownerAccount);
|
||||
}
|
||||
|
||||
long SwitchInstanceHARequest::getOwnerId()const
|
||||
{
|
||||
return ownerId_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setOwnerId(long ownerId)
|
||||
{
|
||||
ownerId_ = ownerId;
|
||||
setParameter("OwnerId", std::to_string(ownerId));
|
||||
}
|
||||
|
||||
std::string SwitchInstanceHARequest::getInstanceId()const
|
||||
{
|
||||
return instanceId_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setInstanceId(const std::string& instanceId)
|
||||
{
|
||||
instanceId_ = instanceId;
|
||||
setParameter("InstanceId", instanceId);
|
||||
}
|
||||
|
||||
std::string SwitchInstanceHARequest::getSwitchType()const
|
||||
{
|
||||
return switchType_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setSwitchType(const std::string& switchType)
|
||||
{
|
||||
switchType_ = switchType;
|
||||
setParameter("SwitchType", switchType);
|
||||
}
|
||||
|
||||
std::string SwitchInstanceHARequest::getCategory()const
|
||||
{
|
||||
return category_;
|
||||
}
|
||||
|
||||
void SwitchInstanceHARequest::setCategory(const std::string& category)
|
||||
{
|
||||
category_ = category;
|
||||
setParameter("Category", category);
|
||||
}
|
||||
|
||||
44
r-kvstore/src/model/SwitchInstanceHAResult.cc
Normal file
44
r-kvstore/src/model/SwitchInstanceHAResult.cc
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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/r-kvstore/model/SwitchInstanceHAResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::R_kvstore;
|
||||
using namespace AlibabaCloud::R_kvstore::Model;
|
||||
|
||||
SwitchInstanceHAResult::SwitchInstanceHAResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
SwitchInstanceHAResult::SwitchInstanceHAResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
SwitchInstanceHAResult::~SwitchInstanceHAResult()
|
||||
{}
|
||||
|
||||
void SwitchInstanceHAResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user