1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/directconnect/model/AssociatedGateway.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 DirectConnect
17 {
18 namespace Model
19 {
20
AssociatedGateway()21 AssociatedGateway::AssociatedGateway() :
22 m_idHasBeenSet(false),
23 m_type(GatewayType::NOT_SET),
24 m_typeHasBeenSet(false),
25 m_ownerAccountHasBeenSet(false),
26 m_regionHasBeenSet(false)
27 {
28 }
29
AssociatedGateway(JsonView jsonValue)30 AssociatedGateway::AssociatedGateway(JsonView jsonValue) :
31 m_idHasBeenSet(false),
32 m_type(GatewayType::NOT_SET),
33 m_typeHasBeenSet(false),
34 m_ownerAccountHasBeenSet(false),
35 m_regionHasBeenSet(false)
36 {
37 *this = jsonValue;
38 }
39
operator =(JsonView jsonValue)40 AssociatedGateway& AssociatedGateway::operator =(JsonView jsonValue)
41 {
42 if(jsonValue.ValueExists("id"))
43 {
44 m_id = jsonValue.GetString("id");
45
46 m_idHasBeenSet = true;
47 }
48
49 if(jsonValue.ValueExists("type"))
50 {
51 m_type = GatewayTypeMapper::GetGatewayTypeForName(jsonValue.GetString("type"));
52
53 m_typeHasBeenSet = true;
54 }
55
56 if(jsonValue.ValueExists("ownerAccount"))
57 {
58 m_ownerAccount = jsonValue.GetString("ownerAccount");
59
60 m_ownerAccountHasBeenSet = true;
61 }
62
63 if(jsonValue.ValueExists("region"))
64 {
65 m_region = jsonValue.GetString("region");
66
67 m_regionHasBeenSet = true;
68 }
69
70 return *this;
71 }
72
Jsonize() const73 JsonValue AssociatedGateway::Jsonize() const
74 {
75 JsonValue payload;
76
77 if(m_idHasBeenSet)
78 {
79 payload.WithString("id", m_id);
80
81 }
82
83 if(m_typeHasBeenSet)
84 {
85 payload.WithString("type", GatewayTypeMapper::GetNameForGatewayType(m_type));
86 }
87
88 if(m_ownerAccountHasBeenSet)
89 {
90 payload.WithString("ownerAccount", m_ownerAccount);
91
92 }
93
94 if(m_regionHasBeenSet)
95 {
96 payload.WithString("region", m_region);
97
98 }
99
100 return payload;
101 }
102
103 } // namespace Model
104 } // namespace DirectConnect
105 } // namespace Aws
106