1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/mq/model/BrokerSummary.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 MQ
17 {
18 namespace Model
19 {
20 
BrokerSummary()21 BrokerSummary::BrokerSummary() :
22     m_brokerArnHasBeenSet(false),
23     m_brokerIdHasBeenSet(false),
24     m_brokerNameHasBeenSet(false),
25     m_brokerState(BrokerState::NOT_SET),
26     m_brokerStateHasBeenSet(false),
27     m_createdHasBeenSet(false),
28     m_deploymentMode(DeploymentMode::NOT_SET),
29     m_deploymentModeHasBeenSet(false),
30     m_engineType(EngineType::NOT_SET),
31     m_engineTypeHasBeenSet(false),
32     m_hostInstanceTypeHasBeenSet(false)
33 {
34 }
35 
BrokerSummary(JsonView jsonValue)36 BrokerSummary::BrokerSummary(JsonView jsonValue) :
37     m_brokerArnHasBeenSet(false),
38     m_brokerIdHasBeenSet(false),
39     m_brokerNameHasBeenSet(false),
40     m_brokerState(BrokerState::NOT_SET),
41     m_brokerStateHasBeenSet(false),
42     m_createdHasBeenSet(false),
43     m_deploymentMode(DeploymentMode::NOT_SET),
44     m_deploymentModeHasBeenSet(false),
45     m_engineType(EngineType::NOT_SET),
46     m_engineTypeHasBeenSet(false),
47     m_hostInstanceTypeHasBeenSet(false)
48 {
49   *this = jsonValue;
50 }
51 
operator =(JsonView jsonValue)52 BrokerSummary& BrokerSummary::operator =(JsonView jsonValue)
53 {
54   if(jsonValue.ValueExists("brokerArn"))
55   {
56     m_brokerArn = jsonValue.GetString("brokerArn");
57 
58     m_brokerArnHasBeenSet = true;
59   }
60 
61   if(jsonValue.ValueExists("brokerId"))
62   {
63     m_brokerId = jsonValue.GetString("brokerId");
64 
65     m_brokerIdHasBeenSet = true;
66   }
67 
68   if(jsonValue.ValueExists("brokerName"))
69   {
70     m_brokerName = jsonValue.GetString("brokerName");
71 
72     m_brokerNameHasBeenSet = true;
73   }
74 
75   if(jsonValue.ValueExists("brokerState"))
76   {
77     m_brokerState = BrokerStateMapper::GetBrokerStateForName(jsonValue.GetString("brokerState"));
78 
79     m_brokerStateHasBeenSet = true;
80   }
81 
82   if(jsonValue.ValueExists("created"))
83   {
84     m_created = jsonValue.GetString("created");
85 
86     m_createdHasBeenSet = true;
87   }
88 
89   if(jsonValue.ValueExists("deploymentMode"))
90   {
91     m_deploymentMode = DeploymentModeMapper::GetDeploymentModeForName(jsonValue.GetString("deploymentMode"));
92 
93     m_deploymentModeHasBeenSet = true;
94   }
95 
96   if(jsonValue.ValueExists("engineType"))
97   {
98     m_engineType = EngineTypeMapper::GetEngineTypeForName(jsonValue.GetString("engineType"));
99 
100     m_engineTypeHasBeenSet = true;
101   }
102 
103   if(jsonValue.ValueExists("hostInstanceType"))
104   {
105     m_hostInstanceType = jsonValue.GetString("hostInstanceType");
106 
107     m_hostInstanceTypeHasBeenSet = true;
108   }
109 
110   return *this;
111 }
112 
Jsonize() const113 JsonValue BrokerSummary::Jsonize() const
114 {
115   JsonValue payload;
116 
117   if(m_brokerArnHasBeenSet)
118   {
119    payload.WithString("brokerArn", m_brokerArn);
120 
121   }
122 
123   if(m_brokerIdHasBeenSet)
124   {
125    payload.WithString("brokerId", m_brokerId);
126 
127   }
128 
129   if(m_brokerNameHasBeenSet)
130   {
131    payload.WithString("brokerName", m_brokerName);
132 
133   }
134 
135   if(m_brokerStateHasBeenSet)
136   {
137    payload.WithString("brokerState", BrokerStateMapper::GetNameForBrokerState(m_brokerState));
138   }
139 
140   if(m_createdHasBeenSet)
141   {
142    payload.WithString("created", m_created.ToGmtString(DateFormat::ISO_8601));
143   }
144 
145   if(m_deploymentModeHasBeenSet)
146   {
147    payload.WithString("deploymentMode", DeploymentModeMapper::GetNameForDeploymentMode(m_deploymentMode));
148   }
149 
150   if(m_engineTypeHasBeenSet)
151   {
152    payload.WithString("engineType", EngineTypeMapper::GetNameForEngineType(m_engineType));
153   }
154 
155   if(m_hostInstanceTypeHasBeenSet)
156   {
157    payload.WithString("hostInstanceType", m_hostInstanceType);
158 
159   }
160 
161   return payload;
162 }
163 
164 } // namespace Model
165 } // namespace MQ
166 } // namespace Aws
167