diff --git a/CHANGELOG b/CHANGELOG index 86b6d92f1..967b025e9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +2020-07-17 Version: 1.36.522 +- Add DescribeRegions. +- Modify DescribeFullBackupList. +- Modify DescribeBackupPlanList. +- Modify DescribeRestoreRangeInfo. + 2020-07-17 Version: 1.36.521 - Add DescribeDBClusterAuditLogCollector. - Add DescribeBackupPolicy. diff --git a/VERSION b/VERSION index 580010fdb..efa8fcad6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.521 \ No newline at end of file +1.36.522 \ No newline at end of file diff --git a/dbs/CMakeLists.txt b/dbs/CMakeLists.txt index 2a1e702b3..e7e7f25e8 100644 --- a/dbs/CMakeLists.txt +++ b/dbs/CMakeLists.txt @@ -49,6 +49,8 @@ set(dbs_public_header_model include/alibabacloud/dbs/model/DescribeNodeCidrListResult.h include/alibabacloud/dbs/model/DescribePreCheckProgressListRequest.h include/alibabacloud/dbs/model/DescribePreCheckProgressListResult.h + include/alibabacloud/dbs/model/DescribeRegionsRequest.h + include/alibabacloud/dbs/model/DescribeRegionsResult.h include/alibabacloud/dbs/model/DescribeRestoreRangeInfoRequest.h include/alibabacloud/dbs/model/DescribeRestoreRangeInfoResult.h include/alibabacloud/dbs/model/DescribeRestoreTaskListRequest.h @@ -106,6 +108,8 @@ set(dbs_src src/model/DescribeNodeCidrListResult.cc src/model/DescribePreCheckProgressListRequest.cc src/model/DescribePreCheckProgressListResult.cc + src/model/DescribeRegionsRequest.cc + src/model/DescribeRegionsResult.cc src/model/DescribeRestoreRangeInfoRequest.cc src/model/DescribeRestoreRangeInfoResult.cc src/model/DescribeRestoreTaskListRequest.cc diff --git a/dbs/include/alibabacloud/dbs/DbsClient.h b/dbs/include/alibabacloud/dbs/DbsClient.h index f2be0f9c8..d674d04ef 100644 --- a/dbs/include/alibabacloud/dbs/DbsClient.h +++ b/dbs/include/alibabacloud/dbs/DbsClient.h @@ -50,6 +50,8 @@ #include "model/DescribeNodeCidrListResult.h" #include "model/DescribePreCheckProgressListRequest.h" #include "model/DescribePreCheckProgressListResult.h" +#include "model/DescribeRegionsRequest.h" +#include "model/DescribeRegionsResult.h" #include "model/DescribeRestoreRangeInfoRequest.h" #include "model/DescribeRestoreRangeInfoResult.h" #include "model/DescribeRestoreTaskListRequest.h" @@ -127,6 +129,9 @@ namespace AlibabaCloud typedef Outcome DescribePreCheckProgressListOutcome; typedef std::future DescribePreCheckProgressListOutcomeCallable; typedef std::function&)> DescribePreCheckProgressListAsyncHandler; + typedef Outcome DescribeRegionsOutcome; + typedef std::future DescribeRegionsOutcomeCallable; + typedef std::function&)> DescribeRegionsAsyncHandler; typedef Outcome DescribeRestoreRangeInfoOutcome; typedef std::future DescribeRestoreRangeInfoOutcomeCallable; typedef std::function&)> DescribeRestoreRangeInfoAsyncHandler; @@ -213,6 +218,9 @@ namespace AlibabaCloud DescribePreCheckProgressListOutcome describePreCheckProgressList(const Model::DescribePreCheckProgressListRequest &request)const; void describePreCheckProgressListAsync(const Model::DescribePreCheckProgressListRequest& request, const DescribePreCheckProgressListAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribePreCheckProgressListOutcomeCallable describePreCheckProgressListCallable(const Model::DescribePreCheckProgressListRequest& request) const; + DescribeRegionsOutcome describeRegions(const Model::DescribeRegionsRequest &request)const; + void describeRegionsAsync(const Model::DescribeRegionsRequest& request, const DescribeRegionsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeRegionsOutcomeCallable describeRegionsCallable(const Model::DescribeRegionsRequest& request) const; DescribeRestoreRangeInfoOutcome describeRestoreRangeInfo(const Model::DescribeRestoreRangeInfoRequest &request)const; void describeRestoreRangeInfoAsync(const Model::DescribeRestoreRangeInfoRequest& request, const DescribeRestoreRangeInfoAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeRestoreRangeInfoOutcomeCallable describeRestoreRangeInfoCallable(const Model::DescribeRestoreRangeInfoRequest& request) const; diff --git a/dbs/include/alibabacloud/dbs/model/DescribeRegionsRequest.h b/dbs/include/alibabacloud/dbs/model/DescribeRegionsRequest.h new file mode 100644 index 000000000..446e80b4a --- /dev/null +++ b/dbs/include/alibabacloud/dbs/model/DescribeRegionsRequest.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_DBS_MODEL_DESCRIBEREGIONSREQUEST_H_ +#define ALIBABACLOUD_DBS_MODEL_DESCRIBEREGIONSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dbs + { + namespace Model + { + class ALIBABACLOUD_DBS_EXPORT DescribeRegionsRequest : public RpcServiceRequest + { + + public: + DescribeRegionsRequest(); + ~DescribeRegionsRequest(); + + std::string getClientToken()const; + void setClientToken(const std::string& clientToken); + std::string getOwnerId()const; + void setOwnerId(const std::string& ownerId); + + private: + std::string clientToken_; + std::string ownerId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DBS_MODEL_DESCRIBEREGIONSREQUEST_H_ \ No newline at end of file diff --git a/dbs/include/alibabacloud/dbs/model/DescribeRegionsResult.h b/dbs/include/alibabacloud/dbs/model/DescribeRegionsResult.h new file mode 100644 index 000000000..607adb13a --- /dev/null +++ b/dbs/include/alibabacloud/dbs/model/DescribeRegionsResult.h @@ -0,0 +1,59 @@ +/* + * 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_DBS_MODEL_DESCRIBEREGIONSRESULT_H_ +#define ALIBABACLOUD_DBS_MODEL_DESCRIBEREGIONSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dbs + { + namespace Model + { + class ALIBABACLOUD_DBS_EXPORT DescribeRegionsResult : public ServiceResult + { + public: + + + DescribeRegionsResult(); + explicit DescribeRegionsResult(const std::string &payload); + ~DescribeRegionsResult(); + int getHttpStatusCode()const; + std::vector getRegions()const; + std::string getErrMessage()const; + bool getSuccess()const; + std::string getErrCode()const; + + protected: + void parse(const std::string &payload); + private: + int httpStatusCode_; + std::vector regions_; + std::string errMessage_; + bool success_; + std::string errCode_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DBS_MODEL_DESCRIBEREGIONSRESULT_H_ \ No newline at end of file diff --git a/dbs/src/DbsClient.cc b/dbs/src/DbsClient.cc index 1c0296dce..88d304726 100644 --- a/dbs/src/DbsClient.cc +++ b/dbs/src/DbsClient.cc @@ -555,6 +555,42 @@ DbsClient::DescribePreCheckProgressListOutcomeCallable DbsClient::describePreChe return task->get_future(); } +DbsClient::DescribeRegionsOutcome DbsClient::describeRegions(const DescribeRegionsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeRegionsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeRegionsOutcome(DescribeRegionsResult(outcome.result())); + else + return DescribeRegionsOutcome(outcome.error()); +} + +void DbsClient::describeRegionsAsync(const DescribeRegionsRequest& request, const DescribeRegionsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeRegions(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +DbsClient::DescribeRegionsOutcomeCallable DbsClient::describeRegionsCallable(const DescribeRegionsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeRegions(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + DbsClient::DescribeRestoreRangeInfoOutcome DbsClient::describeRestoreRangeInfo(const DescribeRestoreRangeInfoRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/dbs/src/model/DescribeRegionsRequest.cc b/dbs/src/model/DescribeRegionsRequest.cc new file mode 100644 index 000000000..24b2d95a2 --- /dev/null +++ b/dbs/src/model/DescribeRegionsRequest.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::Dbs::Model::DescribeRegionsRequest; + +DescribeRegionsRequest::DescribeRegionsRequest() : + RpcServiceRequest("dbs", "2019-03-06", "DescribeRegions") +{ + setMethod(HttpRequest::Method::Post); +} + +DescribeRegionsRequest::~DescribeRegionsRequest() +{} + +std::string DescribeRegionsRequest::getClientToken()const +{ + return clientToken_; +} + +void DescribeRegionsRequest::setClientToken(const std::string& clientToken) +{ + clientToken_ = clientToken; + setParameter("ClientToken", clientToken); +} + +std::string DescribeRegionsRequest::getOwnerId()const +{ + return ownerId_; +} + +void DescribeRegionsRequest::setOwnerId(const std::string& ownerId) +{ + ownerId_ = ownerId; + setParameter("OwnerId", ownerId); +} + diff --git a/dbs/src/model/DescribeRegionsResult.cc b/dbs/src/model/DescribeRegionsResult.cc new file mode 100644 index 000000000..681a80007 --- /dev/null +++ b/dbs/src/model/DescribeRegionsResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Dbs; +using namespace AlibabaCloud::Dbs::Model; + +DescribeRegionsResult::DescribeRegionsResult() : + ServiceResult() +{} + +DescribeRegionsResult::DescribeRegionsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeRegionsResult::~DescribeRegionsResult() +{} + +void DescribeRegionsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allRegions = value["Regions"]["RegionCode"]; + for (const auto &item : allRegions) + regions_.push_back(item.asString()); + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + if(!value["ErrCode"].isNull()) + errCode_ = value["ErrCode"].asString(); + if(!value["ErrMessage"].isNull()) + errMessage_ = value["ErrMessage"].asString(); + if(!value["HttpStatusCode"].isNull()) + httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString()); + +} + +int DescribeRegionsResult::getHttpStatusCode()const +{ + return httpStatusCode_; +} + +std::vector DescribeRegionsResult::getRegions()const +{ + return regions_; +} + +std::string DescribeRegionsResult::getErrMessage()const +{ + return errMessage_; +} + +bool DescribeRegionsResult::getSuccess()const +{ + return success_; +} + +std::string DescribeRegionsResult::getErrCode()const +{ + return errCode_; +} +