1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/docdb/model/CreateDBClusterRequest.h>
7 #include <aws/core/utils/StringUtils.h>
8 #include <aws/core/utils/memory/stl/AWSStringStream.h>
9 
10 using namespace Aws::DocDB::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_dBClusterIdentifierHasBeenSet(false),
18     m_dBClusterParameterGroupNameHasBeenSet(false),
19     m_vpcSecurityGroupIdsHasBeenSet(false),
20     m_dBSubnetGroupNameHasBeenSet(false),
21     m_engineHasBeenSet(false),
22     m_engineVersionHasBeenSet(false),
23     m_port(0),
24     m_portHasBeenSet(false),
25     m_masterUsernameHasBeenSet(false),
26     m_masterUserPasswordHasBeenSet(false),
27     m_preferredBackupWindowHasBeenSet(false),
28     m_preferredMaintenanceWindowHasBeenSet(false),
29     m_tagsHasBeenSet(false),
30     m_storageEncrypted(false),
31     m_storageEncryptedHasBeenSet(false),
32     m_kmsKeyIdHasBeenSet(false),
33     m_preSignedUrlHasBeenSet(false),
34     m_enableCloudwatchLogsExportsHasBeenSet(false),
35     m_deletionProtection(false),
36     m_deletionProtectionHasBeenSet(false),
37     m_globalClusterIdentifierHasBeenSet(false),
38     m_sourceRegionHasBeenSet(false)
39 {
40 }
41 
SerializePayload() const42 Aws::String CreateDBClusterRequest::SerializePayload() const
43 {
44   Aws::StringStream ss;
45   ss << "Action=CreateDBCluster&";
46   if(m_availabilityZonesHasBeenSet)
47   {
48     unsigned availabilityZonesCount = 1;
49     for(auto& item : m_availabilityZones)
50     {
51       ss << "AvailabilityZones.member." << availabilityZonesCount << "="
52           << StringUtils::URLEncode(item.c_str()) << "&";
53       availabilityZonesCount++;
54     }
55   }
56 
57   if(m_backupRetentionPeriodHasBeenSet)
58   {
59     ss << "BackupRetentionPeriod=" << m_backupRetentionPeriod << "&";
60   }
61 
62   if(m_dBClusterIdentifierHasBeenSet)
63   {
64     ss << "DBClusterIdentifier=" << StringUtils::URLEncode(m_dBClusterIdentifier.c_str()) << "&";
65   }
66 
67   if(m_dBClusterParameterGroupNameHasBeenSet)
68   {
69     ss << "DBClusterParameterGroupName=" << StringUtils::URLEncode(m_dBClusterParameterGroupName.c_str()) << "&";
70   }
71 
72   if(m_vpcSecurityGroupIdsHasBeenSet)
73   {
74     unsigned vpcSecurityGroupIdsCount = 1;
75     for(auto& item : m_vpcSecurityGroupIds)
76     {
77       ss << "VpcSecurityGroupIds.member." << vpcSecurityGroupIdsCount << "="
78           << StringUtils::URLEncode(item.c_str()) << "&";
79       vpcSecurityGroupIdsCount++;
80     }
81   }
82 
83   if(m_dBSubnetGroupNameHasBeenSet)
84   {
85     ss << "DBSubnetGroupName=" << StringUtils::URLEncode(m_dBSubnetGroupName.c_str()) << "&";
86   }
87 
88   if(m_engineHasBeenSet)
89   {
90     ss << "Engine=" << StringUtils::URLEncode(m_engine.c_str()) << "&";
91   }
92 
93   if(m_engineVersionHasBeenSet)
94   {
95     ss << "EngineVersion=" << StringUtils::URLEncode(m_engineVersion.c_str()) << "&";
96   }
97 
98   if(m_portHasBeenSet)
99   {
100     ss << "Port=" << m_port << "&";
101   }
102 
103   if(m_masterUsernameHasBeenSet)
104   {
105     ss << "MasterUsername=" << StringUtils::URLEncode(m_masterUsername.c_str()) << "&";
106   }
107 
108   if(m_masterUserPasswordHasBeenSet)
109   {
110     ss << "MasterUserPassword=" << StringUtils::URLEncode(m_masterUserPassword.c_str()) << "&";
111   }
112 
113   if(m_preferredBackupWindowHasBeenSet)
114   {
115     ss << "PreferredBackupWindow=" << StringUtils::URLEncode(m_preferredBackupWindow.c_str()) << "&";
116   }
117 
118   if(m_preferredMaintenanceWindowHasBeenSet)
119   {
120     ss << "PreferredMaintenanceWindow=" << StringUtils::URLEncode(m_preferredMaintenanceWindow.c_str()) << "&";
121   }
122 
123   if(m_tagsHasBeenSet)
124   {
125     unsigned tagsCount = 1;
126     for(auto& item : m_tags)
127     {
128       item.OutputToStream(ss, "Tags.member.", tagsCount, "");
129       tagsCount++;
130     }
131   }
132 
133   if(m_storageEncryptedHasBeenSet)
134   {
135     ss << "StorageEncrypted=" << std::boolalpha << m_storageEncrypted << "&";
136   }
137 
138   if(m_kmsKeyIdHasBeenSet)
139   {
140     ss << "KmsKeyId=" << StringUtils::URLEncode(m_kmsKeyId.c_str()) << "&";
141   }
142 
143   if(m_preSignedUrlHasBeenSet)
144   {
145     ss << "PreSignedUrl=" << StringUtils::URLEncode(m_preSignedUrl.c_str()) << "&";
146   }
147 
148   if(m_enableCloudwatchLogsExportsHasBeenSet)
149   {
150     unsigned enableCloudwatchLogsExportsCount = 1;
151     for(auto& item : m_enableCloudwatchLogsExports)
152     {
153       ss << "EnableCloudwatchLogsExports.member." << enableCloudwatchLogsExportsCount << "="
154           << StringUtils::URLEncode(item.c_str()) << "&";
155       enableCloudwatchLogsExportsCount++;
156     }
157   }
158 
159   if(m_deletionProtectionHasBeenSet)
160   {
161     ss << "DeletionProtection=" << std::boolalpha << m_deletionProtection << "&";
162   }
163 
164   if(m_globalClusterIdentifierHasBeenSet)
165   {
166     ss << "GlobalClusterIdentifier=" << StringUtils::URLEncode(m_globalClusterIdentifier.c_str()) << "&";
167   }
168 
169   ss << "Version=2014-10-31";
170   return ss.str();
171 }
172 
173 
DumpBodyToUrl(Aws::Http::URI & uri) const174 void  CreateDBClusterRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
175 {
176   uri.SetQueryString(SerializePayload());
177 }
178