1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/guardduty/model/LocalPortDetails.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 GuardDuty
17 {
18 namespace Model
19 {
20 
LocalPortDetails()21 LocalPortDetails::LocalPortDetails() :
22     m_port(0),
23     m_portHasBeenSet(false),
24     m_portNameHasBeenSet(false)
25 {
26 }
27 
LocalPortDetails(JsonView jsonValue)28 LocalPortDetails::LocalPortDetails(JsonView jsonValue) :
29     m_port(0),
30     m_portHasBeenSet(false),
31     m_portNameHasBeenSet(false)
32 {
33   *this = jsonValue;
34 }
35 
operator =(JsonView jsonValue)36 LocalPortDetails& LocalPortDetails::operator =(JsonView jsonValue)
37 {
38   if(jsonValue.ValueExists("port"))
39   {
40     m_port = jsonValue.GetInteger("port");
41 
42     m_portHasBeenSet = true;
43   }
44 
45   if(jsonValue.ValueExists("portName"))
46   {
47     m_portName = jsonValue.GetString("portName");
48 
49     m_portNameHasBeenSet = true;
50   }
51 
52   return *this;
53 }
54 
Jsonize() const55 JsonValue LocalPortDetails::Jsonize() const
56 {
57   JsonValue payload;
58 
59   if(m_portHasBeenSet)
60   {
61    payload.WithInteger("port", m_port);
62 
63   }
64 
65   if(m_portNameHasBeenSet)
66   {
67    payload.WithString("portName", m_portName);
68 
69   }
70 
71   return payload;
72 }
73 
74 } // namespace Model
75 } // namespace GuardDuty
76 } // namespace Aws
77