1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/wisdom/model/AssistantData.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 ConnectWisdomService
17 {
18 namespace Model
19 {
20
AssistantData()21 AssistantData::AssistantData() :
22 m_assistantArnHasBeenSet(false),
23 m_assistantIdHasBeenSet(false),
24 m_descriptionHasBeenSet(false),
25 m_nameHasBeenSet(false),
26 m_serverSideEncryptionConfigurationHasBeenSet(false),
27 m_status(AssistantStatus::NOT_SET),
28 m_statusHasBeenSet(false),
29 m_tagsHasBeenSet(false),
30 m_type(AssistantType::NOT_SET),
31 m_typeHasBeenSet(false)
32 {
33 }
34
AssistantData(JsonView jsonValue)35 AssistantData::AssistantData(JsonView jsonValue) :
36 m_assistantArnHasBeenSet(false),
37 m_assistantIdHasBeenSet(false),
38 m_descriptionHasBeenSet(false),
39 m_nameHasBeenSet(false),
40 m_serverSideEncryptionConfigurationHasBeenSet(false),
41 m_status(AssistantStatus::NOT_SET),
42 m_statusHasBeenSet(false),
43 m_tagsHasBeenSet(false),
44 m_type(AssistantType::NOT_SET),
45 m_typeHasBeenSet(false)
46 {
47 *this = jsonValue;
48 }
49
operator =(JsonView jsonValue)50 AssistantData& AssistantData::operator =(JsonView jsonValue)
51 {
52 if(jsonValue.ValueExists("assistantArn"))
53 {
54 m_assistantArn = jsonValue.GetString("assistantArn");
55
56 m_assistantArnHasBeenSet = true;
57 }
58
59 if(jsonValue.ValueExists("assistantId"))
60 {
61 m_assistantId = jsonValue.GetString("assistantId");
62
63 m_assistantIdHasBeenSet = true;
64 }
65
66 if(jsonValue.ValueExists("description"))
67 {
68 m_description = jsonValue.GetString("description");
69
70 m_descriptionHasBeenSet = true;
71 }
72
73 if(jsonValue.ValueExists("name"))
74 {
75 m_name = jsonValue.GetString("name");
76
77 m_nameHasBeenSet = true;
78 }
79
80 if(jsonValue.ValueExists("serverSideEncryptionConfiguration"))
81 {
82 m_serverSideEncryptionConfiguration = jsonValue.GetObject("serverSideEncryptionConfiguration");
83
84 m_serverSideEncryptionConfigurationHasBeenSet = true;
85 }
86
87 if(jsonValue.ValueExists("status"))
88 {
89 m_status = AssistantStatusMapper::GetAssistantStatusForName(jsonValue.GetString("status"));
90
91 m_statusHasBeenSet = true;
92 }
93
94 if(jsonValue.ValueExists("tags"))
95 {
96 Aws::Map<Aws::String, JsonView> tagsJsonMap = jsonValue.GetObject("tags").GetAllObjects();
97 for(auto& tagsItem : tagsJsonMap)
98 {
99 m_tags[tagsItem.first] = tagsItem.second.AsString();
100 }
101 m_tagsHasBeenSet = true;
102 }
103
104 if(jsonValue.ValueExists("type"))
105 {
106 m_type = AssistantTypeMapper::GetAssistantTypeForName(jsonValue.GetString("type"));
107
108 m_typeHasBeenSet = true;
109 }
110
111 return *this;
112 }
113
Jsonize() const114 JsonValue AssistantData::Jsonize() const
115 {
116 JsonValue payload;
117
118 if(m_assistantArnHasBeenSet)
119 {
120 payload.WithString("assistantArn", m_assistantArn);
121
122 }
123
124 if(m_assistantIdHasBeenSet)
125 {
126 payload.WithString("assistantId", m_assistantId);
127
128 }
129
130 if(m_descriptionHasBeenSet)
131 {
132 payload.WithString("description", m_description);
133
134 }
135
136 if(m_nameHasBeenSet)
137 {
138 payload.WithString("name", m_name);
139
140 }
141
142 if(m_serverSideEncryptionConfigurationHasBeenSet)
143 {
144 payload.WithObject("serverSideEncryptionConfiguration", m_serverSideEncryptionConfiguration.Jsonize());
145
146 }
147
148 if(m_statusHasBeenSet)
149 {
150 payload.WithString("status", AssistantStatusMapper::GetNameForAssistantStatus(m_status));
151 }
152
153 if(m_tagsHasBeenSet)
154 {
155 JsonValue tagsJsonMap;
156 for(auto& tagsItem : m_tags)
157 {
158 tagsJsonMap.WithString(tagsItem.first, tagsItem.second);
159 }
160 payload.WithObject("tags", std::move(tagsJsonMap));
161
162 }
163
164 if(m_typeHasBeenSet)
165 {
166 payload.WithString("type", AssistantTypeMapper::GetNameForAssistantType(m_type));
167 }
168
169 return payload;
170 }
171
172 } // namespace Model
173 } // namespace ConnectWisdomService
174 } // namespace Aws
175