-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathControlcenterClient.cpp
More file actions
292 lines (265 loc) · 11 KB
/
ControlcenterClient.cpp
File metadata and controls
292 lines (265 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/*
* Copyright (c) 2017-2025 Tencent. 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 <tencentcloud/controlcenter/v20230110/ControlcenterClient.h>
#include <tencentcloud/core/Executor.h>
#include <tencentcloud/core/Runnable.h>
using namespace TencentCloud;
using namespace TencentCloud::Controlcenter::V20230110;
using namespace TencentCloud::Controlcenter::V20230110::Model;
using namespace std;
namespace
{
const string VERSION = "2023-01-10";
const string ENDPOINT = "controlcenter.tencentcloudapi.com";
}
ControlcenterClient::ControlcenterClient(const Credential &credential, const string ®ion) :
ControlcenterClient(credential, region, ClientProfile())
{
}
ControlcenterClient::ControlcenterClient(const Credential &credential, const string ®ion, const ClientProfile &profile) :
AbstractClient(ENDPOINT, VERSION, credential, region, profile)
{
}
ControlcenterClient::BatchApplyAccountBaselinesOutcome ControlcenterClient::BatchApplyAccountBaselines(const BatchApplyAccountBaselinesRequest &request)
{
auto outcome = MakeRequest(request, "BatchApplyAccountBaselines");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
BatchApplyAccountBaselinesResponse rsp = BatchApplyAccountBaselinesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return BatchApplyAccountBaselinesOutcome(rsp);
else
return BatchApplyAccountBaselinesOutcome(o.GetError());
}
else
{
return BatchApplyAccountBaselinesOutcome(outcome.GetError());
}
}
void ControlcenterClient::BatchApplyAccountBaselinesAsync(const BatchApplyAccountBaselinesRequest& request, const BatchApplyAccountBaselinesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const BatchApplyAccountBaselinesRequest&;
using Resp = BatchApplyAccountBaselinesResponse;
DoRequestAsync<Req, Resp>(
"BatchApplyAccountBaselines", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
ControlcenterClient::BatchApplyAccountBaselinesOutcomeCallable ControlcenterClient::BatchApplyAccountBaselinesCallable(const BatchApplyAccountBaselinesRequest &request)
{
const auto prom = std::make_shared<std::promise<BatchApplyAccountBaselinesOutcome>>();
BatchApplyAccountBaselinesAsync(
request,
[prom](
const ControlcenterClient*,
const BatchApplyAccountBaselinesRequest&,
BatchApplyAccountBaselinesOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
ControlcenterClient::GetAccountFactoryBaselineOutcome ControlcenterClient::GetAccountFactoryBaseline(const GetAccountFactoryBaselineRequest &request)
{
auto outcome = MakeRequest(request, "GetAccountFactoryBaseline");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetAccountFactoryBaselineResponse rsp = GetAccountFactoryBaselineResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetAccountFactoryBaselineOutcome(rsp);
else
return GetAccountFactoryBaselineOutcome(o.GetError());
}
else
{
return GetAccountFactoryBaselineOutcome(outcome.GetError());
}
}
void ControlcenterClient::GetAccountFactoryBaselineAsync(const GetAccountFactoryBaselineRequest& request, const GetAccountFactoryBaselineAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const GetAccountFactoryBaselineRequest&;
using Resp = GetAccountFactoryBaselineResponse;
DoRequestAsync<Req, Resp>(
"GetAccountFactoryBaseline", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
ControlcenterClient::GetAccountFactoryBaselineOutcomeCallable ControlcenterClient::GetAccountFactoryBaselineCallable(const GetAccountFactoryBaselineRequest &request)
{
const auto prom = std::make_shared<std::promise<GetAccountFactoryBaselineOutcome>>();
GetAccountFactoryBaselineAsync(
request,
[prom](
const ControlcenterClient*,
const GetAccountFactoryBaselineRequest&,
GetAccountFactoryBaselineOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
ControlcenterClient::ListAccountFactoryBaselineItemsOutcome ControlcenterClient::ListAccountFactoryBaselineItems(const ListAccountFactoryBaselineItemsRequest &request)
{
auto outcome = MakeRequest(request, "ListAccountFactoryBaselineItems");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListAccountFactoryBaselineItemsResponse rsp = ListAccountFactoryBaselineItemsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListAccountFactoryBaselineItemsOutcome(rsp);
else
return ListAccountFactoryBaselineItemsOutcome(o.GetError());
}
else
{
return ListAccountFactoryBaselineItemsOutcome(outcome.GetError());
}
}
void ControlcenterClient::ListAccountFactoryBaselineItemsAsync(const ListAccountFactoryBaselineItemsRequest& request, const ListAccountFactoryBaselineItemsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const ListAccountFactoryBaselineItemsRequest&;
using Resp = ListAccountFactoryBaselineItemsResponse;
DoRequestAsync<Req, Resp>(
"ListAccountFactoryBaselineItems", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
ControlcenterClient::ListAccountFactoryBaselineItemsOutcomeCallable ControlcenterClient::ListAccountFactoryBaselineItemsCallable(const ListAccountFactoryBaselineItemsRequest &request)
{
const auto prom = std::make_shared<std::promise<ListAccountFactoryBaselineItemsOutcome>>();
ListAccountFactoryBaselineItemsAsync(
request,
[prom](
const ControlcenterClient*,
const ListAccountFactoryBaselineItemsRequest&,
ListAccountFactoryBaselineItemsOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
ControlcenterClient::ListDeployStepTasksOutcome ControlcenterClient::ListDeployStepTasks(const ListDeployStepTasksRequest &request)
{
auto outcome = MakeRequest(request, "ListDeployStepTasks");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListDeployStepTasksResponse rsp = ListDeployStepTasksResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListDeployStepTasksOutcome(rsp);
else
return ListDeployStepTasksOutcome(o.GetError());
}
else
{
return ListDeployStepTasksOutcome(outcome.GetError());
}
}
void ControlcenterClient::ListDeployStepTasksAsync(const ListDeployStepTasksRequest& request, const ListDeployStepTasksAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const ListDeployStepTasksRequest&;
using Resp = ListDeployStepTasksResponse;
DoRequestAsync<Req, Resp>(
"ListDeployStepTasks", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
ControlcenterClient::ListDeployStepTasksOutcomeCallable ControlcenterClient::ListDeployStepTasksCallable(const ListDeployStepTasksRequest &request)
{
const auto prom = std::make_shared<std::promise<ListDeployStepTasksOutcome>>();
ListDeployStepTasksAsync(
request,
[prom](
const ControlcenterClient*,
const ListDeployStepTasksRequest&,
ListDeployStepTasksOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
ControlcenterClient::UpdateAccountFactoryBaselineOutcome ControlcenterClient::UpdateAccountFactoryBaseline(const UpdateAccountFactoryBaselineRequest &request)
{
auto outcome = MakeRequest(request, "UpdateAccountFactoryBaseline");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
UpdateAccountFactoryBaselineResponse rsp = UpdateAccountFactoryBaselineResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return UpdateAccountFactoryBaselineOutcome(rsp);
else
return UpdateAccountFactoryBaselineOutcome(o.GetError());
}
else
{
return UpdateAccountFactoryBaselineOutcome(outcome.GetError());
}
}
void ControlcenterClient::UpdateAccountFactoryBaselineAsync(const UpdateAccountFactoryBaselineRequest& request, const UpdateAccountFactoryBaselineAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const UpdateAccountFactoryBaselineRequest&;
using Resp = UpdateAccountFactoryBaselineResponse;
DoRequestAsync<Req, Resp>(
"UpdateAccountFactoryBaseline", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
ControlcenterClient::UpdateAccountFactoryBaselineOutcomeCallable ControlcenterClient::UpdateAccountFactoryBaselineCallable(const UpdateAccountFactoryBaselineRequest &request)
{
const auto prom = std::make_shared<std::promise<UpdateAccountFactoryBaselineOutcome>>();
UpdateAccountFactoryBaselineAsync(
request,
[prom](
const ControlcenterClient*,
const UpdateAccountFactoryBaselineRequest&,
UpdateAccountFactoryBaselineOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}