1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/panorama/model/StaticIpConnectionInfo.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 Panorama
17 {
18 namespace Model
19 {
20
StaticIpConnectionInfo()21 StaticIpConnectionInfo::StaticIpConnectionInfo() :
22 m_ipAddressHasBeenSet(false),
23 m_maskHasBeenSet(false),
24 m_dnsHasBeenSet(false),
25 m_defaultGatewayHasBeenSet(false)
26 {
27 }
28
StaticIpConnectionInfo(JsonView jsonValue)29 StaticIpConnectionInfo::StaticIpConnectionInfo(JsonView jsonValue) :
30 m_ipAddressHasBeenSet(false),
31 m_maskHasBeenSet(false),
32 m_dnsHasBeenSet(false),
33 m_defaultGatewayHasBeenSet(false)
34 {
35 *this = jsonValue;
36 }
37
operator =(JsonView jsonValue)38 StaticIpConnectionInfo& StaticIpConnectionInfo::operator =(JsonView jsonValue)
39 {
40 if(jsonValue.ValueExists("IpAddress"))
41 {
42 m_ipAddress = jsonValue.GetString("IpAddress");
43
44 m_ipAddressHasBeenSet = true;
45 }
46
47 if(jsonValue.ValueExists("Mask"))
48 {
49 m_mask = jsonValue.GetString("Mask");
50
51 m_maskHasBeenSet = true;
52 }
53
54 if(jsonValue.ValueExists("Dns"))
55 {
56 Array<JsonView> dnsJsonList = jsonValue.GetArray("Dns");
57 for(unsigned dnsIndex = 0; dnsIndex < dnsJsonList.GetLength(); ++dnsIndex)
58 {
59 m_dns.push_back(dnsJsonList[dnsIndex].AsString());
60 }
61 m_dnsHasBeenSet = true;
62 }
63
64 if(jsonValue.ValueExists("DefaultGateway"))
65 {
66 m_defaultGateway = jsonValue.GetString("DefaultGateway");
67
68 m_defaultGatewayHasBeenSet = true;
69 }
70
71 return *this;
72 }
73
Jsonize() const74 JsonValue StaticIpConnectionInfo::Jsonize() const
75 {
76 JsonValue payload;
77
78 if(m_ipAddressHasBeenSet)
79 {
80 payload.WithString("IpAddress", m_ipAddress);
81
82 }
83
84 if(m_maskHasBeenSet)
85 {
86 payload.WithString("Mask", m_mask);
87
88 }
89
90 if(m_dnsHasBeenSet)
91 {
92 Array<JsonValue> dnsJsonList(m_dns.size());
93 for(unsigned dnsIndex = 0; dnsIndex < dnsJsonList.GetLength(); ++dnsIndex)
94 {
95 dnsJsonList[dnsIndex].AsString(m_dns[dnsIndex]);
96 }
97 payload.WithArray("Dns", std::move(dnsJsonList));
98
99 }
100
101 if(m_defaultGatewayHasBeenSet)
102 {
103 payload.WithString("DefaultGateway", m_defaultGateway);
104
105 }
106
107 return payload;
108 }
109
110 } // namespace Model
111 } // namespace Panorama
112 } // namespace Aws
113