1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/glue/model/Blueprint.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 Glue
17 {
18 namespace Model
19 {
20 
Blueprint()21 Blueprint::Blueprint() :
22     m_nameHasBeenSet(false),
23     m_descriptionHasBeenSet(false),
24     m_createdOnHasBeenSet(false),
25     m_lastModifiedOnHasBeenSet(false),
26     m_parameterSpecHasBeenSet(false),
27     m_blueprintLocationHasBeenSet(false),
28     m_blueprintServiceLocationHasBeenSet(false),
29     m_status(BlueprintStatus::NOT_SET),
30     m_statusHasBeenSet(false),
31     m_errorMessageHasBeenSet(false),
32     m_lastActiveDefinitionHasBeenSet(false)
33 {
34 }
35 
Blueprint(JsonView jsonValue)36 Blueprint::Blueprint(JsonView jsonValue) :
37     m_nameHasBeenSet(false),
38     m_descriptionHasBeenSet(false),
39     m_createdOnHasBeenSet(false),
40     m_lastModifiedOnHasBeenSet(false),
41     m_parameterSpecHasBeenSet(false),
42     m_blueprintLocationHasBeenSet(false),
43     m_blueprintServiceLocationHasBeenSet(false),
44     m_status(BlueprintStatus::NOT_SET),
45     m_statusHasBeenSet(false),
46     m_errorMessageHasBeenSet(false),
47     m_lastActiveDefinitionHasBeenSet(false)
48 {
49   *this = jsonValue;
50 }
51 
operator =(JsonView jsonValue)52 Blueprint& Blueprint::operator =(JsonView jsonValue)
53 {
54   if(jsonValue.ValueExists("Name"))
55   {
56     m_name = jsonValue.GetString("Name");
57 
58     m_nameHasBeenSet = true;
59   }
60 
61   if(jsonValue.ValueExists("Description"))
62   {
63     m_description = jsonValue.GetString("Description");
64 
65     m_descriptionHasBeenSet = true;
66   }
67 
68   if(jsonValue.ValueExists("CreatedOn"))
69   {
70     m_createdOn = jsonValue.GetDouble("CreatedOn");
71 
72     m_createdOnHasBeenSet = true;
73   }
74 
75   if(jsonValue.ValueExists("LastModifiedOn"))
76   {
77     m_lastModifiedOn = jsonValue.GetDouble("LastModifiedOn");
78 
79     m_lastModifiedOnHasBeenSet = true;
80   }
81 
82   if(jsonValue.ValueExists("ParameterSpec"))
83   {
84     m_parameterSpec = jsonValue.GetString("ParameterSpec");
85 
86     m_parameterSpecHasBeenSet = true;
87   }
88 
89   if(jsonValue.ValueExists("BlueprintLocation"))
90   {
91     m_blueprintLocation = jsonValue.GetString("BlueprintLocation");
92 
93     m_blueprintLocationHasBeenSet = true;
94   }
95 
96   if(jsonValue.ValueExists("BlueprintServiceLocation"))
97   {
98     m_blueprintServiceLocation = jsonValue.GetString("BlueprintServiceLocation");
99 
100     m_blueprintServiceLocationHasBeenSet = true;
101   }
102 
103   if(jsonValue.ValueExists("Status"))
104   {
105     m_status = BlueprintStatusMapper::GetBlueprintStatusForName(jsonValue.GetString("Status"));
106 
107     m_statusHasBeenSet = true;
108   }
109 
110   if(jsonValue.ValueExists("ErrorMessage"))
111   {
112     m_errorMessage = jsonValue.GetString("ErrorMessage");
113 
114     m_errorMessageHasBeenSet = true;
115   }
116 
117   if(jsonValue.ValueExists("LastActiveDefinition"))
118   {
119     m_lastActiveDefinition = jsonValue.GetObject("LastActiveDefinition");
120 
121     m_lastActiveDefinitionHasBeenSet = true;
122   }
123 
124   return *this;
125 }
126 
Jsonize() const127 JsonValue Blueprint::Jsonize() const
128 {
129   JsonValue payload;
130 
131   if(m_nameHasBeenSet)
132   {
133    payload.WithString("Name", m_name);
134 
135   }
136 
137   if(m_descriptionHasBeenSet)
138   {
139    payload.WithString("Description", m_description);
140 
141   }
142 
143   if(m_createdOnHasBeenSet)
144   {
145    payload.WithDouble("CreatedOn", m_createdOn.SecondsWithMSPrecision());
146   }
147 
148   if(m_lastModifiedOnHasBeenSet)
149   {
150    payload.WithDouble("LastModifiedOn", m_lastModifiedOn.SecondsWithMSPrecision());
151   }
152 
153   if(m_parameterSpecHasBeenSet)
154   {
155    payload.WithString("ParameterSpec", m_parameterSpec);
156 
157   }
158 
159   if(m_blueprintLocationHasBeenSet)
160   {
161    payload.WithString("BlueprintLocation", m_blueprintLocation);
162 
163   }
164 
165   if(m_blueprintServiceLocationHasBeenSet)
166   {
167    payload.WithString("BlueprintServiceLocation", m_blueprintServiceLocation);
168 
169   }
170 
171   if(m_statusHasBeenSet)
172   {
173    payload.WithString("Status", BlueprintStatusMapper::GetNameForBlueprintStatus(m_status));
174   }
175 
176   if(m_errorMessageHasBeenSet)
177   {
178    payload.WithString("ErrorMessage", m_errorMessage);
179 
180   }
181 
182   if(m_lastActiveDefinitionHasBeenSet)
183   {
184    payload.WithObject("LastActiveDefinition", m_lastActiveDefinition.Jsonize());
185 
186   }
187 
188   return payload;
189 }
190 
191 } // namespace Model
192 } // namespace Glue
193 } // namespace Aws
194