1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/glacier/model/GlacierJobDescription.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 Glacier
17 {
18 namespace Model
19 {
20 
GlacierJobDescription()21 GlacierJobDescription::GlacierJobDescription() :
22     m_jobIdHasBeenSet(false),
23     m_jobDescriptionHasBeenSet(false),
24     m_action(ActionCode::NOT_SET),
25     m_actionHasBeenSet(false),
26     m_archiveIdHasBeenSet(false),
27     m_vaultARNHasBeenSet(false),
28     m_creationDateHasBeenSet(false),
29     m_completed(false),
30     m_completedHasBeenSet(false),
31     m_statusCode(StatusCode::NOT_SET),
32     m_statusCodeHasBeenSet(false),
33     m_statusMessageHasBeenSet(false),
34     m_archiveSizeInBytes(0),
35     m_archiveSizeInBytesHasBeenSet(false),
36     m_inventorySizeInBytes(0),
37     m_inventorySizeInBytesHasBeenSet(false),
38     m_sNSTopicHasBeenSet(false),
39     m_completionDateHasBeenSet(false),
40     m_sHA256TreeHashHasBeenSet(false),
41     m_archiveSHA256TreeHashHasBeenSet(false),
42     m_retrievalByteRangeHasBeenSet(false),
43     m_tierHasBeenSet(false),
44     m_inventoryRetrievalParametersHasBeenSet(false),
45     m_jobOutputPathHasBeenSet(false),
46     m_selectParametersHasBeenSet(false),
47     m_outputLocationHasBeenSet(false)
48 {
49 }
50 
GlacierJobDescription(JsonView jsonValue)51 GlacierJobDescription::GlacierJobDescription(JsonView jsonValue) :
52     m_jobIdHasBeenSet(false),
53     m_jobDescriptionHasBeenSet(false),
54     m_action(ActionCode::NOT_SET),
55     m_actionHasBeenSet(false),
56     m_archiveIdHasBeenSet(false),
57     m_vaultARNHasBeenSet(false),
58     m_creationDateHasBeenSet(false),
59     m_completed(false),
60     m_completedHasBeenSet(false),
61     m_statusCode(StatusCode::NOT_SET),
62     m_statusCodeHasBeenSet(false),
63     m_statusMessageHasBeenSet(false),
64     m_archiveSizeInBytes(0),
65     m_archiveSizeInBytesHasBeenSet(false),
66     m_inventorySizeInBytes(0),
67     m_inventorySizeInBytesHasBeenSet(false),
68     m_sNSTopicHasBeenSet(false),
69     m_completionDateHasBeenSet(false),
70     m_sHA256TreeHashHasBeenSet(false),
71     m_archiveSHA256TreeHashHasBeenSet(false),
72     m_retrievalByteRangeHasBeenSet(false),
73     m_tierHasBeenSet(false),
74     m_inventoryRetrievalParametersHasBeenSet(false),
75     m_jobOutputPathHasBeenSet(false),
76     m_selectParametersHasBeenSet(false),
77     m_outputLocationHasBeenSet(false)
78 {
79   *this = jsonValue;
80 }
81 
operator =(JsonView jsonValue)82 GlacierJobDescription& GlacierJobDescription::operator =(JsonView jsonValue)
83 {
84   if(jsonValue.ValueExists("JobId"))
85   {
86     m_jobId = jsonValue.GetString("JobId");
87 
88     m_jobIdHasBeenSet = true;
89   }
90 
91   if(jsonValue.ValueExists("JobDescription"))
92   {
93     m_jobDescription = jsonValue.GetString("JobDescription");
94 
95     m_jobDescriptionHasBeenSet = true;
96   }
97 
98   if(jsonValue.ValueExists("Action"))
99   {
100     m_action = ActionCodeMapper::GetActionCodeForName(jsonValue.GetString("Action"));
101 
102     m_actionHasBeenSet = true;
103   }
104 
105   if(jsonValue.ValueExists("ArchiveId"))
106   {
107     m_archiveId = jsonValue.GetString("ArchiveId");
108 
109     m_archiveIdHasBeenSet = true;
110   }
111 
112   if(jsonValue.ValueExists("VaultARN"))
113   {
114     m_vaultARN = jsonValue.GetString("VaultARN");
115 
116     m_vaultARNHasBeenSet = true;
117   }
118 
119   if(jsonValue.ValueExists("CreationDate"))
120   {
121     m_creationDate = jsonValue.GetString("CreationDate");
122 
123     m_creationDateHasBeenSet = true;
124   }
125 
126   if(jsonValue.ValueExists("Completed"))
127   {
128     m_completed = jsonValue.GetBool("Completed");
129 
130     m_completedHasBeenSet = true;
131   }
132 
133   if(jsonValue.ValueExists("StatusCode"))
134   {
135     m_statusCode = StatusCodeMapper::GetStatusCodeForName(jsonValue.GetString("StatusCode"));
136 
137     m_statusCodeHasBeenSet = true;
138   }
139 
140   if(jsonValue.ValueExists("StatusMessage"))
141   {
142     m_statusMessage = jsonValue.GetString("StatusMessage");
143 
144     m_statusMessageHasBeenSet = true;
145   }
146 
147   if(jsonValue.ValueExists("ArchiveSizeInBytes"))
148   {
149     m_archiveSizeInBytes = jsonValue.GetInt64("ArchiveSizeInBytes");
150 
151     m_archiveSizeInBytesHasBeenSet = true;
152   }
153 
154   if(jsonValue.ValueExists("InventorySizeInBytes"))
155   {
156     m_inventorySizeInBytes = jsonValue.GetInt64("InventorySizeInBytes");
157 
158     m_inventorySizeInBytesHasBeenSet = true;
159   }
160 
161   if(jsonValue.ValueExists("SNSTopic"))
162   {
163     m_sNSTopic = jsonValue.GetString("SNSTopic");
164 
165     m_sNSTopicHasBeenSet = true;
166   }
167 
168   if(jsonValue.ValueExists("CompletionDate"))
169   {
170     m_completionDate = jsonValue.GetString("CompletionDate");
171 
172     m_completionDateHasBeenSet = true;
173   }
174 
175   if(jsonValue.ValueExists("SHA256TreeHash"))
176   {
177     m_sHA256TreeHash = jsonValue.GetString("SHA256TreeHash");
178 
179     m_sHA256TreeHashHasBeenSet = true;
180   }
181 
182   if(jsonValue.ValueExists("ArchiveSHA256TreeHash"))
183   {
184     m_archiveSHA256TreeHash = jsonValue.GetString("ArchiveSHA256TreeHash");
185 
186     m_archiveSHA256TreeHashHasBeenSet = true;
187   }
188 
189   if(jsonValue.ValueExists("RetrievalByteRange"))
190   {
191     m_retrievalByteRange = jsonValue.GetString("RetrievalByteRange");
192 
193     m_retrievalByteRangeHasBeenSet = true;
194   }
195 
196   if(jsonValue.ValueExists("Tier"))
197   {
198     m_tier = jsonValue.GetString("Tier");
199 
200     m_tierHasBeenSet = true;
201   }
202 
203   if(jsonValue.ValueExists("InventoryRetrievalParameters"))
204   {
205     m_inventoryRetrievalParameters = jsonValue.GetObject("InventoryRetrievalParameters");
206 
207     m_inventoryRetrievalParametersHasBeenSet = true;
208   }
209 
210   if(jsonValue.ValueExists("JobOutputPath"))
211   {
212     m_jobOutputPath = jsonValue.GetString("JobOutputPath");
213 
214     m_jobOutputPathHasBeenSet = true;
215   }
216 
217   if(jsonValue.ValueExists("SelectParameters"))
218   {
219     m_selectParameters = jsonValue.GetObject("SelectParameters");
220 
221     m_selectParametersHasBeenSet = true;
222   }
223 
224   if(jsonValue.ValueExists("OutputLocation"))
225   {
226     m_outputLocation = jsonValue.GetObject("OutputLocation");
227 
228     m_outputLocationHasBeenSet = true;
229   }
230 
231   return *this;
232 }
233 
Jsonize() const234 JsonValue GlacierJobDescription::Jsonize() const
235 {
236   JsonValue payload;
237 
238   if(m_jobIdHasBeenSet)
239   {
240    payload.WithString("JobId", m_jobId);
241 
242   }
243 
244   if(m_jobDescriptionHasBeenSet)
245   {
246    payload.WithString("JobDescription", m_jobDescription);
247 
248   }
249 
250   if(m_actionHasBeenSet)
251   {
252    payload.WithString("Action", ActionCodeMapper::GetNameForActionCode(m_action));
253   }
254 
255   if(m_archiveIdHasBeenSet)
256   {
257    payload.WithString("ArchiveId", m_archiveId);
258 
259   }
260 
261   if(m_vaultARNHasBeenSet)
262   {
263    payload.WithString("VaultARN", m_vaultARN);
264 
265   }
266 
267   if(m_creationDateHasBeenSet)
268   {
269    payload.WithString("CreationDate", m_creationDate);
270 
271   }
272 
273   if(m_completedHasBeenSet)
274   {
275    payload.WithBool("Completed", m_completed);
276 
277   }
278 
279   if(m_statusCodeHasBeenSet)
280   {
281    payload.WithString("StatusCode", StatusCodeMapper::GetNameForStatusCode(m_statusCode));
282   }
283 
284   if(m_statusMessageHasBeenSet)
285   {
286    payload.WithString("StatusMessage", m_statusMessage);
287 
288   }
289 
290   if(m_archiveSizeInBytesHasBeenSet)
291   {
292    payload.WithInt64("ArchiveSizeInBytes", m_archiveSizeInBytes);
293 
294   }
295 
296   if(m_inventorySizeInBytesHasBeenSet)
297   {
298    payload.WithInt64("InventorySizeInBytes", m_inventorySizeInBytes);
299 
300   }
301 
302   if(m_sNSTopicHasBeenSet)
303   {
304    payload.WithString("SNSTopic", m_sNSTopic);
305 
306   }
307 
308   if(m_completionDateHasBeenSet)
309   {
310    payload.WithString("CompletionDate", m_completionDate);
311 
312   }
313 
314   if(m_sHA256TreeHashHasBeenSet)
315   {
316    payload.WithString("SHA256TreeHash", m_sHA256TreeHash);
317 
318   }
319 
320   if(m_archiveSHA256TreeHashHasBeenSet)
321   {
322    payload.WithString("ArchiveSHA256TreeHash", m_archiveSHA256TreeHash);
323 
324   }
325 
326   if(m_retrievalByteRangeHasBeenSet)
327   {
328    payload.WithString("RetrievalByteRange", m_retrievalByteRange);
329 
330   }
331 
332   if(m_tierHasBeenSet)
333   {
334    payload.WithString("Tier", m_tier);
335 
336   }
337 
338   if(m_inventoryRetrievalParametersHasBeenSet)
339   {
340    payload.WithObject("InventoryRetrievalParameters", m_inventoryRetrievalParameters.Jsonize());
341 
342   }
343 
344   if(m_jobOutputPathHasBeenSet)
345   {
346    payload.WithString("JobOutputPath", m_jobOutputPath);
347 
348   }
349 
350   if(m_selectParametersHasBeenSet)
351   {
352    payload.WithObject("SelectParameters", m_selectParameters.Jsonize());
353 
354   }
355 
356   if(m_outputLocationHasBeenSet)
357   {
358    payload.WithObject("OutputLocation", m_outputLocation.Jsonize());
359 
360   }
361 
362   return payload;
363 }
364 
365 } // namespace Model
366 } // namespace Glacier
367 } // namespace Aws
368