1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/macie2/model/IpAddressDetails.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 Macie2
17 {
18 namespace Model
19 {
20
IpAddressDetails()21 IpAddressDetails::IpAddressDetails() :
22 m_ipAddressV4HasBeenSet(false),
23 m_ipCityHasBeenSet(false),
24 m_ipCountryHasBeenSet(false),
25 m_ipGeoLocationHasBeenSet(false),
26 m_ipOwnerHasBeenSet(false)
27 {
28 }
29
IpAddressDetails(JsonView jsonValue)30 IpAddressDetails::IpAddressDetails(JsonView jsonValue) :
31 m_ipAddressV4HasBeenSet(false),
32 m_ipCityHasBeenSet(false),
33 m_ipCountryHasBeenSet(false),
34 m_ipGeoLocationHasBeenSet(false),
35 m_ipOwnerHasBeenSet(false)
36 {
37 *this = jsonValue;
38 }
39
operator =(JsonView jsonValue)40 IpAddressDetails& IpAddressDetails::operator =(JsonView jsonValue)
41 {
42 if(jsonValue.ValueExists("ipAddressV4"))
43 {
44 m_ipAddressV4 = jsonValue.GetString("ipAddressV4");
45
46 m_ipAddressV4HasBeenSet = true;
47 }
48
49 if(jsonValue.ValueExists("ipCity"))
50 {
51 m_ipCity = jsonValue.GetObject("ipCity");
52
53 m_ipCityHasBeenSet = true;
54 }
55
56 if(jsonValue.ValueExists("ipCountry"))
57 {
58 m_ipCountry = jsonValue.GetObject("ipCountry");
59
60 m_ipCountryHasBeenSet = true;
61 }
62
63 if(jsonValue.ValueExists("ipGeoLocation"))
64 {
65 m_ipGeoLocation = jsonValue.GetObject("ipGeoLocation");
66
67 m_ipGeoLocationHasBeenSet = true;
68 }
69
70 if(jsonValue.ValueExists("ipOwner"))
71 {
72 m_ipOwner = jsonValue.GetObject("ipOwner");
73
74 m_ipOwnerHasBeenSet = true;
75 }
76
77 return *this;
78 }
79
Jsonize() const80 JsonValue IpAddressDetails::Jsonize() const
81 {
82 JsonValue payload;
83
84 if(m_ipAddressV4HasBeenSet)
85 {
86 payload.WithString("ipAddressV4", m_ipAddressV4);
87
88 }
89
90 if(m_ipCityHasBeenSet)
91 {
92 payload.WithObject("ipCity", m_ipCity.Jsonize());
93
94 }
95
96 if(m_ipCountryHasBeenSet)
97 {
98 payload.WithObject("ipCountry", m_ipCountry.Jsonize());
99
100 }
101
102 if(m_ipGeoLocationHasBeenSet)
103 {
104 payload.WithObject("ipGeoLocation", m_ipGeoLocation.Jsonize());
105
106 }
107
108 if(m_ipOwnerHasBeenSet)
109 {
110 payload.WithObject("ipOwner", m_ipOwner.Jsonize());
111
112 }
113
114 return payload;
115 }
116
117 } // namespace Model
118 } // namespace Macie2
119 } // namespace Aws
120