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/PortRange.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 
PortRange()21 PortRange::PortRange() :
22     m_begin(0),
23     m_beginHasBeenSet(false),
24     m_end(0),
25     m_endHasBeenSet(false)
26 {
27 }
28 
PortRange(JsonView jsonValue)29 PortRange::PortRange(JsonView jsonValue) :
30     m_begin(0),
31     m_beginHasBeenSet(false),
32     m_end(0),
33     m_endHasBeenSet(false)
34 {
35   *this = jsonValue;
36 }
37 
operator =(JsonView jsonValue)38 PortRange& PortRange::operator =(JsonView jsonValue)
39 {
40   if(jsonValue.ValueExists("Begin"))
41   {
42     m_begin = jsonValue.GetInteger("Begin");
43 
44     m_beginHasBeenSet = true;
45   }
46 
47   if(jsonValue.ValueExists("End"))
48   {
49     m_end = jsonValue.GetInteger("End");
50 
51     m_endHasBeenSet = true;
52   }
53 
54   return *this;
55 }
56 
Jsonize() const57 JsonValue PortRange::Jsonize() const
58 {
59   JsonValue payload;
60 
61   if(m_beginHasBeenSet)
62   {
63    payload.WithInteger("Begin", m_begin);
64 
65   }
66 
67   if(m_endHasBeenSet)
68   {
69    payload.WithInteger("End", m_end);
70 
71   }
72 
73   return payload;
74 }
75 
76 } // namespace Model
77 } // namespace SecurityHub
78 } // namespace Aws
79