1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/securityhub/model/AwsCodeBuildProjectDetails.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 SecurityHub
17 {
18 namespace Model
19 {
20
AwsCodeBuildProjectDetails()21 AwsCodeBuildProjectDetails::AwsCodeBuildProjectDetails() :
22 m_encryptionKeyHasBeenSet(false),
23 m_artifactsHasBeenSet(false),
24 m_environmentHasBeenSet(false),
25 m_nameHasBeenSet(false),
26 m_sourceHasBeenSet(false),
27 m_serviceRoleHasBeenSet(false),
28 m_logsConfigHasBeenSet(false),
29 m_vpcConfigHasBeenSet(false)
30 {
31 }
32
AwsCodeBuildProjectDetails(JsonView jsonValue)33 AwsCodeBuildProjectDetails::AwsCodeBuildProjectDetails(JsonView jsonValue) :
34 m_encryptionKeyHasBeenSet(false),
35 m_artifactsHasBeenSet(false),
36 m_environmentHasBeenSet(false),
37 m_nameHasBeenSet(false),
38 m_sourceHasBeenSet(false),
39 m_serviceRoleHasBeenSet(false),
40 m_logsConfigHasBeenSet(false),
41 m_vpcConfigHasBeenSet(false)
42 {
43 *this = jsonValue;
44 }
45
operator =(JsonView jsonValue)46 AwsCodeBuildProjectDetails& AwsCodeBuildProjectDetails::operator =(JsonView jsonValue)
47 {
48 if(jsonValue.ValueExists("EncryptionKey"))
49 {
50 m_encryptionKey = jsonValue.GetString("EncryptionKey");
51
52 m_encryptionKeyHasBeenSet = true;
53 }
54
55 if(jsonValue.ValueExists("Artifacts"))
56 {
57 Array<JsonView> artifactsJsonList = jsonValue.GetArray("Artifacts");
58 for(unsigned artifactsIndex = 0; artifactsIndex < artifactsJsonList.GetLength(); ++artifactsIndex)
59 {
60 m_artifacts.push_back(artifactsJsonList[artifactsIndex].AsObject());
61 }
62 m_artifactsHasBeenSet = true;
63 }
64
65 if(jsonValue.ValueExists("Environment"))
66 {
67 m_environment = jsonValue.GetObject("Environment");
68
69 m_environmentHasBeenSet = true;
70 }
71
72 if(jsonValue.ValueExists("Name"))
73 {
74 m_name = jsonValue.GetString("Name");
75
76 m_nameHasBeenSet = true;
77 }
78
79 if(jsonValue.ValueExists("Source"))
80 {
81 m_source = jsonValue.GetObject("Source");
82
83 m_sourceHasBeenSet = true;
84 }
85
86 if(jsonValue.ValueExists("ServiceRole"))
87 {
88 m_serviceRole = jsonValue.GetString("ServiceRole");
89
90 m_serviceRoleHasBeenSet = true;
91 }
92
93 if(jsonValue.ValueExists("LogsConfig"))
94 {
95 m_logsConfig = jsonValue.GetObject("LogsConfig");
96
97 m_logsConfigHasBeenSet = true;
98 }
99
100 if(jsonValue.ValueExists("VpcConfig"))
101 {
102 m_vpcConfig = jsonValue.GetObject("VpcConfig");
103
104 m_vpcConfigHasBeenSet = true;
105 }
106
107 return *this;
108 }
109
Jsonize() const110 JsonValue AwsCodeBuildProjectDetails::Jsonize() const
111 {
112 JsonValue payload;
113
114 if(m_encryptionKeyHasBeenSet)
115 {
116 payload.WithString("EncryptionKey", m_encryptionKey);
117
118 }
119
120 if(m_artifactsHasBeenSet)
121 {
122 Array<JsonValue> artifactsJsonList(m_artifacts.size());
123 for(unsigned artifactsIndex = 0; artifactsIndex < artifactsJsonList.GetLength(); ++artifactsIndex)
124 {
125 artifactsJsonList[artifactsIndex].AsObject(m_artifacts[artifactsIndex].Jsonize());
126 }
127 payload.WithArray("Artifacts", std::move(artifactsJsonList));
128
129 }
130
131 if(m_environmentHasBeenSet)
132 {
133 payload.WithObject("Environment", m_environment.Jsonize());
134
135 }
136
137 if(m_nameHasBeenSet)
138 {
139 payload.WithString("Name", m_name);
140
141 }
142
143 if(m_sourceHasBeenSet)
144 {
145 payload.WithObject("Source", m_source.Jsonize());
146
147 }
148
149 if(m_serviceRoleHasBeenSet)
150 {
151 payload.WithString("ServiceRole", m_serviceRole);
152
153 }
154
155 if(m_logsConfigHasBeenSet)
156 {
157 payload.WithObject("LogsConfig", m_logsConfig.Jsonize());
158
159 }
160
161 if(m_vpcConfigHasBeenSet)
162 {
163 payload.WithObject("VpcConfig", m_vpcConfig.Jsonize());
164
165 }
166
167 return payload;
168 }
169
170 } // namespace Model
171 } // namespace SecurityHub
172 } // namespace Aws
173