From 4ff900857ebc9c5c381f2f6d262839d906c8b40c Mon Sep 17 00:00:00 2001 From: sdk-team Date: Sun, 23 May 2021 10:19:46 +0000 Subject: [PATCH] New API- GetDrdsDbRdsRelationInfo, which can get private RDS list under certain DB out of DRDS instance ID and DB name. --- CHANGELOG | 3 + VERSION | 2 +- drds/CMakeLists.txt | 4 ++ drds/include/alibabacloud/drds/DrdsClient.h | 8 +++ .../model/GetDrdsDbRdsRelationInfoRequest.h | 54 ++++++++++++++ .../model/GetDrdsDbRdsRelationInfoResult.h | 60 ++++++++++++++++ drds/src/DrdsClient.cc | 36 ++++++++++ .../model/GetDrdsDbRdsRelationInfoRequest.cc | 62 ++++++++++++++++ .../model/GetDrdsDbRdsRelationInfoResult.cc | 71 +++++++++++++++++++ 9 files changed, 299 insertions(+), 1 deletion(-) create mode 100644 drds/include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoRequest.h create mode 100644 drds/include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoResult.h create mode 100644 drds/src/model/GetDrdsDbRdsRelationInfoRequest.cc create mode 100644 drds/src/model/GetDrdsDbRdsRelationInfoResult.cc diff --git a/CHANGELOG b/CHANGELOG index aac901036..dd026738f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2021-05-23 Version: 1.36.752 +- New API- GetDrdsDbRdsRelationInfo, which can get private RDS list under certain DB out of DRDS instance ID and DB name. + 2021-05-22 Version: 1.36.751 - Aaaaa. diff --git a/VERSION b/VERSION index 512ddb048..f0219be2b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.751 \ No newline at end of file +1.36.752 \ No newline at end of file diff --git a/drds/CMakeLists.txt b/drds/CMakeLists.txt index 5b45566f1..5dae7f737 100644 --- a/drds/CMakeLists.txt +++ b/drds/CMakeLists.txt @@ -145,6 +145,8 @@ set(drds_public_header_model include/alibabacloud/drds/model/EnableSqlAuditResult.h include/alibabacloud/drds/model/EnableSqlFlashbackMatchSwitchRequest.h include/alibabacloud/drds/model/EnableSqlFlashbackMatchSwitchResult.h + include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoRequest.h + include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoResult.h include/alibabacloud/drds/model/ListTagResourcesRequest.h include/alibabacloud/drds/model/ListTagResourcesResult.h include/alibabacloud/drds/model/ManagePrivateRdsRequest.h @@ -342,6 +344,8 @@ set(drds_src src/model/EnableSqlAuditResult.cc src/model/EnableSqlFlashbackMatchSwitchRequest.cc src/model/EnableSqlFlashbackMatchSwitchResult.cc + src/model/GetDrdsDbRdsRelationInfoRequest.cc + src/model/GetDrdsDbRdsRelationInfoResult.cc src/model/ListTagResourcesRequest.cc src/model/ListTagResourcesResult.cc src/model/ManagePrivateRdsRequest.cc diff --git a/drds/include/alibabacloud/drds/DrdsClient.h b/drds/include/alibabacloud/drds/DrdsClient.h index 84dd2a569..4a053f23a 100644 --- a/drds/include/alibabacloud/drds/DrdsClient.h +++ b/drds/include/alibabacloud/drds/DrdsClient.h @@ -146,6 +146,8 @@ #include "model/EnableSqlAuditResult.h" #include "model/EnableSqlFlashbackMatchSwitchRequest.h" #include "model/EnableSqlFlashbackMatchSwitchResult.h" +#include "model/GetDrdsDbRdsRelationInfoRequest.h" +#include "model/GetDrdsDbRdsRelationInfoResult.h" #include "model/ListTagResourcesRequest.h" #include "model/ListTagResourcesResult.h" #include "model/ManagePrivateRdsRequest.h" @@ -411,6 +413,9 @@ namespace AlibabaCloud typedef Outcome EnableSqlFlashbackMatchSwitchOutcome; typedef std::future EnableSqlFlashbackMatchSwitchOutcomeCallable; typedef std::function&)> EnableSqlFlashbackMatchSwitchAsyncHandler; + typedef Outcome GetDrdsDbRdsRelationInfoOutcome; + typedef std::future GetDrdsDbRdsRelationInfoOutcomeCallable; + typedef std::function&)> GetDrdsDbRdsRelationInfoAsyncHandler; typedef Outcome ListTagResourcesOutcome; typedef std::future ListTagResourcesOutcomeCallable; typedef std::function&)> ListTagResourcesAsyncHandler; @@ -707,6 +712,9 @@ namespace AlibabaCloud EnableSqlFlashbackMatchSwitchOutcome enableSqlFlashbackMatchSwitch(const Model::EnableSqlFlashbackMatchSwitchRequest &request)const; void enableSqlFlashbackMatchSwitchAsync(const Model::EnableSqlFlashbackMatchSwitchRequest& request, const EnableSqlFlashbackMatchSwitchAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; EnableSqlFlashbackMatchSwitchOutcomeCallable enableSqlFlashbackMatchSwitchCallable(const Model::EnableSqlFlashbackMatchSwitchRequest& request) const; + GetDrdsDbRdsRelationInfoOutcome getDrdsDbRdsRelationInfo(const Model::GetDrdsDbRdsRelationInfoRequest &request)const; + void getDrdsDbRdsRelationInfoAsync(const Model::GetDrdsDbRdsRelationInfoRequest& request, const GetDrdsDbRdsRelationInfoAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetDrdsDbRdsRelationInfoOutcomeCallable getDrdsDbRdsRelationInfoCallable(const Model::GetDrdsDbRdsRelationInfoRequest& request) const; ListTagResourcesOutcome listTagResources(const Model::ListTagResourcesRequest &request)const; void listTagResourcesAsync(const Model::ListTagResourcesRequest& request, const ListTagResourcesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListTagResourcesOutcomeCallable listTagResourcesCallable(const Model::ListTagResourcesRequest& request) const; diff --git a/drds/include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoRequest.h b/drds/include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoRequest.h new file mode 100644 index 000000000..1f5cc4863 --- /dev/null +++ b/drds/include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoRequest.h @@ -0,0 +1,54 @@ +/* + * 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_DRDS_MODEL_GETDRDSDBRDSRELATIONINFOREQUEST_H_ +#define ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFOREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Drds + { + namespace Model + { + class ALIBABACLOUD_DRDS_EXPORT GetDrdsDbRdsRelationInfoRequest : public RpcServiceRequest + { + + public: + GetDrdsDbRdsRelationInfoRequest(); + ~GetDrdsDbRdsRelationInfoRequest(); + + std::string getDrdsInstanceId()const; + void setDrdsInstanceId(const std::string& drdsInstanceId); + std::string getAccessKeyId()const; + void setAccessKeyId(const std::string& accessKeyId); + std::string getDbName()const; + void setDbName(const std::string& dbName); + + private: + std::string drdsInstanceId_; + std::string accessKeyId_; + std::string dbName_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFOREQUEST_H_ \ No newline at end of file diff --git a/drds/include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoResult.h b/drds/include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoResult.h new file mode 100644 index 000000000..c09b66195 --- /dev/null +++ b/drds/include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoResult.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_DRDS_MODEL_GETDRDSDBRDSRELATIONINFORESULT_H_ +#define ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFORESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Drds + { + namespace Model + { + class ALIBABACLOUD_DRDS_EXPORT GetDrdsDbRdsRelationInfoResult : public ServiceResult + { + public: + struct DataItem + { + std::string usedInstanceId; + std::vector readOnlyInstanceInfo; + std::string usedInstanceType; + std::string rdsInstanceId; + }; + + + GetDrdsDbRdsRelationInfoResult(); + explicit GetDrdsDbRdsRelationInfoResult(const std::string &payload); + ~GetDrdsDbRdsRelationInfoResult(); + std::vector getData()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::vector data_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFORESULT_H_ \ No newline at end of file diff --git a/drds/src/DrdsClient.cc b/drds/src/DrdsClient.cc index d4fada285..f13d8510c 100644 --- a/drds/src/DrdsClient.cc +++ b/drds/src/DrdsClient.cc @@ -2283,6 +2283,42 @@ DrdsClient::EnableSqlFlashbackMatchSwitchOutcomeCallable DrdsClient::enableSqlFl return task->get_future(); } +DrdsClient::GetDrdsDbRdsRelationInfoOutcome DrdsClient::getDrdsDbRdsRelationInfo(const GetDrdsDbRdsRelationInfoRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetDrdsDbRdsRelationInfoOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetDrdsDbRdsRelationInfoOutcome(GetDrdsDbRdsRelationInfoResult(outcome.result())); + else + return GetDrdsDbRdsRelationInfoOutcome(outcome.error()); +} + +void DrdsClient::getDrdsDbRdsRelationInfoAsync(const GetDrdsDbRdsRelationInfoRequest& request, const GetDrdsDbRdsRelationInfoAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getDrdsDbRdsRelationInfo(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +DrdsClient::GetDrdsDbRdsRelationInfoOutcomeCallable DrdsClient::getDrdsDbRdsRelationInfoCallable(const GetDrdsDbRdsRelationInfoRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getDrdsDbRdsRelationInfo(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + DrdsClient::ListTagResourcesOutcome DrdsClient::listTagResources(const ListTagResourcesRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/drds/src/model/GetDrdsDbRdsRelationInfoRequest.cc b/drds/src/model/GetDrdsDbRdsRelationInfoRequest.cc new file mode 100644 index 000000000..98271c0d9 --- /dev/null +++ b/drds/src/model/GetDrdsDbRdsRelationInfoRequest.cc @@ -0,0 +1,62 @@ +/* + * 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::Drds::Model::GetDrdsDbRdsRelationInfoRequest; + +GetDrdsDbRdsRelationInfoRequest::GetDrdsDbRdsRelationInfoRequest() : + RpcServiceRequest("drds", "2019-01-23", "GetDrdsDbRdsRelationInfo") +{ + setMethod(HttpRequest::Method::Post); +} + +GetDrdsDbRdsRelationInfoRequest::~GetDrdsDbRdsRelationInfoRequest() +{} + +std::string GetDrdsDbRdsRelationInfoRequest::getDrdsInstanceId()const +{ + return drdsInstanceId_; +} + +void GetDrdsDbRdsRelationInfoRequest::setDrdsInstanceId(const std::string& drdsInstanceId) +{ + drdsInstanceId_ = drdsInstanceId; + setParameter("DrdsInstanceId", drdsInstanceId); +} + +std::string GetDrdsDbRdsRelationInfoRequest::getAccessKeyId()const +{ + return accessKeyId_; +} + +void GetDrdsDbRdsRelationInfoRequest::setAccessKeyId(const std::string& accessKeyId) +{ + accessKeyId_ = accessKeyId; + setParameter("AccessKeyId", accessKeyId); +} + +std::string GetDrdsDbRdsRelationInfoRequest::getDbName()const +{ + return dbName_; +} + +void GetDrdsDbRdsRelationInfoRequest::setDbName(const std::string& dbName) +{ + dbName_ = dbName; + setParameter("DbName", dbName); +} + diff --git a/drds/src/model/GetDrdsDbRdsRelationInfoResult.cc b/drds/src/model/GetDrdsDbRdsRelationInfoResult.cc new file mode 100644 index 000000000..41b9c945f --- /dev/null +++ b/drds/src/model/GetDrdsDbRdsRelationInfoResult.cc @@ -0,0 +1,71 @@ +/* + * 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::Drds; +using namespace AlibabaCloud::Drds::Model; + +GetDrdsDbRdsRelationInfoResult::GetDrdsDbRdsRelationInfoResult() : + ServiceResult() +{} + +GetDrdsDbRdsRelationInfoResult::GetDrdsDbRdsRelationInfoResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetDrdsDbRdsRelationInfoResult::~GetDrdsDbRdsRelationInfoResult() +{} + +void GetDrdsDbRdsRelationInfoResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allDataNode = value["Data"]["DataItem"]; + for (auto valueDataDataItem : allDataNode) + { + DataItem dataObject; + if(!valueDataDataItem["RdsInstanceId"].isNull()) + dataObject.rdsInstanceId = valueDataDataItem["RdsInstanceId"].asString(); + if(!valueDataDataItem["UsedInstanceId"].isNull()) + dataObject.usedInstanceId = valueDataDataItem["UsedInstanceId"].asString(); + if(!valueDataDataItem["UsedInstanceType"].isNull()) + dataObject.usedInstanceType = valueDataDataItem["UsedInstanceType"].asString(); + auto allReadOnlyInstanceInfo = value["ReadOnlyInstanceInfo"]["ReadOnlyInstanceIds"]; + for (auto value : allReadOnlyInstanceInfo) + dataObject.readOnlyInstanceInfo.push_back(value.asString()); + data_.push_back(dataObject); + } + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + +} + +std::vector GetDrdsDbRdsRelationInfoResult::getData()const +{ + return data_; +} + +bool GetDrdsDbRdsRelationInfoResult::getSuccess()const +{ + return success_; +} +