1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/ssm/model/InstanceInformation.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 SSM
17 {
18 namespace Model
19 {
20
InstanceInformation()21 InstanceInformation::InstanceInformation() :
22 m_instanceIdHasBeenSet(false),
23 m_pingStatus(PingStatus::NOT_SET),
24 m_pingStatusHasBeenSet(false),
25 m_lastPingDateTimeHasBeenSet(false),
26 m_agentVersionHasBeenSet(false),
27 m_isLatestVersion(false),
28 m_isLatestVersionHasBeenSet(false),
29 m_platformType(PlatformType::NOT_SET),
30 m_platformTypeHasBeenSet(false),
31 m_platformNameHasBeenSet(false),
32 m_platformVersionHasBeenSet(false),
33 m_activationIdHasBeenSet(false),
34 m_iamRoleHasBeenSet(false),
35 m_registrationDateHasBeenSet(false),
36 m_resourceType(ResourceType::NOT_SET),
37 m_resourceTypeHasBeenSet(false),
38 m_nameHasBeenSet(false),
39 m_iPAddressHasBeenSet(false),
40 m_computerNameHasBeenSet(false),
41 m_associationStatusHasBeenSet(false),
42 m_lastAssociationExecutionDateHasBeenSet(false),
43 m_lastSuccessfulAssociationExecutionDateHasBeenSet(false),
44 m_associationOverviewHasBeenSet(false)
45 {
46 }
47
InstanceInformation(JsonView jsonValue)48 InstanceInformation::InstanceInformation(JsonView jsonValue) :
49 m_instanceIdHasBeenSet(false),
50 m_pingStatus(PingStatus::NOT_SET),
51 m_pingStatusHasBeenSet(false),
52 m_lastPingDateTimeHasBeenSet(false),
53 m_agentVersionHasBeenSet(false),
54 m_isLatestVersion(false),
55 m_isLatestVersionHasBeenSet(false),
56 m_platformType(PlatformType::NOT_SET),
57 m_platformTypeHasBeenSet(false),
58 m_platformNameHasBeenSet(false),
59 m_platformVersionHasBeenSet(false),
60 m_activationIdHasBeenSet(false),
61 m_iamRoleHasBeenSet(false),
62 m_registrationDateHasBeenSet(false),
63 m_resourceType(ResourceType::NOT_SET),
64 m_resourceTypeHasBeenSet(false),
65 m_nameHasBeenSet(false),
66 m_iPAddressHasBeenSet(false),
67 m_computerNameHasBeenSet(false),
68 m_associationStatusHasBeenSet(false),
69 m_lastAssociationExecutionDateHasBeenSet(false),
70 m_lastSuccessfulAssociationExecutionDateHasBeenSet(false),
71 m_associationOverviewHasBeenSet(false)
72 {
73 *this = jsonValue;
74 }
75
operator =(JsonView jsonValue)76 InstanceInformation& InstanceInformation::operator =(JsonView jsonValue)
77 {
78 if(jsonValue.ValueExists("InstanceId"))
79 {
80 m_instanceId = jsonValue.GetString("InstanceId");
81
82 m_instanceIdHasBeenSet = true;
83 }
84
85 if(jsonValue.ValueExists("PingStatus"))
86 {
87 m_pingStatus = PingStatusMapper::GetPingStatusForName(jsonValue.GetString("PingStatus"));
88
89 m_pingStatusHasBeenSet = true;
90 }
91
92 if(jsonValue.ValueExists("LastPingDateTime"))
93 {
94 m_lastPingDateTime = jsonValue.GetDouble("LastPingDateTime");
95
96 m_lastPingDateTimeHasBeenSet = true;
97 }
98
99 if(jsonValue.ValueExists("AgentVersion"))
100 {
101 m_agentVersion = jsonValue.GetString("AgentVersion");
102
103 m_agentVersionHasBeenSet = true;
104 }
105
106 if(jsonValue.ValueExists("IsLatestVersion"))
107 {
108 m_isLatestVersion = jsonValue.GetBool("IsLatestVersion");
109
110 m_isLatestVersionHasBeenSet = true;
111 }
112
113 if(jsonValue.ValueExists("PlatformType"))
114 {
115 m_platformType = PlatformTypeMapper::GetPlatformTypeForName(jsonValue.GetString("PlatformType"));
116
117 m_platformTypeHasBeenSet = true;
118 }
119
120 if(jsonValue.ValueExists("PlatformName"))
121 {
122 m_platformName = jsonValue.GetString("PlatformName");
123
124 m_platformNameHasBeenSet = true;
125 }
126
127 if(jsonValue.ValueExists("PlatformVersion"))
128 {
129 m_platformVersion = jsonValue.GetString("PlatformVersion");
130
131 m_platformVersionHasBeenSet = true;
132 }
133
134 if(jsonValue.ValueExists("ActivationId"))
135 {
136 m_activationId = jsonValue.GetString("ActivationId");
137
138 m_activationIdHasBeenSet = true;
139 }
140
141 if(jsonValue.ValueExists("IamRole"))
142 {
143 m_iamRole = jsonValue.GetString("IamRole");
144
145 m_iamRoleHasBeenSet = true;
146 }
147
148 if(jsonValue.ValueExists("RegistrationDate"))
149 {
150 m_registrationDate = jsonValue.GetDouble("RegistrationDate");
151
152 m_registrationDateHasBeenSet = true;
153 }
154
155 if(jsonValue.ValueExists("ResourceType"))
156 {
157 m_resourceType = ResourceTypeMapper::GetResourceTypeForName(jsonValue.GetString("ResourceType"));
158
159 m_resourceTypeHasBeenSet = true;
160 }
161
162 if(jsonValue.ValueExists("Name"))
163 {
164 m_name = jsonValue.GetString("Name");
165
166 m_nameHasBeenSet = true;
167 }
168
169 if(jsonValue.ValueExists("IPAddress"))
170 {
171 m_iPAddress = jsonValue.GetString("IPAddress");
172
173 m_iPAddressHasBeenSet = true;
174 }
175
176 if(jsonValue.ValueExists("ComputerName"))
177 {
178 m_computerName = jsonValue.GetString("ComputerName");
179
180 m_computerNameHasBeenSet = true;
181 }
182
183 if(jsonValue.ValueExists("AssociationStatus"))
184 {
185 m_associationStatus = jsonValue.GetString("AssociationStatus");
186
187 m_associationStatusHasBeenSet = true;
188 }
189
190 if(jsonValue.ValueExists("LastAssociationExecutionDate"))
191 {
192 m_lastAssociationExecutionDate = jsonValue.GetDouble("LastAssociationExecutionDate");
193
194 m_lastAssociationExecutionDateHasBeenSet = true;
195 }
196
197 if(jsonValue.ValueExists("LastSuccessfulAssociationExecutionDate"))
198 {
199 m_lastSuccessfulAssociationExecutionDate = jsonValue.GetDouble("LastSuccessfulAssociationExecutionDate");
200
201 m_lastSuccessfulAssociationExecutionDateHasBeenSet = true;
202 }
203
204 if(jsonValue.ValueExists("AssociationOverview"))
205 {
206 m_associationOverview = jsonValue.GetObject("AssociationOverview");
207
208 m_associationOverviewHasBeenSet = true;
209 }
210
211 return *this;
212 }
213
Jsonize() const214 JsonValue InstanceInformation::Jsonize() const
215 {
216 JsonValue payload;
217
218 if(m_instanceIdHasBeenSet)
219 {
220 payload.WithString("InstanceId", m_instanceId);
221
222 }
223
224 if(m_pingStatusHasBeenSet)
225 {
226 payload.WithString("PingStatus", PingStatusMapper::GetNameForPingStatus(m_pingStatus));
227 }
228
229 if(m_lastPingDateTimeHasBeenSet)
230 {
231 payload.WithDouble("LastPingDateTime", m_lastPingDateTime.SecondsWithMSPrecision());
232 }
233
234 if(m_agentVersionHasBeenSet)
235 {
236 payload.WithString("AgentVersion", m_agentVersion);
237
238 }
239
240 if(m_isLatestVersionHasBeenSet)
241 {
242 payload.WithBool("IsLatestVersion", m_isLatestVersion);
243
244 }
245
246 if(m_platformTypeHasBeenSet)
247 {
248 payload.WithString("PlatformType", PlatformTypeMapper::GetNameForPlatformType(m_platformType));
249 }
250
251 if(m_platformNameHasBeenSet)
252 {
253 payload.WithString("PlatformName", m_platformName);
254
255 }
256
257 if(m_platformVersionHasBeenSet)
258 {
259 payload.WithString("PlatformVersion", m_platformVersion);
260
261 }
262
263 if(m_activationIdHasBeenSet)
264 {
265 payload.WithString("ActivationId", m_activationId);
266
267 }
268
269 if(m_iamRoleHasBeenSet)
270 {
271 payload.WithString("IamRole", m_iamRole);
272
273 }
274
275 if(m_registrationDateHasBeenSet)
276 {
277 payload.WithDouble("RegistrationDate", m_registrationDate.SecondsWithMSPrecision());
278 }
279
280 if(m_resourceTypeHasBeenSet)
281 {
282 payload.WithString("ResourceType", ResourceTypeMapper::GetNameForResourceType(m_resourceType));
283 }
284
285 if(m_nameHasBeenSet)
286 {
287 payload.WithString("Name", m_name);
288
289 }
290
291 if(m_iPAddressHasBeenSet)
292 {
293 payload.WithString("IPAddress", m_iPAddress);
294
295 }
296
297 if(m_computerNameHasBeenSet)
298 {
299 payload.WithString("ComputerName", m_computerName);
300
301 }
302
303 if(m_associationStatusHasBeenSet)
304 {
305 payload.WithString("AssociationStatus", m_associationStatus);
306
307 }
308
309 if(m_lastAssociationExecutionDateHasBeenSet)
310 {
311 payload.WithDouble("LastAssociationExecutionDate", m_lastAssociationExecutionDate.SecondsWithMSPrecision());
312 }
313
314 if(m_lastSuccessfulAssociationExecutionDateHasBeenSet)
315 {
316 payload.WithDouble("LastSuccessfulAssociationExecutionDate", m_lastSuccessfulAssociationExecutionDate.SecondsWithMSPrecision());
317 }
318
319 if(m_associationOverviewHasBeenSet)
320 {
321 payload.WithObject("AssociationOverview", m_associationOverview.Jsonize());
322
323 }
324
325 return payload;
326 }
327
328 } // namespace Model
329 } // namespace SSM
330 } // namespace Aws
331