diff --git a/CHANGELOG b/CHANGELOG index 2a65b11a6..3979d6b6b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2021-11-12 Version: 1.36.926 +- Optimize the API for querying storage package information. + 2021-11-08 Version: 1.36.925 - Supported apm restful api. diff --git a/VERSION b/VERSION index baf4e49b7..59625db10 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.925 \ No newline at end of file +1.36.926 \ No newline at end of file diff --git a/polardb/CMakeLists.txt b/polardb/CMakeLists.txt index 409967c47..b2e0cf929 100644 --- a/polardb/CMakeLists.txt +++ b/polardb/CMakeLists.txt @@ -153,6 +153,8 @@ set(polardb_public_header_model include/alibabacloud/polardb/model/DescribeScheduleTasksResult.h include/alibabacloud/polardb/model/DescribeSlowLogRecordsRequest.h include/alibabacloud/polardb/model/DescribeSlowLogRecordsResult.h + include/alibabacloud/polardb/model/DescribeStoragePlanRequest.h + include/alibabacloud/polardb/model/DescribeStoragePlanResult.h include/alibabacloud/polardb/model/DescribeTasksRequest.h include/alibabacloud/polardb/model/DescribeTasksResult.h include/alibabacloud/polardb/model/FailoverDBClusterRequest.h @@ -362,6 +364,8 @@ set(polardb_src src/model/DescribeScheduleTasksResult.cc src/model/DescribeSlowLogRecordsRequest.cc src/model/DescribeSlowLogRecordsResult.cc + src/model/DescribeStoragePlanRequest.cc + src/model/DescribeStoragePlanResult.cc src/model/DescribeTasksRequest.cc src/model/DescribeTasksResult.cc src/model/FailoverDBClusterRequest.cc diff --git a/polardb/include/alibabacloud/polardb/PolardbClient.h b/polardb/include/alibabacloud/polardb/PolardbClient.h index 0c7cdcdfd..4e29ba914 100644 --- a/polardb/include/alibabacloud/polardb/PolardbClient.h +++ b/polardb/include/alibabacloud/polardb/PolardbClient.h @@ -154,6 +154,8 @@ #include "model/DescribeScheduleTasksResult.h" #include "model/DescribeSlowLogRecordsRequest.h" #include "model/DescribeSlowLogRecordsResult.h" +#include "model/DescribeStoragePlanRequest.h" +#include "model/DescribeStoragePlanResult.h" #include "model/DescribeTasksRequest.h" #include "model/DescribeTasksResult.h" #include "model/FailoverDBClusterRequest.h" @@ -435,6 +437,9 @@ namespace AlibabaCloud typedef Outcome DescribeSlowLogRecordsOutcome; typedef std::future DescribeSlowLogRecordsOutcomeCallable; typedef std::function&)> DescribeSlowLogRecordsAsyncHandler; + typedef Outcome DescribeStoragePlanOutcome; + typedef std::future DescribeStoragePlanOutcomeCallable; + typedef std::function&)> DescribeStoragePlanAsyncHandler; typedef Outcome DescribeTasksOutcome; typedef std::future DescribeTasksOutcomeCallable; typedef std::function&)> DescribeTasksAsyncHandler; @@ -749,6 +754,9 @@ namespace AlibabaCloud DescribeSlowLogRecordsOutcome describeSlowLogRecords(const Model::DescribeSlowLogRecordsRequest &request)const; void describeSlowLogRecordsAsync(const Model::DescribeSlowLogRecordsRequest& request, const DescribeSlowLogRecordsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeSlowLogRecordsOutcomeCallable describeSlowLogRecordsCallable(const Model::DescribeSlowLogRecordsRequest& request) const; + DescribeStoragePlanOutcome describeStoragePlan(const Model::DescribeStoragePlanRequest &request)const; + void describeStoragePlanAsync(const Model::DescribeStoragePlanRequest& request, const DescribeStoragePlanAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeStoragePlanOutcomeCallable describeStoragePlanCallable(const Model::DescribeStoragePlanRequest& request) const; DescribeTasksOutcome describeTasks(const Model::DescribeTasksRequest &request)const; void describeTasksAsync(const Model::DescribeTasksRequest& request, const DescribeTasksAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeTasksOutcomeCallable describeTasksCallable(const Model::DescribeTasksRequest& request) const; diff --git a/polardb/include/alibabacloud/polardb/model/DescribeMetaListResult.h b/polardb/include/alibabacloud/polardb/model/DescribeMetaListResult.h index 764674bf0..118c20f48 100644 --- a/polardb/include/alibabacloud/polardb/model/DescribeMetaListResult.h +++ b/polardb/include/alibabacloud/polardb/model/DescribeMetaListResult.h @@ -42,8 +42,8 @@ namespace AlibabaCloud DescribeMetaListResult(); explicit DescribeMetaListResult(const std::string &payload); ~DescribeMetaListResult(); - std::string getTotalRecordCount()const; std::string getTotalPageCount()const; + std::string getTotalRecordCount()const; std::string getPageSize()const; std::string getPageNumber()const; std::vector getItems()const; @@ -51,8 +51,8 @@ namespace AlibabaCloud protected: void parse(const std::string &payload); private: - std::string totalRecordCount_; std::string totalPageCount_; + std::string totalRecordCount_; std::string pageSize_; std::string pageNumber_; std::vector items_; diff --git a/polardb/include/alibabacloud/polardb/model/DescribeScheduleTasksResult.h b/polardb/include/alibabacloud/polardb/model/DescribeScheduleTasksResult.h index 8f16b65e3..a195adc0d 100644 --- a/polardb/include/alibabacloud/polardb/model/DescribeScheduleTasksResult.h +++ b/polardb/include/alibabacloud/polardb/model/DescribeScheduleTasksResult.h @@ -41,6 +41,7 @@ namespace AlibabaCloud std::string plannedTime; std::string taskId; std::string dbClusterDescription; + bool taskCancel; std::string dBClusterId; std::string plannedStartTime; std::string region; diff --git a/polardb/include/alibabacloud/polardb/model/DescribeStoragePlanRequest.h b/polardb/include/alibabacloud/polardb/model/DescribeStoragePlanRequest.h new file mode 100644 index 000000000..28f1bb154 --- /dev/null +++ b/polardb/include/alibabacloud/polardb/model/DescribeStoragePlanRequest.h @@ -0,0 +1,66 @@ +/* + * 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_POLARDB_MODEL_DESCRIBESTORAGEPLANREQUEST_H_ +#define ALIBABACLOUD_POLARDB_MODEL_DESCRIBESTORAGEPLANREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Polardb + { + namespace Model + { + class ALIBABACLOUD_POLARDB_EXPORT DescribeStoragePlanRequest : public RpcServiceRequest + { + + public: + DescribeStoragePlanRequest(); + ~DescribeStoragePlanRequest(); + + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + int getPageNumber()const; + void setPageNumber(int pageNumber); + std::string getAccessKeyId()const; + void setAccessKeyId(const std::string& accessKeyId); + int getPageSize()const; + void setPageSize(int pageSize); + std::string getResourceOwnerAccount()const; + void setResourceOwnerAccount(const std::string& resourceOwnerAccount); + std::string getOwnerAccount()const; + void setOwnerAccount(const std::string& ownerAccount); + long getOwnerId()const; + void setOwnerId(long ownerId); + + private: + long resourceOwnerId_; + int pageNumber_; + std::string accessKeyId_; + int pageSize_; + std::string resourceOwnerAccount_; + std::string ownerAccount_; + long ownerId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_POLARDB_MODEL_DESCRIBESTORAGEPLANREQUEST_H_ \ No newline at end of file diff --git a/polardb/include/alibabacloud/polardb/model/DescribeStoragePlanResult.h b/polardb/include/alibabacloud/polardb/model/DescribeStoragePlanResult.h new file mode 100644 index 000000000..6d16d2993 --- /dev/null +++ b/polardb/include/alibabacloud/polardb/model/DescribeStoragePlanResult.h @@ -0,0 +1,75 @@ +/* + * 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_POLARDB_MODEL_DESCRIBESTORAGEPLANRESULT_H_ +#define ALIBABACLOUD_POLARDB_MODEL_DESCRIBESTORAGEPLANRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Polardb + { + namespace Model + { + class ALIBABACLOUD_POLARDB_EXPORT DescribeStoragePlanResult : public ServiceResult + { + public: + struct DescribeStoragePlanResponses + { + std::string status; + std::string storageType; + std::string instanceId; + std::string initCapaCityViewUnit; + std::string startTimes; + std::string prodCode; + std::string initCapacityViewValue; + std::string purchaseTimes; + std::string periodTime; + std::string periodCapacityViewValue; + std::string commodityCode; + std::string templateName; + std::string periodCapaCityViewUnit; + std::string aliUid; + std::string endTimes; + }; + + + DescribeStoragePlanResult(); + explicit DescribeStoragePlanResult(const std::string &payload); + ~DescribeStoragePlanResult(); + long getTotalRecordCount()const; + long getPageSize()const; + long getPageNumber()const; + std::vector getItems()const; + + protected: + void parse(const std::string &payload); + private: + long totalRecordCount_; + long pageSize_; + long pageNumber_; + std::vector items_; + + }; + } + } +} +#endif // !ALIBABACLOUD_POLARDB_MODEL_DESCRIBESTORAGEPLANRESULT_H_ \ No newline at end of file diff --git a/polardb/src/PolardbClient.cc b/polardb/src/PolardbClient.cc index 86e7a905e..58d519c12 100644 --- a/polardb/src/PolardbClient.cc +++ b/polardb/src/PolardbClient.cc @@ -2427,6 +2427,42 @@ PolardbClient::DescribeSlowLogRecordsOutcomeCallable PolardbClient::describeSlow return task->get_future(); } +PolardbClient::DescribeStoragePlanOutcome PolardbClient::describeStoragePlan(const DescribeStoragePlanRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeStoragePlanOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeStoragePlanOutcome(DescribeStoragePlanResult(outcome.result())); + else + return DescribeStoragePlanOutcome(outcome.error()); +} + +void PolardbClient::describeStoragePlanAsync(const DescribeStoragePlanRequest& request, const DescribeStoragePlanAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeStoragePlan(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +PolardbClient::DescribeStoragePlanOutcomeCallable PolardbClient::describeStoragePlanCallable(const DescribeStoragePlanRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeStoragePlan(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + PolardbClient::DescribeTasksOutcome PolardbClient::describeTasks(const DescribeTasksRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/polardb/src/model/DescribeMetaListResult.cc b/polardb/src/model/DescribeMetaListResult.cc index eb958878c..300d59cb8 100644 --- a/polardb/src/model/DescribeMetaListResult.cc +++ b/polardb/src/model/DescribeMetaListResult.cc @@ -50,10 +50,10 @@ void DescribeMetaListResult::parse(const std::string &payload) itemsObject.tables.push_back(value.asString()); items_.push_back(itemsObject); } - if(!value["TotalRecordCount"].isNull()) - totalRecordCount_ = value["TotalRecordCount"].asString(); if(!value["TotalPageCount"].isNull()) totalPageCount_ = value["TotalPageCount"].asString(); + if(!value["TotalRecordCount"].isNull()) + totalRecordCount_ = value["TotalRecordCount"].asString(); if(!value["PageSize"].isNull()) pageSize_ = value["PageSize"].asString(); if(!value["PageNumber"].isNull()) @@ -61,16 +61,16 @@ void DescribeMetaListResult::parse(const std::string &payload) } -std::string DescribeMetaListResult::getTotalRecordCount()const -{ - return totalRecordCount_; -} - std::string DescribeMetaListResult::getTotalPageCount()const { return totalPageCount_; } +std::string DescribeMetaListResult::getTotalRecordCount()const +{ + return totalRecordCount_; +} + std::string DescribeMetaListResult::getPageSize()const { return pageSize_; diff --git a/polardb/src/model/DescribeScheduleTasksResult.cc b/polardb/src/model/DescribeScheduleTasksResult.cc index 8af111a9f..a62687fbe 100644 --- a/polardb/src/model/DescribeScheduleTasksResult.cc +++ b/polardb/src/model/DescribeScheduleTasksResult.cc @@ -72,6 +72,8 @@ void DescribeScheduleTasksResult::parse(const std::string &payload) timerInfosItemObject.dbClusterStatus = dataNodeTimerInfostimerInfosItem["DbClusterStatus"].asString(); if(!dataNodeTimerInfostimerInfosItem["DbClusterDescription"].isNull()) timerInfosItemObject.dbClusterDescription = dataNodeTimerInfostimerInfosItem["DbClusterDescription"].asString(); + if(!dataNodeTimerInfostimerInfosItem["TaskCancel"].isNull()) + timerInfosItemObject.taskCancel = dataNodeTimerInfostimerInfosItem["TaskCancel"].asString() == "true"; data_.timerInfos.push_back(timerInfosItemObject); } if(!value["Message"].isNull()) diff --git a/polardb/src/model/DescribeStoragePlanRequest.cc b/polardb/src/model/DescribeStoragePlanRequest.cc new file mode 100644 index 000000000..517878c90 --- /dev/null +++ b/polardb/src/model/DescribeStoragePlanRequest.cc @@ -0,0 +1,106 @@ +/* + * 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::Polardb::Model::DescribeStoragePlanRequest; + +DescribeStoragePlanRequest::DescribeStoragePlanRequest() : + RpcServiceRequest("polardb", "2017-08-01", "DescribeStoragePlan") +{ + setMethod(HttpRequest::Method::Post); +} + +DescribeStoragePlanRequest::~DescribeStoragePlanRequest() +{} + +long DescribeStoragePlanRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void DescribeStoragePlanRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +int DescribeStoragePlanRequest::getPageNumber()const +{ + return pageNumber_; +} + +void DescribeStoragePlanRequest::setPageNumber(int pageNumber) +{ + pageNumber_ = pageNumber; + setParameter("PageNumber", std::to_string(pageNumber)); +} + +std::string DescribeStoragePlanRequest::getAccessKeyId()const +{ + return accessKeyId_; +} + +void DescribeStoragePlanRequest::setAccessKeyId(const std::string& accessKeyId) +{ + accessKeyId_ = accessKeyId; + setParameter("AccessKeyId", accessKeyId); +} + +int DescribeStoragePlanRequest::getPageSize()const +{ + return pageSize_; +} + +void DescribeStoragePlanRequest::setPageSize(int pageSize) +{ + pageSize_ = pageSize; + setParameter("PageSize", std::to_string(pageSize)); +} + +std::string DescribeStoragePlanRequest::getResourceOwnerAccount()const +{ + return resourceOwnerAccount_; +} + +void DescribeStoragePlanRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount) +{ + resourceOwnerAccount_ = resourceOwnerAccount; + setParameter("ResourceOwnerAccount", resourceOwnerAccount); +} + +std::string DescribeStoragePlanRequest::getOwnerAccount()const +{ + return ownerAccount_; +} + +void DescribeStoragePlanRequest::setOwnerAccount(const std::string& ownerAccount) +{ + ownerAccount_ = ownerAccount; + setParameter("OwnerAccount", ownerAccount); +} + +long DescribeStoragePlanRequest::getOwnerId()const +{ + return ownerId_; +} + +void DescribeStoragePlanRequest::setOwnerId(long ownerId) +{ + ownerId_ = ownerId; + setParameter("OwnerId", std::to_string(ownerId)); +} + diff --git a/polardb/src/model/DescribeStoragePlanResult.cc b/polardb/src/model/DescribeStoragePlanResult.cc new file mode 100644 index 000000000..bca5f24a8 --- /dev/null +++ b/polardb/src/model/DescribeStoragePlanResult.cc @@ -0,0 +1,106 @@ +/* + * 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::Polardb; +using namespace AlibabaCloud::Polardb::Model; + +DescribeStoragePlanResult::DescribeStoragePlanResult() : + ServiceResult() +{} + +DescribeStoragePlanResult::DescribeStoragePlanResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeStoragePlanResult::~DescribeStoragePlanResult() +{} + +void DescribeStoragePlanResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allItemsNode = value["Items"]["DescribeStoragePlanResponses"]; + for (auto valueItemsDescribeStoragePlanResponses : allItemsNode) + { + DescribeStoragePlanResponses itemsObject; + if(!valueItemsDescribeStoragePlanResponses["ProdCode"].isNull()) + itemsObject.prodCode = valueItemsDescribeStoragePlanResponses["ProdCode"].asString(); + if(!valueItemsDescribeStoragePlanResponses["AliUid"].isNull()) + itemsObject.aliUid = valueItemsDescribeStoragePlanResponses["AliUid"].asString(); + if(!valueItemsDescribeStoragePlanResponses["CommodityCode"].isNull()) + itemsObject.commodityCode = valueItemsDescribeStoragePlanResponses["CommodityCode"].asString(); + if(!valueItemsDescribeStoragePlanResponses["TemplateName"].isNull()) + itemsObject.templateName = valueItemsDescribeStoragePlanResponses["TemplateName"].asString(); + if(!valueItemsDescribeStoragePlanResponses["StorageType"].isNull()) + itemsObject.storageType = valueItemsDescribeStoragePlanResponses["StorageType"].asString(); + if(!valueItemsDescribeStoragePlanResponses["Status"].isNull()) + itemsObject.status = valueItemsDescribeStoragePlanResponses["Status"].asString(); + if(!valueItemsDescribeStoragePlanResponses["StartTimes"].isNull()) + itemsObject.startTimes = valueItemsDescribeStoragePlanResponses["StartTimes"].asString(); + if(!valueItemsDescribeStoragePlanResponses["EndTimes"].isNull()) + itemsObject.endTimes = valueItemsDescribeStoragePlanResponses["EndTimes"].asString(); + if(!valueItemsDescribeStoragePlanResponses["PurchaseTimes"].isNull()) + itemsObject.purchaseTimes = valueItemsDescribeStoragePlanResponses["PurchaseTimes"].asString(); + if(!valueItemsDescribeStoragePlanResponses["InstanceId"].isNull()) + itemsObject.instanceId = valueItemsDescribeStoragePlanResponses["InstanceId"].asString(); + if(!valueItemsDescribeStoragePlanResponses["InitCapacityViewValue"].isNull()) + itemsObject.initCapacityViewValue = valueItemsDescribeStoragePlanResponses["InitCapacityViewValue"].asString(); + if(!valueItemsDescribeStoragePlanResponses["InitCapaCityViewUnit"].isNull()) + itemsObject.initCapaCityViewUnit = valueItemsDescribeStoragePlanResponses["InitCapaCityViewUnit"].asString(); + if(!valueItemsDescribeStoragePlanResponses["PeriodCapacityViewValue"].isNull()) + itemsObject.periodCapacityViewValue = valueItemsDescribeStoragePlanResponses["PeriodCapacityViewValue"].asString(); + if(!valueItemsDescribeStoragePlanResponses["PeriodCapaCityViewUnit"].isNull()) + itemsObject.periodCapaCityViewUnit = valueItemsDescribeStoragePlanResponses["PeriodCapaCityViewUnit"].asString(); + if(!valueItemsDescribeStoragePlanResponses["PeriodTime"].isNull()) + itemsObject.periodTime = valueItemsDescribeStoragePlanResponses["PeriodTime"].asString(); + items_.push_back(itemsObject); + } + if(!value["TotalRecordCount"].isNull()) + totalRecordCount_ = std::stol(value["TotalRecordCount"].asString()); + if(!value["PageSize"].isNull()) + pageSize_ = std::stol(value["PageSize"].asString()); + if(!value["PageNumber"].isNull()) + pageNumber_ = std::stol(value["PageNumber"].asString()); + +} + +long DescribeStoragePlanResult::getTotalRecordCount()const +{ + return totalRecordCount_; +} + +long DescribeStoragePlanResult::getPageSize()const +{ + return pageSize_; +} + +long DescribeStoragePlanResult::getPageNumber()const +{ + return pageNumber_; +} + +std::vector DescribeStoragePlanResult::getItems()const +{ + return items_; +} +