From 24b5803214be1300d4a4459a5fb6053ec72afd47 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Tue, 10 Aug 2021 02:15:17 +0000 Subject: [PATCH] Supported DescribeSubscriptionMeta for distributed subscription. --- CHANGELOG | 5 + VERSION | 2 +- dts/CMakeLists.txt | 4 + dts/include/alibabacloud/dts/DtsClient.h | 8 ++ .../model/DescribeConsumerChannelRequest.h | 3 + .../model/DescribeSubscriptionMetaRequest.h | 60 ++++++++++++ .../model/DescribeSubscriptionMetaResult.h | 67 +++++++++++++ .../dts/model/ModifyDtsJobRequest.h | 3 + dts/src/DtsClient.cc | 36 +++++++ .../model/DescribeConsumerChannelRequest.cc | 11 +++ .../model/DescribeSubscriptionMetaRequest.cc | 84 +++++++++++++++++ .../model/DescribeSubscriptionMetaResult.cc | 93 +++++++++++++++++++ dts/src/model/ModifyDtsJobRequest.cc | 11 +++ 13 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 dts/include/alibabacloud/dts/model/DescribeSubscriptionMetaRequest.h create mode 100644 dts/include/alibabacloud/dts/model/DescribeSubscriptionMetaResult.h create mode 100644 dts/src/model/DescribeSubscriptionMetaRequest.cc create mode 100644 dts/src/model/DescribeSubscriptionMetaResult.cc diff --git a/CHANGELOG b/CHANGELOG index 17150bfbf..8c7bea904 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2021-08-10 Version: 1.36.844 +- Supported DescribeSubscriptionMeta for distributed subscription. +- Supported ParentChannelId for DescribeConsumerChannel. +- Supported Reserve for ModifyDtsJob. + 2021-08-09 Version: 1.36.843 - Supported DescribeSubscriptionMeta for distributed subscription. - Supported ParentChannelId for DescribeConsumerChannel. diff --git a/VERSION b/VERSION index 5af82cba6..c23de1a3b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.843 \ No newline at end of file +1.36.844 \ No newline at end of file diff --git a/dts/CMakeLists.txt b/dts/CMakeLists.txt index 38102275c..6cf6533e4 100644 --- a/dts/CMakeLists.txt +++ b/dts/CMakeLists.txt @@ -99,6 +99,8 @@ set(dts_public_header_model include/alibabacloud/dts/model/DescribeSubscriptionInstanceStatusResult.h include/alibabacloud/dts/model/DescribeSubscriptionInstancesRequest.h include/alibabacloud/dts/model/DescribeSubscriptionInstancesResult.h + include/alibabacloud/dts/model/DescribeSubscriptionMetaRequest.h + include/alibabacloud/dts/model/DescribeSubscriptionMetaResult.h include/alibabacloud/dts/model/DescribeSynchronizationJobAlertRequest.h include/alibabacloud/dts/model/DescribeSynchronizationJobAlertResult.h include/alibabacloud/dts/model/DescribeSynchronizationJobReplicatorCompareRequest.h @@ -254,6 +256,8 @@ set(dts_src src/model/DescribeSubscriptionInstanceStatusResult.cc src/model/DescribeSubscriptionInstancesRequest.cc src/model/DescribeSubscriptionInstancesResult.cc + src/model/DescribeSubscriptionMetaRequest.cc + src/model/DescribeSubscriptionMetaResult.cc src/model/DescribeSynchronizationJobAlertRequest.cc src/model/DescribeSynchronizationJobAlertResult.cc src/model/DescribeSynchronizationJobReplicatorCompareRequest.cc diff --git a/dts/include/alibabacloud/dts/DtsClient.h b/dts/include/alibabacloud/dts/DtsClient.h index a1f4b0a3a..c01fe435b 100644 --- a/dts/include/alibabacloud/dts/DtsClient.h +++ b/dts/include/alibabacloud/dts/DtsClient.h @@ -100,6 +100,8 @@ #include "model/DescribeSubscriptionInstanceStatusResult.h" #include "model/DescribeSubscriptionInstancesRequest.h" #include "model/DescribeSubscriptionInstancesResult.h" +#include "model/DescribeSubscriptionMetaRequest.h" +#include "model/DescribeSubscriptionMetaResult.h" #include "model/DescribeSynchronizationJobAlertRequest.h" #include "model/DescribeSynchronizationJobAlertResult.h" #include "model/DescribeSynchronizationJobReplicatorCompareRequest.h" @@ -300,6 +302,9 @@ namespace AlibabaCloud typedef Outcome DescribeSubscriptionInstancesOutcome; typedef std::future DescribeSubscriptionInstancesOutcomeCallable; typedef std::function&)> DescribeSubscriptionInstancesAsyncHandler; + typedef Outcome DescribeSubscriptionMetaOutcome; + typedef std::future DescribeSubscriptionMetaOutcomeCallable; + typedef std::function&)> DescribeSubscriptionMetaAsyncHandler; typedef Outcome DescribeSynchronizationJobAlertOutcome; typedef std::future DescribeSynchronizationJobAlertOutcomeCallable; typedef std::function&)> DescribeSynchronizationJobAlertAsyncHandler; @@ -533,6 +538,9 @@ namespace AlibabaCloud DescribeSubscriptionInstancesOutcome describeSubscriptionInstances(const Model::DescribeSubscriptionInstancesRequest &request)const; void describeSubscriptionInstancesAsync(const Model::DescribeSubscriptionInstancesRequest& request, const DescribeSubscriptionInstancesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeSubscriptionInstancesOutcomeCallable describeSubscriptionInstancesCallable(const Model::DescribeSubscriptionInstancesRequest& request) const; + DescribeSubscriptionMetaOutcome describeSubscriptionMeta(const Model::DescribeSubscriptionMetaRequest &request)const; + void describeSubscriptionMetaAsync(const Model::DescribeSubscriptionMetaRequest& request, const DescribeSubscriptionMetaAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeSubscriptionMetaOutcomeCallable describeSubscriptionMetaCallable(const Model::DescribeSubscriptionMetaRequest& request) const; DescribeSynchronizationJobAlertOutcome describeSynchronizationJobAlert(const Model::DescribeSynchronizationJobAlertRequest &request)const; void describeSynchronizationJobAlertAsync(const Model::DescribeSynchronizationJobAlertRequest& request, const DescribeSynchronizationJobAlertAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeSynchronizationJobAlertOutcomeCallable describeSynchronizationJobAlertCallable(const Model::DescribeSynchronizationJobAlertRequest& request) const; diff --git a/dts/include/alibabacloud/dts/model/DescribeConsumerChannelRequest.h b/dts/include/alibabacloud/dts/model/DescribeConsumerChannelRequest.h index 4ed1d21c4..1988baf9f 100644 --- a/dts/include/alibabacloud/dts/model/DescribeConsumerChannelRequest.h +++ b/dts/include/alibabacloud/dts/model/DescribeConsumerChannelRequest.h @@ -39,6 +39,8 @@ namespace AlibabaCloud void setPageNumber(int pageNumber); std::string getRegionId()const; void setRegionId(const std::string& regionId); + std::string getParentChannelId()const; + void setParentChannelId(const std::string& parentChannelId); int getPageSize()const; void setPageSize(int pageSize); std::string getDtsJobId()const; @@ -49,6 +51,7 @@ namespace AlibabaCloud private: int pageNumber_; std::string regionId_; + std::string parentChannelId_; int pageSize_; std::string dtsJobId_; std::string dtsInstanceId_; diff --git a/dts/include/alibabacloud/dts/model/DescribeSubscriptionMetaRequest.h b/dts/include/alibabacloud/dts/model/DescribeSubscriptionMetaRequest.h new file mode 100644 index 000000000..229caf64e --- /dev/null +++ b/dts/include/alibabacloud/dts/model/DescribeSubscriptionMetaRequest.h @@ -0,0 +1,60 @@ +/* + * 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_DTS_MODEL_DESCRIBESUBSCRIPTIONMETAREQUEST_H_ +#define ALIBABACLOUD_DTS_MODEL_DESCRIBESUBSCRIPTIONMETAREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dts + { + namespace Model + { + class ALIBABACLOUD_DTS_EXPORT DescribeSubscriptionMetaRequest : public RpcServiceRequest + { + + public: + DescribeSubscriptionMetaRequest(); + ~DescribeSubscriptionMetaRequest(); + + std::string getTopics()const; + void setTopics(const std::string& topics); + std::string getSid()const; + void setSid(const std::string& sid); + std::string getRegionId()const; + void setRegionId(const std::string& regionId); + std::string getSubMigrationJobIds()const; + void setSubMigrationJobIds(const std::string& subMigrationJobIds); + std::string getDtsInstanceId()const; + void setDtsInstanceId(const std::string& dtsInstanceId); + + private: + std::string topics_; + std::string sid_; + std::string regionId_; + std::string subMigrationJobIds_; + std::string dtsInstanceId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DTS_MODEL_DESCRIBESUBSCRIPTIONMETAREQUEST_H_ \ No newline at end of file diff --git a/dts/include/alibabacloud/dts/model/DescribeSubscriptionMetaResult.h b/dts/include/alibabacloud/dts/model/DescribeSubscriptionMetaResult.h new file mode 100644 index 000000000..b65ccd09d --- /dev/null +++ b/dts/include/alibabacloud/dts/model/DescribeSubscriptionMetaResult.h @@ -0,0 +1,67 @@ +/* + * 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_DTS_MODEL_DESCRIBESUBSCRIPTIONMETARESULT_H_ +#define ALIBABACLOUD_DTS_MODEL_DESCRIBESUBSCRIPTIONMETARESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dts + { + namespace Model + { + class ALIBABACLOUD_DTS_EXPORT DescribeSubscriptionMetaResult : public ServiceResult + { + public: + struct SubscriptionMetaListItem + { + long checkpoint; + std::string dBList; + std::string dProxyUrl; + std::string topic; + std::string sid; + }; + + + DescribeSubscriptionMetaResult(); + explicit DescribeSubscriptionMetaResult(const std::string &payload); + ~DescribeSubscriptionMetaResult(); + std::vector getSubscriptionMetaList()const; + std::string getHttpStatusCode()const; + std::string getErrMessage()const; + std::string getSuccess()const; + std::string getErrCode()const; + + protected: + void parse(const std::string &payload); + private: + std::vector subscriptionMetaList_; + std::string httpStatusCode_; + std::string errMessage_; + std::string success_; + std::string errCode_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DTS_MODEL_DESCRIBESUBSCRIPTIONMETARESULT_H_ \ No newline at end of file diff --git a/dts/include/alibabacloud/dts/model/ModifyDtsJobRequest.h b/dts/include/alibabacloud/dts/model/ModifyDtsJobRequest.h index d094719dc..df9b66dcb 100644 --- a/dts/include/alibabacloud/dts/model/ModifyDtsJobRequest.h +++ b/dts/include/alibabacloud/dts/model/ModifyDtsJobRequest.h @@ -45,6 +45,8 @@ namespace AlibabaCloud void setAccessKeyId(const std::string& accessKeyId); std::string getRegionId()const; void setRegionId(const std::string& regionId); + std::string getReserve()const; + void setReserve(const std::string& reserve); std::string getDtsInstanceId()const; void setDtsInstanceId(const std::string& dtsInstanceId); std::string getSynchronizationDirection()const; @@ -56,6 +58,7 @@ namespace AlibabaCloud std::string ownerId_; std::string accessKeyId_; std::string regionId_; + std::string reserve_; std::string dtsInstanceId_; std::string synchronizationDirection_; diff --git a/dts/src/DtsClient.cc b/dts/src/DtsClient.cc index fc1ae6af2..53cb25552 100644 --- a/dts/src/DtsClient.cc +++ b/dts/src/DtsClient.cc @@ -1455,6 +1455,42 @@ DtsClient::DescribeSubscriptionInstancesOutcomeCallable DtsClient::describeSubsc return task->get_future(); } +DtsClient::DescribeSubscriptionMetaOutcome DtsClient::describeSubscriptionMeta(const DescribeSubscriptionMetaRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeSubscriptionMetaOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeSubscriptionMetaOutcome(DescribeSubscriptionMetaResult(outcome.result())); + else + return DescribeSubscriptionMetaOutcome(outcome.error()); +} + +void DtsClient::describeSubscriptionMetaAsync(const DescribeSubscriptionMetaRequest& request, const DescribeSubscriptionMetaAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeSubscriptionMeta(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +DtsClient::DescribeSubscriptionMetaOutcomeCallable DtsClient::describeSubscriptionMetaCallable(const DescribeSubscriptionMetaRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeSubscriptionMeta(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + DtsClient::DescribeSynchronizationJobAlertOutcome DtsClient::describeSynchronizationJobAlert(const DescribeSynchronizationJobAlertRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/dts/src/model/DescribeConsumerChannelRequest.cc b/dts/src/model/DescribeConsumerChannelRequest.cc index 41e4f3dfc..a4772052c 100644 --- a/dts/src/model/DescribeConsumerChannelRequest.cc +++ b/dts/src/model/DescribeConsumerChannelRequest.cc @@ -49,6 +49,17 @@ void DescribeConsumerChannelRequest::setRegionId(const std::string& regionId) setParameter("RegionId", regionId); } +std::string DescribeConsumerChannelRequest::getParentChannelId()const +{ + return parentChannelId_; +} + +void DescribeConsumerChannelRequest::setParentChannelId(const std::string& parentChannelId) +{ + parentChannelId_ = parentChannelId; + setParameter("ParentChannelId", parentChannelId); +} + int DescribeConsumerChannelRequest::getPageSize()const { return pageSize_; diff --git a/dts/src/model/DescribeSubscriptionMetaRequest.cc b/dts/src/model/DescribeSubscriptionMetaRequest.cc new file mode 100644 index 000000000..628e512a8 --- /dev/null +++ b/dts/src/model/DescribeSubscriptionMetaRequest.cc @@ -0,0 +1,84 @@ +/* + * 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 + +using AlibabaCloud::Dts::Model::DescribeSubscriptionMetaRequest; + +DescribeSubscriptionMetaRequest::DescribeSubscriptionMetaRequest() : + RpcServiceRequest("dts", "2020-01-01", "DescribeSubscriptionMeta") +{ + setMethod(HttpRequest::Method::Post); +} + +DescribeSubscriptionMetaRequest::~DescribeSubscriptionMetaRequest() +{} + +std::string DescribeSubscriptionMetaRequest::getTopics()const +{ + return topics_; +} + +void DescribeSubscriptionMetaRequest::setTopics(const std::string& topics) +{ + topics_ = topics; + setParameter("Topics", topics); +} + +std::string DescribeSubscriptionMetaRequest::getSid()const +{ + return sid_; +} + +void DescribeSubscriptionMetaRequest::setSid(const std::string& sid) +{ + sid_ = sid; + setParameter("Sid", sid); +} + +std::string DescribeSubscriptionMetaRequest::getRegionId()const +{ + return regionId_; +} + +void DescribeSubscriptionMetaRequest::setRegionId(const std::string& regionId) +{ + regionId_ = regionId; + setParameter("RegionId", regionId); +} + +std::string DescribeSubscriptionMetaRequest::getSubMigrationJobIds()const +{ + return subMigrationJobIds_; +} + +void DescribeSubscriptionMetaRequest::setSubMigrationJobIds(const std::string& subMigrationJobIds) +{ + subMigrationJobIds_ = subMigrationJobIds; + setParameter("SubMigrationJobIds", subMigrationJobIds); +} + +std::string DescribeSubscriptionMetaRequest::getDtsInstanceId()const +{ + return dtsInstanceId_; +} + +void DescribeSubscriptionMetaRequest::setDtsInstanceId(const std::string& dtsInstanceId) +{ + dtsInstanceId_ = dtsInstanceId; + setParameter("DtsInstanceId", dtsInstanceId); +} + diff --git a/dts/src/model/DescribeSubscriptionMetaResult.cc b/dts/src/model/DescribeSubscriptionMetaResult.cc new file mode 100644 index 000000000..281520ab7 --- /dev/null +++ b/dts/src/model/DescribeSubscriptionMetaResult.cc @@ -0,0 +1,93 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Dts; +using namespace AlibabaCloud::Dts::Model; + +DescribeSubscriptionMetaResult::DescribeSubscriptionMetaResult() : + ServiceResult() +{} + +DescribeSubscriptionMetaResult::DescribeSubscriptionMetaResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeSubscriptionMetaResult::~DescribeSubscriptionMetaResult() +{} + +void DescribeSubscriptionMetaResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allSubscriptionMetaListNode = value["SubscriptionMetaList"]["SubscriptionMetaListItem"]; + for (auto valueSubscriptionMetaListSubscriptionMetaListItem : allSubscriptionMetaListNode) + { + SubscriptionMetaListItem subscriptionMetaListObject; + if(!valueSubscriptionMetaListSubscriptionMetaListItem["DProxyUrl"].isNull()) + subscriptionMetaListObject.dProxyUrl = valueSubscriptionMetaListSubscriptionMetaListItem["DProxyUrl"].asString(); + if(!valueSubscriptionMetaListSubscriptionMetaListItem["Topic"].isNull()) + subscriptionMetaListObject.topic = valueSubscriptionMetaListSubscriptionMetaListItem["Topic"].asString(); + if(!valueSubscriptionMetaListSubscriptionMetaListItem["Sid"].isNull()) + subscriptionMetaListObject.sid = valueSubscriptionMetaListSubscriptionMetaListItem["Sid"].asString(); + if(!valueSubscriptionMetaListSubscriptionMetaListItem["Checkpoint"].isNull()) + subscriptionMetaListObject.checkpoint = std::stol(valueSubscriptionMetaListSubscriptionMetaListItem["Checkpoint"].asString()); + if(!valueSubscriptionMetaListSubscriptionMetaListItem["DBList"].isNull()) + subscriptionMetaListObject.dBList = valueSubscriptionMetaListSubscriptionMetaListItem["DBList"].asString(); + subscriptionMetaList_.push_back(subscriptionMetaListObject); + } + if(!value["ErrCode"].isNull()) + errCode_ = value["ErrCode"].asString(); + if(!value["ErrMessage"].isNull()) + errMessage_ = value["ErrMessage"].asString(); + if(!value["HttpStatusCode"].isNull()) + httpStatusCode_ = value["HttpStatusCode"].asString(); + if(!value["Success"].isNull()) + success_ = value["Success"].asString(); + +} + +std::vector DescribeSubscriptionMetaResult::getSubscriptionMetaList()const +{ + return subscriptionMetaList_; +} + +std::string DescribeSubscriptionMetaResult::getHttpStatusCode()const +{ + return httpStatusCode_; +} + +std::string DescribeSubscriptionMetaResult::getErrMessage()const +{ + return errMessage_; +} + +std::string DescribeSubscriptionMetaResult::getSuccess()const +{ + return success_; +} + +std::string DescribeSubscriptionMetaResult::getErrCode()const +{ + return errCode_; +} + diff --git a/dts/src/model/ModifyDtsJobRequest.cc b/dts/src/model/ModifyDtsJobRequest.cc index 3f714550e..243e08b6c 100644 --- a/dts/src/model/ModifyDtsJobRequest.cc +++ b/dts/src/model/ModifyDtsJobRequest.cc @@ -82,6 +82,17 @@ void ModifyDtsJobRequest::setRegionId(const std::string& regionId) setParameter("RegionId", regionId); } +std::string ModifyDtsJobRequest::getReserve()const +{ + return reserve_; +} + +void ModifyDtsJobRequest::setReserve(const std::string& reserve) +{ + reserve_ = reserve; + setBodyParameter("Reserve", reserve); +} + std::string ModifyDtsJobRequest::getDtsInstanceId()const { return dtsInstanceId_;