1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/securityhub/model/AwsEc2SubnetDetails.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 SecurityHub
17 {
18 namespace Model
19 {
20
AwsEc2SubnetDetails()21 AwsEc2SubnetDetails::AwsEc2SubnetDetails() :
22 m_assignIpv6AddressOnCreation(false),
23 m_assignIpv6AddressOnCreationHasBeenSet(false),
24 m_availabilityZoneHasBeenSet(false),
25 m_availabilityZoneIdHasBeenSet(false),
26 m_availableIpAddressCount(0),
27 m_availableIpAddressCountHasBeenSet(false),
28 m_cidrBlockHasBeenSet(false),
29 m_defaultForAz(false),
30 m_defaultForAzHasBeenSet(false),
31 m_mapPublicIpOnLaunch(false),
32 m_mapPublicIpOnLaunchHasBeenSet(false),
33 m_ownerIdHasBeenSet(false),
34 m_stateHasBeenSet(false),
35 m_subnetArnHasBeenSet(false),
36 m_subnetIdHasBeenSet(false),
37 m_vpcIdHasBeenSet(false),
38 m_ipv6CidrBlockAssociationSetHasBeenSet(false)
39 {
40 }
41
AwsEc2SubnetDetails(JsonView jsonValue)42 AwsEc2SubnetDetails::AwsEc2SubnetDetails(JsonView jsonValue) :
43 m_assignIpv6AddressOnCreation(false),
44 m_assignIpv6AddressOnCreationHasBeenSet(false),
45 m_availabilityZoneHasBeenSet(false),
46 m_availabilityZoneIdHasBeenSet(false),
47 m_availableIpAddressCount(0),
48 m_availableIpAddressCountHasBeenSet(false),
49 m_cidrBlockHasBeenSet(false),
50 m_defaultForAz(false),
51 m_defaultForAzHasBeenSet(false),
52 m_mapPublicIpOnLaunch(false),
53 m_mapPublicIpOnLaunchHasBeenSet(false),
54 m_ownerIdHasBeenSet(false),
55 m_stateHasBeenSet(false),
56 m_subnetArnHasBeenSet(false),
57 m_subnetIdHasBeenSet(false),
58 m_vpcIdHasBeenSet(false),
59 m_ipv6CidrBlockAssociationSetHasBeenSet(false)
60 {
61 *this = jsonValue;
62 }
63
operator =(JsonView jsonValue)64 AwsEc2SubnetDetails& AwsEc2SubnetDetails::operator =(JsonView jsonValue)
65 {
66 if(jsonValue.ValueExists("AssignIpv6AddressOnCreation"))
67 {
68 m_assignIpv6AddressOnCreation = jsonValue.GetBool("AssignIpv6AddressOnCreation");
69
70 m_assignIpv6AddressOnCreationHasBeenSet = true;
71 }
72
73 if(jsonValue.ValueExists("AvailabilityZone"))
74 {
75 m_availabilityZone = jsonValue.GetString("AvailabilityZone");
76
77 m_availabilityZoneHasBeenSet = true;
78 }
79
80 if(jsonValue.ValueExists("AvailabilityZoneId"))
81 {
82 m_availabilityZoneId = jsonValue.GetString("AvailabilityZoneId");
83
84 m_availabilityZoneIdHasBeenSet = true;
85 }
86
87 if(jsonValue.ValueExists("AvailableIpAddressCount"))
88 {
89 m_availableIpAddressCount = jsonValue.GetInteger("AvailableIpAddressCount");
90
91 m_availableIpAddressCountHasBeenSet = true;
92 }
93
94 if(jsonValue.ValueExists("CidrBlock"))
95 {
96 m_cidrBlock = jsonValue.GetString("CidrBlock");
97
98 m_cidrBlockHasBeenSet = true;
99 }
100
101 if(jsonValue.ValueExists("DefaultForAz"))
102 {
103 m_defaultForAz = jsonValue.GetBool("DefaultForAz");
104
105 m_defaultForAzHasBeenSet = true;
106 }
107
108 if(jsonValue.ValueExists("MapPublicIpOnLaunch"))
109 {
110 m_mapPublicIpOnLaunch = jsonValue.GetBool("MapPublicIpOnLaunch");
111
112 m_mapPublicIpOnLaunchHasBeenSet = true;
113 }
114
115 if(jsonValue.ValueExists("OwnerId"))
116 {
117 m_ownerId = jsonValue.GetString("OwnerId");
118
119 m_ownerIdHasBeenSet = true;
120 }
121
122 if(jsonValue.ValueExists("State"))
123 {
124 m_state = jsonValue.GetString("State");
125
126 m_stateHasBeenSet = true;
127 }
128
129 if(jsonValue.ValueExists("SubnetArn"))
130 {
131 m_subnetArn = jsonValue.GetString("SubnetArn");
132
133 m_subnetArnHasBeenSet = true;
134 }
135
136 if(jsonValue.ValueExists("SubnetId"))
137 {
138 m_subnetId = jsonValue.GetString("SubnetId");
139
140 m_subnetIdHasBeenSet = true;
141 }
142
143 if(jsonValue.ValueExists("VpcId"))
144 {
145 m_vpcId = jsonValue.GetString("VpcId");
146
147 m_vpcIdHasBeenSet = true;
148 }
149
150 if(jsonValue.ValueExists("Ipv6CidrBlockAssociationSet"))
151 {
152 Array<JsonView> ipv6CidrBlockAssociationSetJsonList = jsonValue.GetArray("Ipv6CidrBlockAssociationSet");
153 for(unsigned ipv6CidrBlockAssociationSetIndex = 0; ipv6CidrBlockAssociationSetIndex < ipv6CidrBlockAssociationSetJsonList.GetLength(); ++ipv6CidrBlockAssociationSetIndex)
154 {
155 m_ipv6CidrBlockAssociationSet.push_back(ipv6CidrBlockAssociationSetJsonList[ipv6CidrBlockAssociationSetIndex].AsObject());
156 }
157 m_ipv6CidrBlockAssociationSetHasBeenSet = true;
158 }
159
160 return *this;
161 }
162
Jsonize() const163 JsonValue AwsEc2SubnetDetails::Jsonize() const
164 {
165 JsonValue payload;
166
167 if(m_assignIpv6AddressOnCreationHasBeenSet)
168 {
169 payload.WithBool("AssignIpv6AddressOnCreation", m_assignIpv6AddressOnCreation);
170
171 }
172
173 if(m_availabilityZoneHasBeenSet)
174 {
175 payload.WithString("AvailabilityZone", m_availabilityZone);
176
177 }
178
179 if(m_availabilityZoneIdHasBeenSet)
180 {
181 payload.WithString("AvailabilityZoneId", m_availabilityZoneId);
182
183 }
184
185 if(m_availableIpAddressCountHasBeenSet)
186 {
187 payload.WithInteger("AvailableIpAddressCount", m_availableIpAddressCount);
188
189 }
190
191 if(m_cidrBlockHasBeenSet)
192 {
193 payload.WithString("CidrBlock", m_cidrBlock);
194
195 }
196
197 if(m_defaultForAzHasBeenSet)
198 {
199 payload.WithBool("DefaultForAz", m_defaultForAz);
200
201 }
202
203 if(m_mapPublicIpOnLaunchHasBeenSet)
204 {
205 payload.WithBool("MapPublicIpOnLaunch", m_mapPublicIpOnLaunch);
206
207 }
208
209 if(m_ownerIdHasBeenSet)
210 {
211 payload.WithString("OwnerId", m_ownerId);
212
213 }
214
215 if(m_stateHasBeenSet)
216 {
217 payload.WithString("State", m_state);
218
219 }
220
221 if(m_subnetArnHasBeenSet)
222 {
223 payload.WithString("SubnetArn", m_subnetArn);
224
225 }
226
227 if(m_subnetIdHasBeenSet)
228 {
229 payload.WithString("SubnetId", m_subnetId);
230
231 }
232
233 if(m_vpcIdHasBeenSet)
234 {
235 payload.WithString("VpcId", m_vpcId);
236
237 }
238
239 if(m_ipv6CidrBlockAssociationSetHasBeenSet)
240 {
241 Array<JsonValue> ipv6CidrBlockAssociationSetJsonList(m_ipv6CidrBlockAssociationSet.size());
242 for(unsigned ipv6CidrBlockAssociationSetIndex = 0; ipv6CidrBlockAssociationSetIndex < ipv6CidrBlockAssociationSetJsonList.GetLength(); ++ipv6CidrBlockAssociationSetIndex)
243 {
244 ipv6CidrBlockAssociationSetJsonList[ipv6CidrBlockAssociationSetIndex].AsObject(m_ipv6CidrBlockAssociationSet[ipv6CidrBlockAssociationSetIndex].Jsonize());
245 }
246 payload.WithArray("Ipv6CidrBlockAssociationSet", std::move(ipv6CidrBlockAssociationSetJsonList));
247
248 }
249
250 return payload;
251 }
252
253 } // namespace Model
254 } // namespace SecurityHub
255 } // namespace Aws
256