1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/securityhub/model/AwsEc2VpnConnectionOptionsTunnelOptionsDetails.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 SecurityHub
17 {
18 namespace Model
19 {
20
AwsEc2VpnConnectionOptionsTunnelOptionsDetails()21 AwsEc2VpnConnectionOptionsTunnelOptionsDetails::AwsEc2VpnConnectionOptionsTunnelOptionsDetails() :
22 m_dpdTimeoutSeconds(0),
23 m_dpdTimeoutSecondsHasBeenSet(false),
24 m_ikeVersionsHasBeenSet(false),
25 m_outsideIpAddressHasBeenSet(false),
26 m_phase1DhGroupNumbersHasBeenSet(false),
27 m_phase1EncryptionAlgorithmsHasBeenSet(false),
28 m_phase1IntegrityAlgorithmsHasBeenSet(false),
29 m_phase1LifetimeSeconds(0),
30 m_phase1LifetimeSecondsHasBeenSet(false),
31 m_phase2DhGroupNumbersHasBeenSet(false),
32 m_phase2EncryptionAlgorithmsHasBeenSet(false),
33 m_phase2IntegrityAlgorithmsHasBeenSet(false),
34 m_phase2LifetimeSeconds(0),
35 m_phase2LifetimeSecondsHasBeenSet(false),
36 m_preSharedKeyHasBeenSet(false),
37 m_rekeyFuzzPercentage(0),
38 m_rekeyFuzzPercentageHasBeenSet(false),
39 m_rekeyMarginTimeSeconds(0),
40 m_rekeyMarginTimeSecondsHasBeenSet(false),
41 m_replayWindowSize(0),
42 m_replayWindowSizeHasBeenSet(false),
43 m_tunnelInsideCidrHasBeenSet(false)
44 {
45 }
46
AwsEc2VpnConnectionOptionsTunnelOptionsDetails(JsonView jsonValue)47 AwsEc2VpnConnectionOptionsTunnelOptionsDetails::AwsEc2VpnConnectionOptionsTunnelOptionsDetails(JsonView jsonValue) :
48 m_dpdTimeoutSeconds(0),
49 m_dpdTimeoutSecondsHasBeenSet(false),
50 m_ikeVersionsHasBeenSet(false),
51 m_outsideIpAddressHasBeenSet(false),
52 m_phase1DhGroupNumbersHasBeenSet(false),
53 m_phase1EncryptionAlgorithmsHasBeenSet(false),
54 m_phase1IntegrityAlgorithmsHasBeenSet(false),
55 m_phase1LifetimeSeconds(0),
56 m_phase1LifetimeSecondsHasBeenSet(false),
57 m_phase2DhGroupNumbersHasBeenSet(false),
58 m_phase2EncryptionAlgorithmsHasBeenSet(false),
59 m_phase2IntegrityAlgorithmsHasBeenSet(false),
60 m_phase2LifetimeSeconds(0),
61 m_phase2LifetimeSecondsHasBeenSet(false),
62 m_preSharedKeyHasBeenSet(false),
63 m_rekeyFuzzPercentage(0),
64 m_rekeyFuzzPercentageHasBeenSet(false),
65 m_rekeyMarginTimeSeconds(0),
66 m_rekeyMarginTimeSecondsHasBeenSet(false),
67 m_replayWindowSize(0),
68 m_replayWindowSizeHasBeenSet(false),
69 m_tunnelInsideCidrHasBeenSet(false)
70 {
71 *this = jsonValue;
72 }
73
operator =(JsonView jsonValue)74 AwsEc2VpnConnectionOptionsTunnelOptionsDetails& AwsEc2VpnConnectionOptionsTunnelOptionsDetails::operator =(JsonView jsonValue)
75 {
76 if(jsonValue.ValueExists("DpdTimeoutSeconds"))
77 {
78 m_dpdTimeoutSeconds = jsonValue.GetInteger("DpdTimeoutSeconds");
79
80 m_dpdTimeoutSecondsHasBeenSet = true;
81 }
82
83 if(jsonValue.ValueExists("IkeVersions"))
84 {
85 Array<JsonView> ikeVersionsJsonList = jsonValue.GetArray("IkeVersions");
86 for(unsigned ikeVersionsIndex = 0; ikeVersionsIndex < ikeVersionsJsonList.GetLength(); ++ikeVersionsIndex)
87 {
88 m_ikeVersions.push_back(ikeVersionsJsonList[ikeVersionsIndex].AsString());
89 }
90 m_ikeVersionsHasBeenSet = true;
91 }
92
93 if(jsonValue.ValueExists("OutsideIpAddress"))
94 {
95 m_outsideIpAddress = jsonValue.GetString("OutsideIpAddress");
96
97 m_outsideIpAddressHasBeenSet = true;
98 }
99
100 if(jsonValue.ValueExists("Phase1DhGroupNumbers"))
101 {
102 Array<JsonView> phase1DhGroupNumbersJsonList = jsonValue.GetArray("Phase1DhGroupNumbers");
103 for(unsigned phase1DhGroupNumbersIndex = 0; phase1DhGroupNumbersIndex < phase1DhGroupNumbersJsonList.GetLength(); ++phase1DhGroupNumbersIndex)
104 {
105 m_phase1DhGroupNumbers.push_back(phase1DhGroupNumbersJsonList[phase1DhGroupNumbersIndex].AsInteger());
106 }
107 m_phase1DhGroupNumbersHasBeenSet = true;
108 }
109
110 if(jsonValue.ValueExists("Phase1EncryptionAlgorithms"))
111 {
112 Array<JsonView> phase1EncryptionAlgorithmsJsonList = jsonValue.GetArray("Phase1EncryptionAlgorithms");
113 for(unsigned phase1EncryptionAlgorithmsIndex = 0; phase1EncryptionAlgorithmsIndex < phase1EncryptionAlgorithmsJsonList.GetLength(); ++phase1EncryptionAlgorithmsIndex)
114 {
115 m_phase1EncryptionAlgorithms.push_back(phase1EncryptionAlgorithmsJsonList[phase1EncryptionAlgorithmsIndex].AsString());
116 }
117 m_phase1EncryptionAlgorithmsHasBeenSet = true;
118 }
119
120 if(jsonValue.ValueExists("Phase1IntegrityAlgorithms"))
121 {
122 Array<JsonView> phase1IntegrityAlgorithmsJsonList = jsonValue.GetArray("Phase1IntegrityAlgorithms");
123 for(unsigned phase1IntegrityAlgorithmsIndex = 0; phase1IntegrityAlgorithmsIndex < phase1IntegrityAlgorithmsJsonList.GetLength(); ++phase1IntegrityAlgorithmsIndex)
124 {
125 m_phase1IntegrityAlgorithms.push_back(phase1IntegrityAlgorithmsJsonList[phase1IntegrityAlgorithmsIndex].AsString());
126 }
127 m_phase1IntegrityAlgorithmsHasBeenSet = true;
128 }
129
130 if(jsonValue.ValueExists("Phase1LifetimeSeconds"))
131 {
132 m_phase1LifetimeSeconds = jsonValue.GetInteger("Phase1LifetimeSeconds");
133
134 m_phase1LifetimeSecondsHasBeenSet = true;
135 }
136
137 if(jsonValue.ValueExists("Phase2DhGroupNumbers"))
138 {
139 Array<JsonView> phase2DhGroupNumbersJsonList = jsonValue.GetArray("Phase2DhGroupNumbers");
140 for(unsigned phase2DhGroupNumbersIndex = 0; phase2DhGroupNumbersIndex < phase2DhGroupNumbersJsonList.GetLength(); ++phase2DhGroupNumbersIndex)
141 {
142 m_phase2DhGroupNumbers.push_back(phase2DhGroupNumbersJsonList[phase2DhGroupNumbersIndex].AsInteger());
143 }
144 m_phase2DhGroupNumbersHasBeenSet = true;
145 }
146
147 if(jsonValue.ValueExists("Phase2EncryptionAlgorithms"))
148 {
149 Array<JsonView> phase2EncryptionAlgorithmsJsonList = jsonValue.GetArray("Phase2EncryptionAlgorithms");
150 for(unsigned phase2EncryptionAlgorithmsIndex = 0; phase2EncryptionAlgorithmsIndex < phase2EncryptionAlgorithmsJsonList.GetLength(); ++phase2EncryptionAlgorithmsIndex)
151 {
152 m_phase2EncryptionAlgorithms.push_back(phase2EncryptionAlgorithmsJsonList[phase2EncryptionAlgorithmsIndex].AsString());
153 }
154 m_phase2EncryptionAlgorithmsHasBeenSet = true;
155 }
156
157 if(jsonValue.ValueExists("Phase2IntegrityAlgorithms"))
158 {
159 Array<JsonView> phase2IntegrityAlgorithmsJsonList = jsonValue.GetArray("Phase2IntegrityAlgorithms");
160 for(unsigned phase2IntegrityAlgorithmsIndex = 0; phase2IntegrityAlgorithmsIndex < phase2IntegrityAlgorithmsJsonList.GetLength(); ++phase2IntegrityAlgorithmsIndex)
161 {
162 m_phase2IntegrityAlgorithms.push_back(phase2IntegrityAlgorithmsJsonList[phase2IntegrityAlgorithmsIndex].AsString());
163 }
164 m_phase2IntegrityAlgorithmsHasBeenSet = true;
165 }
166
167 if(jsonValue.ValueExists("Phase2LifetimeSeconds"))
168 {
169 m_phase2LifetimeSeconds = jsonValue.GetInteger("Phase2LifetimeSeconds");
170
171 m_phase2LifetimeSecondsHasBeenSet = true;
172 }
173
174 if(jsonValue.ValueExists("PreSharedKey"))
175 {
176 m_preSharedKey = jsonValue.GetString("PreSharedKey");
177
178 m_preSharedKeyHasBeenSet = true;
179 }
180
181 if(jsonValue.ValueExists("RekeyFuzzPercentage"))
182 {
183 m_rekeyFuzzPercentage = jsonValue.GetInteger("RekeyFuzzPercentage");
184
185 m_rekeyFuzzPercentageHasBeenSet = true;
186 }
187
188 if(jsonValue.ValueExists("RekeyMarginTimeSeconds"))
189 {
190 m_rekeyMarginTimeSeconds = jsonValue.GetInteger("RekeyMarginTimeSeconds");
191
192 m_rekeyMarginTimeSecondsHasBeenSet = true;
193 }
194
195 if(jsonValue.ValueExists("ReplayWindowSize"))
196 {
197 m_replayWindowSize = jsonValue.GetInteger("ReplayWindowSize");
198
199 m_replayWindowSizeHasBeenSet = true;
200 }
201
202 if(jsonValue.ValueExists("TunnelInsideCidr"))
203 {
204 m_tunnelInsideCidr = jsonValue.GetString("TunnelInsideCidr");
205
206 m_tunnelInsideCidrHasBeenSet = true;
207 }
208
209 return *this;
210 }
211
Jsonize() const212 JsonValue AwsEc2VpnConnectionOptionsTunnelOptionsDetails::Jsonize() const
213 {
214 JsonValue payload;
215
216 if(m_dpdTimeoutSecondsHasBeenSet)
217 {
218 payload.WithInteger("DpdTimeoutSeconds", m_dpdTimeoutSeconds);
219
220 }
221
222 if(m_ikeVersionsHasBeenSet)
223 {
224 Array<JsonValue> ikeVersionsJsonList(m_ikeVersions.size());
225 for(unsigned ikeVersionsIndex = 0; ikeVersionsIndex < ikeVersionsJsonList.GetLength(); ++ikeVersionsIndex)
226 {
227 ikeVersionsJsonList[ikeVersionsIndex].AsString(m_ikeVersions[ikeVersionsIndex]);
228 }
229 payload.WithArray("IkeVersions", std::move(ikeVersionsJsonList));
230
231 }
232
233 if(m_outsideIpAddressHasBeenSet)
234 {
235 payload.WithString("OutsideIpAddress", m_outsideIpAddress);
236
237 }
238
239 if(m_phase1DhGroupNumbersHasBeenSet)
240 {
241 Array<JsonValue> phase1DhGroupNumbersJsonList(m_phase1DhGroupNumbers.size());
242 for(unsigned phase1DhGroupNumbersIndex = 0; phase1DhGroupNumbersIndex < phase1DhGroupNumbersJsonList.GetLength(); ++phase1DhGroupNumbersIndex)
243 {
244 phase1DhGroupNumbersJsonList[phase1DhGroupNumbersIndex].AsInteger(m_phase1DhGroupNumbers[phase1DhGroupNumbersIndex]);
245 }
246 payload.WithArray("Phase1DhGroupNumbers", std::move(phase1DhGroupNumbersJsonList));
247
248 }
249
250 if(m_phase1EncryptionAlgorithmsHasBeenSet)
251 {
252 Array<JsonValue> phase1EncryptionAlgorithmsJsonList(m_phase1EncryptionAlgorithms.size());
253 for(unsigned phase1EncryptionAlgorithmsIndex = 0; phase1EncryptionAlgorithmsIndex < phase1EncryptionAlgorithmsJsonList.GetLength(); ++phase1EncryptionAlgorithmsIndex)
254 {
255 phase1EncryptionAlgorithmsJsonList[phase1EncryptionAlgorithmsIndex].AsString(m_phase1EncryptionAlgorithms[phase1EncryptionAlgorithmsIndex]);
256 }
257 payload.WithArray("Phase1EncryptionAlgorithms", std::move(phase1EncryptionAlgorithmsJsonList));
258
259 }
260
261 if(m_phase1IntegrityAlgorithmsHasBeenSet)
262 {
263 Array<JsonValue> phase1IntegrityAlgorithmsJsonList(m_phase1IntegrityAlgorithms.size());
264 for(unsigned phase1IntegrityAlgorithmsIndex = 0; phase1IntegrityAlgorithmsIndex < phase1IntegrityAlgorithmsJsonList.GetLength(); ++phase1IntegrityAlgorithmsIndex)
265 {
266 phase1IntegrityAlgorithmsJsonList[phase1IntegrityAlgorithmsIndex].AsString(m_phase1IntegrityAlgorithms[phase1IntegrityAlgorithmsIndex]);
267 }
268 payload.WithArray("Phase1IntegrityAlgorithms", std::move(phase1IntegrityAlgorithmsJsonList));
269
270 }
271
272 if(m_phase1LifetimeSecondsHasBeenSet)
273 {
274 payload.WithInteger("Phase1LifetimeSeconds", m_phase1LifetimeSeconds);
275
276 }
277
278 if(m_phase2DhGroupNumbersHasBeenSet)
279 {
280 Array<JsonValue> phase2DhGroupNumbersJsonList(m_phase2DhGroupNumbers.size());
281 for(unsigned phase2DhGroupNumbersIndex = 0; phase2DhGroupNumbersIndex < phase2DhGroupNumbersJsonList.GetLength(); ++phase2DhGroupNumbersIndex)
282 {
283 phase2DhGroupNumbersJsonList[phase2DhGroupNumbersIndex].AsInteger(m_phase2DhGroupNumbers[phase2DhGroupNumbersIndex]);
284 }
285 payload.WithArray("Phase2DhGroupNumbers", std::move(phase2DhGroupNumbersJsonList));
286
287 }
288
289 if(m_phase2EncryptionAlgorithmsHasBeenSet)
290 {
291 Array<JsonValue> phase2EncryptionAlgorithmsJsonList(m_phase2EncryptionAlgorithms.size());
292 for(unsigned phase2EncryptionAlgorithmsIndex = 0; phase2EncryptionAlgorithmsIndex < phase2EncryptionAlgorithmsJsonList.GetLength(); ++phase2EncryptionAlgorithmsIndex)
293 {
294 phase2EncryptionAlgorithmsJsonList[phase2EncryptionAlgorithmsIndex].AsString(m_phase2EncryptionAlgorithms[phase2EncryptionAlgorithmsIndex]);
295 }
296 payload.WithArray("Phase2EncryptionAlgorithms", std::move(phase2EncryptionAlgorithmsJsonList));
297
298 }
299
300 if(m_phase2IntegrityAlgorithmsHasBeenSet)
301 {
302 Array<JsonValue> phase2IntegrityAlgorithmsJsonList(m_phase2IntegrityAlgorithms.size());
303 for(unsigned phase2IntegrityAlgorithmsIndex = 0; phase2IntegrityAlgorithmsIndex < phase2IntegrityAlgorithmsJsonList.GetLength(); ++phase2IntegrityAlgorithmsIndex)
304 {
305 phase2IntegrityAlgorithmsJsonList[phase2IntegrityAlgorithmsIndex].AsString(m_phase2IntegrityAlgorithms[phase2IntegrityAlgorithmsIndex]);
306 }
307 payload.WithArray("Phase2IntegrityAlgorithms", std::move(phase2IntegrityAlgorithmsJsonList));
308
309 }
310
311 if(m_phase2LifetimeSecondsHasBeenSet)
312 {
313 payload.WithInteger("Phase2LifetimeSeconds", m_phase2LifetimeSeconds);
314
315 }
316
317 if(m_preSharedKeyHasBeenSet)
318 {
319 payload.WithString("PreSharedKey", m_preSharedKey);
320
321 }
322
323 if(m_rekeyFuzzPercentageHasBeenSet)
324 {
325 payload.WithInteger("RekeyFuzzPercentage", m_rekeyFuzzPercentage);
326
327 }
328
329 if(m_rekeyMarginTimeSecondsHasBeenSet)
330 {
331 payload.WithInteger("RekeyMarginTimeSeconds", m_rekeyMarginTimeSeconds);
332
333 }
334
335 if(m_replayWindowSizeHasBeenSet)
336 {
337 payload.WithInteger("ReplayWindowSize", m_replayWindowSize);
338
339 }
340
341 if(m_tunnelInsideCidrHasBeenSet)
342 {
343 payload.WithString("TunnelInsideCidr", m_tunnelInsideCidr);
344
345 }
346
347 return payload;
348 }
349
350 } // namespace Model
351 } // namespace SecurityHub
352 } // namespace Aws
353