New API- GetDrdsDbRdsRelationInfo, which can get private RDS list under certain DB out of DRDS instance ID and DB name.
This commit is contained in:
@@ -2283,6 +2283,42 @@ DrdsClient::EnableSqlFlashbackMatchSwitchOutcomeCallable DrdsClient::enableSqlFl
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
DrdsClient::GetDrdsDbRdsRelationInfoOutcome DrdsClient::getDrdsDbRdsRelationInfo(const GetDrdsDbRdsRelationInfoRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetDrdsDbRdsRelationInfoOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetDrdsDbRdsRelationInfoOutcome(GetDrdsDbRdsRelationInfoResult(outcome.result()));
|
||||
else
|
||||
return GetDrdsDbRdsRelationInfoOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void DrdsClient::getDrdsDbRdsRelationInfoAsync(const GetDrdsDbRdsRelationInfoRequest& request, const GetDrdsDbRdsRelationInfoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getDrdsDbRdsRelationInfo(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
DrdsClient::GetDrdsDbRdsRelationInfoOutcomeCallable DrdsClient::getDrdsDbRdsRelationInfoCallable(const GetDrdsDbRdsRelationInfoRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetDrdsDbRdsRelationInfoOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getDrdsDbRdsRelationInfo(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
DrdsClient::ListTagResourcesOutcome DrdsClient::listTagResources(const ListTagResourcesRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
62
drds/src/model/GetDrdsDbRdsRelationInfoRequest.cc
Normal file
62
drds/src/model/GetDrdsDbRdsRelationInfoRequest.cc
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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/drds/model/GetDrdsDbRdsRelationInfoRequest.h>
|
||||
|
||||
using AlibabaCloud::Drds::Model::GetDrdsDbRdsRelationInfoRequest;
|
||||
|
||||
GetDrdsDbRdsRelationInfoRequest::GetDrdsDbRdsRelationInfoRequest() :
|
||||
RpcServiceRequest("drds", "2019-01-23", "GetDrdsDbRdsRelationInfo")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetDrdsDbRdsRelationInfoRequest::~GetDrdsDbRdsRelationInfoRequest()
|
||||
{}
|
||||
|
||||
std::string GetDrdsDbRdsRelationInfoRequest::getDrdsInstanceId()const
|
||||
{
|
||||
return drdsInstanceId_;
|
||||
}
|
||||
|
||||
void GetDrdsDbRdsRelationInfoRequest::setDrdsInstanceId(const std::string& drdsInstanceId)
|
||||
{
|
||||
drdsInstanceId_ = drdsInstanceId;
|
||||
setParameter("DrdsInstanceId", drdsInstanceId);
|
||||
}
|
||||
|
||||
std::string GetDrdsDbRdsRelationInfoRequest::getAccessKeyId()const
|
||||
{
|
||||
return accessKeyId_;
|
||||
}
|
||||
|
||||
void GetDrdsDbRdsRelationInfoRequest::setAccessKeyId(const std::string& accessKeyId)
|
||||
{
|
||||
accessKeyId_ = accessKeyId;
|
||||
setParameter("AccessKeyId", accessKeyId);
|
||||
}
|
||||
|
||||
std::string GetDrdsDbRdsRelationInfoRequest::getDbName()const
|
||||
{
|
||||
return dbName_;
|
||||
}
|
||||
|
||||
void GetDrdsDbRdsRelationInfoRequest::setDbName(const std::string& dbName)
|
||||
{
|
||||
dbName_ = dbName;
|
||||
setParameter("DbName", dbName);
|
||||
}
|
||||
|
||||
71
drds/src/model/GetDrdsDbRdsRelationInfoResult.cc
Normal file
71
drds/src/model/GetDrdsDbRdsRelationInfoResult.cc
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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/drds/model/GetDrdsDbRdsRelationInfoResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Drds;
|
||||
using namespace AlibabaCloud::Drds::Model;
|
||||
|
||||
GetDrdsDbRdsRelationInfoResult::GetDrdsDbRdsRelationInfoResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetDrdsDbRdsRelationInfoResult::GetDrdsDbRdsRelationInfoResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetDrdsDbRdsRelationInfoResult::~GetDrdsDbRdsRelationInfoResult()
|
||||
{}
|
||||
|
||||
void GetDrdsDbRdsRelationInfoResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allDataNode = value["Data"]["DataItem"];
|
||||
for (auto valueDataDataItem : allDataNode)
|
||||
{
|
||||
DataItem dataObject;
|
||||
if(!valueDataDataItem["RdsInstanceId"].isNull())
|
||||
dataObject.rdsInstanceId = valueDataDataItem["RdsInstanceId"].asString();
|
||||
if(!valueDataDataItem["UsedInstanceId"].isNull())
|
||||
dataObject.usedInstanceId = valueDataDataItem["UsedInstanceId"].asString();
|
||||
if(!valueDataDataItem["UsedInstanceType"].isNull())
|
||||
dataObject.usedInstanceType = valueDataDataItem["UsedInstanceType"].asString();
|
||||
auto allReadOnlyInstanceInfo = value["ReadOnlyInstanceInfo"]["ReadOnlyInstanceIds"];
|
||||
for (auto value : allReadOnlyInstanceInfo)
|
||||
dataObject.readOnlyInstanceInfo.push_back(value.asString());
|
||||
data_.push_back(dataObject);
|
||||
}
|
||||
if(!value["Success"].isNull())
|
||||
success_ = value["Success"].asString() == "true";
|
||||
|
||||
}
|
||||
|
||||
std::vector<GetDrdsDbRdsRelationInfoResult::DataItem> GetDrdsDbRdsRelationInfoResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
bool GetDrdsDbRdsRelationInfoResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user