diff --git a/CHANGELOG b/CHANGELOG index bec9be394..5f68c75db 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2021-04-12 Version: 1.36.675 +- Support GetDBTopology API. + 2021-04-09 Version: 1.36.674 - Bank Card Ocr and Verify. diff --git a/VERSION b/VERSION index 751667c73..0c89ed7fe 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.674 \ No newline at end of file +1.36.675 \ No newline at end of file diff --git a/dms-enterprise/2018-11-01/GetDBTopology.xml b/dms-enterprise/2018-11-01/GetDBTopology.xml new file mode 100644 index 000000000..bbb028f97 --- /dev/null +++ b/dms-enterprise/2018-11-01/GetDBTopology.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/dms-enterprise/CMakeLists.txt b/dms-enterprise/CMakeLists.txt index 1d377be9b..d4fb64243 100644 --- a/dms-enterprise/CMakeLists.txt +++ b/dms-enterprise/CMakeLists.txt @@ -61,6 +61,8 @@ set(dms-enterprise_public_header_model include/alibabacloud/dms-enterprise/model/ExecuteStructSyncResult.h include/alibabacloud/dms-enterprise/model/GetApprovalDetailRequest.h include/alibabacloud/dms-enterprise/model/GetApprovalDetailResult.h + include/alibabacloud/dms-enterprise/model/GetDBTopologyRequest.h + include/alibabacloud/dms-enterprise/model/GetDBTopologyResult.h include/alibabacloud/dms-enterprise/model/GetDataCorrectBackupFilesRequest.h include/alibabacloud/dms-enterprise/model/GetDataCorrectBackupFilesResult.h include/alibabacloud/dms-enterprise/model/GetDataCorrectOrderDetailRequest.h @@ -218,6 +220,8 @@ set(dms-enterprise_src src/model/ExecuteStructSyncResult.cc src/model/GetApprovalDetailRequest.cc src/model/GetApprovalDetailResult.cc + src/model/GetDBTopologyRequest.cc + src/model/GetDBTopologyResult.cc src/model/GetDataCorrectBackupFilesRequest.cc src/model/GetDataCorrectBackupFilesResult.cc src/model/GetDataCorrectOrderDetailRequest.cc diff --git a/dms-enterprise/include/alibabacloud/dms-enterprise/Dms_enterpriseClient.h b/dms-enterprise/include/alibabacloud/dms-enterprise/Dms_enterpriseClient.h index 634eae0bb..bdb1f6729 100644 --- a/dms-enterprise/include/alibabacloud/dms-enterprise/Dms_enterpriseClient.h +++ b/dms-enterprise/include/alibabacloud/dms-enterprise/Dms_enterpriseClient.h @@ -62,6 +62,8 @@ #include "model/ExecuteStructSyncResult.h" #include "model/GetApprovalDetailRequest.h" #include "model/GetApprovalDetailResult.h" +#include "model/GetDBTopologyRequest.h" +#include "model/GetDBTopologyResult.h" #include "model/GetDataCorrectBackupFilesRequest.h" #include "model/GetDataCorrectBackupFilesResult.h" #include "model/GetDataCorrectOrderDetailRequest.h" @@ -245,6 +247,9 @@ namespace AlibabaCloud typedef Outcome GetApprovalDetailOutcome; typedef std::future GetApprovalDetailOutcomeCallable; typedef std::function&)> GetApprovalDetailAsyncHandler; + typedef Outcome GetDBTopologyOutcome; + typedef std::future GetDBTopologyOutcomeCallable; + typedef std::function&)> GetDBTopologyAsyncHandler; typedef Outcome GetDataCorrectBackupFilesOutcome; typedef std::future GetDataCorrectBackupFilesOutcomeCallable; typedef std::function&)> GetDataCorrectBackupFilesAsyncHandler; @@ -481,6 +486,9 @@ namespace AlibabaCloud GetApprovalDetailOutcome getApprovalDetail(const Model::GetApprovalDetailRequest &request)const; void getApprovalDetailAsync(const Model::GetApprovalDetailRequest& request, const GetApprovalDetailAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetApprovalDetailOutcomeCallable getApprovalDetailCallable(const Model::GetApprovalDetailRequest& request) const; + GetDBTopologyOutcome getDBTopology(const Model::GetDBTopologyRequest &request)const; + void getDBTopologyAsync(const Model::GetDBTopologyRequest& request, const GetDBTopologyAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetDBTopologyOutcomeCallable getDBTopologyCallable(const Model::GetDBTopologyRequest& request) const; GetDataCorrectBackupFilesOutcome getDataCorrectBackupFiles(const Model::GetDataCorrectBackupFilesRequest &request)const; void getDataCorrectBackupFilesAsync(const Model::GetDataCorrectBackupFilesRequest& request, const GetDataCorrectBackupFilesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetDataCorrectBackupFilesOutcomeCallable getDataCorrectBackupFilesCallable(const Model::GetDataCorrectBackupFilesRequest& request) const; diff --git a/dms-enterprise/include/alibabacloud/dms-enterprise/model/GetDBTopologyRequest.h b/dms-enterprise/include/alibabacloud/dms-enterprise/model/GetDBTopologyRequest.h new file mode 100644 index 000000000..4553f7667 --- /dev/null +++ b/dms-enterprise/include/alibabacloud/dms-enterprise/model/GetDBTopologyRequest.h @@ -0,0 +1,51 @@ +/* + * 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_DMS_ENTERPRISE_MODEL_GETDBTOPOLOGYREQUEST_H_ +#define ALIBABACLOUD_DMS_ENTERPRISE_MODEL_GETDBTOPOLOGYREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dms_enterprise + { + namespace Model + { + class ALIBABACLOUD_DMS_ENTERPRISE_EXPORT GetDBTopologyRequest : public RpcServiceRequest + { + + public: + GetDBTopologyRequest(); + ~GetDBTopologyRequest(); + + long getLogicDbId()const; + void setLogicDbId(long logicDbId); + long getTid()const; + void setTid(long tid); + + private: + long logicDbId_; + long tid_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DMS_ENTERPRISE_MODEL_GETDBTOPOLOGYREQUEST_H_ \ No newline at end of file diff --git a/dms-enterprise/include/alibabacloud/dms-enterprise/model/GetDBTopologyResult.h b/dms-enterprise/include/alibabacloud/dms-enterprise/model/GetDBTopologyResult.h new file mode 100644 index 000000000..615169579 --- /dev/null +++ b/dms-enterprise/include/alibabacloud/dms-enterprise/model/GetDBTopologyResult.h @@ -0,0 +1,80 @@ +/* + * 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_DMS_ENTERPRISE_MODEL_GETDBTOPOLOGYRESULT_H_ +#define ALIBABACLOUD_DMS_ENTERPRISE_MODEL_GETDBTOPOLOGYRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dms_enterprise + { + namespace Model + { + class ALIBABACLOUD_DMS_ENTERPRISE_EXPORT GetDBTopologyResult : public ServiceResult + { + public: + struct DBTopology + { + struct DBTopologyInfo + { + std::string instanceSource; + std::string instanceResourceId; + long instanceId; + std::string searchName; + long dbId; + std::string catalogName; + std::string regionId; + std::string envType; + std::string dbType; + std::string schemaName; + }; + long logicDbId; + std::string searchName; + std::string alias; + std::string logicDbName; + std::vector dBTopologyInfoList; + std::string envType; + std::string dbType; + }; + + + GetDBTopologyResult(); + explicit GetDBTopologyResult(const std::string &payload); + ~GetDBTopologyResult(); + DBTopology getDBTopology()const; + std::string getErrorCode()const; + std::string getErrorMessage()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + DBTopology dBTopology_; + std::string errorCode_; + std::string errorMessage_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DMS_ENTERPRISE_MODEL_GETDBTOPOLOGYRESULT_H_ \ No newline at end of file diff --git a/dms-enterprise/src/Dms-enterpriseClient.cc b/dms-enterprise/src/Dms-enterpriseClient.cc index c4d4cf15e..b684ca1d3 100644 --- a/dms-enterprise/src/Dms-enterpriseClient.cc +++ b/dms-enterprise/src/Dms-enterpriseClient.cc @@ -771,6 +771,42 @@ Dms_enterpriseClient::GetApprovalDetailOutcomeCallable Dms_enterpriseClient::get return task->get_future(); } +Dms_enterpriseClient::GetDBTopologyOutcome Dms_enterpriseClient::getDBTopology(const GetDBTopologyRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetDBTopologyOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetDBTopologyOutcome(GetDBTopologyResult(outcome.result())); + else + return GetDBTopologyOutcome(outcome.error()); +} + +void Dms_enterpriseClient::getDBTopologyAsync(const GetDBTopologyRequest& request, const GetDBTopologyAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getDBTopology(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Dms_enterpriseClient::GetDBTopologyOutcomeCallable Dms_enterpriseClient::getDBTopologyCallable(const GetDBTopologyRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getDBTopology(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + Dms_enterpriseClient::GetDataCorrectBackupFilesOutcome Dms_enterpriseClient::getDataCorrectBackupFiles(const GetDataCorrectBackupFilesRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/dms-enterprise/src/model/GetDBTopologyRequest.cc b/dms-enterprise/src/model/GetDBTopologyRequest.cc new file mode 100644 index 000000000..6751e57a8 --- /dev/null +++ b/dms-enterprise/src/model/GetDBTopologyRequest.cc @@ -0,0 +1,51 @@ +/* + * 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::Dms_enterprise::Model::GetDBTopologyRequest; + +GetDBTopologyRequest::GetDBTopologyRequest() : + RpcServiceRequest("dms-enterprise", "2018-11-01", "GetDBTopology") +{ + setMethod(HttpRequest::Method::Post); +} + +GetDBTopologyRequest::~GetDBTopologyRequest() +{} + +long GetDBTopologyRequest::getLogicDbId()const +{ + return logicDbId_; +} + +void GetDBTopologyRequest::setLogicDbId(long logicDbId) +{ + logicDbId_ = logicDbId; + setParameter("LogicDbId", std::to_string(logicDbId)); +} + +long GetDBTopologyRequest::getTid()const +{ + return tid_; +} + +void GetDBTopologyRequest::setTid(long tid) +{ + tid_ = tid; + setParameter("Tid", std::to_string(tid)); +} + diff --git a/dms-enterprise/src/model/GetDBTopologyResult.cc b/dms-enterprise/src/model/GetDBTopologyResult.cc new file mode 100644 index 000000000..ea1368853 --- /dev/null +++ b/dms-enterprise/src/model/GetDBTopologyResult.cc @@ -0,0 +1,109 @@ +/* + * 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::Dms_enterprise; +using namespace AlibabaCloud::Dms_enterprise::Model; + +GetDBTopologyResult::GetDBTopologyResult() : + ServiceResult() +{} + +GetDBTopologyResult::GetDBTopologyResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetDBTopologyResult::~GetDBTopologyResult() +{} + +void GetDBTopologyResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dBTopologyNode = value["DBTopology"]; + if(!dBTopologyNode["LogicDbId"].isNull()) + dBTopology_.logicDbId = std::stol(dBTopologyNode["LogicDbId"].asString()); + if(!dBTopologyNode["SearchName"].isNull()) + dBTopology_.searchName = dBTopologyNode["SearchName"].asString(); + if(!dBTopologyNode["Alias"].isNull()) + dBTopology_.alias = dBTopologyNode["Alias"].asString(); + if(!dBTopologyNode["LogicDbName"].isNull()) + dBTopology_.logicDbName = dBTopologyNode["LogicDbName"].asString(); + if(!dBTopologyNode["EnvType"].isNull()) + dBTopology_.envType = dBTopologyNode["EnvType"].asString(); + if(!dBTopologyNode["DbType"].isNull()) + dBTopology_.dbType = dBTopologyNode["DbType"].asString(); + auto allDBTopologyInfoListNode = dBTopologyNode["DBTopologyInfoList"]["DBTopologyInfo"]; + for (auto dBTopologyNodeDBTopologyInfoListDBTopologyInfo : allDBTopologyInfoListNode) + { + DBTopology::DBTopologyInfo dBTopologyInfoObject; + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["InstanceSource"].isNull()) + dBTopologyInfoObject.instanceSource = dBTopologyNodeDBTopologyInfoListDBTopologyInfo["InstanceSource"].asString(); + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["InstanceResourceId"].isNull()) + dBTopologyInfoObject.instanceResourceId = dBTopologyNodeDBTopologyInfoListDBTopologyInfo["InstanceResourceId"].asString(); + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["InstanceId"].isNull()) + dBTopologyInfoObject.instanceId = std::stol(dBTopologyNodeDBTopologyInfoListDBTopologyInfo["InstanceId"].asString()); + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["SearchName"].isNull()) + dBTopologyInfoObject.searchName = dBTopologyNodeDBTopologyInfoListDBTopologyInfo["SearchName"].asString(); + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["DbId"].isNull()) + dBTopologyInfoObject.dbId = std::stol(dBTopologyNodeDBTopologyInfoListDBTopologyInfo["DbId"].asString()); + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["CatalogName"].isNull()) + dBTopologyInfoObject.catalogName = dBTopologyNodeDBTopologyInfoListDBTopologyInfo["CatalogName"].asString(); + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["RegionId"].isNull()) + dBTopologyInfoObject.regionId = dBTopologyNodeDBTopologyInfoListDBTopologyInfo["RegionId"].asString(); + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["EnvType"].isNull()) + dBTopologyInfoObject.envType = dBTopologyNodeDBTopologyInfoListDBTopologyInfo["EnvType"].asString(); + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["DbType"].isNull()) + dBTopologyInfoObject.dbType = dBTopologyNodeDBTopologyInfoListDBTopologyInfo["DbType"].asString(); + if(!dBTopologyNodeDBTopologyInfoListDBTopologyInfo["SchemaName"].isNull()) + dBTopologyInfoObject.schemaName = dBTopologyNodeDBTopologyInfoListDBTopologyInfo["SchemaName"].asString(); + dBTopology_.dBTopologyInfoList.push_back(dBTopologyInfoObject); + } + if(!value["ErrorCode"].isNull()) + errorCode_ = value["ErrorCode"].asString(); + if(!value["ErrorMessage"].isNull()) + errorMessage_ = value["ErrorMessage"].asString(); + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + +} + +GetDBTopologyResult::DBTopology GetDBTopologyResult::getDBTopology()const +{ + return dBTopology_; +} + +std::string GetDBTopologyResult::getErrorCode()const +{ + return errorCode_; +} + +std::string GetDBTopologyResult::getErrorMessage()const +{ + return errorMessage_; +} + +bool GetDBTopologyResult::getSuccess()const +{ + return success_; +} + diff --git a/dms-enterprise/version-2018-11-01.xml b/dms-enterprise/version-2018-11-01.xml index 1f94bcbfb..cda1f4a94 100644 --- a/dms-enterprise/version-2018-11-01.xml +++ b/dms-enterprise/version-2018-11-01.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file