1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/auditmanager/model/Delegation.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 AuditManager
17 {
18 namespace Model
19 {
20 
Delegation()21 Delegation::Delegation() :
22     m_idHasBeenSet(false),
23     m_assessmentNameHasBeenSet(false),
24     m_assessmentIdHasBeenSet(false),
25     m_status(DelegationStatus::NOT_SET),
26     m_statusHasBeenSet(false),
27     m_roleArnHasBeenSet(false),
28     m_roleType(RoleType::NOT_SET),
29     m_roleTypeHasBeenSet(false),
30     m_creationTimeHasBeenSet(false),
31     m_lastUpdatedHasBeenSet(false),
32     m_controlSetIdHasBeenSet(false),
33     m_commentHasBeenSet(false),
34     m_createdByHasBeenSet(false)
35 {
36 }
37 
Delegation(JsonView jsonValue)38 Delegation::Delegation(JsonView jsonValue) :
39     m_idHasBeenSet(false),
40     m_assessmentNameHasBeenSet(false),
41     m_assessmentIdHasBeenSet(false),
42     m_status(DelegationStatus::NOT_SET),
43     m_statusHasBeenSet(false),
44     m_roleArnHasBeenSet(false),
45     m_roleType(RoleType::NOT_SET),
46     m_roleTypeHasBeenSet(false),
47     m_creationTimeHasBeenSet(false),
48     m_lastUpdatedHasBeenSet(false),
49     m_controlSetIdHasBeenSet(false),
50     m_commentHasBeenSet(false),
51     m_createdByHasBeenSet(false)
52 {
53   *this = jsonValue;
54 }
55 
operator =(JsonView jsonValue)56 Delegation& Delegation::operator =(JsonView jsonValue)
57 {
58   if(jsonValue.ValueExists("id"))
59   {
60     m_id = jsonValue.GetString("id");
61 
62     m_idHasBeenSet = true;
63   }
64 
65   if(jsonValue.ValueExists("assessmentName"))
66   {
67     m_assessmentName = jsonValue.GetString("assessmentName");
68 
69     m_assessmentNameHasBeenSet = true;
70   }
71 
72   if(jsonValue.ValueExists("assessmentId"))
73   {
74     m_assessmentId = jsonValue.GetString("assessmentId");
75 
76     m_assessmentIdHasBeenSet = true;
77   }
78 
79   if(jsonValue.ValueExists("status"))
80   {
81     m_status = DelegationStatusMapper::GetDelegationStatusForName(jsonValue.GetString("status"));
82 
83     m_statusHasBeenSet = true;
84   }
85 
86   if(jsonValue.ValueExists("roleArn"))
87   {
88     m_roleArn = jsonValue.GetString("roleArn");
89 
90     m_roleArnHasBeenSet = true;
91   }
92 
93   if(jsonValue.ValueExists("roleType"))
94   {
95     m_roleType = RoleTypeMapper::GetRoleTypeForName(jsonValue.GetString("roleType"));
96 
97     m_roleTypeHasBeenSet = true;
98   }
99 
100   if(jsonValue.ValueExists("creationTime"))
101   {
102     m_creationTime = jsonValue.GetDouble("creationTime");
103 
104     m_creationTimeHasBeenSet = true;
105   }
106 
107   if(jsonValue.ValueExists("lastUpdated"))
108   {
109     m_lastUpdated = jsonValue.GetDouble("lastUpdated");
110 
111     m_lastUpdatedHasBeenSet = true;
112   }
113 
114   if(jsonValue.ValueExists("controlSetId"))
115   {
116     m_controlSetId = jsonValue.GetString("controlSetId");
117 
118     m_controlSetIdHasBeenSet = true;
119   }
120 
121   if(jsonValue.ValueExists("comment"))
122   {
123     m_comment = jsonValue.GetString("comment");
124 
125     m_commentHasBeenSet = true;
126   }
127 
128   if(jsonValue.ValueExists("createdBy"))
129   {
130     m_createdBy = jsonValue.GetString("createdBy");
131 
132     m_createdByHasBeenSet = true;
133   }
134 
135   return *this;
136 }
137 
Jsonize() const138 JsonValue Delegation::Jsonize() const
139 {
140   JsonValue payload;
141 
142   if(m_idHasBeenSet)
143   {
144    payload.WithString("id", m_id);
145 
146   }
147 
148   if(m_assessmentNameHasBeenSet)
149   {
150    payload.WithString("assessmentName", m_assessmentName);
151 
152   }
153 
154   if(m_assessmentIdHasBeenSet)
155   {
156    payload.WithString("assessmentId", m_assessmentId);
157 
158   }
159 
160   if(m_statusHasBeenSet)
161   {
162    payload.WithString("status", DelegationStatusMapper::GetNameForDelegationStatus(m_status));
163   }
164 
165   if(m_roleArnHasBeenSet)
166   {
167    payload.WithString("roleArn", m_roleArn);
168 
169   }
170 
171   if(m_roleTypeHasBeenSet)
172   {
173    payload.WithString("roleType", RoleTypeMapper::GetNameForRoleType(m_roleType));
174   }
175 
176   if(m_creationTimeHasBeenSet)
177   {
178    payload.WithDouble("creationTime", m_creationTime.SecondsWithMSPrecision());
179   }
180 
181   if(m_lastUpdatedHasBeenSet)
182   {
183    payload.WithDouble("lastUpdated", m_lastUpdated.SecondsWithMSPrecision());
184   }
185 
186   if(m_controlSetIdHasBeenSet)
187   {
188    payload.WithString("controlSetId", m_controlSetId);
189 
190   }
191 
192   if(m_commentHasBeenSet)
193   {
194    payload.WithString("comment", m_comment);
195 
196   }
197 
198   if(m_createdByHasBeenSet)
199   {
200    payload.WithString("createdBy", m_createdBy);
201 
202   }
203 
204   return payload;
205 }
206 
207 } // namespace Model
208 } // namespace AuditManager
209 } // namespace Aws
210