瀏覽代碼

New API- GetDrdsDbRdsRelationInfo, which can get private RDS list under certain DB out of DRDS instance ID and DB name.

sdk-team 5 年之前
父節點
當前提交
4ff900857e

+ 3 - 0
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.
 

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.36.751
+1.36.752

+ 4 - 0
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

+ 8 - 0
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<Error, Model::EnableSqlFlashbackMatchSwitchResult> EnableSqlFlashbackMatchSwitchOutcome;
 			typedef std::future<EnableSqlFlashbackMatchSwitchOutcome> EnableSqlFlashbackMatchSwitchOutcomeCallable;
 			typedef std::function<void(const DrdsClient*, const Model::EnableSqlFlashbackMatchSwitchRequest&, const EnableSqlFlashbackMatchSwitchOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> EnableSqlFlashbackMatchSwitchAsyncHandler;
+			typedef Outcome<Error, Model::GetDrdsDbRdsRelationInfoResult> GetDrdsDbRdsRelationInfoOutcome;
+			typedef std::future<GetDrdsDbRdsRelationInfoOutcome> GetDrdsDbRdsRelationInfoOutcomeCallable;
+			typedef std::function<void(const DrdsClient*, const Model::GetDrdsDbRdsRelationInfoRequest&, const GetDrdsDbRdsRelationInfoOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetDrdsDbRdsRelationInfoAsyncHandler;
 			typedef Outcome<Error, Model::ListTagResourcesResult> ListTagResourcesOutcome;
 			typedef std::future<ListTagResourcesOutcome> ListTagResourcesOutcomeCallable;
 			typedef std::function<void(const DrdsClient*, const Model::ListTagResourcesRequest&, const ListTagResourcesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
 			ListTagResourcesOutcomeCallable listTagResourcesCallable(const Model::ListTagResourcesRequest& request) const;

+ 54 - 0
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 <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/drds/DrdsExport.h>
+
+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_

+ 60 - 0
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 <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/drds/DrdsExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Drds
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_DRDS_EXPORT GetDrdsDbRdsRelationInfoResult : public ServiceResult
+			{
+			public:
+				struct DataItem
+				{
+					std::string usedInstanceId;
+					std::vector<std::string> readOnlyInstanceInfo;
+					std::string usedInstanceType;
+					std::string rdsInstanceId;
+				};
+
+
+				GetDrdsDbRdsRelationInfoResult();
+				explicit GetDrdsDbRdsRelationInfoResult(const std::string &payload);
+				~GetDrdsDbRdsRelationInfoResult();
+				std::vector<DataItem> getData()const;
+				bool getSuccess()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				std::vector<DataItem> data_;
+				bool success_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFORESULT_H_

+ 36 - 0
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<const AsyncCallerContext>& 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<std::packaged_task<GetDrdsDbRdsRelationInfoOutcome()>>(
+			[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();

+ 62 - 0
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 <alibabacloud/drds/model/GetDrdsDbRdsRelationInfoRequest.h>
+
+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);
+}
+

+ 71 - 0
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 <alibabacloud/drds/model/GetDrdsDbRdsRelationInfoResult.h>
+#include <json/json.h>
+
+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::DataItem> GetDrdsDbRdsRelationInfoResult::getData()const
+{
+	return data_;
+}
+
+bool GetDrdsDbRdsRelationInfoResult::getSuccess()const
+{
+	return success_;
+}
+