From 82107640c0ceb0a61232d2064d6f18706b2722c0 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Wed, 23 Aug 2023 01:53:40 +0000 Subject: [PATCH] Support DryRunCluster For LakeVersion. --- VERSION | 2 +- adb/CMakeLists.txt | 4 + adb/include/alibabacloud/adb/AdbClient.h | 8 ++ .../model/DescribeComputeResourceRequest.h | 6 ++ .../adb/model/DescribeTablesRequest.h | 3 + .../adb/model/MigrateDBClusterRequest.h | 57 +++++++++++++ .../adb/model/MigrateDBClusterResult.h | 49 +++++++++++ adb/src/AdbClient.cc | 36 +++++++++ .../model/DescribeComputeResourceRequest.cc | 18 +++++ adb/src/model/DescribeTablesRequest.cc | 9 +++ adb/src/model/MigrateDBClusterRequest.cc | 81 +++++++++++++++++++ adb/src/model/MigrateDBClusterResult.cc | 44 ++++++++++ 12 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 adb/include/alibabacloud/adb/model/MigrateDBClusterRequest.h create mode 100644 adb/include/alibabacloud/adb/model/MigrateDBClusterResult.h create mode 100644 adb/src/model/MigrateDBClusterRequest.cc create mode 100644 adb/src/model/MigrateDBClusterResult.cc diff --git a/VERSION b/VERSION index cd1a82cf5..e1099fcee 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1729 \ No newline at end of file +1.36.1730 \ No newline at end of file diff --git a/adb/CMakeLists.txt b/adb/CMakeLists.txt index a1cd81eb1..9e754fda0 100644 --- a/adb/CMakeLists.txt +++ b/adb/CMakeLists.txt @@ -179,6 +179,8 @@ set(adb_public_header_model include/alibabacloud/adb/model/KillProcessResult.h include/alibabacloud/adb/model/ListTagResourcesRequest.h include/alibabacloud/adb/model/ListTagResourcesResult.h + include/alibabacloud/adb/model/MigrateDBClusterRequest.h + include/alibabacloud/adb/model/MigrateDBClusterResult.h include/alibabacloud/adb/model/ModifyAccountDescriptionRequest.h include/alibabacloud/adb/model/ModifyAccountDescriptionResult.h include/alibabacloud/adb/model/ModifyAuditLogConfigRequest.h @@ -386,6 +388,8 @@ set(adb_src src/model/KillProcessResult.cc src/model/ListTagResourcesRequest.cc src/model/ListTagResourcesResult.cc + src/model/MigrateDBClusterRequest.cc + src/model/MigrateDBClusterResult.cc src/model/ModifyAccountDescriptionRequest.cc src/model/ModifyAccountDescriptionResult.cc src/model/ModifyAuditLogConfigRequest.cc diff --git a/adb/include/alibabacloud/adb/AdbClient.h b/adb/include/alibabacloud/adb/AdbClient.h index 6dd68abb8..6843f8ec9 100644 --- a/adb/include/alibabacloud/adb/AdbClient.h +++ b/adb/include/alibabacloud/adb/AdbClient.h @@ -180,6 +180,8 @@ #include "model/KillProcessResult.h" #include "model/ListTagResourcesRequest.h" #include "model/ListTagResourcesResult.h" +#include "model/MigrateDBClusterRequest.h" +#include "model/MigrateDBClusterResult.h" #include "model/ModifyAccountDescriptionRequest.h" #include "model/ModifyAccountDescriptionResult.h" #include "model/ModifyAuditLogConfigRequest.h" @@ -472,6 +474,9 @@ namespace AlibabaCloud typedef Outcome ListTagResourcesOutcome; typedef std::future ListTagResourcesOutcomeCallable; typedef std::function&)> ListTagResourcesAsyncHandler; + typedef Outcome MigrateDBClusterOutcome; + typedef std::future MigrateDBClusterOutcomeCallable; + typedef std::function&)> MigrateDBClusterAsyncHandler; typedef Outcome ModifyAccountDescriptionOutcome; typedef std::future ModifyAccountDescriptionOutcomeCallable; typedef std::function&)> ModifyAccountDescriptionAsyncHandler; @@ -783,6 +788,9 @@ namespace AlibabaCloud 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; + MigrateDBClusterOutcome migrateDBCluster(const Model::MigrateDBClusterRequest &request)const; + void migrateDBClusterAsync(const Model::MigrateDBClusterRequest& request, const MigrateDBClusterAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + MigrateDBClusterOutcomeCallable migrateDBClusterCallable(const Model::MigrateDBClusterRequest& request) const; ModifyAccountDescriptionOutcome modifyAccountDescription(const Model::ModifyAccountDescriptionRequest &request)const; void modifyAccountDescriptionAsync(const Model::ModifyAccountDescriptionRequest& request, const ModifyAccountDescriptionAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ModifyAccountDescriptionOutcomeCallable modifyAccountDescriptionCallable(const Model::ModifyAccountDescriptionRequest& request) const; diff --git a/adb/include/alibabacloud/adb/model/DescribeComputeResourceRequest.h b/adb/include/alibabacloud/adb/model/DescribeComputeResourceRequest.h index 085cf78d4..2fca8fd0a 100644 --- a/adb/include/alibabacloud/adb/model/DescribeComputeResourceRequest.h +++ b/adb/include/alibabacloud/adb/model/DescribeComputeResourceRequest.h @@ -38,6 +38,8 @@ public: void setRegionId(const std::string ®ionId); std::string getResourceOwnerAccount() const; void setResourceOwnerAccount(const std::string &resourceOwnerAccount); + std::string getDBClusterId() const; + void setDBClusterId(const std::string &dBClusterId); std::string getOwnerAccount() const; void setOwnerAccount(const std::string &ownerAccount); std::string getDBClusterVersion() const; @@ -46,16 +48,20 @@ public: void setOwnerId(long ownerId); std::string getZoneId() const; void setZoneId(const std::string &zoneId); + bool getMigrate() const; + void setMigrate(bool migrate); private: long resourceOwnerId_; std::string accessKeyId_; std::string regionId_; std::string resourceOwnerAccount_; + std::string dBClusterId_; std::string ownerAccount_; std::string dBClusterVersion_; long ownerId_; std::string zoneId_; + bool migrate_; }; } // namespace Model } // namespace Adb diff --git a/adb/include/alibabacloud/adb/model/DescribeTablesRequest.h b/adb/include/alibabacloud/adb/model/DescribeTablesRequest.h index 8e14d2fcf..a47b829c1 100644 --- a/adb/include/alibabacloud/adb/model/DescribeTablesRequest.h +++ b/adb/include/alibabacloud/adb/model/DescribeTablesRequest.h @@ -34,6 +34,8 @@ public: void setResourceOwnerId(long resourceOwnerId); std::string getAccessKeyId() const; void setAccessKeyId(const std::string &accessKeyId); + std::string getRegionId() const; + void setRegionId(const std::string ®ionId); std::string getSchemaName() const; void setSchemaName(const std::string &schemaName); std::string getResourceOwnerAccount() const; @@ -48,6 +50,7 @@ public: private: long resourceOwnerId_; std::string accessKeyId_; + std::string regionId_; std::string schemaName_; std::string resourceOwnerAccount_; std::string dBClusterId_; diff --git a/adb/include/alibabacloud/adb/model/MigrateDBClusterRequest.h b/adb/include/alibabacloud/adb/model/MigrateDBClusterRequest.h new file mode 100644 index 000000000..abe21f100 --- /dev/null +++ b/adb/include/alibabacloud/adb/model/MigrateDBClusterRequest.h @@ -0,0 +1,57 @@ +/* + * 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_ADB_MODEL_MIGRATEDBCLUSTERREQUEST_H_ +#define ALIBABACLOUD_ADB_MODEL_MIGRATEDBCLUSTERREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Adb { +namespace Model { +class ALIBABACLOUD_ADB_EXPORT MigrateDBClusterRequest : public RpcServiceRequest { +public: + MigrateDBClusterRequest(); + ~MigrateDBClusterRequest(); + long getResourceOwnerId() const; + void setResourceOwnerId(long resourceOwnerId); + std::string getAccessKeyId() const; + void setAccessKeyId(const std::string &accessKeyId); + std::string getResourceOwnerAccount() const; + void setResourceOwnerAccount(const std::string &resourceOwnerAccount); + std::string getDBClusterId() const; + void setDBClusterId(const std::string &dBClusterId); + std::string getOwnerAccount() const; + void setOwnerAccount(const std::string &ownerAccount); + long getOwnerId() const; + void setOwnerId(long ownerId); + +private: + long resourceOwnerId_; + std::string accessKeyId_; + std::string resourceOwnerAccount_; + std::string dBClusterId_; + std::string ownerAccount_; + long ownerId_; +}; +} // namespace Model +} // namespace Adb +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_ADB_MODEL_MIGRATEDBCLUSTERREQUEST_H_ diff --git a/adb/include/alibabacloud/adb/model/MigrateDBClusterResult.h b/adb/include/alibabacloud/adb/model/MigrateDBClusterResult.h new file mode 100644 index 000000000..7ab524dd4 --- /dev/null +++ b/adb/include/alibabacloud/adb/model/MigrateDBClusterResult.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_ADB_MODEL_MIGRATEDBCLUSTERRESULT_H_ +#define ALIBABACLOUD_ADB_MODEL_MIGRATEDBCLUSTERRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Adb + { + namespace Model + { + class ALIBABACLOUD_ADB_EXPORT MigrateDBClusterResult : public ServiceResult + { + public: + + + MigrateDBClusterResult(); + explicit MigrateDBClusterResult(const std::string &payload); + ~MigrateDBClusterResult(); + + protected: + void parse(const std::string &payload); + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_ADB_MODEL_MIGRATEDBCLUSTERRESULT_H_ \ No newline at end of file diff --git a/adb/src/AdbClient.cc b/adb/src/AdbClient.cc index 2592a1610..49d63d42f 100644 --- a/adb/src/AdbClient.cc +++ b/adb/src/AdbClient.cc @@ -2895,6 +2895,42 @@ AdbClient::ListTagResourcesOutcomeCallable AdbClient::listTagResourcesCallable(c return task->get_future(); } +AdbClient::MigrateDBClusterOutcome AdbClient::migrateDBCluster(const MigrateDBClusterRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return MigrateDBClusterOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return MigrateDBClusterOutcome(MigrateDBClusterResult(outcome.result())); + else + return MigrateDBClusterOutcome(outcome.error()); +} + +void AdbClient::migrateDBClusterAsync(const MigrateDBClusterRequest& request, const MigrateDBClusterAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, migrateDBCluster(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +AdbClient::MigrateDBClusterOutcomeCallable AdbClient::migrateDBClusterCallable(const MigrateDBClusterRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->migrateDBCluster(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + AdbClient::ModifyAccountDescriptionOutcome AdbClient::modifyAccountDescription(const ModifyAccountDescriptionRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/adb/src/model/DescribeComputeResourceRequest.cc b/adb/src/model/DescribeComputeResourceRequest.cc index 1e686cd00..314488ead 100644 --- a/adb/src/model/DescribeComputeResourceRequest.cc +++ b/adb/src/model/DescribeComputeResourceRequest.cc @@ -61,6 +61,15 @@ void DescribeComputeResourceRequest::setResourceOwnerAccount(const std::string & setParameter(std::string("ResourceOwnerAccount"), resourceOwnerAccount); } +std::string DescribeComputeResourceRequest::getDBClusterId() const { + return dBClusterId_; +} + +void DescribeComputeResourceRequest::setDBClusterId(const std::string &dBClusterId) { + dBClusterId_ = dBClusterId; + setParameter(std::string("DBClusterId"), dBClusterId); +} + std::string DescribeComputeResourceRequest::getOwnerAccount() const { return ownerAccount_; } @@ -97,3 +106,12 @@ void DescribeComputeResourceRequest::setZoneId(const std::string &zoneId) { setParameter(std::string("ZoneId"), zoneId); } +bool DescribeComputeResourceRequest::getMigrate() const { + return migrate_; +} + +void DescribeComputeResourceRequest::setMigrate(bool migrate) { + migrate_ = migrate; + setParameter(std::string("Migrate"), migrate ? "true" : "false"); +} + diff --git a/adb/src/model/DescribeTablesRequest.cc b/adb/src/model/DescribeTablesRequest.cc index def811763..ef573a213 100644 --- a/adb/src/model/DescribeTablesRequest.cc +++ b/adb/src/model/DescribeTablesRequest.cc @@ -43,6 +43,15 @@ void DescribeTablesRequest::setAccessKeyId(const std::string &accessKeyId) { setParameter(std::string("AccessKeyId"), accessKeyId); } +std::string DescribeTablesRequest::getRegionId() const { + return regionId_; +} + +void DescribeTablesRequest::setRegionId(const std::string ®ionId) { + regionId_ = regionId; + setParameter(std::string("RegionId"), regionId); +} + std::string DescribeTablesRequest::getSchemaName() const { return schemaName_; } diff --git a/adb/src/model/MigrateDBClusterRequest.cc b/adb/src/model/MigrateDBClusterRequest.cc new file mode 100644 index 000000000..331c1582a --- /dev/null +++ b/adb/src/model/MigrateDBClusterRequest.cc @@ -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. + */ + +#include + +using AlibabaCloud::Adb::Model::MigrateDBClusterRequest; + +MigrateDBClusterRequest::MigrateDBClusterRequest() + : RpcServiceRequest("adb", "2019-03-15", "MigrateDBCluster") { + setMethod(HttpRequest::Method::Post); +} + +MigrateDBClusterRequest::~MigrateDBClusterRequest() {} + +long MigrateDBClusterRequest::getResourceOwnerId() const { + return resourceOwnerId_; +} + +void MigrateDBClusterRequest::setResourceOwnerId(long resourceOwnerId) { + resourceOwnerId_ = resourceOwnerId; + setParameter(std::string("ResourceOwnerId"), std::to_string(resourceOwnerId)); +} + +std::string MigrateDBClusterRequest::getAccessKeyId() const { + return accessKeyId_; +} + +void MigrateDBClusterRequest::setAccessKeyId(const std::string &accessKeyId) { + accessKeyId_ = accessKeyId; + setParameter(std::string("AccessKeyId"), accessKeyId); +} + +std::string MigrateDBClusterRequest::getResourceOwnerAccount() const { + return resourceOwnerAccount_; +} + +void MigrateDBClusterRequest::setResourceOwnerAccount(const std::string &resourceOwnerAccount) { + resourceOwnerAccount_ = resourceOwnerAccount; + setParameter(std::string("ResourceOwnerAccount"), resourceOwnerAccount); +} + +std::string MigrateDBClusterRequest::getDBClusterId() const { + return dBClusterId_; +} + +void MigrateDBClusterRequest::setDBClusterId(const std::string &dBClusterId) { + dBClusterId_ = dBClusterId; + setParameter(std::string("DBClusterId"), dBClusterId); +} + +std::string MigrateDBClusterRequest::getOwnerAccount() const { + return ownerAccount_; +} + +void MigrateDBClusterRequest::setOwnerAccount(const std::string &ownerAccount) { + ownerAccount_ = ownerAccount; + setParameter(std::string("OwnerAccount"), ownerAccount); +} + +long MigrateDBClusterRequest::getOwnerId() const { + return ownerId_; +} + +void MigrateDBClusterRequest::setOwnerId(long ownerId) { + ownerId_ = ownerId; + setParameter(std::string("OwnerId"), std::to_string(ownerId)); +} + diff --git a/adb/src/model/MigrateDBClusterResult.cc b/adb/src/model/MigrateDBClusterResult.cc new file mode 100644 index 000000000..694c99f46 --- /dev/null +++ b/adb/src/model/MigrateDBClusterResult.cc @@ -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 +#include + +using namespace AlibabaCloud::Adb; +using namespace AlibabaCloud::Adb::Model; + +MigrateDBClusterResult::MigrateDBClusterResult() : + ServiceResult() +{} + +MigrateDBClusterResult::MigrateDBClusterResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +MigrateDBClusterResult::~MigrateDBClusterResult() +{} + +void MigrateDBClusterResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + +} +