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/RestoreDBInstanceFromDBSnapshotRequest.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 
RestoreDBInstanceFromDBSnapshotRequest()13 RestoreDBInstanceFromDBSnapshotRequest::RestoreDBInstanceFromDBSnapshotRequest() :
14     m_dBInstanceIdentifierHasBeenSet(false),
15     m_dBSnapshotIdentifierHasBeenSet(false),
16     m_dBInstanceClassHasBeenSet(false),
17     m_port(0),
18     m_portHasBeenSet(false),
19     m_availabilityZoneHasBeenSet(false),
20     m_dBSubnetGroupNameHasBeenSet(false),
21     m_multiAZ(false),
22     m_multiAZHasBeenSet(false),
23     m_publiclyAccessible(false),
24     m_publiclyAccessibleHasBeenSet(false),
25     m_autoMinorVersionUpgrade(false),
26     m_autoMinorVersionUpgradeHasBeenSet(false),
27     m_licenseModelHasBeenSet(false),
28     m_dBNameHasBeenSet(false),
29     m_engineHasBeenSet(false),
30     m_iops(0),
31     m_iopsHasBeenSet(false),
32     m_optionGroupNameHasBeenSet(false),
33     m_tagsHasBeenSet(false),
34     m_storageTypeHasBeenSet(false),
35     m_tdeCredentialArnHasBeenSet(false),
36     m_tdeCredentialPasswordHasBeenSet(false),
37     m_vpcSecurityGroupIdsHasBeenSet(false),
38     m_domainHasBeenSet(false),
39     m_copyTagsToSnapshot(false),
40     m_copyTagsToSnapshotHasBeenSet(false),
41     m_domainIAMRoleNameHasBeenSet(false),
42     m_enableIAMDatabaseAuthentication(false),
43     m_enableIAMDatabaseAuthenticationHasBeenSet(false),
44     m_enableCloudwatchLogsExportsHasBeenSet(false),
45     m_processorFeaturesHasBeenSet(false),
46     m_useDefaultProcessorFeatures(false),
47     m_useDefaultProcessorFeaturesHasBeenSet(false),
48     m_dBParameterGroupNameHasBeenSet(false),
49     m_deletionProtection(false),
50     m_deletionProtectionHasBeenSet(false),
51     m_enableCustomerOwnedIp(false),
52     m_enableCustomerOwnedIpHasBeenSet(false)
53 {
54 }
55 
SerializePayload() const56 Aws::String RestoreDBInstanceFromDBSnapshotRequest::SerializePayload() const
57 {
58   Aws::StringStream ss;
59   ss << "Action=RestoreDBInstanceFromDBSnapshot&";
60   if(m_dBInstanceIdentifierHasBeenSet)
61   {
62     ss << "DBInstanceIdentifier=" << StringUtils::URLEncode(m_dBInstanceIdentifier.c_str()) << "&";
63   }
64 
65   if(m_dBSnapshotIdentifierHasBeenSet)
66   {
67     ss << "DBSnapshotIdentifier=" << StringUtils::URLEncode(m_dBSnapshotIdentifier.c_str()) << "&";
68   }
69 
70   if(m_dBInstanceClassHasBeenSet)
71   {
72     ss << "DBInstanceClass=" << StringUtils::URLEncode(m_dBInstanceClass.c_str()) << "&";
73   }
74 
75   if(m_portHasBeenSet)
76   {
77     ss << "Port=" << m_port << "&";
78   }
79 
80   if(m_availabilityZoneHasBeenSet)
81   {
82     ss << "AvailabilityZone=" << StringUtils::URLEncode(m_availabilityZone.c_str()) << "&";
83   }
84 
85   if(m_dBSubnetGroupNameHasBeenSet)
86   {
87     ss << "DBSubnetGroupName=" << StringUtils::URLEncode(m_dBSubnetGroupName.c_str()) << "&";
88   }
89 
90   if(m_multiAZHasBeenSet)
91   {
92     ss << "MultiAZ=" << std::boolalpha << m_multiAZ << "&";
93   }
94 
95   if(m_publiclyAccessibleHasBeenSet)
96   {
97     ss << "PubliclyAccessible=" << std::boolalpha << m_publiclyAccessible << "&";
98   }
99 
100   if(m_autoMinorVersionUpgradeHasBeenSet)
101   {
102     ss << "AutoMinorVersionUpgrade=" << std::boolalpha << m_autoMinorVersionUpgrade << "&";
103   }
104 
105   if(m_licenseModelHasBeenSet)
106   {
107     ss << "LicenseModel=" << StringUtils::URLEncode(m_licenseModel.c_str()) << "&";
108   }
109 
110   if(m_dBNameHasBeenSet)
111   {
112     ss << "DBName=" << StringUtils::URLEncode(m_dBName.c_str()) << "&";
113   }
114 
115   if(m_engineHasBeenSet)
116   {
117     ss << "Engine=" << StringUtils::URLEncode(m_engine.c_str()) << "&";
118   }
119 
120   if(m_iopsHasBeenSet)
121   {
122     ss << "Iops=" << m_iops << "&";
123   }
124 
125   if(m_optionGroupNameHasBeenSet)
126   {
127     ss << "OptionGroupName=" << StringUtils::URLEncode(m_optionGroupName.c_str()) << "&";
128   }
129 
130   if(m_tagsHasBeenSet)
131   {
132     unsigned tagsCount = 1;
133     for(auto& item : m_tags)
134     {
135       item.OutputToStream(ss, "Tags.member.", tagsCount, "");
136       tagsCount++;
137     }
138   }
139 
140   if(m_storageTypeHasBeenSet)
141   {
142     ss << "StorageType=" << StringUtils::URLEncode(m_storageType.c_str()) << "&";
143   }
144 
145   if(m_tdeCredentialArnHasBeenSet)
146   {
147     ss << "TdeCredentialArn=" << StringUtils::URLEncode(m_tdeCredentialArn.c_str()) << "&";
148   }
149 
150   if(m_tdeCredentialPasswordHasBeenSet)
151   {
152     ss << "TdeCredentialPassword=" << StringUtils::URLEncode(m_tdeCredentialPassword.c_str()) << "&";
153   }
154 
155   if(m_vpcSecurityGroupIdsHasBeenSet)
156   {
157     unsigned vpcSecurityGroupIdsCount = 1;
158     for(auto& item : m_vpcSecurityGroupIds)
159     {
160       ss << "VpcSecurityGroupIds.member." << vpcSecurityGroupIdsCount << "="
161           << StringUtils::URLEncode(item.c_str()) << "&";
162       vpcSecurityGroupIdsCount++;
163     }
164   }
165 
166   if(m_domainHasBeenSet)
167   {
168     ss << "Domain=" << StringUtils::URLEncode(m_domain.c_str()) << "&";
169   }
170 
171   if(m_copyTagsToSnapshotHasBeenSet)
172   {
173     ss << "CopyTagsToSnapshot=" << std::boolalpha << m_copyTagsToSnapshot << "&";
174   }
175 
176   if(m_domainIAMRoleNameHasBeenSet)
177   {
178     ss << "DomainIAMRoleName=" << StringUtils::URLEncode(m_domainIAMRoleName.c_str()) << "&";
179   }
180 
181   if(m_enableIAMDatabaseAuthenticationHasBeenSet)
182   {
183     ss << "EnableIAMDatabaseAuthentication=" << std::boolalpha << m_enableIAMDatabaseAuthentication << "&";
184   }
185 
186   if(m_enableCloudwatchLogsExportsHasBeenSet)
187   {
188     unsigned enableCloudwatchLogsExportsCount = 1;
189     for(auto& item : m_enableCloudwatchLogsExports)
190     {
191       ss << "EnableCloudwatchLogsExports.member." << enableCloudwatchLogsExportsCount << "="
192           << StringUtils::URLEncode(item.c_str()) << "&";
193       enableCloudwatchLogsExportsCount++;
194     }
195   }
196 
197   if(m_processorFeaturesHasBeenSet)
198   {
199     unsigned processorFeaturesCount = 1;
200     for(auto& item : m_processorFeatures)
201     {
202       item.OutputToStream(ss, "ProcessorFeatures.member.", processorFeaturesCount, "");
203       processorFeaturesCount++;
204     }
205   }
206 
207   if(m_useDefaultProcessorFeaturesHasBeenSet)
208   {
209     ss << "UseDefaultProcessorFeatures=" << std::boolalpha << m_useDefaultProcessorFeatures << "&";
210   }
211 
212   if(m_dBParameterGroupNameHasBeenSet)
213   {
214     ss << "DBParameterGroupName=" << StringUtils::URLEncode(m_dBParameterGroupName.c_str()) << "&";
215   }
216 
217   if(m_deletionProtectionHasBeenSet)
218   {
219     ss << "DeletionProtection=" << std::boolalpha << m_deletionProtection << "&";
220   }
221 
222   if(m_enableCustomerOwnedIpHasBeenSet)
223   {
224     ss << "EnableCustomerOwnedIp=" << std::boolalpha << m_enableCustomerOwnedIp << "&";
225   }
226 
227   ss << "Version=2014-10-31";
228   return ss.str();
229 }
230 
231 
DumpBodyToUrl(Aws::Http::URI & uri) const232 void  RestoreDBInstanceFromDBSnapshotRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
233 {
234   uri.SetQueryString(SerializePayload());
235 }
236