1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/firehose/model/RedshiftDestinationConfiguration.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 Firehose
17 {
18 namespace Model
19 {
20 
RedshiftDestinationConfiguration()21 RedshiftDestinationConfiguration::RedshiftDestinationConfiguration() :
22     m_roleARNHasBeenSet(false),
23     m_clusterJDBCURLHasBeenSet(false),
24     m_copyCommandHasBeenSet(false),
25     m_usernameHasBeenSet(false),
26     m_passwordHasBeenSet(false),
27     m_retryOptionsHasBeenSet(false),
28     m_s3ConfigurationHasBeenSet(false),
29     m_processingConfigurationHasBeenSet(false),
30     m_s3BackupMode(RedshiftS3BackupMode::NOT_SET),
31     m_s3BackupModeHasBeenSet(false),
32     m_s3BackupConfigurationHasBeenSet(false),
33     m_cloudWatchLoggingOptionsHasBeenSet(false)
34 {
35 }
36 
RedshiftDestinationConfiguration(JsonView jsonValue)37 RedshiftDestinationConfiguration::RedshiftDestinationConfiguration(JsonView jsonValue) :
38     m_roleARNHasBeenSet(false),
39     m_clusterJDBCURLHasBeenSet(false),
40     m_copyCommandHasBeenSet(false),
41     m_usernameHasBeenSet(false),
42     m_passwordHasBeenSet(false),
43     m_retryOptionsHasBeenSet(false),
44     m_s3ConfigurationHasBeenSet(false),
45     m_processingConfigurationHasBeenSet(false),
46     m_s3BackupMode(RedshiftS3BackupMode::NOT_SET),
47     m_s3BackupModeHasBeenSet(false),
48     m_s3BackupConfigurationHasBeenSet(false),
49     m_cloudWatchLoggingOptionsHasBeenSet(false)
50 {
51   *this = jsonValue;
52 }
53 
operator =(JsonView jsonValue)54 RedshiftDestinationConfiguration& RedshiftDestinationConfiguration::operator =(JsonView jsonValue)
55 {
56   if(jsonValue.ValueExists("RoleARN"))
57   {
58     m_roleARN = jsonValue.GetString("RoleARN");
59 
60     m_roleARNHasBeenSet = true;
61   }
62 
63   if(jsonValue.ValueExists("ClusterJDBCURL"))
64   {
65     m_clusterJDBCURL = jsonValue.GetString("ClusterJDBCURL");
66 
67     m_clusterJDBCURLHasBeenSet = true;
68   }
69 
70   if(jsonValue.ValueExists("CopyCommand"))
71   {
72     m_copyCommand = jsonValue.GetObject("CopyCommand");
73 
74     m_copyCommandHasBeenSet = true;
75   }
76 
77   if(jsonValue.ValueExists("Username"))
78   {
79     m_username = jsonValue.GetString("Username");
80 
81     m_usernameHasBeenSet = true;
82   }
83 
84   if(jsonValue.ValueExists("Password"))
85   {
86     m_password = jsonValue.GetString("Password");
87 
88     m_passwordHasBeenSet = true;
89   }
90 
91   if(jsonValue.ValueExists("RetryOptions"))
92   {
93     m_retryOptions = jsonValue.GetObject("RetryOptions");
94 
95     m_retryOptionsHasBeenSet = true;
96   }
97 
98   if(jsonValue.ValueExists("S3Configuration"))
99   {
100     m_s3Configuration = jsonValue.GetObject("S3Configuration");
101 
102     m_s3ConfigurationHasBeenSet = true;
103   }
104 
105   if(jsonValue.ValueExists("ProcessingConfiguration"))
106   {
107     m_processingConfiguration = jsonValue.GetObject("ProcessingConfiguration");
108 
109     m_processingConfigurationHasBeenSet = true;
110   }
111 
112   if(jsonValue.ValueExists("S3BackupMode"))
113   {
114     m_s3BackupMode = RedshiftS3BackupModeMapper::GetRedshiftS3BackupModeForName(jsonValue.GetString("S3BackupMode"));
115 
116     m_s3BackupModeHasBeenSet = true;
117   }
118 
119   if(jsonValue.ValueExists("S3BackupConfiguration"))
120   {
121     m_s3BackupConfiguration = jsonValue.GetObject("S3BackupConfiguration");
122 
123     m_s3BackupConfigurationHasBeenSet = true;
124   }
125 
126   if(jsonValue.ValueExists("CloudWatchLoggingOptions"))
127   {
128     m_cloudWatchLoggingOptions = jsonValue.GetObject("CloudWatchLoggingOptions");
129 
130     m_cloudWatchLoggingOptionsHasBeenSet = true;
131   }
132 
133   return *this;
134 }
135 
Jsonize() const136 JsonValue RedshiftDestinationConfiguration::Jsonize() const
137 {
138   JsonValue payload;
139 
140   if(m_roleARNHasBeenSet)
141   {
142    payload.WithString("RoleARN", m_roleARN);
143 
144   }
145 
146   if(m_clusterJDBCURLHasBeenSet)
147   {
148    payload.WithString("ClusterJDBCURL", m_clusterJDBCURL);
149 
150   }
151 
152   if(m_copyCommandHasBeenSet)
153   {
154    payload.WithObject("CopyCommand", m_copyCommand.Jsonize());
155 
156   }
157 
158   if(m_usernameHasBeenSet)
159   {
160    payload.WithString("Username", m_username);
161 
162   }
163 
164   if(m_passwordHasBeenSet)
165   {
166    payload.WithString("Password", m_password);
167 
168   }
169 
170   if(m_retryOptionsHasBeenSet)
171   {
172    payload.WithObject("RetryOptions", m_retryOptions.Jsonize());
173 
174   }
175 
176   if(m_s3ConfigurationHasBeenSet)
177   {
178    payload.WithObject("S3Configuration", m_s3Configuration.Jsonize());
179 
180   }
181 
182   if(m_processingConfigurationHasBeenSet)
183   {
184    payload.WithObject("ProcessingConfiguration", m_processingConfiguration.Jsonize());
185 
186   }
187 
188   if(m_s3BackupModeHasBeenSet)
189   {
190    payload.WithString("S3BackupMode", RedshiftS3BackupModeMapper::GetNameForRedshiftS3BackupMode(m_s3BackupMode));
191   }
192 
193   if(m_s3BackupConfigurationHasBeenSet)
194   {
195    payload.WithObject("S3BackupConfiguration", m_s3BackupConfiguration.Jsonize());
196 
197   }
198 
199   if(m_cloudWatchLoggingOptionsHasBeenSet)
200   {
201    payload.WithObject("CloudWatchLoggingOptions", m_cloudWatchLoggingOptions.Jsonize());
202 
203   }
204 
205   return payload;
206 }
207 
208 } // namespace Model
209 } // namespace Firehose
210 } // namespace Aws
211