1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/pinpoint/model/SegmentResponse.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 Pinpoint
17 {
18 namespace Model
19 {
20
SegmentResponse()21 SegmentResponse::SegmentResponse() :
22 m_applicationIdHasBeenSet(false),
23 m_arnHasBeenSet(false),
24 m_creationDateHasBeenSet(false),
25 m_dimensionsHasBeenSet(false),
26 m_idHasBeenSet(false),
27 m_importDefinitionHasBeenSet(false),
28 m_lastModifiedDateHasBeenSet(false),
29 m_nameHasBeenSet(false),
30 m_segmentGroupsHasBeenSet(false),
31 m_segmentType(SegmentType::NOT_SET),
32 m_segmentTypeHasBeenSet(false),
33 m_tagsHasBeenSet(false),
34 m_version(0),
35 m_versionHasBeenSet(false)
36 {
37 }
38
SegmentResponse(JsonView jsonValue)39 SegmentResponse::SegmentResponse(JsonView jsonValue) :
40 m_applicationIdHasBeenSet(false),
41 m_arnHasBeenSet(false),
42 m_creationDateHasBeenSet(false),
43 m_dimensionsHasBeenSet(false),
44 m_idHasBeenSet(false),
45 m_importDefinitionHasBeenSet(false),
46 m_lastModifiedDateHasBeenSet(false),
47 m_nameHasBeenSet(false),
48 m_segmentGroupsHasBeenSet(false),
49 m_segmentType(SegmentType::NOT_SET),
50 m_segmentTypeHasBeenSet(false),
51 m_tagsHasBeenSet(false),
52 m_version(0),
53 m_versionHasBeenSet(false)
54 {
55 *this = jsonValue;
56 }
57
operator =(JsonView jsonValue)58 SegmentResponse& SegmentResponse::operator =(JsonView jsonValue)
59 {
60 if(jsonValue.ValueExists("ApplicationId"))
61 {
62 m_applicationId = jsonValue.GetString("ApplicationId");
63
64 m_applicationIdHasBeenSet = true;
65 }
66
67 if(jsonValue.ValueExists("Arn"))
68 {
69 m_arn = jsonValue.GetString("Arn");
70
71 m_arnHasBeenSet = true;
72 }
73
74 if(jsonValue.ValueExists("CreationDate"))
75 {
76 m_creationDate = jsonValue.GetString("CreationDate");
77
78 m_creationDateHasBeenSet = true;
79 }
80
81 if(jsonValue.ValueExists("Dimensions"))
82 {
83 m_dimensions = jsonValue.GetObject("Dimensions");
84
85 m_dimensionsHasBeenSet = true;
86 }
87
88 if(jsonValue.ValueExists("Id"))
89 {
90 m_id = jsonValue.GetString("Id");
91
92 m_idHasBeenSet = true;
93 }
94
95 if(jsonValue.ValueExists("ImportDefinition"))
96 {
97 m_importDefinition = jsonValue.GetObject("ImportDefinition");
98
99 m_importDefinitionHasBeenSet = true;
100 }
101
102 if(jsonValue.ValueExists("LastModifiedDate"))
103 {
104 m_lastModifiedDate = jsonValue.GetString("LastModifiedDate");
105
106 m_lastModifiedDateHasBeenSet = true;
107 }
108
109 if(jsonValue.ValueExists("Name"))
110 {
111 m_name = jsonValue.GetString("Name");
112
113 m_nameHasBeenSet = true;
114 }
115
116 if(jsonValue.ValueExists("SegmentGroups"))
117 {
118 m_segmentGroups = jsonValue.GetObject("SegmentGroups");
119
120 m_segmentGroupsHasBeenSet = true;
121 }
122
123 if(jsonValue.ValueExists("SegmentType"))
124 {
125 m_segmentType = SegmentTypeMapper::GetSegmentTypeForName(jsonValue.GetString("SegmentType"));
126
127 m_segmentTypeHasBeenSet = true;
128 }
129
130 if(jsonValue.ValueExists("tags"))
131 {
132 Aws::Map<Aws::String, JsonView> tagsJsonMap = jsonValue.GetObject("tags").GetAllObjects();
133 for(auto& tagsItem : tagsJsonMap)
134 {
135 m_tags[tagsItem.first] = tagsItem.second.AsString();
136 }
137 m_tagsHasBeenSet = true;
138 }
139
140 if(jsonValue.ValueExists("Version"))
141 {
142 m_version = jsonValue.GetInteger("Version");
143
144 m_versionHasBeenSet = true;
145 }
146
147 return *this;
148 }
149
Jsonize() const150 JsonValue SegmentResponse::Jsonize() const
151 {
152 JsonValue payload;
153
154 if(m_applicationIdHasBeenSet)
155 {
156 payload.WithString("ApplicationId", m_applicationId);
157
158 }
159
160 if(m_arnHasBeenSet)
161 {
162 payload.WithString("Arn", m_arn);
163
164 }
165
166 if(m_creationDateHasBeenSet)
167 {
168 payload.WithString("CreationDate", m_creationDate);
169
170 }
171
172 if(m_dimensionsHasBeenSet)
173 {
174 payload.WithObject("Dimensions", m_dimensions.Jsonize());
175
176 }
177
178 if(m_idHasBeenSet)
179 {
180 payload.WithString("Id", m_id);
181
182 }
183
184 if(m_importDefinitionHasBeenSet)
185 {
186 payload.WithObject("ImportDefinition", m_importDefinition.Jsonize());
187
188 }
189
190 if(m_lastModifiedDateHasBeenSet)
191 {
192 payload.WithString("LastModifiedDate", m_lastModifiedDate);
193
194 }
195
196 if(m_nameHasBeenSet)
197 {
198 payload.WithString("Name", m_name);
199
200 }
201
202 if(m_segmentGroupsHasBeenSet)
203 {
204 payload.WithObject("SegmentGroups", m_segmentGroups.Jsonize());
205
206 }
207
208 if(m_segmentTypeHasBeenSet)
209 {
210 payload.WithString("SegmentType", SegmentTypeMapper::GetNameForSegmentType(m_segmentType));
211 }
212
213 if(m_tagsHasBeenSet)
214 {
215 JsonValue tagsJsonMap;
216 for(auto& tagsItem : m_tags)
217 {
218 tagsJsonMap.WithString(tagsItem.first, tagsItem.second);
219 }
220 payload.WithObject("tags", std::move(tagsJsonMap));
221
222 }
223
224 if(m_versionHasBeenSet)
225 {
226 payload.WithInteger("Version", m_version);
227
228 }
229
230 return payload;
231 }
232
233 } // namespace Model
234 } // namespace Pinpoint
235 } // namespace Aws
236