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/NamespaceSummary.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 
NamespaceSummary()21 NamespaceSummary::NamespaceSummary() :
22     m_idHasBeenSet(false),
23     m_arnHasBeenSet(false),
24     m_nameHasBeenSet(false),
25     m_type(NamespaceType::NOT_SET),
26     m_typeHasBeenSet(false),
27     m_descriptionHasBeenSet(false),
28     m_serviceCount(0),
29     m_serviceCountHasBeenSet(false),
30     m_propertiesHasBeenSet(false),
31     m_createDateHasBeenSet(false)
32 {
33 }
34 
NamespaceSummary(JsonView jsonValue)35 NamespaceSummary::NamespaceSummary(JsonView jsonValue) :
36     m_idHasBeenSet(false),
37     m_arnHasBeenSet(false),
38     m_nameHasBeenSet(false),
39     m_type(NamespaceType::NOT_SET),
40     m_typeHasBeenSet(false),
41     m_descriptionHasBeenSet(false),
42     m_serviceCount(0),
43     m_serviceCountHasBeenSet(false),
44     m_propertiesHasBeenSet(false),
45     m_createDateHasBeenSet(false)
46 {
47   *this = jsonValue;
48 }
49 
operator =(JsonView jsonValue)50 NamespaceSummary& NamespaceSummary::operator =(JsonView jsonValue)
51 {
52   if(jsonValue.ValueExists("Id"))
53   {
54     m_id = jsonValue.GetString("Id");
55 
56     m_idHasBeenSet = true;
57   }
58 
59   if(jsonValue.ValueExists("Arn"))
60   {
61     m_arn = jsonValue.GetString("Arn");
62 
63     m_arnHasBeenSet = true;
64   }
65 
66   if(jsonValue.ValueExists("Name"))
67   {
68     m_name = jsonValue.GetString("Name");
69 
70     m_nameHasBeenSet = true;
71   }
72 
73   if(jsonValue.ValueExists("Type"))
74   {
75     m_type = NamespaceTypeMapper::GetNamespaceTypeForName(jsonValue.GetString("Type"));
76 
77     m_typeHasBeenSet = true;
78   }
79 
80   if(jsonValue.ValueExists("Description"))
81   {
82     m_description = jsonValue.GetString("Description");
83 
84     m_descriptionHasBeenSet = true;
85   }
86 
87   if(jsonValue.ValueExists("ServiceCount"))
88   {
89     m_serviceCount = jsonValue.GetInteger("ServiceCount");
90 
91     m_serviceCountHasBeenSet = true;
92   }
93 
94   if(jsonValue.ValueExists("Properties"))
95   {
96     m_properties = jsonValue.GetObject("Properties");
97 
98     m_propertiesHasBeenSet = true;
99   }
100 
101   if(jsonValue.ValueExists("CreateDate"))
102   {
103     m_createDate = jsonValue.GetDouble("CreateDate");
104 
105     m_createDateHasBeenSet = true;
106   }
107 
108   return *this;
109 }
110 
Jsonize() const111 JsonValue NamespaceSummary::Jsonize() const
112 {
113   JsonValue payload;
114 
115   if(m_idHasBeenSet)
116   {
117    payload.WithString("Id", m_id);
118 
119   }
120 
121   if(m_arnHasBeenSet)
122   {
123    payload.WithString("Arn", m_arn);
124 
125   }
126 
127   if(m_nameHasBeenSet)
128   {
129    payload.WithString("Name", m_name);
130 
131   }
132 
133   if(m_typeHasBeenSet)
134   {
135    payload.WithString("Type", NamespaceTypeMapper::GetNameForNamespaceType(m_type));
136   }
137 
138   if(m_descriptionHasBeenSet)
139   {
140    payload.WithString("Description", m_description);
141 
142   }
143 
144   if(m_serviceCountHasBeenSet)
145   {
146    payload.WithInteger("ServiceCount", m_serviceCount);
147 
148   }
149 
150   if(m_propertiesHasBeenSet)
151   {
152    payload.WithObject("Properties", m_properties.Jsonize());
153 
154   }
155 
156   if(m_createDateHasBeenSet)
157   {
158    payload.WithDouble("CreateDate", m_createDate.SecondsWithMSPrecision());
159   }
160 
161   return payload;
162 }
163 
164 } // namespace Model
165 } // namespace ServiceDiscovery
166 } // namespace Aws
167