1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/sso-admin/model/AccountAssignmentOperationStatus.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 SSOAdmin
17 {
18 namespace Model
19 {
20
AccountAssignmentOperationStatus()21 AccountAssignmentOperationStatus::AccountAssignmentOperationStatus() :
22 m_status(StatusValues::NOT_SET),
23 m_statusHasBeenSet(false),
24 m_requestIdHasBeenSet(false),
25 m_failureReasonHasBeenSet(false),
26 m_targetIdHasBeenSet(false),
27 m_targetType(TargetType::NOT_SET),
28 m_targetTypeHasBeenSet(false),
29 m_permissionSetArnHasBeenSet(false),
30 m_principalType(PrincipalType::NOT_SET),
31 m_principalTypeHasBeenSet(false),
32 m_principalIdHasBeenSet(false),
33 m_createdDateHasBeenSet(false)
34 {
35 }
36
AccountAssignmentOperationStatus(JsonView jsonValue)37 AccountAssignmentOperationStatus::AccountAssignmentOperationStatus(JsonView jsonValue) :
38 m_status(StatusValues::NOT_SET),
39 m_statusHasBeenSet(false),
40 m_requestIdHasBeenSet(false),
41 m_failureReasonHasBeenSet(false),
42 m_targetIdHasBeenSet(false),
43 m_targetType(TargetType::NOT_SET),
44 m_targetTypeHasBeenSet(false),
45 m_permissionSetArnHasBeenSet(false),
46 m_principalType(PrincipalType::NOT_SET),
47 m_principalTypeHasBeenSet(false),
48 m_principalIdHasBeenSet(false),
49 m_createdDateHasBeenSet(false)
50 {
51 *this = jsonValue;
52 }
53
operator =(JsonView jsonValue)54 AccountAssignmentOperationStatus& AccountAssignmentOperationStatus::operator =(JsonView jsonValue)
55 {
56 if(jsonValue.ValueExists("Status"))
57 {
58 m_status = StatusValuesMapper::GetStatusValuesForName(jsonValue.GetString("Status"));
59
60 m_statusHasBeenSet = true;
61 }
62
63 if(jsonValue.ValueExists("RequestId"))
64 {
65 m_requestId = jsonValue.GetString("RequestId");
66
67 m_requestIdHasBeenSet = true;
68 }
69
70 if(jsonValue.ValueExists("FailureReason"))
71 {
72 m_failureReason = jsonValue.GetString("FailureReason");
73
74 m_failureReasonHasBeenSet = true;
75 }
76
77 if(jsonValue.ValueExists("TargetId"))
78 {
79 m_targetId = jsonValue.GetString("TargetId");
80
81 m_targetIdHasBeenSet = true;
82 }
83
84 if(jsonValue.ValueExists("TargetType"))
85 {
86 m_targetType = TargetTypeMapper::GetTargetTypeForName(jsonValue.GetString("TargetType"));
87
88 m_targetTypeHasBeenSet = true;
89 }
90
91 if(jsonValue.ValueExists("PermissionSetArn"))
92 {
93 m_permissionSetArn = jsonValue.GetString("PermissionSetArn");
94
95 m_permissionSetArnHasBeenSet = true;
96 }
97
98 if(jsonValue.ValueExists("PrincipalType"))
99 {
100 m_principalType = PrincipalTypeMapper::GetPrincipalTypeForName(jsonValue.GetString("PrincipalType"));
101
102 m_principalTypeHasBeenSet = true;
103 }
104
105 if(jsonValue.ValueExists("PrincipalId"))
106 {
107 m_principalId = jsonValue.GetString("PrincipalId");
108
109 m_principalIdHasBeenSet = true;
110 }
111
112 if(jsonValue.ValueExists("CreatedDate"))
113 {
114 m_createdDate = jsonValue.GetDouble("CreatedDate");
115
116 m_createdDateHasBeenSet = true;
117 }
118
119 return *this;
120 }
121
Jsonize() const122 JsonValue AccountAssignmentOperationStatus::Jsonize() const
123 {
124 JsonValue payload;
125
126 if(m_statusHasBeenSet)
127 {
128 payload.WithString("Status", StatusValuesMapper::GetNameForStatusValues(m_status));
129 }
130
131 if(m_requestIdHasBeenSet)
132 {
133 payload.WithString("RequestId", m_requestId);
134
135 }
136
137 if(m_failureReasonHasBeenSet)
138 {
139 payload.WithString("FailureReason", m_failureReason);
140
141 }
142
143 if(m_targetIdHasBeenSet)
144 {
145 payload.WithString("TargetId", m_targetId);
146
147 }
148
149 if(m_targetTypeHasBeenSet)
150 {
151 payload.WithString("TargetType", TargetTypeMapper::GetNameForTargetType(m_targetType));
152 }
153
154 if(m_permissionSetArnHasBeenSet)
155 {
156 payload.WithString("PermissionSetArn", m_permissionSetArn);
157
158 }
159
160 if(m_principalTypeHasBeenSet)
161 {
162 payload.WithString("PrincipalType", PrincipalTypeMapper::GetNameForPrincipalType(m_principalType));
163 }
164
165 if(m_principalIdHasBeenSet)
166 {
167 payload.WithString("PrincipalId", m_principalId);
168
169 }
170
171 if(m_createdDateHasBeenSet)
172 {
173 payload.WithDouble("CreatedDate", m_createdDate.SecondsWithMSPrecision());
174 }
175
176 return payload;
177 }
178
179 } // namespace Model
180 } // namespace SSOAdmin
181 } // namespace Aws
182