1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/iot-jobs-data/model/JobExecutionSummary.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 IoTJobsDataPlane
17 {
18 namespace Model
19 {
20 
JobExecutionSummary()21 JobExecutionSummary::JobExecutionSummary() :
22     m_jobIdHasBeenSet(false),
23     m_queuedAt(0),
24     m_queuedAtHasBeenSet(false),
25     m_startedAt(0),
26     m_startedAtHasBeenSet(false),
27     m_lastUpdatedAt(0),
28     m_lastUpdatedAtHasBeenSet(false),
29     m_versionNumber(0),
30     m_versionNumberHasBeenSet(false),
31     m_executionNumber(0),
32     m_executionNumberHasBeenSet(false)
33 {
34 }
35 
JobExecutionSummary(JsonView jsonValue)36 JobExecutionSummary::JobExecutionSummary(JsonView jsonValue) :
37     m_jobIdHasBeenSet(false),
38     m_queuedAt(0),
39     m_queuedAtHasBeenSet(false),
40     m_startedAt(0),
41     m_startedAtHasBeenSet(false),
42     m_lastUpdatedAt(0),
43     m_lastUpdatedAtHasBeenSet(false),
44     m_versionNumber(0),
45     m_versionNumberHasBeenSet(false),
46     m_executionNumber(0),
47     m_executionNumberHasBeenSet(false)
48 {
49   *this = jsonValue;
50 }
51 
operator =(JsonView jsonValue)52 JobExecutionSummary& JobExecutionSummary::operator =(JsonView jsonValue)
53 {
54   if(jsonValue.ValueExists("jobId"))
55   {
56     m_jobId = jsonValue.GetString("jobId");
57 
58     m_jobIdHasBeenSet = true;
59   }
60 
61   if(jsonValue.ValueExists("queuedAt"))
62   {
63     m_queuedAt = jsonValue.GetInt64("queuedAt");
64 
65     m_queuedAtHasBeenSet = true;
66   }
67 
68   if(jsonValue.ValueExists("startedAt"))
69   {
70     m_startedAt = jsonValue.GetInt64("startedAt");
71 
72     m_startedAtHasBeenSet = true;
73   }
74 
75   if(jsonValue.ValueExists("lastUpdatedAt"))
76   {
77     m_lastUpdatedAt = jsonValue.GetInt64("lastUpdatedAt");
78 
79     m_lastUpdatedAtHasBeenSet = true;
80   }
81 
82   if(jsonValue.ValueExists("versionNumber"))
83   {
84     m_versionNumber = jsonValue.GetInt64("versionNumber");
85 
86     m_versionNumberHasBeenSet = true;
87   }
88 
89   if(jsonValue.ValueExists("executionNumber"))
90   {
91     m_executionNumber = jsonValue.GetInt64("executionNumber");
92 
93     m_executionNumberHasBeenSet = true;
94   }
95 
96   return *this;
97 }
98 
Jsonize() const99 JsonValue JobExecutionSummary::Jsonize() const
100 {
101   JsonValue payload;
102 
103   if(m_jobIdHasBeenSet)
104   {
105    payload.WithString("jobId", m_jobId);
106 
107   }
108 
109   if(m_queuedAtHasBeenSet)
110   {
111    payload.WithInt64("queuedAt", m_queuedAt);
112 
113   }
114 
115   if(m_startedAtHasBeenSet)
116   {
117    payload.WithInt64("startedAt", m_startedAt);
118 
119   }
120 
121   if(m_lastUpdatedAtHasBeenSet)
122   {
123    payload.WithInt64("lastUpdatedAt", m_lastUpdatedAt);
124 
125   }
126 
127   if(m_versionNumberHasBeenSet)
128   {
129    payload.WithInt64("versionNumber", m_versionNumber);
130 
131   }
132 
133   if(m_executionNumberHasBeenSet)
134   {
135    payload.WithInt64("executionNumber", m_executionNumber);
136 
137   }
138 
139   return payload;
140 }
141 
142 } // namespace Model
143 } // namespace IoTJobsDataPlane
144 } // namespace Aws
145