Optimize the API for querying storage package information.

This commit is contained in:
sdk-team
2021-11-12 02:05:07 +00:00
parent a6a706f7bd
commit 4dea18972d
13 changed files with 417 additions and 10 deletions

View File

@@ -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.

View File

@@ -1 +1 @@
1.36.925
1.36.926

View File

@@ -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

View File

@@ -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<Error, Model::DescribeSlowLogRecordsResult> DescribeSlowLogRecordsOutcome;
typedef std::future<DescribeSlowLogRecordsOutcome> DescribeSlowLogRecordsOutcomeCallable;
typedef std::function<void(const PolardbClient*, const Model::DescribeSlowLogRecordsRequest&, const DescribeSlowLogRecordsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeSlowLogRecordsAsyncHandler;
typedef Outcome<Error, Model::DescribeStoragePlanResult> DescribeStoragePlanOutcome;
typedef std::future<DescribeStoragePlanOutcome> DescribeStoragePlanOutcomeCallable;
typedef std::function<void(const PolardbClient*, const Model::DescribeStoragePlanRequest&, const DescribeStoragePlanOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeStoragePlanAsyncHandler;
typedef Outcome<Error, Model::DescribeTasksResult> DescribeTasksOutcome;
typedef std::future<DescribeTasksOutcome> DescribeTasksOutcomeCallable;
typedef std::function<void(const PolardbClient*, const Model::DescribeTasksRequest&, const DescribeTasksOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
DescribeTasksOutcomeCallable describeTasksCallable(const Model::DescribeTasksRequest& request) const;

View File

@@ -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<MetaItem> 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<MetaItem> items_;

View File

@@ -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;

View File

@@ -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 <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/polardb/PolardbExport.h>
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_

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/polardb/PolardbExport.h>
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<DescribeStoragePlanResponses> getItems()const;
protected:
void parse(const std::string &payload);
private:
long totalRecordCount_;
long pageSize_;
long pageNumber_;
std::vector<DescribeStoragePlanResponses> items_;
};
}
}
}
#endif // !ALIBABACLOUD_POLARDB_MODEL_DESCRIBESTORAGEPLANRESULT_H_

View File

@@ -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<const AsyncCallerContext>& 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<std::packaged_task<DescribeStoragePlanOutcome()>>(
[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();

View File

@@ -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_;

View File

@@ -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())

View File

@@ -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 <alibabacloud/polardb/model/DescribeStoragePlanRequest.h>
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));
}

View File

@@ -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 <alibabacloud/polardb/model/DescribeStoragePlanResult.h>
#include <json/json.h>
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::DescribeStoragePlanResponses> DescribeStoragePlanResult::getItems()const
{
return items_;
}