Add DescribeRegions.

This commit is contained in:
sdk-team
2020-07-17 18:49:59 +08:00
parent 4d79d51820
commit b64262402e
9 changed files with 296 additions and 1 deletions

View File

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

View File

@@ -1 +1 @@
1.36.521
1.36.522

View File

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

View File

@@ -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<Error, Model::DescribePreCheckProgressListResult> DescribePreCheckProgressListOutcome;
typedef std::future<DescribePreCheckProgressListOutcome> DescribePreCheckProgressListOutcomeCallable;
typedef std::function<void(const DbsClient*, const Model::DescribePreCheckProgressListRequest&, const DescribePreCheckProgressListOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribePreCheckProgressListAsyncHandler;
typedef Outcome<Error, Model::DescribeRegionsResult> DescribeRegionsOutcome;
typedef std::future<DescribeRegionsOutcome> DescribeRegionsOutcomeCallable;
typedef std::function<void(const DbsClient*, const Model::DescribeRegionsRequest&, const DescribeRegionsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeRegionsAsyncHandler;
typedef Outcome<Error, Model::DescribeRestoreRangeInfoResult> DescribeRestoreRangeInfoOutcome;
typedef std::future<DescribeRestoreRangeInfoOutcome> DescribeRestoreRangeInfoOutcomeCallable;
typedef std::function<void(const DbsClient*, const Model::DescribeRestoreRangeInfoRequest&, const DescribeRestoreRangeInfoOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
DescribeRestoreRangeInfoOutcomeCallable describeRestoreRangeInfoCallable(const Model::DescribeRestoreRangeInfoRequest& request) const;

View File

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

View File

@@ -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 <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/dbs/DbsExport.h>
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<std::string> 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<std::string> regions_;
std::string errMessage_;
bool success_;
std::string errCode_;
};
}
}
}
#endif // !ALIBABACLOUD_DBS_MODEL_DESCRIBEREGIONSRESULT_H_

View File

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

View File

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

View File

@@ -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 <alibabacloud/dbs/model/DescribeRegionsResult.h>
#include <json/json.h>
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<std::string> 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_;
}