From 7a898c20fc45311a74568f9c2695343e64e1825f Mon Sep 17 00:00:00 2001 From: sdk-team Date: Fri, 15 Nov 2019 01:34:57 +0800 Subject: [PATCH] Add DescribeRestoreRangeInfo. --- CHANGELOG | 3 + VERSION | 2 +- dbs/CMakeLists.txt | 4 + dbs/include/alibabacloud/dbs/DbsClient.h | 8 ++ .../model/DescribeRestoreRangeInfoRequest.h | 60 ++++++++++ .../model/DescribeRestoreRangeInfoResult.h | 74 ++++++++++++ dbs/src/DbsClient.cc | 36 ++++++ .../model/DescribeRestoreRangeInfoRequest.cc | 84 ++++++++++++++ .../model/DescribeRestoreRangeInfoResult.cc | 105 ++++++++++++++++++ 9 files changed, 375 insertions(+), 1 deletion(-) create mode 100644 dbs/include/alibabacloud/dbs/model/DescribeRestoreRangeInfoRequest.h create mode 100644 dbs/include/alibabacloud/dbs/model/DescribeRestoreRangeInfoResult.h create mode 100644 dbs/src/model/DescribeRestoreRangeInfoRequest.cc create mode 100644 dbs/src/model/DescribeRestoreRangeInfoResult.cc diff --git a/CHANGELOG b/CHANGELOG index f2fdf67c6..8a4f7ca65 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2019-11-15 Version 1.36.177 +- Add DescribeRestoreRangeInfo. + 2019-11-14 Version 1.36.176 - Released dysms OpenAPI. diff --git a/VERSION b/VERSION index 3602bfa81..8fe9d594c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.176 \ No newline at end of file +1.36.177 \ No newline at end of file diff --git a/dbs/CMakeLists.txt b/dbs/CMakeLists.txt index a5cc5d805..1daeac727 100644 --- a/dbs/CMakeLists.txt +++ b/dbs/CMakeLists.txt @@ -41,6 +41,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/DescribeRestoreRangeInfoRequest.h + include/alibabacloud/dbs/model/DescribeRestoreRangeInfoResult.h include/alibabacloud/dbs/model/DescribeRestoreTaskListRequest.h include/alibabacloud/dbs/model/DescribeRestoreTaskListResult.h include/alibabacloud/dbs/model/ModifyBackupObjectsRequest.h @@ -84,6 +86,8 @@ set(dbs_src src/model/DescribeNodeCidrListResult.cc src/model/DescribePreCheckProgressListRequest.cc src/model/DescribePreCheckProgressListResult.cc + src/model/DescribeRestoreRangeInfoRequest.cc + src/model/DescribeRestoreRangeInfoResult.cc src/model/DescribeRestoreTaskListRequest.cc src/model/DescribeRestoreTaskListResult.cc src/model/ModifyBackupObjectsRequest.cc diff --git a/dbs/include/alibabacloud/dbs/DbsClient.h b/dbs/include/alibabacloud/dbs/DbsClient.h index df556ca3a..90530cb1f 100644 --- a/dbs/include/alibabacloud/dbs/DbsClient.h +++ b/dbs/include/alibabacloud/dbs/DbsClient.h @@ -42,6 +42,8 @@ #include "model/DescribeNodeCidrListResult.h" #include "model/DescribePreCheckProgressListRequest.h" #include "model/DescribePreCheckProgressListResult.h" +#include "model/DescribeRestoreRangeInfoRequest.h" +#include "model/DescribeRestoreRangeInfoResult.h" #include "model/DescribeRestoreTaskListRequest.h" #include "model/DescribeRestoreTaskListResult.h" #include "model/ModifyBackupObjectsRequest.h" @@ -101,6 +103,9 @@ namespace AlibabaCloud typedef Outcome DescribePreCheckProgressListOutcome; typedef std::future DescribePreCheckProgressListOutcomeCallable; typedef std::function&)> DescribePreCheckProgressListAsyncHandler; + typedef Outcome DescribeRestoreRangeInfoOutcome; + typedef std::future DescribeRestoreRangeInfoOutcomeCallable; + typedef std::function&)> DescribeRestoreRangeInfoAsyncHandler; typedef Outcome DescribeRestoreTaskListOutcome; typedef std::future DescribeRestoreTaskListOutcomeCallable; typedef std::function&)> DescribeRestoreTaskListAsyncHandler; @@ -166,6 +171,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; + 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; DescribeRestoreTaskListOutcome describeRestoreTaskList(const Model::DescribeRestoreTaskListRequest &request)const; void describeRestoreTaskListAsync(const Model::DescribeRestoreTaskListRequest& request, const DescribeRestoreTaskListAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeRestoreTaskListOutcomeCallable describeRestoreTaskListCallable(const Model::DescribeRestoreTaskListRequest& request) const; diff --git a/dbs/include/alibabacloud/dbs/model/DescribeRestoreRangeInfoRequest.h b/dbs/include/alibabacloud/dbs/model/DescribeRestoreRangeInfoRequest.h new file mode 100644 index 000000000..2d5908541 --- /dev/null +++ b/dbs/include/alibabacloud/dbs/model/DescribeRestoreRangeInfoRequest.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_DBS_MODEL_DESCRIBERESTORERANGEINFOREQUEST_H_ +#define ALIBABACLOUD_DBS_MODEL_DESCRIBERESTORERANGEINFOREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dbs + { + namespace Model + { + class ALIBABACLOUD_DBS_EXPORT DescribeRestoreRangeInfoRequest : public RpcServiceRequest + { + + public: + DescribeRestoreRangeInfoRequest(); + ~DescribeRestoreRangeInfoRequest(); + + long getBeginTimestampForRestore()const; + void setBeginTimestampForRestore(long beginTimestampForRestore); + long getEndTimestampForRestore()const; + void setEndTimestampForRestore(long endTimestampForRestore); + std::string getClientToken()const; + void setClientToken(const std::string& clientToken); + std::string getBackupPlanId()const; + void setBackupPlanId(const std::string& backupPlanId); + std::string getOwnerId()const; + void setOwnerId(const std::string& ownerId); + + private: + long beginTimestampForRestore_; + long endTimestampForRestore_; + std::string clientToken_; + std::string backupPlanId_; + std::string ownerId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DBS_MODEL_DESCRIBERESTORERANGEINFOREQUEST_H_ \ No newline at end of file diff --git a/dbs/include/alibabacloud/dbs/model/DescribeRestoreRangeInfoResult.h b/dbs/include/alibabacloud/dbs/model/DescribeRestoreRangeInfoResult.h new file mode 100644 index 000000000..084605c41 --- /dev/null +++ b/dbs/include/alibabacloud/dbs/model/DescribeRestoreRangeInfoResult.h @@ -0,0 +1,74 @@ +/* + * 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_DESCRIBERESTORERANGEINFORESULT_H_ +#define ALIBABACLOUD_DBS_MODEL_DESCRIBERESTORERANGEINFORESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Dbs + { + namespace Model + { + class ALIBABACLOUD_DBS_EXPORT DescribeRestoreRangeInfoResult : public ServiceResult + { + public: + struct DBSRecoverRange + { + struct FullBackupDetail + { + std::string endTime; + std::string startTime; + std::string backupSetId; + }; + std::string rangeType; + std::vector fullBackupList; + std::string sourceEndpointInstanceID; + std::string sourceEndpointInstanceType; + std::string endTimestampForRestore; + std::string beginTimestampForRestore; + }; + + + DescribeRestoreRangeInfoResult(); + explicit DescribeRestoreRangeInfoResult(const std::string &payload); + ~DescribeRestoreRangeInfoResult(); + int getHttpStatusCode()const; + std::vector getItems()const; + std::string getErrMessage()const; + bool getSuccess()const; + std::string getErrCode()const; + + protected: + void parse(const std::string &payload); + private: + int httpStatusCode_; + std::vector items_; + std::string errMessage_; + bool success_; + std::string errCode_; + + }; + } + } +} +#endif // !ALIBABACLOUD_DBS_MODEL_DESCRIBERESTORERANGEINFORESULT_H_ \ No newline at end of file diff --git a/dbs/src/DbsClient.cc b/dbs/src/DbsClient.cc index 75a209a30..b177c857e 100644 --- a/dbs/src/DbsClient.cc +++ b/dbs/src/DbsClient.cc @@ -411,6 +411,42 @@ DbsClient::DescribePreCheckProgressListOutcomeCallable DbsClient::describePreChe return task->get_future(); } +DbsClient::DescribeRestoreRangeInfoOutcome DbsClient::describeRestoreRangeInfo(const DescribeRestoreRangeInfoRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeRestoreRangeInfoOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeRestoreRangeInfoOutcome(DescribeRestoreRangeInfoResult(outcome.result())); + else + return DescribeRestoreRangeInfoOutcome(outcome.error()); +} + +void DbsClient::describeRestoreRangeInfoAsync(const DescribeRestoreRangeInfoRequest& request, const DescribeRestoreRangeInfoAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeRestoreRangeInfo(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +DbsClient::DescribeRestoreRangeInfoOutcomeCallable DbsClient::describeRestoreRangeInfoCallable(const DescribeRestoreRangeInfoRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeRestoreRangeInfo(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + DbsClient::DescribeRestoreTaskListOutcome DbsClient::describeRestoreTaskList(const DescribeRestoreTaskListRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/dbs/src/model/DescribeRestoreRangeInfoRequest.cc b/dbs/src/model/DescribeRestoreRangeInfoRequest.cc new file mode 100644 index 000000000..5e68dcb6c --- /dev/null +++ b/dbs/src/model/DescribeRestoreRangeInfoRequest.cc @@ -0,0 +1,84 @@ +/* + * 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::DescribeRestoreRangeInfoRequest; + +DescribeRestoreRangeInfoRequest::DescribeRestoreRangeInfoRequest() : + RpcServiceRequest("dbs", "2019-03-06", "DescribeRestoreRangeInfo") +{ + setMethod(HttpRequest::Method::Post); +} + +DescribeRestoreRangeInfoRequest::~DescribeRestoreRangeInfoRequest() +{} + +long DescribeRestoreRangeInfoRequest::getBeginTimestampForRestore()const +{ + return beginTimestampForRestore_; +} + +void DescribeRestoreRangeInfoRequest::setBeginTimestampForRestore(long beginTimestampForRestore) +{ + beginTimestampForRestore_ = beginTimestampForRestore; + setCoreParameter("BeginTimestampForRestore", std::to_string(beginTimestampForRestore)); +} + +long DescribeRestoreRangeInfoRequest::getEndTimestampForRestore()const +{ + return endTimestampForRestore_; +} + +void DescribeRestoreRangeInfoRequest::setEndTimestampForRestore(long endTimestampForRestore) +{ + endTimestampForRestore_ = endTimestampForRestore; + setCoreParameter("EndTimestampForRestore", std::to_string(endTimestampForRestore)); +} + +std::string DescribeRestoreRangeInfoRequest::getClientToken()const +{ + return clientToken_; +} + +void DescribeRestoreRangeInfoRequest::setClientToken(const std::string& clientToken) +{ + clientToken_ = clientToken; + setCoreParameter("ClientToken", clientToken); +} + +std::string DescribeRestoreRangeInfoRequest::getBackupPlanId()const +{ + return backupPlanId_; +} + +void DescribeRestoreRangeInfoRequest::setBackupPlanId(const std::string& backupPlanId) +{ + backupPlanId_ = backupPlanId; + setCoreParameter("BackupPlanId", backupPlanId); +} + +std::string DescribeRestoreRangeInfoRequest::getOwnerId()const +{ + return ownerId_; +} + +void DescribeRestoreRangeInfoRequest::setOwnerId(const std::string& ownerId) +{ + ownerId_ = ownerId; + setCoreParameter("OwnerId", ownerId); +} + diff --git a/dbs/src/model/DescribeRestoreRangeInfoResult.cc b/dbs/src/model/DescribeRestoreRangeInfoResult.cc new file mode 100644 index 000000000..1b8d5e612 --- /dev/null +++ b/dbs/src/model/DescribeRestoreRangeInfoResult.cc @@ -0,0 +1,105 @@ +/* + * 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; + +DescribeRestoreRangeInfoResult::DescribeRestoreRangeInfoResult() : + ServiceResult() +{} + +DescribeRestoreRangeInfoResult::DescribeRestoreRangeInfoResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeRestoreRangeInfoResult::~DescribeRestoreRangeInfoResult() +{} + +void DescribeRestoreRangeInfoResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allItemsNode = value["Items"]["DBSRecoverRange"]; + for (auto valueItemsDBSRecoverRange : allItemsNode) + { + DBSRecoverRange itemsObject; + if(!valueItemsDBSRecoverRange["SourceEndpointInstanceType"].isNull()) + itemsObject.sourceEndpointInstanceType = valueItemsDBSRecoverRange["SourceEndpointInstanceType"].asString(); + if(!valueItemsDBSRecoverRange["SourceEndpointInstanceID"].isNull()) + itemsObject.sourceEndpointInstanceID = valueItemsDBSRecoverRange["SourceEndpointInstanceID"].asString(); + if(!valueItemsDBSRecoverRange["BeginTimestampForRestore"].isNull()) + itemsObject.beginTimestampForRestore = valueItemsDBSRecoverRange["BeginTimestampForRestore"].asString(); + if(!valueItemsDBSRecoverRange["EndTimestampForRestore"].isNull()) + itemsObject.endTimestampForRestore = valueItemsDBSRecoverRange["EndTimestampForRestore"].asString(); + if(!valueItemsDBSRecoverRange["RangeType"].isNull()) + itemsObject.rangeType = valueItemsDBSRecoverRange["RangeType"].asString(); + auto allFullBackupListNode = allItemsNode["FullBackupList"]["FullBackupDetail"]; + for (auto allItemsNodeFullBackupListFullBackupDetail : allFullBackupListNode) + { + DBSRecoverRange::FullBackupDetail fullBackupListObject; + if(!allItemsNodeFullBackupListFullBackupDetail["BackupSetId"].isNull()) + fullBackupListObject.backupSetId = allItemsNodeFullBackupListFullBackupDetail["BackupSetId"].asString(); + if(!allItemsNodeFullBackupListFullBackupDetail["StartTime"].isNull()) + fullBackupListObject.startTime = allItemsNodeFullBackupListFullBackupDetail["StartTime"].asString(); + if(!allItemsNodeFullBackupListFullBackupDetail["EndTime"].isNull()) + fullBackupListObject.endTime = allItemsNodeFullBackupListFullBackupDetail["EndTime"].asString(); + itemsObject.fullBackupList.push_back(fullBackupListObject); + } + items_.push_back(itemsObject); + } + 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 DescribeRestoreRangeInfoResult::getHttpStatusCode()const +{ + return httpStatusCode_; +} + +std::vector DescribeRestoreRangeInfoResult::getItems()const +{ + return items_; +} + +std::string DescribeRestoreRangeInfoResult::getErrMessage()const +{ + return errMessage_; +} + +bool DescribeRestoreRangeInfoResult::getSuccess()const +{ + return success_; +} + +std::string DescribeRestoreRangeInfoResult::getErrCode()const +{ + return errCode_; +} +