1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/amplify/model/AutoBranchCreationConfig.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 Amplify
17 {
18 namespace Model
19 {
20
AutoBranchCreationConfig()21 AutoBranchCreationConfig::AutoBranchCreationConfig() :
22 m_stage(Stage::NOT_SET),
23 m_stageHasBeenSet(false),
24 m_frameworkHasBeenSet(false),
25 m_enableAutoBuild(false),
26 m_enableAutoBuildHasBeenSet(false),
27 m_environmentVariablesHasBeenSet(false),
28 m_basicAuthCredentialsHasBeenSet(false),
29 m_enableBasicAuth(false),
30 m_enableBasicAuthHasBeenSet(false),
31 m_enablePerformanceMode(false),
32 m_enablePerformanceModeHasBeenSet(false),
33 m_buildSpecHasBeenSet(false),
34 m_enablePullRequestPreview(false),
35 m_enablePullRequestPreviewHasBeenSet(false),
36 m_pullRequestEnvironmentNameHasBeenSet(false)
37 {
38 }
39
AutoBranchCreationConfig(JsonView jsonValue)40 AutoBranchCreationConfig::AutoBranchCreationConfig(JsonView jsonValue) :
41 m_stage(Stage::NOT_SET),
42 m_stageHasBeenSet(false),
43 m_frameworkHasBeenSet(false),
44 m_enableAutoBuild(false),
45 m_enableAutoBuildHasBeenSet(false),
46 m_environmentVariablesHasBeenSet(false),
47 m_basicAuthCredentialsHasBeenSet(false),
48 m_enableBasicAuth(false),
49 m_enableBasicAuthHasBeenSet(false),
50 m_enablePerformanceMode(false),
51 m_enablePerformanceModeHasBeenSet(false),
52 m_buildSpecHasBeenSet(false),
53 m_enablePullRequestPreview(false),
54 m_enablePullRequestPreviewHasBeenSet(false),
55 m_pullRequestEnvironmentNameHasBeenSet(false)
56 {
57 *this = jsonValue;
58 }
59
operator =(JsonView jsonValue)60 AutoBranchCreationConfig& AutoBranchCreationConfig::operator =(JsonView jsonValue)
61 {
62 if(jsonValue.ValueExists("stage"))
63 {
64 m_stage = StageMapper::GetStageForName(jsonValue.GetString("stage"));
65
66 m_stageHasBeenSet = true;
67 }
68
69 if(jsonValue.ValueExists("framework"))
70 {
71 m_framework = jsonValue.GetString("framework");
72
73 m_frameworkHasBeenSet = true;
74 }
75
76 if(jsonValue.ValueExists("enableAutoBuild"))
77 {
78 m_enableAutoBuild = jsonValue.GetBool("enableAutoBuild");
79
80 m_enableAutoBuildHasBeenSet = true;
81 }
82
83 if(jsonValue.ValueExists("environmentVariables"))
84 {
85 Aws::Map<Aws::String, JsonView> environmentVariablesJsonMap = jsonValue.GetObject("environmentVariables").GetAllObjects();
86 for(auto& environmentVariablesItem : environmentVariablesJsonMap)
87 {
88 m_environmentVariables[environmentVariablesItem.first] = environmentVariablesItem.second.AsString();
89 }
90 m_environmentVariablesHasBeenSet = true;
91 }
92
93 if(jsonValue.ValueExists("basicAuthCredentials"))
94 {
95 m_basicAuthCredentials = jsonValue.GetString("basicAuthCredentials");
96
97 m_basicAuthCredentialsHasBeenSet = true;
98 }
99
100 if(jsonValue.ValueExists("enableBasicAuth"))
101 {
102 m_enableBasicAuth = jsonValue.GetBool("enableBasicAuth");
103
104 m_enableBasicAuthHasBeenSet = true;
105 }
106
107 if(jsonValue.ValueExists("enablePerformanceMode"))
108 {
109 m_enablePerformanceMode = jsonValue.GetBool("enablePerformanceMode");
110
111 m_enablePerformanceModeHasBeenSet = true;
112 }
113
114 if(jsonValue.ValueExists("buildSpec"))
115 {
116 m_buildSpec = jsonValue.GetString("buildSpec");
117
118 m_buildSpecHasBeenSet = true;
119 }
120
121 if(jsonValue.ValueExists("enablePullRequestPreview"))
122 {
123 m_enablePullRequestPreview = jsonValue.GetBool("enablePullRequestPreview");
124
125 m_enablePullRequestPreviewHasBeenSet = true;
126 }
127
128 if(jsonValue.ValueExists("pullRequestEnvironmentName"))
129 {
130 m_pullRequestEnvironmentName = jsonValue.GetString("pullRequestEnvironmentName");
131
132 m_pullRequestEnvironmentNameHasBeenSet = true;
133 }
134
135 return *this;
136 }
137
Jsonize() const138 JsonValue AutoBranchCreationConfig::Jsonize() const
139 {
140 JsonValue payload;
141
142 if(m_stageHasBeenSet)
143 {
144 payload.WithString("stage", StageMapper::GetNameForStage(m_stage));
145 }
146
147 if(m_frameworkHasBeenSet)
148 {
149 payload.WithString("framework", m_framework);
150
151 }
152
153 if(m_enableAutoBuildHasBeenSet)
154 {
155 payload.WithBool("enableAutoBuild", m_enableAutoBuild);
156
157 }
158
159 if(m_environmentVariablesHasBeenSet)
160 {
161 JsonValue environmentVariablesJsonMap;
162 for(auto& environmentVariablesItem : m_environmentVariables)
163 {
164 environmentVariablesJsonMap.WithString(environmentVariablesItem.first, environmentVariablesItem.second);
165 }
166 payload.WithObject("environmentVariables", std::move(environmentVariablesJsonMap));
167
168 }
169
170 if(m_basicAuthCredentialsHasBeenSet)
171 {
172 payload.WithString("basicAuthCredentials", m_basicAuthCredentials);
173
174 }
175
176 if(m_enableBasicAuthHasBeenSet)
177 {
178 payload.WithBool("enableBasicAuth", m_enableBasicAuth);
179
180 }
181
182 if(m_enablePerformanceModeHasBeenSet)
183 {
184 payload.WithBool("enablePerformanceMode", m_enablePerformanceMode);
185
186 }
187
188 if(m_buildSpecHasBeenSet)
189 {
190 payload.WithString("buildSpec", m_buildSpec);
191
192 }
193
194 if(m_enablePullRequestPreviewHasBeenSet)
195 {
196 payload.WithBool("enablePullRequestPreview", m_enablePullRequestPreview);
197
198 }
199
200 if(m_pullRequestEnvironmentNameHasBeenSet)
201 {
202 payload.WithString("pullRequestEnvironmentName", m_pullRequestEnvironmentName);
203
204 }
205
206 return payload;
207 }
208
209 } // namespace Model
210 } // namespace Amplify
211 } // namespace Aws
212