1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/lexv2-models/model/ImportSummary.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 LexModelsV2
17 {
18 namespace Model
19 {
20 
ImportSummary()21 ImportSummary::ImportSummary() :
22     m_importIdHasBeenSet(false),
23     m_importedResourceIdHasBeenSet(false),
24     m_importedResourceNameHasBeenSet(false),
25     m_importStatus(ImportStatus::NOT_SET),
26     m_importStatusHasBeenSet(false),
27     m_mergeStrategy(MergeStrategy::NOT_SET),
28     m_mergeStrategyHasBeenSet(false),
29     m_creationDateTimeHasBeenSet(false),
30     m_lastUpdatedDateTimeHasBeenSet(false)
31 {
32 }
33 
ImportSummary(JsonView jsonValue)34 ImportSummary::ImportSummary(JsonView jsonValue) :
35     m_importIdHasBeenSet(false),
36     m_importedResourceIdHasBeenSet(false),
37     m_importedResourceNameHasBeenSet(false),
38     m_importStatus(ImportStatus::NOT_SET),
39     m_importStatusHasBeenSet(false),
40     m_mergeStrategy(MergeStrategy::NOT_SET),
41     m_mergeStrategyHasBeenSet(false),
42     m_creationDateTimeHasBeenSet(false),
43     m_lastUpdatedDateTimeHasBeenSet(false)
44 {
45   *this = jsonValue;
46 }
47 
operator =(JsonView jsonValue)48 ImportSummary& ImportSummary::operator =(JsonView jsonValue)
49 {
50   if(jsonValue.ValueExists("importId"))
51   {
52     m_importId = jsonValue.GetString("importId");
53 
54     m_importIdHasBeenSet = true;
55   }
56 
57   if(jsonValue.ValueExists("importedResourceId"))
58   {
59     m_importedResourceId = jsonValue.GetString("importedResourceId");
60 
61     m_importedResourceIdHasBeenSet = true;
62   }
63 
64   if(jsonValue.ValueExists("importedResourceName"))
65   {
66     m_importedResourceName = jsonValue.GetString("importedResourceName");
67 
68     m_importedResourceNameHasBeenSet = true;
69   }
70 
71   if(jsonValue.ValueExists("importStatus"))
72   {
73     m_importStatus = ImportStatusMapper::GetImportStatusForName(jsonValue.GetString("importStatus"));
74 
75     m_importStatusHasBeenSet = true;
76   }
77 
78   if(jsonValue.ValueExists("mergeStrategy"))
79   {
80     m_mergeStrategy = MergeStrategyMapper::GetMergeStrategyForName(jsonValue.GetString("mergeStrategy"));
81 
82     m_mergeStrategyHasBeenSet = true;
83   }
84 
85   if(jsonValue.ValueExists("creationDateTime"))
86   {
87     m_creationDateTime = jsonValue.GetDouble("creationDateTime");
88 
89     m_creationDateTimeHasBeenSet = true;
90   }
91 
92   if(jsonValue.ValueExists("lastUpdatedDateTime"))
93   {
94     m_lastUpdatedDateTime = jsonValue.GetDouble("lastUpdatedDateTime");
95 
96     m_lastUpdatedDateTimeHasBeenSet = true;
97   }
98 
99   return *this;
100 }
101 
Jsonize() const102 JsonValue ImportSummary::Jsonize() const
103 {
104   JsonValue payload;
105 
106   if(m_importIdHasBeenSet)
107   {
108    payload.WithString("importId", m_importId);
109 
110   }
111 
112   if(m_importedResourceIdHasBeenSet)
113   {
114    payload.WithString("importedResourceId", m_importedResourceId);
115 
116   }
117 
118   if(m_importedResourceNameHasBeenSet)
119   {
120    payload.WithString("importedResourceName", m_importedResourceName);
121 
122   }
123 
124   if(m_importStatusHasBeenSet)
125   {
126    payload.WithString("importStatus", ImportStatusMapper::GetNameForImportStatus(m_importStatus));
127   }
128 
129   if(m_mergeStrategyHasBeenSet)
130   {
131    payload.WithString("mergeStrategy", MergeStrategyMapper::GetNameForMergeStrategy(m_mergeStrategy));
132   }
133 
134   if(m_creationDateTimeHasBeenSet)
135   {
136    payload.WithDouble("creationDateTime", m_creationDateTime.SecondsWithMSPrecision());
137   }
138 
139   if(m_lastUpdatedDateTimeHasBeenSet)
140   {
141    payload.WithDouble("lastUpdatedDateTime", m_lastUpdatedDateTime.SecondsWithMSPrecision());
142   }
143 
144   return payload;
145 }
146 
147 } // namespace Model
148 } // namespace LexModelsV2
149 } // namespace Aws
150