1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/rds/model/CreateDBClusterRequest.h>
7 #include <aws/core/utils/StringUtils.h>
8 #include <aws/core/utils/memory/stl/AWSStringStream.h>
9 
10 using namespace Aws::RDS::Model;
11 using namespace Aws::Utils;
12 
CreateDBClusterRequest()13 CreateDBClusterRequest::CreateDBClusterRequest() :
14     m_availabilityZonesHasBeenSet(false),
15     m_backupRetentionPeriod(0),
16     m_backupRetentionPeriodHasBeenSet(false),
17     m_characterSetNameHasBeenSet(false),
18     m_databaseNameHasBeenSet(false),
19     m_dBClusterIdentifierHasBeenSet(false),
20     m_dBClusterParameterGroupNameHasBeenSet(false),
21     m_vpcSecurityGroupIdsHasBeenSet(false),
22     m_dBSubnetGroupNameHasBeenSet(false),
23     m_engineHasBeenSet(false),
24     m_engineVersionHasBeenSet(false),
25     m_port(0),
26     m_portHasBeenSet(false),
27     m_masterUsernameHasBeenSet(false),
28     m_masterUserPasswordHasBeenSet(false),
29     m_optionGroupNameHasBeenSet(false),
30     m_preferredBackupWindowHasBeenSet(false),
31     m_preferredMaintenanceWindowHasBeenSet(false),
32     m_replicationSourceIdentifierHasBeenSet(false),
33     m_tagsHasBeenSet(false),
34     m_storageEncrypted(false),
35     m_storageEncryptedHasBeenSet(false),
36     m_kmsKeyIdHasBeenSet(false),
37     m_preSignedUrlHasBeenSet(false),
38     m_enableIAMDatabaseAuthentication(false),
39     m_enableIAMDatabaseAuthenticationHasBeenSet(false),
40     m_backtrackWindow(0),
41     m_backtrackWindowHasBeenSet(false),
42     m_enableCloudwatchLogsExportsHasBeenSet(false),
43     m_engineModeHasBeenSet(false),
44     m_scalingConfigurationHasBeenSet(false),
45     m_deletionProtection(false),
46     m_deletionProtectionHasBeenSet(false),
47     m_globalClusterIdentifierHasBeenSet(false),
48     m_enableHttpEndpoint(false),
49     m_enableHttpEndpointHasBeenSet(false),
50     m_copyTagsToSnapshot(false),
51     m_copyTagsToSnapshotHasBeenSet(false),
52     m_domainHasBeenSet(false),
53     m_domainIAMRoleNameHasBeenSet(false),
54     m_enableGlobalWriteForwarding(false),
55     m_enableGlobalWriteForwardingHasBeenSet(false),
56     m_sourceRegionHasBeenSet(false)
57 {
58 }
59 
SerializePayload() const60 Aws::String CreateDBClusterRequest::SerializePayload() const
61 {
62   Aws::StringStream ss;
63   ss << "Action=CreateDBCluster&";
64   if(m_availabilityZonesHasBeenSet)
65   {
66     unsigned availabilityZonesCount = 1;
67     for(auto& item : m_availabilityZones)
68     {
69       ss << "AvailabilityZones.member." << availabilityZonesCount << "="
70           << StringUtils::URLEncode(item.c_str()) << "&";
71       availabilityZonesCount++;
72     }
73   }
74 
75   if(m_backupRetentionPeriodHasBeenSet)
76   {
77     ss << "BackupRetentionPeriod=" << m_backupRetentionPeriod << "&";
78   }
79 
80   if(m_characterSetNameHasBeenSet)
81   {
82     ss << "CharacterSetName=" << StringUtils::URLEncode(m_characterSetName.c_str()) << "&";
83   }
84 
85   if(m_databaseNameHasBeenSet)
86   {
87     ss << "DatabaseName=" << StringUtils::URLEncode(m_databaseName.c_str()) << "&";
88   }
89 
90   if(m_dBClusterIdentifierHasBeenSet)
91   {
92     ss << "DBClusterIdentifier=" << StringUtils::URLEncode(m_dBClusterIdentifier.c_str()) << "&";
93   }
94 
95   if(m_dBClusterParameterGroupNameHasBeenSet)
96   {
97     ss << "DBClusterParameterGroupName=" << StringUtils::URLEncode(m_dBClusterParameterGroupName.c_str()) << "&";
98   }
99 
100   if(m_vpcSecurityGroupIdsHasBeenSet)
101   {
102     unsigned vpcSecurityGroupIdsCount = 1;
103     for(auto& item : m_vpcSecurityGroupIds)
104     {
105       ss << "VpcSecurityGroupIds.member." << vpcSecurityGroupIdsCount << "="
106           << StringUtils::URLEncode(item.c_str()) << "&";
107       vpcSecurityGroupIdsCount++;
108     }
109   }
110 
111   if(m_dBSubnetGroupNameHasBeenSet)
112   {
113     ss << "DBSubnetGroupName=" << StringUtils::URLEncode(m_dBSubnetGroupName.c_str()) << "&";
114   }
115 
116   if(m_engineHasBeenSet)
117   {
118     ss << "Engine=" << StringUtils::URLEncode(m_engine.c_str()) << "&";
119   }
120 
121   if(m_engineVersionHasBeenSet)
122   {
123     ss << "EngineVersion=" << StringUtils::URLEncode(m_engineVersion.c_str()) << "&";
124   }
125 
126   if(m_portHasBeenSet)
127   {
128     ss << "Port=" << m_port << "&";
129   }
130 
131   if(m_masterUsernameHasBeenSet)
132   {
133     ss << "MasterUsername=" << StringUtils::URLEncode(m_masterUsername.c_str()) << "&";
134   }
135 
136   if(m_masterUserPasswordHasBeenSet)
137   {
138     ss << "MasterUserPassword=" << StringUtils::URLEncode(m_masterUserPassword.c_str()) << "&";
139   }
140 
141   if(m_optionGroupNameHasBeenSet)
142   {
143     ss << "OptionGroupName=" << StringUtils::URLEncode(m_optionGroupName.c_str()) << "&";
144   }
145 
146   if(m_preferredBackupWindowHasBeenSet)
147   {
148     ss << "PreferredBackupWindow=" << StringUtils::URLEncode(m_preferredBackupWindow.c_str()) << "&";
149   }
150 
151   if(m_preferredMaintenanceWindowHasBeenSet)
152   {
153     ss << "PreferredMaintenanceWindow=" << StringUtils::URLEncode(m_preferredMaintenanceWindow.c_str()) << "&";
154   }
155 
156   if(m_replicationSourceIdentifierHasBeenSet)
157   {
158     ss << "ReplicationSourceIdentifier=" << StringUtils::URLEncode(m_replicationSourceIdentifier.c_str()) << "&";
159   }
160 
161   if(m_tagsHasBeenSet)
162   {
163     unsigned tagsCount = 1;
164     for(auto& item : m_tags)
165     {
166       item.OutputToStream(ss, "Tags.member.", tagsCount, "");
167       tagsCount++;
168     }
169   }
170 
171   if(m_storageEncryptedHasBeenSet)
172   {
173     ss << "StorageEncrypted=" << std::boolalpha << m_storageEncrypted << "&";
174   }
175 
176   if(m_kmsKeyIdHasBeenSet)
177   {
178     ss << "KmsKeyId=" << StringUtils::URLEncode(m_kmsKeyId.c_str()) << "&";
179   }
180 
181   if(m_preSignedUrlHasBeenSet)
182   {
183     ss << "PreSignedUrl=" << StringUtils::URLEncode(m_preSignedUrl.c_str()) << "&";
184   }
185 
186   if(m_enableIAMDatabaseAuthenticationHasBeenSet)
187   {
188     ss << "EnableIAMDatabaseAuthentication=" << std::boolalpha << m_enableIAMDatabaseAuthentication << "&";
189   }
190 
191   if(m_backtrackWindowHasBeenSet)
192   {
193     ss << "BacktrackWindow=" << m_backtrackWindow << "&";
194   }
195 
196   if(m_enableCloudwatchLogsExportsHasBeenSet)
197   {
198     unsigned enableCloudwatchLogsExportsCount = 1;
199     for(auto& item : m_enableCloudwatchLogsExports)
200     {
201       ss << "EnableCloudwatchLogsExports.member." << enableCloudwatchLogsExportsCount << "="
202           << StringUtils::URLEncode(item.c_str()) << "&";
203       enableCloudwatchLogsExportsCount++;
204     }
205   }
206 
207   if(m_engineModeHasBeenSet)
208   {
209     ss << "EngineMode=" << StringUtils::URLEncode(m_engineMode.c_str()) << "&";
210   }
211 
212   if(m_scalingConfigurationHasBeenSet)
213   {
214     m_scalingConfiguration.OutputToStream(ss, "ScalingConfiguration");
215   }
216 
217   if(m_deletionProtectionHasBeenSet)
218   {
219     ss << "DeletionProtection=" << std::boolalpha << m_deletionProtection << "&";
220   }
221 
222   if(m_globalClusterIdentifierHasBeenSet)
223   {
224     ss << "GlobalClusterIdentifier=" << StringUtils::URLEncode(m_globalClusterIdentifier.c_str()) << "&";
225   }
226 
227   if(m_enableHttpEndpointHasBeenSet)
228   {
229     ss << "EnableHttpEndpoint=" << std::boolalpha << m_enableHttpEndpoint << "&";
230   }
231 
232   if(m_copyTagsToSnapshotHasBeenSet)
233   {
234     ss << "CopyTagsToSnapshot=" << std::boolalpha << m_copyTagsToSnapshot << "&";
235   }
236 
237   if(m_domainHasBeenSet)
238   {
239     ss << "Domain=" << StringUtils::URLEncode(m_domain.c_str()) << "&";
240   }
241 
242   if(m_domainIAMRoleNameHasBeenSet)
243   {
244     ss << "DomainIAMRoleName=" << StringUtils::URLEncode(m_domainIAMRoleName.c_str()) << "&";
245   }
246 
247   if(m_enableGlobalWriteForwardingHasBeenSet)
248   {
249     ss << "EnableGlobalWriteForwarding=" << std::boolalpha << m_enableGlobalWriteForwarding << "&";
250   }
251 
252   ss << "Version=2014-10-31";
253   return ss.str();
254 }
255 
256 
DumpBodyToUrl(Aws::Http::URI & uri) const257 void  CreateDBClusterRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
258 {
259   uri.SetQueryString(SerializePayload());
260 }
261