1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/eks/model/Cluster.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 EKS
17 {
18 namespace Model
19 {
20
Cluster()21 Cluster::Cluster() :
22 m_nameHasBeenSet(false),
23 m_arnHasBeenSet(false),
24 m_createdAtHasBeenSet(false),
25 m_versionHasBeenSet(false),
26 m_endpointHasBeenSet(false),
27 m_roleArnHasBeenSet(false),
28 m_resourcesVpcConfigHasBeenSet(false),
29 m_kubernetesNetworkConfigHasBeenSet(false),
30 m_loggingHasBeenSet(false),
31 m_identityHasBeenSet(false),
32 m_status(ClusterStatus::NOT_SET),
33 m_statusHasBeenSet(false),
34 m_certificateAuthorityHasBeenSet(false),
35 m_clientRequestTokenHasBeenSet(false),
36 m_platformVersionHasBeenSet(false),
37 m_tagsHasBeenSet(false),
38 m_encryptionConfigHasBeenSet(false),
39 m_connectorConfigHasBeenSet(false)
40 {
41 }
42
Cluster(JsonView jsonValue)43 Cluster::Cluster(JsonView jsonValue) :
44 m_nameHasBeenSet(false),
45 m_arnHasBeenSet(false),
46 m_createdAtHasBeenSet(false),
47 m_versionHasBeenSet(false),
48 m_endpointHasBeenSet(false),
49 m_roleArnHasBeenSet(false),
50 m_resourcesVpcConfigHasBeenSet(false),
51 m_kubernetesNetworkConfigHasBeenSet(false),
52 m_loggingHasBeenSet(false),
53 m_identityHasBeenSet(false),
54 m_status(ClusterStatus::NOT_SET),
55 m_statusHasBeenSet(false),
56 m_certificateAuthorityHasBeenSet(false),
57 m_clientRequestTokenHasBeenSet(false),
58 m_platformVersionHasBeenSet(false),
59 m_tagsHasBeenSet(false),
60 m_encryptionConfigHasBeenSet(false),
61 m_connectorConfigHasBeenSet(false)
62 {
63 *this = jsonValue;
64 }
65
operator =(JsonView jsonValue)66 Cluster& Cluster::operator =(JsonView jsonValue)
67 {
68 if(jsonValue.ValueExists("name"))
69 {
70 m_name = jsonValue.GetString("name");
71
72 m_nameHasBeenSet = true;
73 }
74
75 if(jsonValue.ValueExists("arn"))
76 {
77 m_arn = jsonValue.GetString("arn");
78
79 m_arnHasBeenSet = true;
80 }
81
82 if(jsonValue.ValueExists("createdAt"))
83 {
84 m_createdAt = jsonValue.GetDouble("createdAt");
85
86 m_createdAtHasBeenSet = true;
87 }
88
89 if(jsonValue.ValueExists("version"))
90 {
91 m_version = jsonValue.GetString("version");
92
93 m_versionHasBeenSet = true;
94 }
95
96 if(jsonValue.ValueExists("endpoint"))
97 {
98 m_endpoint = jsonValue.GetString("endpoint");
99
100 m_endpointHasBeenSet = true;
101 }
102
103 if(jsonValue.ValueExists("roleArn"))
104 {
105 m_roleArn = jsonValue.GetString("roleArn");
106
107 m_roleArnHasBeenSet = true;
108 }
109
110 if(jsonValue.ValueExists("resourcesVpcConfig"))
111 {
112 m_resourcesVpcConfig = jsonValue.GetObject("resourcesVpcConfig");
113
114 m_resourcesVpcConfigHasBeenSet = true;
115 }
116
117 if(jsonValue.ValueExists("kubernetesNetworkConfig"))
118 {
119 m_kubernetesNetworkConfig = jsonValue.GetObject("kubernetesNetworkConfig");
120
121 m_kubernetesNetworkConfigHasBeenSet = true;
122 }
123
124 if(jsonValue.ValueExists("logging"))
125 {
126 m_logging = jsonValue.GetObject("logging");
127
128 m_loggingHasBeenSet = true;
129 }
130
131 if(jsonValue.ValueExists("identity"))
132 {
133 m_identity = jsonValue.GetObject("identity");
134
135 m_identityHasBeenSet = true;
136 }
137
138 if(jsonValue.ValueExists("status"))
139 {
140 m_status = ClusterStatusMapper::GetClusterStatusForName(jsonValue.GetString("status"));
141
142 m_statusHasBeenSet = true;
143 }
144
145 if(jsonValue.ValueExists("certificateAuthority"))
146 {
147 m_certificateAuthority = jsonValue.GetObject("certificateAuthority");
148
149 m_certificateAuthorityHasBeenSet = true;
150 }
151
152 if(jsonValue.ValueExists("clientRequestToken"))
153 {
154 m_clientRequestToken = jsonValue.GetString("clientRequestToken");
155
156 m_clientRequestTokenHasBeenSet = true;
157 }
158
159 if(jsonValue.ValueExists("platformVersion"))
160 {
161 m_platformVersion = jsonValue.GetString("platformVersion");
162
163 m_platformVersionHasBeenSet = true;
164 }
165
166 if(jsonValue.ValueExists("tags"))
167 {
168 Aws::Map<Aws::String, JsonView> tagsJsonMap = jsonValue.GetObject("tags").GetAllObjects();
169 for(auto& tagsItem : tagsJsonMap)
170 {
171 m_tags[tagsItem.first] = tagsItem.second.AsString();
172 }
173 m_tagsHasBeenSet = true;
174 }
175
176 if(jsonValue.ValueExists("encryptionConfig"))
177 {
178 Array<JsonView> encryptionConfigJsonList = jsonValue.GetArray("encryptionConfig");
179 for(unsigned encryptionConfigIndex = 0; encryptionConfigIndex < encryptionConfigJsonList.GetLength(); ++encryptionConfigIndex)
180 {
181 m_encryptionConfig.push_back(encryptionConfigJsonList[encryptionConfigIndex].AsObject());
182 }
183 m_encryptionConfigHasBeenSet = true;
184 }
185
186 if(jsonValue.ValueExists("connectorConfig"))
187 {
188 m_connectorConfig = jsonValue.GetObject("connectorConfig");
189
190 m_connectorConfigHasBeenSet = true;
191 }
192
193 return *this;
194 }
195
Jsonize() const196 JsonValue Cluster::Jsonize() const
197 {
198 JsonValue payload;
199
200 if(m_nameHasBeenSet)
201 {
202 payload.WithString("name", m_name);
203
204 }
205
206 if(m_arnHasBeenSet)
207 {
208 payload.WithString("arn", m_arn);
209
210 }
211
212 if(m_createdAtHasBeenSet)
213 {
214 payload.WithDouble("createdAt", m_createdAt.SecondsWithMSPrecision());
215 }
216
217 if(m_versionHasBeenSet)
218 {
219 payload.WithString("version", m_version);
220
221 }
222
223 if(m_endpointHasBeenSet)
224 {
225 payload.WithString("endpoint", m_endpoint);
226
227 }
228
229 if(m_roleArnHasBeenSet)
230 {
231 payload.WithString("roleArn", m_roleArn);
232
233 }
234
235 if(m_resourcesVpcConfigHasBeenSet)
236 {
237 payload.WithObject("resourcesVpcConfig", m_resourcesVpcConfig.Jsonize());
238
239 }
240
241 if(m_kubernetesNetworkConfigHasBeenSet)
242 {
243 payload.WithObject("kubernetesNetworkConfig", m_kubernetesNetworkConfig.Jsonize());
244
245 }
246
247 if(m_loggingHasBeenSet)
248 {
249 payload.WithObject("logging", m_logging.Jsonize());
250
251 }
252
253 if(m_identityHasBeenSet)
254 {
255 payload.WithObject("identity", m_identity.Jsonize());
256
257 }
258
259 if(m_statusHasBeenSet)
260 {
261 payload.WithString("status", ClusterStatusMapper::GetNameForClusterStatus(m_status));
262 }
263
264 if(m_certificateAuthorityHasBeenSet)
265 {
266 payload.WithObject("certificateAuthority", m_certificateAuthority.Jsonize());
267
268 }
269
270 if(m_clientRequestTokenHasBeenSet)
271 {
272 payload.WithString("clientRequestToken", m_clientRequestToken);
273
274 }
275
276 if(m_platformVersionHasBeenSet)
277 {
278 payload.WithString("platformVersion", m_platformVersion);
279
280 }
281
282 if(m_tagsHasBeenSet)
283 {
284 JsonValue tagsJsonMap;
285 for(auto& tagsItem : m_tags)
286 {
287 tagsJsonMap.WithString(tagsItem.first, tagsItem.second);
288 }
289 payload.WithObject("tags", std::move(tagsJsonMap));
290
291 }
292
293 if(m_encryptionConfigHasBeenSet)
294 {
295 Array<JsonValue> encryptionConfigJsonList(m_encryptionConfig.size());
296 for(unsigned encryptionConfigIndex = 0; encryptionConfigIndex < encryptionConfigJsonList.GetLength(); ++encryptionConfigIndex)
297 {
298 encryptionConfigJsonList[encryptionConfigIndex].AsObject(m_encryptionConfig[encryptionConfigIndex].Jsonize());
299 }
300 payload.WithArray("encryptionConfig", std::move(encryptionConfigJsonList));
301
302 }
303
304 if(m_connectorConfigHasBeenSet)
305 {
306 payload.WithObject("connectorConfig", m_connectorConfig.Jsonize());
307
308 }
309
310 return payload;
311 }
312
313 } // namespace Model
314 } // namespace EKS
315 } // namespace Aws
316