1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/redshift-data/model/ColumnMetadata.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 RedshiftDataAPIService
17 {
18 namespace Model
19 {
20
ColumnMetadata()21 ColumnMetadata::ColumnMetadata() :
22 m_columnDefaultHasBeenSet(false),
23 m_isCaseSensitive(false),
24 m_isCaseSensitiveHasBeenSet(false),
25 m_isCurrency(false),
26 m_isCurrencyHasBeenSet(false),
27 m_isSigned(false),
28 m_isSignedHasBeenSet(false),
29 m_labelHasBeenSet(false),
30 m_length(0),
31 m_lengthHasBeenSet(false),
32 m_nameHasBeenSet(false),
33 m_nullable(0),
34 m_nullableHasBeenSet(false),
35 m_precision(0),
36 m_precisionHasBeenSet(false),
37 m_scale(0),
38 m_scaleHasBeenSet(false),
39 m_schemaNameHasBeenSet(false),
40 m_tableNameHasBeenSet(false),
41 m_typeNameHasBeenSet(false)
42 {
43 }
44
ColumnMetadata(JsonView jsonValue)45 ColumnMetadata::ColumnMetadata(JsonView jsonValue) :
46 m_columnDefaultHasBeenSet(false),
47 m_isCaseSensitive(false),
48 m_isCaseSensitiveHasBeenSet(false),
49 m_isCurrency(false),
50 m_isCurrencyHasBeenSet(false),
51 m_isSigned(false),
52 m_isSignedHasBeenSet(false),
53 m_labelHasBeenSet(false),
54 m_length(0),
55 m_lengthHasBeenSet(false),
56 m_nameHasBeenSet(false),
57 m_nullable(0),
58 m_nullableHasBeenSet(false),
59 m_precision(0),
60 m_precisionHasBeenSet(false),
61 m_scale(0),
62 m_scaleHasBeenSet(false),
63 m_schemaNameHasBeenSet(false),
64 m_tableNameHasBeenSet(false),
65 m_typeNameHasBeenSet(false)
66 {
67 *this = jsonValue;
68 }
69
operator =(JsonView jsonValue)70 ColumnMetadata& ColumnMetadata::operator =(JsonView jsonValue)
71 {
72 if(jsonValue.ValueExists("columnDefault"))
73 {
74 m_columnDefault = jsonValue.GetString("columnDefault");
75
76 m_columnDefaultHasBeenSet = true;
77 }
78
79 if(jsonValue.ValueExists("isCaseSensitive"))
80 {
81 m_isCaseSensitive = jsonValue.GetBool("isCaseSensitive");
82
83 m_isCaseSensitiveHasBeenSet = true;
84 }
85
86 if(jsonValue.ValueExists("isCurrency"))
87 {
88 m_isCurrency = jsonValue.GetBool("isCurrency");
89
90 m_isCurrencyHasBeenSet = true;
91 }
92
93 if(jsonValue.ValueExists("isSigned"))
94 {
95 m_isSigned = jsonValue.GetBool("isSigned");
96
97 m_isSignedHasBeenSet = true;
98 }
99
100 if(jsonValue.ValueExists("label"))
101 {
102 m_label = jsonValue.GetString("label");
103
104 m_labelHasBeenSet = true;
105 }
106
107 if(jsonValue.ValueExists("length"))
108 {
109 m_length = jsonValue.GetInteger("length");
110
111 m_lengthHasBeenSet = true;
112 }
113
114 if(jsonValue.ValueExists("name"))
115 {
116 m_name = jsonValue.GetString("name");
117
118 m_nameHasBeenSet = true;
119 }
120
121 if(jsonValue.ValueExists("nullable"))
122 {
123 m_nullable = jsonValue.GetInteger("nullable");
124
125 m_nullableHasBeenSet = true;
126 }
127
128 if(jsonValue.ValueExists("precision"))
129 {
130 m_precision = jsonValue.GetInteger("precision");
131
132 m_precisionHasBeenSet = true;
133 }
134
135 if(jsonValue.ValueExists("scale"))
136 {
137 m_scale = jsonValue.GetInteger("scale");
138
139 m_scaleHasBeenSet = true;
140 }
141
142 if(jsonValue.ValueExists("schemaName"))
143 {
144 m_schemaName = jsonValue.GetString("schemaName");
145
146 m_schemaNameHasBeenSet = true;
147 }
148
149 if(jsonValue.ValueExists("tableName"))
150 {
151 m_tableName = jsonValue.GetString("tableName");
152
153 m_tableNameHasBeenSet = true;
154 }
155
156 if(jsonValue.ValueExists("typeName"))
157 {
158 m_typeName = jsonValue.GetString("typeName");
159
160 m_typeNameHasBeenSet = true;
161 }
162
163 return *this;
164 }
165
Jsonize() const166 JsonValue ColumnMetadata::Jsonize() const
167 {
168 JsonValue payload;
169
170 if(m_columnDefaultHasBeenSet)
171 {
172 payload.WithString("columnDefault", m_columnDefault);
173
174 }
175
176 if(m_isCaseSensitiveHasBeenSet)
177 {
178 payload.WithBool("isCaseSensitive", m_isCaseSensitive);
179
180 }
181
182 if(m_isCurrencyHasBeenSet)
183 {
184 payload.WithBool("isCurrency", m_isCurrency);
185
186 }
187
188 if(m_isSignedHasBeenSet)
189 {
190 payload.WithBool("isSigned", m_isSigned);
191
192 }
193
194 if(m_labelHasBeenSet)
195 {
196 payload.WithString("label", m_label);
197
198 }
199
200 if(m_lengthHasBeenSet)
201 {
202 payload.WithInteger("length", m_length);
203
204 }
205
206 if(m_nameHasBeenSet)
207 {
208 payload.WithString("name", m_name);
209
210 }
211
212 if(m_nullableHasBeenSet)
213 {
214 payload.WithInteger("nullable", m_nullable);
215
216 }
217
218 if(m_precisionHasBeenSet)
219 {
220 payload.WithInteger("precision", m_precision);
221
222 }
223
224 if(m_scaleHasBeenSet)
225 {
226 payload.WithInteger("scale", m_scale);
227
228 }
229
230 if(m_schemaNameHasBeenSet)
231 {
232 payload.WithString("schemaName", m_schemaName);
233
234 }
235
236 if(m_tableNameHasBeenSet)
237 {
238 payload.WithString("tableName", m_tableName);
239
240 }
241
242 if(m_typeNameHasBeenSet)
243 {
244 payload.WithString("typeName", m_typeName);
245
246 }
247
248 return payload;
249 }
250
251 } // namespace Model
252 } // namespace RedshiftDataAPIService
253 } // namespace Aws
254