1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/quicksight/model/TemplateVersionSummary.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 QuickSight
17 {
18 namespace Model
19 {
20 
TemplateVersionSummary()21 TemplateVersionSummary::TemplateVersionSummary() :
22     m_arnHasBeenSet(false),
23     m_versionNumber(0),
24     m_versionNumberHasBeenSet(false),
25     m_createdTimeHasBeenSet(false),
26     m_status(ResourceStatus::NOT_SET),
27     m_statusHasBeenSet(false),
28     m_descriptionHasBeenSet(false)
29 {
30 }
31 
TemplateVersionSummary(JsonView jsonValue)32 TemplateVersionSummary::TemplateVersionSummary(JsonView jsonValue) :
33     m_arnHasBeenSet(false),
34     m_versionNumber(0),
35     m_versionNumberHasBeenSet(false),
36     m_createdTimeHasBeenSet(false),
37     m_status(ResourceStatus::NOT_SET),
38     m_statusHasBeenSet(false),
39     m_descriptionHasBeenSet(false)
40 {
41   *this = jsonValue;
42 }
43 
operator =(JsonView jsonValue)44 TemplateVersionSummary& TemplateVersionSummary::operator =(JsonView jsonValue)
45 {
46   if(jsonValue.ValueExists("Arn"))
47   {
48     m_arn = jsonValue.GetString("Arn");
49 
50     m_arnHasBeenSet = true;
51   }
52 
53   if(jsonValue.ValueExists("VersionNumber"))
54   {
55     m_versionNumber = jsonValue.GetInt64("VersionNumber");
56 
57     m_versionNumberHasBeenSet = true;
58   }
59 
60   if(jsonValue.ValueExists("CreatedTime"))
61   {
62     m_createdTime = jsonValue.GetDouble("CreatedTime");
63 
64     m_createdTimeHasBeenSet = true;
65   }
66 
67   if(jsonValue.ValueExists("Status"))
68   {
69     m_status = ResourceStatusMapper::GetResourceStatusForName(jsonValue.GetString("Status"));
70 
71     m_statusHasBeenSet = true;
72   }
73 
74   if(jsonValue.ValueExists("Description"))
75   {
76     m_description = jsonValue.GetString("Description");
77 
78     m_descriptionHasBeenSet = true;
79   }
80 
81   return *this;
82 }
83 
Jsonize() const84 JsonValue TemplateVersionSummary::Jsonize() const
85 {
86   JsonValue payload;
87 
88   if(m_arnHasBeenSet)
89   {
90    payload.WithString("Arn", m_arn);
91 
92   }
93 
94   if(m_versionNumberHasBeenSet)
95   {
96    payload.WithInt64("VersionNumber", m_versionNumber);
97 
98   }
99 
100   if(m_createdTimeHasBeenSet)
101   {
102    payload.WithDouble("CreatedTime", m_createdTime.SecondsWithMSPrecision());
103   }
104 
105   if(m_statusHasBeenSet)
106   {
107    payload.WithString("Status", ResourceStatusMapper::GetNameForResourceStatus(m_status));
108   }
109 
110   if(m_descriptionHasBeenSet)
111   {
112    payload.WithString("Description", m_description);
113 
114   }
115 
116   return payload;
117 }
118 
119 } // namespace Model
120 } // namespace QuickSight
121 } // namespace Aws
122