1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/servicediscovery/model/ServiceSummary.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 ServiceDiscovery
17 {
18 namespace Model
19 {
20
ServiceSummary()21 ServiceSummary::ServiceSummary() :
22 m_idHasBeenSet(false),
23 m_arnHasBeenSet(false),
24 m_nameHasBeenSet(false),
25 m_type(ServiceType::NOT_SET),
26 m_typeHasBeenSet(false),
27 m_descriptionHasBeenSet(false),
28 m_instanceCount(0),
29 m_instanceCountHasBeenSet(false),
30 m_dnsConfigHasBeenSet(false),
31 m_healthCheckConfigHasBeenSet(false),
32 m_healthCheckCustomConfigHasBeenSet(false),
33 m_createDateHasBeenSet(false)
34 {
35 }
36
ServiceSummary(JsonView jsonValue)37 ServiceSummary::ServiceSummary(JsonView jsonValue) :
38 m_idHasBeenSet(false),
39 m_arnHasBeenSet(false),
40 m_nameHasBeenSet(false),
41 m_type(ServiceType::NOT_SET),
42 m_typeHasBeenSet(false),
43 m_descriptionHasBeenSet(false),
44 m_instanceCount(0),
45 m_instanceCountHasBeenSet(false),
46 m_dnsConfigHasBeenSet(false),
47 m_healthCheckConfigHasBeenSet(false),
48 m_healthCheckCustomConfigHasBeenSet(false),
49 m_createDateHasBeenSet(false)
50 {
51 *this = jsonValue;
52 }
53
operator =(JsonView jsonValue)54 ServiceSummary& ServiceSummary::operator =(JsonView jsonValue)
55 {
56 if(jsonValue.ValueExists("Id"))
57 {
58 m_id = jsonValue.GetString("Id");
59
60 m_idHasBeenSet = true;
61 }
62
63 if(jsonValue.ValueExists("Arn"))
64 {
65 m_arn = jsonValue.GetString("Arn");
66
67 m_arnHasBeenSet = true;
68 }
69
70 if(jsonValue.ValueExists("Name"))
71 {
72 m_name = jsonValue.GetString("Name");
73
74 m_nameHasBeenSet = true;
75 }
76
77 if(jsonValue.ValueExists("Type"))
78 {
79 m_type = ServiceTypeMapper::GetServiceTypeForName(jsonValue.GetString("Type"));
80
81 m_typeHasBeenSet = true;
82 }
83
84 if(jsonValue.ValueExists("Description"))
85 {
86 m_description = jsonValue.GetString("Description");
87
88 m_descriptionHasBeenSet = true;
89 }
90
91 if(jsonValue.ValueExists("InstanceCount"))
92 {
93 m_instanceCount = jsonValue.GetInteger("InstanceCount");
94
95 m_instanceCountHasBeenSet = true;
96 }
97
98 if(jsonValue.ValueExists("DnsConfig"))
99 {
100 m_dnsConfig = jsonValue.GetObject("DnsConfig");
101
102 m_dnsConfigHasBeenSet = true;
103 }
104
105 if(jsonValue.ValueExists("HealthCheckConfig"))
106 {
107 m_healthCheckConfig = jsonValue.GetObject("HealthCheckConfig");
108
109 m_healthCheckConfigHasBeenSet = true;
110 }
111
112 if(jsonValue.ValueExists("HealthCheckCustomConfig"))
113 {
114 m_healthCheckCustomConfig = jsonValue.GetObject("HealthCheckCustomConfig");
115
116 m_healthCheckCustomConfigHasBeenSet = true;
117 }
118
119 if(jsonValue.ValueExists("CreateDate"))
120 {
121 m_createDate = jsonValue.GetDouble("CreateDate");
122
123 m_createDateHasBeenSet = true;
124 }
125
126 return *this;
127 }
128
Jsonize() const129 JsonValue ServiceSummary::Jsonize() const
130 {
131 JsonValue payload;
132
133 if(m_idHasBeenSet)
134 {
135 payload.WithString("Id", m_id);
136
137 }
138
139 if(m_arnHasBeenSet)
140 {
141 payload.WithString("Arn", m_arn);
142
143 }
144
145 if(m_nameHasBeenSet)
146 {
147 payload.WithString("Name", m_name);
148
149 }
150
151 if(m_typeHasBeenSet)
152 {
153 payload.WithString("Type", ServiceTypeMapper::GetNameForServiceType(m_type));
154 }
155
156 if(m_descriptionHasBeenSet)
157 {
158 payload.WithString("Description", m_description);
159
160 }
161
162 if(m_instanceCountHasBeenSet)
163 {
164 payload.WithInteger("InstanceCount", m_instanceCount);
165
166 }
167
168 if(m_dnsConfigHasBeenSet)
169 {
170 payload.WithObject("DnsConfig", m_dnsConfig.Jsonize());
171
172 }
173
174 if(m_healthCheckConfigHasBeenSet)
175 {
176 payload.WithObject("HealthCheckConfig", m_healthCheckConfig.Jsonize());
177
178 }
179
180 if(m_healthCheckCustomConfigHasBeenSet)
181 {
182 payload.WithObject("HealthCheckCustomConfig", m_healthCheckCustomConfig.Jsonize());
183
184 }
185
186 if(m_createDateHasBeenSet)
187 {
188 payload.WithDouble("CreateDate", m_createDate.SecondsWithMSPrecision());
189 }
190
191 return payload;
192 }
193
194 } // namespace Model
195 } // namespace ServiceDiscovery
196 } // namespace Aws
197