1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/glue/model/Job.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 Glue
17 {
18 namespace Model
19 {
20
Job()21 Job::Job() :
22 m_nameHasBeenSet(false),
23 m_descriptionHasBeenSet(false),
24 m_logUriHasBeenSet(false),
25 m_roleHasBeenSet(false),
26 m_createdOnHasBeenSet(false),
27 m_lastModifiedOnHasBeenSet(false),
28 m_executionPropertyHasBeenSet(false),
29 m_commandHasBeenSet(false),
30 m_defaultArgumentsHasBeenSet(false),
31 m_nonOverridableArgumentsHasBeenSet(false),
32 m_connectionsHasBeenSet(false),
33 m_maxRetries(0),
34 m_maxRetriesHasBeenSet(false),
35 m_timeout(0),
36 m_timeoutHasBeenSet(false),
37 m_maxCapacity(0.0),
38 m_maxCapacityHasBeenSet(false),
39 m_workerType(WorkerType::NOT_SET),
40 m_workerTypeHasBeenSet(false),
41 m_numberOfWorkers(0),
42 m_numberOfWorkersHasBeenSet(false),
43 m_securityConfigurationHasBeenSet(false),
44 m_notificationPropertyHasBeenSet(false),
45 m_glueVersionHasBeenSet(false)
46 {
47 }
48
Job(JsonView jsonValue)49 Job::Job(JsonView jsonValue) :
50 m_nameHasBeenSet(false),
51 m_descriptionHasBeenSet(false),
52 m_logUriHasBeenSet(false),
53 m_roleHasBeenSet(false),
54 m_createdOnHasBeenSet(false),
55 m_lastModifiedOnHasBeenSet(false),
56 m_executionPropertyHasBeenSet(false),
57 m_commandHasBeenSet(false),
58 m_defaultArgumentsHasBeenSet(false),
59 m_nonOverridableArgumentsHasBeenSet(false),
60 m_connectionsHasBeenSet(false),
61 m_maxRetries(0),
62 m_maxRetriesHasBeenSet(false),
63 m_timeout(0),
64 m_timeoutHasBeenSet(false),
65 m_maxCapacity(0.0),
66 m_maxCapacityHasBeenSet(false),
67 m_workerType(WorkerType::NOT_SET),
68 m_workerTypeHasBeenSet(false),
69 m_numberOfWorkers(0),
70 m_numberOfWorkersHasBeenSet(false),
71 m_securityConfigurationHasBeenSet(false),
72 m_notificationPropertyHasBeenSet(false),
73 m_glueVersionHasBeenSet(false)
74 {
75 *this = jsonValue;
76 }
77
operator =(JsonView jsonValue)78 Job& Job::operator =(JsonView jsonValue)
79 {
80 if(jsonValue.ValueExists("Name"))
81 {
82 m_name = jsonValue.GetString("Name");
83
84 m_nameHasBeenSet = true;
85 }
86
87 if(jsonValue.ValueExists("Description"))
88 {
89 m_description = jsonValue.GetString("Description");
90
91 m_descriptionHasBeenSet = true;
92 }
93
94 if(jsonValue.ValueExists("LogUri"))
95 {
96 m_logUri = jsonValue.GetString("LogUri");
97
98 m_logUriHasBeenSet = true;
99 }
100
101 if(jsonValue.ValueExists("Role"))
102 {
103 m_role = jsonValue.GetString("Role");
104
105 m_roleHasBeenSet = true;
106 }
107
108 if(jsonValue.ValueExists("CreatedOn"))
109 {
110 m_createdOn = jsonValue.GetDouble("CreatedOn");
111
112 m_createdOnHasBeenSet = true;
113 }
114
115 if(jsonValue.ValueExists("LastModifiedOn"))
116 {
117 m_lastModifiedOn = jsonValue.GetDouble("LastModifiedOn");
118
119 m_lastModifiedOnHasBeenSet = true;
120 }
121
122 if(jsonValue.ValueExists("ExecutionProperty"))
123 {
124 m_executionProperty = jsonValue.GetObject("ExecutionProperty");
125
126 m_executionPropertyHasBeenSet = true;
127 }
128
129 if(jsonValue.ValueExists("Command"))
130 {
131 m_command = jsonValue.GetObject("Command");
132
133 m_commandHasBeenSet = true;
134 }
135
136 if(jsonValue.ValueExists("DefaultArguments"))
137 {
138 Aws::Map<Aws::String, JsonView> defaultArgumentsJsonMap = jsonValue.GetObject("DefaultArguments").GetAllObjects();
139 for(auto& defaultArgumentsItem : defaultArgumentsJsonMap)
140 {
141 m_defaultArguments[defaultArgumentsItem.first] = defaultArgumentsItem.second.AsString();
142 }
143 m_defaultArgumentsHasBeenSet = true;
144 }
145
146 if(jsonValue.ValueExists("NonOverridableArguments"))
147 {
148 Aws::Map<Aws::String, JsonView> nonOverridableArgumentsJsonMap = jsonValue.GetObject("NonOverridableArguments").GetAllObjects();
149 for(auto& nonOverridableArgumentsItem : nonOverridableArgumentsJsonMap)
150 {
151 m_nonOverridableArguments[nonOverridableArgumentsItem.first] = nonOverridableArgumentsItem.second.AsString();
152 }
153 m_nonOverridableArgumentsHasBeenSet = true;
154 }
155
156 if(jsonValue.ValueExists("Connections"))
157 {
158 m_connections = jsonValue.GetObject("Connections");
159
160 m_connectionsHasBeenSet = true;
161 }
162
163 if(jsonValue.ValueExists("MaxRetries"))
164 {
165 m_maxRetries = jsonValue.GetInteger("MaxRetries");
166
167 m_maxRetriesHasBeenSet = true;
168 }
169
170 if(jsonValue.ValueExists("Timeout"))
171 {
172 m_timeout = jsonValue.GetInteger("Timeout");
173
174 m_timeoutHasBeenSet = true;
175 }
176
177 if(jsonValue.ValueExists("MaxCapacity"))
178 {
179 m_maxCapacity = jsonValue.GetDouble("MaxCapacity");
180
181 m_maxCapacityHasBeenSet = true;
182 }
183
184 if(jsonValue.ValueExists("WorkerType"))
185 {
186 m_workerType = WorkerTypeMapper::GetWorkerTypeForName(jsonValue.GetString("WorkerType"));
187
188 m_workerTypeHasBeenSet = true;
189 }
190
191 if(jsonValue.ValueExists("NumberOfWorkers"))
192 {
193 m_numberOfWorkers = jsonValue.GetInteger("NumberOfWorkers");
194
195 m_numberOfWorkersHasBeenSet = true;
196 }
197
198 if(jsonValue.ValueExists("SecurityConfiguration"))
199 {
200 m_securityConfiguration = jsonValue.GetString("SecurityConfiguration");
201
202 m_securityConfigurationHasBeenSet = true;
203 }
204
205 if(jsonValue.ValueExists("NotificationProperty"))
206 {
207 m_notificationProperty = jsonValue.GetObject("NotificationProperty");
208
209 m_notificationPropertyHasBeenSet = true;
210 }
211
212 if(jsonValue.ValueExists("GlueVersion"))
213 {
214 m_glueVersion = jsonValue.GetString("GlueVersion");
215
216 m_glueVersionHasBeenSet = true;
217 }
218
219 return *this;
220 }
221
Jsonize() const222 JsonValue Job::Jsonize() const
223 {
224 JsonValue payload;
225
226 if(m_nameHasBeenSet)
227 {
228 payload.WithString("Name", m_name);
229
230 }
231
232 if(m_descriptionHasBeenSet)
233 {
234 payload.WithString("Description", m_description);
235
236 }
237
238 if(m_logUriHasBeenSet)
239 {
240 payload.WithString("LogUri", m_logUri);
241
242 }
243
244 if(m_roleHasBeenSet)
245 {
246 payload.WithString("Role", m_role);
247
248 }
249
250 if(m_createdOnHasBeenSet)
251 {
252 payload.WithDouble("CreatedOn", m_createdOn.SecondsWithMSPrecision());
253 }
254
255 if(m_lastModifiedOnHasBeenSet)
256 {
257 payload.WithDouble("LastModifiedOn", m_lastModifiedOn.SecondsWithMSPrecision());
258 }
259
260 if(m_executionPropertyHasBeenSet)
261 {
262 payload.WithObject("ExecutionProperty", m_executionProperty.Jsonize());
263
264 }
265
266 if(m_commandHasBeenSet)
267 {
268 payload.WithObject("Command", m_command.Jsonize());
269
270 }
271
272 if(m_defaultArgumentsHasBeenSet)
273 {
274 JsonValue defaultArgumentsJsonMap;
275 for(auto& defaultArgumentsItem : m_defaultArguments)
276 {
277 defaultArgumentsJsonMap.WithString(defaultArgumentsItem.first, defaultArgumentsItem.second);
278 }
279 payload.WithObject("DefaultArguments", std::move(defaultArgumentsJsonMap));
280
281 }
282
283 if(m_nonOverridableArgumentsHasBeenSet)
284 {
285 JsonValue nonOverridableArgumentsJsonMap;
286 for(auto& nonOverridableArgumentsItem : m_nonOverridableArguments)
287 {
288 nonOverridableArgumentsJsonMap.WithString(nonOverridableArgumentsItem.first, nonOverridableArgumentsItem.second);
289 }
290 payload.WithObject("NonOverridableArguments", std::move(nonOverridableArgumentsJsonMap));
291
292 }
293
294 if(m_connectionsHasBeenSet)
295 {
296 payload.WithObject("Connections", m_connections.Jsonize());
297
298 }
299
300 if(m_maxRetriesHasBeenSet)
301 {
302 payload.WithInteger("MaxRetries", m_maxRetries);
303
304 }
305
306 if(m_timeoutHasBeenSet)
307 {
308 payload.WithInteger("Timeout", m_timeout);
309
310 }
311
312 if(m_maxCapacityHasBeenSet)
313 {
314 payload.WithDouble("MaxCapacity", m_maxCapacity);
315
316 }
317
318 if(m_workerTypeHasBeenSet)
319 {
320 payload.WithString("WorkerType", WorkerTypeMapper::GetNameForWorkerType(m_workerType));
321 }
322
323 if(m_numberOfWorkersHasBeenSet)
324 {
325 payload.WithInteger("NumberOfWorkers", m_numberOfWorkers);
326
327 }
328
329 if(m_securityConfigurationHasBeenSet)
330 {
331 payload.WithString("SecurityConfiguration", m_securityConfiguration);
332
333 }
334
335 if(m_notificationPropertyHasBeenSet)
336 {
337 payload.WithObject("NotificationProperty", m_notificationProperty.Jsonize());
338
339 }
340
341 if(m_glueVersionHasBeenSet)
342 {
343 payload.WithString("GlueVersion", m_glueVersion);
344
345 }
346
347 return payload;
348 }
349
350 } // namespace Model
351 } // namespace Glue
352 } // namespace Aws
353