1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/opsworkscm/model/Backup.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8
9 #include <utility>
10
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13
14 namespace Aws
15 {
16 namespace OpsWorksCM
17 {
18 namespace Model
19 {
20
Backup()21 Backup::Backup() :
22 m_backupArnHasBeenSet(false),
23 m_backupIdHasBeenSet(false),
24 m_backupType(BackupType::NOT_SET),
25 m_backupTypeHasBeenSet(false),
26 m_createdAtHasBeenSet(false),
27 m_descriptionHasBeenSet(false),
28 m_engineHasBeenSet(false),
29 m_engineModelHasBeenSet(false),
30 m_engineVersionHasBeenSet(false),
31 m_instanceProfileArnHasBeenSet(false),
32 m_instanceTypeHasBeenSet(false),
33 m_keyPairHasBeenSet(false),
34 m_preferredBackupWindowHasBeenSet(false),
35 m_preferredMaintenanceWindowHasBeenSet(false),
36 m_s3LogUrlHasBeenSet(false),
37 m_securityGroupIdsHasBeenSet(false),
38 m_serverNameHasBeenSet(false),
39 m_serviceRoleArnHasBeenSet(false),
40 m_status(BackupStatus::NOT_SET),
41 m_statusHasBeenSet(false),
42 m_statusDescriptionHasBeenSet(false),
43 m_subnetIdsHasBeenSet(false),
44 m_toolsVersionHasBeenSet(false),
45 m_userArnHasBeenSet(false)
46 {
47 }
48
Backup(JsonView jsonValue)49 Backup::Backup(JsonView jsonValue) :
50 m_backupArnHasBeenSet(false),
51 m_backupIdHasBeenSet(false),
52 m_backupType(BackupType::NOT_SET),
53 m_backupTypeHasBeenSet(false),
54 m_createdAtHasBeenSet(false),
55 m_descriptionHasBeenSet(false),
56 m_engineHasBeenSet(false),
57 m_engineModelHasBeenSet(false),
58 m_engineVersionHasBeenSet(false),
59 m_instanceProfileArnHasBeenSet(false),
60 m_instanceTypeHasBeenSet(false),
61 m_keyPairHasBeenSet(false),
62 m_preferredBackupWindowHasBeenSet(false),
63 m_preferredMaintenanceWindowHasBeenSet(false),
64 m_s3LogUrlHasBeenSet(false),
65 m_securityGroupIdsHasBeenSet(false),
66 m_serverNameHasBeenSet(false),
67 m_serviceRoleArnHasBeenSet(false),
68 m_status(BackupStatus::NOT_SET),
69 m_statusHasBeenSet(false),
70 m_statusDescriptionHasBeenSet(false),
71 m_subnetIdsHasBeenSet(false),
72 m_toolsVersionHasBeenSet(false),
73 m_userArnHasBeenSet(false)
74 {
75 *this = jsonValue;
76 }
77
operator =(JsonView jsonValue)78 Backup& Backup::operator =(JsonView jsonValue)
79 {
80 if(jsonValue.ValueExists("BackupArn"))
81 {
82 m_backupArn = jsonValue.GetString("BackupArn");
83
84 m_backupArnHasBeenSet = true;
85 }
86
87 if(jsonValue.ValueExists("BackupId"))
88 {
89 m_backupId = jsonValue.GetString("BackupId");
90
91 m_backupIdHasBeenSet = true;
92 }
93
94 if(jsonValue.ValueExists("BackupType"))
95 {
96 m_backupType = BackupTypeMapper::GetBackupTypeForName(jsonValue.GetString("BackupType"));
97
98 m_backupTypeHasBeenSet = true;
99 }
100
101 if(jsonValue.ValueExists("CreatedAt"))
102 {
103 m_createdAt = jsonValue.GetDouble("CreatedAt");
104
105 m_createdAtHasBeenSet = true;
106 }
107
108 if(jsonValue.ValueExists("Description"))
109 {
110 m_description = jsonValue.GetString("Description");
111
112 m_descriptionHasBeenSet = true;
113 }
114
115 if(jsonValue.ValueExists("Engine"))
116 {
117 m_engine = jsonValue.GetString("Engine");
118
119 m_engineHasBeenSet = true;
120 }
121
122 if(jsonValue.ValueExists("EngineModel"))
123 {
124 m_engineModel = jsonValue.GetString("EngineModel");
125
126 m_engineModelHasBeenSet = true;
127 }
128
129 if(jsonValue.ValueExists("EngineVersion"))
130 {
131 m_engineVersion = jsonValue.GetString("EngineVersion");
132
133 m_engineVersionHasBeenSet = true;
134 }
135
136 if(jsonValue.ValueExists("InstanceProfileArn"))
137 {
138 m_instanceProfileArn = jsonValue.GetString("InstanceProfileArn");
139
140 m_instanceProfileArnHasBeenSet = true;
141 }
142
143 if(jsonValue.ValueExists("InstanceType"))
144 {
145 m_instanceType = jsonValue.GetString("InstanceType");
146
147 m_instanceTypeHasBeenSet = true;
148 }
149
150 if(jsonValue.ValueExists("KeyPair"))
151 {
152 m_keyPair = jsonValue.GetString("KeyPair");
153
154 m_keyPairHasBeenSet = true;
155 }
156
157 if(jsonValue.ValueExists("PreferredBackupWindow"))
158 {
159 m_preferredBackupWindow = jsonValue.GetString("PreferredBackupWindow");
160
161 m_preferredBackupWindowHasBeenSet = true;
162 }
163
164 if(jsonValue.ValueExists("PreferredMaintenanceWindow"))
165 {
166 m_preferredMaintenanceWindow = jsonValue.GetString("PreferredMaintenanceWindow");
167
168 m_preferredMaintenanceWindowHasBeenSet = true;
169 }
170
171 if(jsonValue.ValueExists("S3LogUrl"))
172 {
173 m_s3LogUrl = jsonValue.GetString("S3LogUrl");
174
175 m_s3LogUrlHasBeenSet = true;
176 }
177
178 if(jsonValue.ValueExists("SecurityGroupIds"))
179 {
180 Array<JsonView> securityGroupIdsJsonList = jsonValue.GetArray("SecurityGroupIds");
181 for(unsigned securityGroupIdsIndex = 0; securityGroupIdsIndex < securityGroupIdsJsonList.GetLength(); ++securityGroupIdsIndex)
182 {
183 m_securityGroupIds.push_back(securityGroupIdsJsonList[securityGroupIdsIndex].AsString());
184 }
185 m_securityGroupIdsHasBeenSet = true;
186 }
187
188 if(jsonValue.ValueExists("ServerName"))
189 {
190 m_serverName = jsonValue.GetString("ServerName");
191
192 m_serverNameHasBeenSet = true;
193 }
194
195 if(jsonValue.ValueExists("ServiceRoleArn"))
196 {
197 m_serviceRoleArn = jsonValue.GetString("ServiceRoleArn");
198
199 m_serviceRoleArnHasBeenSet = true;
200 }
201
202 if(jsonValue.ValueExists("Status"))
203 {
204 m_status = BackupStatusMapper::GetBackupStatusForName(jsonValue.GetString("Status"));
205
206 m_statusHasBeenSet = true;
207 }
208
209 if(jsonValue.ValueExists("StatusDescription"))
210 {
211 m_statusDescription = jsonValue.GetString("StatusDescription");
212
213 m_statusDescriptionHasBeenSet = true;
214 }
215
216 if(jsonValue.ValueExists("SubnetIds"))
217 {
218 Array<JsonView> subnetIdsJsonList = jsonValue.GetArray("SubnetIds");
219 for(unsigned subnetIdsIndex = 0; subnetIdsIndex < subnetIdsJsonList.GetLength(); ++subnetIdsIndex)
220 {
221 m_subnetIds.push_back(subnetIdsJsonList[subnetIdsIndex].AsString());
222 }
223 m_subnetIdsHasBeenSet = true;
224 }
225
226 if(jsonValue.ValueExists("ToolsVersion"))
227 {
228 m_toolsVersion = jsonValue.GetString("ToolsVersion");
229
230 m_toolsVersionHasBeenSet = true;
231 }
232
233 if(jsonValue.ValueExists("UserArn"))
234 {
235 m_userArn = jsonValue.GetString("UserArn");
236
237 m_userArnHasBeenSet = true;
238 }
239
240 return *this;
241 }
242
Jsonize() const243 JsonValue Backup::Jsonize() const
244 {
245 JsonValue payload;
246
247 if(m_backupArnHasBeenSet)
248 {
249 payload.WithString("BackupArn", m_backupArn);
250
251 }
252
253 if(m_backupIdHasBeenSet)
254 {
255 payload.WithString("BackupId", m_backupId);
256
257 }
258
259 if(m_backupTypeHasBeenSet)
260 {
261 payload.WithString("BackupType", BackupTypeMapper::GetNameForBackupType(m_backupType));
262 }
263
264 if(m_createdAtHasBeenSet)
265 {
266 payload.WithDouble("CreatedAt", m_createdAt.SecondsWithMSPrecision());
267 }
268
269 if(m_descriptionHasBeenSet)
270 {
271 payload.WithString("Description", m_description);
272
273 }
274
275 if(m_engineHasBeenSet)
276 {
277 payload.WithString("Engine", m_engine);
278
279 }
280
281 if(m_engineModelHasBeenSet)
282 {
283 payload.WithString("EngineModel", m_engineModel);
284
285 }
286
287 if(m_engineVersionHasBeenSet)
288 {
289 payload.WithString("EngineVersion", m_engineVersion);
290
291 }
292
293 if(m_instanceProfileArnHasBeenSet)
294 {
295 payload.WithString("InstanceProfileArn", m_instanceProfileArn);
296
297 }
298
299 if(m_instanceTypeHasBeenSet)
300 {
301 payload.WithString("InstanceType", m_instanceType);
302
303 }
304
305 if(m_keyPairHasBeenSet)
306 {
307 payload.WithString("KeyPair", m_keyPair);
308
309 }
310
311 if(m_preferredBackupWindowHasBeenSet)
312 {
313 payload.WithString("PreferredBackupWindow", m_preferredBackupWindow);
314
315 }
316
317 if(m_preferredMaintenanceWindowHasBeenSet)
318 {
319 payload.WithString("PreferredMaintenanceWindow", m_preferredMaintenanceWindow);
320
321 }
322
323 if(m_s3LogUrlHasBeenSet)
324 {
325 payload.WithString("S3LogUrl", m_s3LogUrl);
326
327 }
328
329 if(m_securityGroupIdsHasBeenSet)
330 {
331 Array<JsonValue> securityGroupIdsJsonList(m_securityGroupIds.size());
332 for(unsigned securityGroupIdsIndex = 0; securityGroupIdsIndex < securityGroupIdsJsonList.GetLength(); ++securityGroupIdsIndex)
333 {
334 securityGroupIdsJsonList[securityGroupIdsIndex].AsString(m_securityGroupIds[securityGroupIdsIndex]);
335 }
336 payload.WithArray("SecurityGroupIds", std::move(securityGroupIdsJsonList));
337
338 }
339
340 if(m_serverNameHasBeenSet)
341 {
342 payload.WithString("ServerName", m_serverName);
343
344 }
345
346 if(m_serviceRoleArnHasBeenSet)
347 {
348 payload.WithString("ServiceRoleArn", m_serviceRoleArn);
349
350 }
351
352 if(m_statusHasBeenSet)
353 {
354 payload.WithString("Status", BackupStatusMapper::GetNameForBackupStatus(m_status));
355 }
356
357 if(m_statusDescriptionHasBeenSet)
358 {
359 payload.WithString("StatusDescription", m_statusDescription);
360
361 }
362
363 if(m_subnetIdsHasBeenSet)
364 {
365 Array<JsonValue> subnetIdsJsonList(m_subnetIds.size());
366 for(unsigned subnetIdsIndex = 0; subnetIdsIndex < subnetIdsJsonList.GetLength(); ++subnetIdsIndex)
367 {
368 subnetIdsJsonList[subnetIdsIndex].AsString(m_subnetIds[subnetIdsIndex]);
369 }
370 payload.WithArray("SubnetIds", std::move(subnetIdsJsonList));
371
372 }
373
374 if(m_toolsVersionHasBeenSet)
375 {
376 payload.WithString("ToolsVersion", m_toolsVersion);
377
378 }
379
380 if(m_userArnHasBeenSet)
381 {
382 payload.WithString("UserArn", m_userArn);
383
384 }
385
386 return payload;
387 }
388
389 } // namespace Model
390 } // namespace OpsWorksCM
391 } // namespace Aws
392