Skip to content

Commit 4ff9008

Browse files
committed
New API- GetDrdsDbRdsRelationInfo, which can get private RDS list under certain DB out of DRDS instance ID and DB name.
1 parent 8617b6f commit 4ff9008

File tree

9 files changed

+299
-1
lines changed

9 files changed

+299
-1
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2021-05-23 Version: 1.36.752
2+
- New API- GetDrdsDbRdsRelationInfo, which can get private RDS list under certain DB out of DRDS instance ID and DB name.
3+
14
2021-05-22 Version: 1.36.751
25
- Aaaaa.
36

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.36.751
1+
1.36.752

drds/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ set(drds_public_header_model
145145
include/alibabacloud/drds/model/EnableSqlAuditResult.h
146146
include/alibabacloud/drds/model/EnableSqlFlashbackMatchSwitchRequest.h
147147
include/alibabacloud/drds/model/EnableSqlFlashbackMatchSwitchResult.h
148+
include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoRequest.h
149+
include/alibabacloud/drds/model/GetDrdsDbRdsRelationInfoResult.h
148150
include/alibabacloud/drds/model/ListTagResourcesRequest.h
149151
include/alibabacloud/drds/model/ListTagResourcesResult.h
150152
include/alibabacloud/drds/model/ManagePrivateRdsRequest.h
@@ -342,6 +344,8 @@ set(drds_src
342344
src/model/EnableSqlAuditResult.cc
343345
src/model/EnableSqlFlashbackMatchSwitchRequest.cc
344346
src/model/EnableSqlFlashbackMatchSwitchResult.cc
347+
src/model/GetDrdsDbRdsRelationInfoRequest.cc
348+
src/model/GetDrdsDbRdsRelationInfoResult.cc
345349
src/model/ListTagResourcesRequest.cc
346350
src/model/ListTagResourcesResult.cc
347351
src/model/ManagePrivateRdsRequest.cc

drds/include/alibabacloud/drds/DrdsClient.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@
146146
#include "model/EnableSqlAuditResult.h"
147147
#include "model/EnableSqlFlashbackMatchSwitchRequest.h"
148148
#include "model/EnableSqlFlashbackMatchSwitchResult.h"
149+
#include "model/GetDrdsDbRdsRelationInfoRequest.h"
150+
#include "model/GetDrdsDbRdsRelationInfoResult.h"
149151
#include "model/ListTagResourcesRequest.h"
150152
#include "model/ListTagResourcesResult.h"
151153
#include "model/ManagePrivateRdsRequest.h"
@@ -411,6 +413,9 @@ namespace AlibabaCloud
411413
typedef Outcome<Error, Model::EnableSqlFlashbackMatchSwitchResult> EnableSqlFlashbackMatchSwitchOutcome;
412414
typedef std::future<EnableSqlFlashbackMatchSwitchOutcome> EnableSqlFlashbackMatchSwitchOutcomeCallable;
413415
typedef std::function<void(const DrdsClient*, const Model::EnableSqlFlashbackMatchSwitchRequest&, const EnableSqlFlashbackMatchSwitchOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> EnableSqlFlashbackMatchSwitchAsyncHandler;
416+
typedef Outcome<Error, Model::GetDrdsDbRdsRelationInfoResult> GetDrdsDbRdsRelationInfoOutcome;
417+
typedef std::future<GetDrdsDbRdsRelationInfoOutcome> GetDrdsDbRdsRelationInfoOutcomeCallable;
418+
typedef std::function<void(const DrdsClient*, const Model::GetDrdsDbRdsRelationInfoRequest&, const GetDrdsDbRdsRelationInfoOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetDrdsDbRdsRelationInfoAsyncHandler;
414419
typedef Outcome<Error, Model::ListTagResourcesResult> ListTagResourcesOutcome;
415420
typedef std::future<ListTagResourcesOutcome> ListTagResourcesOutcomeCallable;
416421
typedef std::function<void(const DrdsClient*, const Model::ListTagResourcesRequest&, const ListTagResourcesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListTagResourcesAsyncHandler;
@@ -707,6 +712,9 @@ namespace AlibabaCloud
707712
EnableSqlFlashbackMatchSwitchOutcome enableSqlFlashbackMatchSwitch(const Model::EnableSqlFlashbackMatchSwitchRequest &request)const;
708713
void enableSqlFlashbackMatchSwitchAsync(const Model::EnableSqlFlashbackMatchSwitchRequest& request, const EnableSqlFlashbackMatchSwitchAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
709714
EnableSqlFlashbackMatchSwitchOutcomeCallable enableSqlFlashbackMatchSwitchCallable(const Model::EnableSqlFlashbackMatchSwitchRequest& request) const;
715+
GetDrdsDbRdsRelationInfoOutcome getDrdsDbRdsRelationInfo(const Model::GetDrdsDbRdsRelationInfoRequest &request)const;
716+
void getDrdsDbRdsRelationInfoAsync(const Model::GetDrdsDbRdsRelationInfoRequest& request, const GetDrdsDbRdsRelationInfoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
717+
GetDrdsDbRdsRelationInfoOutcomeCallable getDrdsDbRdsRelationInfoCallable(const Model::GetDrdsDbRdsRelationInfoRequest& request) const;
710718
ListTagResourcesOutcome listTagResources(const Model::ListTagResourcesRequest &request)const;
711719
void listTagResourcesAsync(const Model::ListTagResourcesRequest& request, const ListTagResourcesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
712720
ListTagResourcesOutcomeCallable listTagResourcesCallable(const Model::ListTagResourcesRequest& request) const;
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFOREQUEST_H_
18+
#define ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFOREQUEST_H_
19+
20+
#include <string>
21+
#include <vector>
22+
#include <alibabacloud/core/RpcServiceRequest.h>
23+
#include <alibabacloud/drds/DrdsExport.h>
24+
25+
namespace AlibabaCloud
26+
{
27+
namespace Drds
28+
{
29+
namespace Model
30+
{
31+
class ALIBABACLOUD_DRDS_EXPORT GetDrdsDbRdsRelationInfoRequest : public RpcServiceRequest
32+
{
33+
34+
public:
35+
GetDrdsDbRdsRelationInfoRequest();
36+
~GetDrdsDbRdsRelationInfoRequest();
37+
38+
std::string getDrdsInstanceId()const;
39+
void setDrdsInstanceId(const std::string& drdsInstanceId);
40+
std::string getAccessKeyId()const;
41+
void setAccessKeyId(const std::string& accessKeyId);
42+
std::string getDbName()const;
43+
void setDbName(const std::string& dbName);
44+
45+
private:
46+
std::string drdsInstanceId_;
47+
std::string accessKeyId_;
48+
std::string dbName_;
49+
50+
};
51+
}
52+
}
53+
}
54+
#endif // !ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFOREQUEST_H_
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFORESULT_H_
18+
#define ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFORESULT_H_
19+
20+
#include <string>
21+
#include <vector>
22+
#include <utility>
23+
#include <alibabacloud/core/ServiceResult.h>
24+
#include <alibabacloud/drds/DrdsExport.h>
25+
26+
namespace AlibabaCloud
27+
{
28+
namespace Drds
29+
{
30+
namespace Model
31+
{
32+
class ALIBABACLOUD_DRDS_EXPORT GetDrdsDbRdsRelationInfoResult : public ServiceResult
33+
{
34+
public:
35+
struct DataItem
36+
{
37+
std::string usedInstanceId;
38+
std::vector<std::string> readOnlyInstanceInfo;
39+
std::string usedInstanceType;
40+
std::string rdsInstanceId;
41+
};
42+
43+
44+
GetDrdsDbRdsRelationInfoResult();
45+
explicit GetDrdsDbRdsRelationInfoResult(const std::string &payload);
46+
~GetDrdsDbRdsRelationInfoResult();
47+
std::vector<DataItem> getData()const;
48+
bool getSuccess()const;
49+
50+
protected:
51+
void parse(const std::string &payload);
52+
private:
53+
std::vector<DataItem> data_;
54+
bool success_;
55+
56+
};
57+
}
58+
}
59+
}
60+
#endif // !ALIBABACLOUD_DRDS_MODEL_GETDRDSDBRDSRELATIONINFORESULT_H_

drds/src/DrdsClient.cc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,42 @@ DrdsClient::EnableSqlFlashbackMatchSwitchOutcomeCallable DrdsClient::enableSqlFl
22832283
return task->get_future();
22842284
}
22852285

2286+
DrdsClient::GetDrdsDbRdsRelationInfoOutcome DrdsClient::getDrdsDbRdsRelationInfo(const GetDrdsDbRdsRelationInfoRequest &request) const
2287+
{
2288+
auto endpointOutcome = endpointProvider_->getEndpoint();
2289+
if (!endpointOutcome.isSuccess())
2290+
return GetDrdsDbRdsRelationInfoOutcome(endpointOutcome.error());
2291+
2292+
auto outcome = makeRequest(endpointOutcome.result(), request);
2293+
2294+
if (outcome.isSuccess())
2295+
return GetDrdsDbRdsRelationInfoOutcome(GetDrdsDbRdsRelationInfoResult(outcome.result()));
2296+
else
2297+
return GetDrdsDbRdsRelationInfoOutcome(outcome.error());
2298+
}
2299+
2300+
void DrdsClient::getDrdsDbRdsRelationInfoAsync(const GetDrdsDbRdsRelationInfoRequest& request, const GetDrdsDbRdsRelationInfoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
2301+
{
2302+
auto fn = [this, request, handler, context]()
2303+
{
2304+
handler(this, request, getDrdsDbRdsRelationInfo(request), context);
2305+
};
2306+
2307+
asyncExecute(new Runnable(fn));
2308+
}
2309+
2310+
DrdsClient::GetDrdsDbRdsRelationInfoOutcomeCallable DrdsClient::getDrdsDbRdsRelationInfoCallable(const GetDrdsDbRdsRelationInfoRequest &request) const
2311+
{
2312+
auto task = std::make_shared<std::packaged_task<GetDrdsDbRdsRelationInfoOutcome()>>(
2313+
[this, request]()
2314+
{
2315+
return this->getDrdsDbRdsRelationInfo(request);
2316+
});
2317+
2318+
asyncExecute(new Runnable([task]() { (*task)(); }));
2319+
return task->get_future();
2320+
}
2321+
22862322
DrdsClient::ListTagResourcesOutcome DrdsClient::listTagResources(const ListTagResourcesRequest &request) const
22872323
{
22882324
auto endpointOutcome = endpointProvider_->getEndpoint();
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <alibabacloud/drds/model/GetDrdsDbRdsRelationInfoRequest.h>
18+
19+
using AlibabaCloud::Drds::Model::GetDrdsDbRdsRelationInfoRequest;
20+
21+
GetDrdsDbRdsRelationInfoRequest::GetDrdsDbRdsRelationInfoRequest() :
22+
RpcServiceRequest("drds", "2019-01-23", "GetDrdsDbRdsRelationInfo")
23+
{
24+
setMethod(HttpRequest::Method::Post);
25+
}
26+
27+
GetDrdsDbRdsRelationInfoRequest::~GetDrdsDbRdsRelationInfoRequest()
28+
{}
29+
30+
std::string GetDrdsDbRdsRelationInfoRequest::getDrdsInstanceId()const
31+
{
32+
return drdsInstanceId_;
33+
}
34+
35+
void GetDrdsDbRdsRelationInfoRequest::setDrdsInstanceId(const std::string& drdsInstanceId)
36+
{
37+
drdsInstanceId_ = drdsInstanceId;
38+
setParameter("DrdsInstanceId", drdsInstanceId);
39+
}
40+
41+
std::string GetDrdsDbRdsRelationInfoRequest::getAccessKeyId()const
42+
{
43+
return accessKeyId_;
44+
}
45+
46+
void GetDrdsDbRdsRelationInfoRequest::setAccessKeyId(const std::string& accessKeyId)
47+
{
48+
accessKeyId_ = accessKeyId;
49+
setParameter("AccessKeyId", accessKeyId);
50+
}
51+
52+
std::string GetDrdsDbRdsRelationInfoRequest::getDbName()const
53+
{
54+
return dbName_;
55+
}
56+
57+
void GetDrdsDbRdsRelationInfoRequest::setDbName(const std::string& dbName)
58+
{
59+
dbName_ = dbName;
60+
setParameter("DbName", dbName);
61+
}
62+
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <alibabacloud/drds/model/GetDrdsDbRdsRelationInfoResult.h>
18+
#include <json/json.h>
19+
20+
using namespace AlibabaCloud::Drds;
21+
using namespace AlibabaCloud::Drds::Model;
22+
23+
GetDrdsDbRdsRelationInfoResult::GetDrdsDbRdsRelationInfoResult() :
24+
ServiceResult()
25+
{}
26+
27+
GetDrdsDbRdsRelationInfoResult::GetDrdsDbRdsRelationInfoResult(const std::string &payload) :
28+
ServiceResult()
29+
{
30+
parse(payload);
31+
}
32+
33+
GetDrdsDbRdsRelationInfoResult::~GetDrdsDbRdsRelationInfoResult()
34+
{}
35+
36+
void GetDrdsDbRdsRelationInfoResult::parse(const std::string &payload)
37+
{
38+
Json::Reader reader;
39+
Json::Value value;
40+
reader.parse(payload, value);
41+
setRequestId(value["RequestId"].asString());
42+
auto allDataNode = value["Data"]["DataItem"];
43+
for (auto valueDataDataItem : allDataNode)
44+
{
45+
DataItem dataObject;
46+
if(!valueDataDataItem["RdsInstanceId"].isNull())
47+
dataObject.rdsInstanceId = valueDataDataItem["RdsInstanceId"].asString();
48+
if(!valueDataDataItem["UsedInstanceId"].isNull())
49+
dataObject.usedInstanceId = valueDataDataItem["UsedInstanceId"].asString();
50+
if(!valueDataDataItem["UsedInstanceType"].isNull())
51+
dataObject.usedInstanceType = valueDataDataItem["UsedInstanceType"].asString();
52+
auto allReadOnlyInstanceInfo = value["ReadOnlyInstanceInfo"]["ReadOnlyInstanceIds"];
53+
for (auto value : allReadOnlyInstanceInfo)
54+
dataObject.readOnlyInstanceInfo.push_back(value.asString());
55+
data_.push_back(dataObject);
56+
}
57+
if(!value["Success"].isNull())
58+
success_ = value["Success"].asString() == "true";
59+
60+
}
61+
62+
std::vector<GetDrdsDbRdsRelationInfoResult::DataItem> GetDrdsDbRdsRelationInfoResult::getData()const
63+
{
64+
return data_;
65+
}
66+
67+
bool GetDrdsDbRdsRelationInfoResult::getSuccess()const
68+
{
69+
return success_;
70+
}
71+

0 commit comments

Comments
 (0)