1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/discovery/model/ConfigurationTag.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 ApplicationDiscoveryService
17 {
18 namespace Model
19 {
20 
ConfigurationTag()21 ConfigurationTag::ConfigurationTag() :
22     m_configurationType(ConfigurationItemType::NOT_SET),
23     m_configurationTypeHasBeenSet(false),
24     m_configurationIdHasBeenSet(false),
25     m_keyHasBeenSet(false),
26     m_valueHasBeenSet(false),
27     m_timeOfCreationHasBeenSet(false)
28 {
29 }
30 
ConfigurationTag(JsonView jsonValue)31 ConfigurationTag::ConfigurationTag(JsonView jsonValue) :
32     m_configurationType(ConfigurationItemType::NOT_SET),
33     m_configurationTypeHasBeenSet(false),
34     m_configurationIdHasBeenSet(false),
35     m_keyHasBeenSet(false),
36     m_valueHasBeenSet(false),
37     m_timeOfCreationHasBeenSet(false)
38 {
39   *this = jsonValue;
40 }
41 
operator =(JsonView jsonValue)42 ConfigurationTag& ConfigurationTag::operator =(JsonView jsonValue)
43 {
44   if(jsonValue.ValueExists("configurationType"))
45   {
46     m_configurationType = ConfigurationItemTypeMapper::GetConfigurationItemTypeForName(jsonValue.GetString("configurationType"));
47 
48     m_configurationTypeHasBeenSet = true;
49   }
50 
51   if(jsonValue.ValueExists("configurationId"))
52   {
53     m_configurationId = jsonValue.GetString("configurationId");
54 
55     m_configurationIdHasBeenSet = true;
56   }
57 
58   if(jsonValue.ValueExists("key"))
59   {
60     m_key = jsonValue.GetString("key");
61 
62     m_keyHasBeenSet = true;
63   }
64 
65   if(jsonValue.ValueExists("value"))
66   {
67     m_value = jsonValue.GetString("value");
68 
69     m_valueHasBeenSet = true;
70   }
71 
72   if(jsonValue.ValueExists("timeOfCreation"))
73   {
74     m_timeOfCreation = jsonValue.GetDouble("timeOfCreation");
75 
76     m_timeOfCreationHasBeenSet = true;
77   }
78 
79   return *this;
80 }
81 
Jsonize() const82 JsonValue ConfigurationTag::Jsonize() const
83 {
84   JsonValue payload;
85 
86   if(m_configurationTypeHasBeenSet)
87   {
88    payload.WithString("configurationType", ConfigurationItemTypeMapper::GetNameForConfigurationItemType(m_configurationType));
89   }
90 
91   if(m_configurationIdHasBeenSet)
92   {
93    payload.WithString("configurationId", m_configurationId);
94 
95   }
96 
97   if(m_keyHasBeenSet)
98   {
99    payload.WithString("key", m_key);
100 
101   }
102 
103   if(m_valueHasBeenSet)
104   {
105    payload.WithString("value", m_value);
106 
107   }
108 
109   if(m_timeOfCreationHasBeenSet)
110   {
111    payload.WithDouble("timeOfCreation", m_timeOfCreation.SecondsWithMSPrecision());
112   }
113 
114   return payload;
115 }
116 
117 } // namespace Model
118 } // namespace ApplicationDiscoveryService
119 } // namespace Aws
120