1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/quicksight/model/ThemeVersion.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 QuickSight
17 {
18 namespace Model
19 {
20
ThemeVersion()21 ThemeVersion::ThemeVersion() :
22 m_versionNumber(0),
23 m_versionNumberHasBeenSet(false),
24 m_arnHasBeenSet(false),
25 m_descriptionHasBeenSet(false),
26 m_baseThemeIdHasBeenSet(false),
27 m_createdTimeHasBeenSet(false),
28 m_configurationHasBeenSet(false),
29 m_errorsHasBeenSet(false),
30 m_status(ResourceStatus::NOT_SET),
31 m_statusHasBeenSet(false)
32 {
33 }
34
ThemeVersion(JsonView jsonValue)35 ThemeVersion::ThemeVersion(JsonView jsonValue) :
36 m_versionNumber(0),
37 m_versionNumberHasBeenSet(false),
38 m_arnHasBeenSet(false),
39 m_descriptionHasBeenSet(false),
40 m_baseThemeIdHasBeenSet(false),
41 m_createdTimeHasBeenSet(false),
42 m_configurationHasBeenSet(false),
43 m_errorsHasBeenSet(false),
44 m_status(ResourceStatus::NOT_SET),
45 m_statusHasBeenSet(false)
46 {
47 *this = jsonValue;
48 }
49
operator =(JsonView jsonValue)50 ThemeVersion& ThemeVersion::operator =(JsonView jsonValue)
51 {
52 if(jsonValue.ValueExists("VersionNumber"))
53 {
54 m_versionNumber = jsonValue.GetInt64("VersionNumber");
55
56 m_versionNumberHasBeenSet = true;
57 }
58
59 if(jsonValue.ValueExists("Arn"))
60 {
61 m_arn = jsonValue.GetString("Arn");
62
63 m_arnHasBeenSet = true;
64 }
65
66 if(jsonValue.ValueExists("Description"))
67 {
68 m_description = jsonValue.GetString("Description");
69
70 m_descriptionHasBeenSet = true;
71 }
72
73 if(jsonValue.ValueExists("BaseThemeId"))
74 {
75 m_baseThemeId = jsonValue.GetString("BaseThemeId");
76
77 m_baseThemeIdHasBeenSet = true;
78 }
79
80 if(jsonValue.ValueExists("CreatedTime"))
81 {
82 m_createdTime = jsonValue.GetDouble("CreatedTime");
83
84 m_createdTimeHasBeenSet = true;
85 }
86
87 if(jsonValue.ValueExists("Configuration"))
88 {
89 m_configuration = jsonValue.GetObject("Configuration");
90
91 m_configurationHasBeenSet = true;
92 }
93
94 if(jsonValue.ValueExists("Errors"))
95 {
96 Array<JsonView> errorsJsonList = jsonValue.GetArray("Errors");
97 for(unsigned errorsIndex = 0; errorsIndex < errorsJsonList.GetLength(); ++errorsIndex)
98 {
99 m_errors.push_back(errorsJsonList[errorsIndex].AsObject());
100 }
101 m_errorsHasBeenSet = true;
102 }
103
104 if(jsonValue.ValueExists("Status"))
105 {
106 m_status = ResourceStatusMapper::GetResourceStatusForName(jsonValue.GetString("Status"));
107
108 m_statusHasBeenSet = true;
109 }
110
111 return *this;
112 }
113
Jsonize() const114 JsonValue ThemeVersion::Jsonize() const
115 {
116 JsonValue payload;
117
118 if(m_versionNumberHasBeenSet)
119 {
120 payload.WithInt64("VersionNumber", m_versionNumber);
121
122 }
123
124 if(m_arnHasBeenSet)
125 {
126 payload.WithString("Arn", m_arn);
127
128 }
129
130 if(m_descriptionHasBeenSet)
131 {
132 payload.WithString("Description", m_description);
133
134 }
135
136 if(m_baseThemeIdHasBeenSet)
137 {
138 payload.WithString("BaseThemeId", m_baseThemeId);
139
140 }
141
142 if(m_createdTimeHasBeenSet)
143 {
144 payload.WithDouble("CreatedTime", m_createdTime.SecondsWithMSPrecision());
145 }
146
147 if(m_configurationHasBeenSet)
148 {
149 payload.WithObject("Configuration", m_configuration.Jsonize());
150
151 }
152
153 if(m_errorsHasBeenSet)
154 {
155 Array<JsonValue> errorsJsonList(m_errors.size());
156 for(unsigned errorsIndex = 0; errorsIndex < errorsJsonList.GetLength(); ++errorsIndex)
157 {
158 errorsJsonList[errorsIndex].AsObject(m_errors[errorsIndex].Jsonize());
159 }
160 payload.WithArray("Errors", std::move(errorsJsonList));
161
162 }
163
164 if(m_statusHasBeenSet)
165 {
166 payload.WithString("Status", ResourceStatusMapper::GetNameForResourceStatus(m_status));
167 }
168
169 return payload;
170 }
171
172 } // namespace Model
173 } // namespace QuickSight
174 } // namespace Aws
175