1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/redshift/model/RestoreFromClusterSnapshotRequest.h>
7 #include <aws/core/utils/StringUtils.h>
8 #include <aws/core/utils/memory/stl/AWSStringStream.h>
9
10 using namespace Aws::Redshift::Model;
11 using namespace Aws::Utils;
12
RestoreFromClusterSnapshotRequest()13 RestoreFromClusterSnapshotRequest::RestoreFromClusterSnapshotRequest() :
14 m_clusterIdentifierHasBeenSet(false),
15 m_snapshotIdentifierHasBeenSet(false),
16 m_snapshotClusterIdentifierHasBeenSet(false),
17 m_port(0),
18 m_portHasBeenSet(false),
19 m_availabilityZoneHasBeenSet(false),
20 m_allowVersionUpgrade(false),
21 m_allowVersionUpgradeHasBeenSet(false),
22 m_clusterSubnetGroupNameHasBeenSet(false),
23 m_publiclyAccessible(false),
24 m_publiclyAccessibleHasBeenSet(false),
25 m_ownerAccountHasBeenSet(false),
26 m_hsmClientCertificateIdentifierHasBeenSet(false),
27 m_hsmConfigurationIdentifierHasBeenSet(false),
28 m_elasticIpHasBeenSet(false),
29 m_clusterParameterGroupNameHasBeenSet(false),
30 m_clusterSecurityGroupsHasBeenSet(false),
31 m_vpcSecurityGroupIdsHasBeenSet(false),
32 m_preferredMaintenanceWindowHasBeenSet(false),
33 m_automatedSnapshotRetentionPeriod(0),
34 m_automatedSnapshotRetentionPeriodHasBeenSet(false),
35 m_manualSnapshotRetentionPeriod(0),
36 m_manualSnapshotRetentionPeriodHasBeenSet(false),
37 m_kmsKeyIdHasBeenSet(false),
38 m_nodeTypeHasBeenSet(false),
39 m_enhancedVpcRouting(false),
40 m_enhancedVpcRoutingHasBeenSet(false),
41 m_additionalInfoHasBeenSet(false),
42 m_iamRolesHasBeenSet(false),
43 m_maintenanceTrackNameHasBeenSet(false),
44 m_snapshotScheduleIdentifierHasBeenSet(false),
45 m_numberOfNodes(0),
46 m_numberOfNodesHasBeenSet(false),
47 m_availabilityZoneRelocation(false),
48 m_availabilityZoneRelocationHasBeenSet(false),
49 m_aquaConfigurationStatus(AquaConfigurationStatus::NOT_SET),
50 m_aquaConfigurationStatusHasBeenSet(false)
51 {
52 }
53
SerializePayload() const54 Aws::String RestoreFromClusterSnapshotRequest::SerializePayload() const
55 {
56 Aws::StringStream ss;
57 ss << "Action=RestoreFromClusterSnapshot&";
58 if(m_clusterIdentifierHasBeenSet)
59 {
60 ss << "ClusterIdentifier=" << StringUtils::URLEncode(m_clusterIdentifier.c_str()) << "&";
61 }
62
63 if(m_snapshotIdentifierHasBeenSet)
64 {
65 ss << "SnapshotIdentifier=" << StringUtils::URLEncode(m_snapshotIdentifier.c_str()) << "&";
66 }
67
68 if(m_snapshotClusterIdentifierHasBeenSet)
69 {
70 ss << "SnapshotClusterIdentifier=" << StringUtils::URLEncode(m_snapshotClusterIdentifier.c_str()) << "&";
71 }
72
73 if(m_portHasBeenSet)
74 {
75 ss << "Port=" << m_port << "&";
76 }
77
78 if(m_availabilityZoneHasBeenSet)
79 {
80 ss << "AvailabilityZone=" << StringUtils::URLEncode(m_availabilityZone.c_str()) << "&";
81 }
82
83 if(m_allowVersionUpgradeHasBeenSet)
84 {
85 ss << "AllowVersionUpgrade=" << std::boolalpha << m_allowVersionUpgrade << "&";
86 }
87
88 if(m_clusterSubnetGroupNameHasBeenSet)
89 {
90 ss << "ClusterSubnetGroupName=" << StringUtils::URLEncode(m_clusterSubnetGroupName.c_str()) << "&";
91 }
92
93 if(m_publiclyAccessibleHasBeenSet)
94 {
95 ss << "PubliclyAccessible=" << std::boolalpha << m_publiclyAccessible << "&";
96 }
97
98 if(m_ownerAccountHasBeenSet)
99 {
100 ss << "OwnerAccount=" << StringUtils::URLEncode(m_ownerAccount.c_str()) << "&";
101 }
102
103 if(m_hsmClientCertificateIdentifierHasBeenSet)
104 {
105 ss << "HsmClientCertificateIdentifier=" << StringUtils::URLEncode(m_hsmClientCertificateIdentifier.c_str()) << "&";
106 }
107
108 if(m_hsmConfigurationIdentifierHasBeenSet)
109 {
110 ss << "HsmConfigurationIdentifier=" << StringUtils::URLEncode(m_hsmConfigurationIdentifier.c_str()) << "&";
111 }
112
113 if(m_elasticIpHasBeenSet)
114 {
115 ss << "ElasticIp=" << StringUtils::URLEncode(m_elasticIp.c_str()) << "&";
116 }
117
118 if(m_clusterParameterGroupNameHasBeenSet)
119 {
120 ss << "ClusterParameterGroupName=" << StringUtils::URLEncode(m_clusterParameterGroupName.c_str()) << "&";
121 }
122
123 if(m_clusterSecurityGroupsHasBeenSet)
124 {
125 unsigned clusterSecurityGroupsCount = 1;
126 for(auto& item : m_clusterSecurityGroups)
127 {
128 ss << "ClusterSecurityGroups.member." << clusterSecurityGroupsCount << "="
129 << StringUtils::URLEncode(item.c_str()) << "&";
130 clusterSecurityGroupsCount++;
131 }
132 }
133
134 if(m_vpcSecurityGroupIdsHasBeenSet)
135 {
136 unsigned vpcSecurityGroupIdsCount = 1;
137 for(auto& item : m_vpcSecurityGroupIds)
138 {
139 ss << "VpcSecurityGroupIds.member." << vpcSecurityGroupIdsCount << "="
140 << StringUtils::URLEncode(item.c_str()) << "&";
141 vpcSecurityGroupIdsCount++;
142 }
143 }
144
145 if(m_preferredMaintenanceWindowHasBeenSet)
146 {
147 ss << "PreferredMaintenanceWindow=" << StringUtils::URLEncode(m_preferredMaintenanceWindow.c_str()) << "&";
148 }
149
150 if(m_automatedSnapshotRetentionPeriodHasBeenSet)
151 {
152 ss << "AutomatedSnapshotRetentionPeriod=" << m_automatedSnapshotRetentionPeriod << "&";
153 }
154
155 if(m_manualSnapshotRetentionPeriodHasBeenSet)
156 {
157 ss << "ManualSnapshotRetentionPeriod=" << m_manualSnapshotRetentionPeriod << "&";
158 }
159
160 if(m_kmsKeyIdHasBeenSet)
161 {
162 ss << "KmsKeyId=" << StringUtils::URLEncode(m_kmsKeyId.c_str()) << "&";
163 }
164
165 if(m_nodeTypeHasBeenSet)
166 {
167 ss << "NodeType=" << StringUtils::URLEncode(m_nodeType.c_str()) << "&";
168 }
169
170 if(m_enhancedVpcRoutingHasBeenSet)
171 {
172 ss << "EnhancedVpcRouting=" << std::boolalpha << m_enhancedVpcRouting << "&";
173 }
174
175 if(m_additionalInfoHasBeenSet)
176 {
177 ss << "AdditionalInfo=" << StringUtils::URLEncode(m_additionalInfo.c_str()) << "&";
178 }
179
180 if(m_iamRolesHasBeenSet)
181 {
182 unsigned iamRolesCount = 1;
183 for(auto& item : m_iamRoles)
184 {
185 ss << "IamRoles.member." << iamRolesCount << "="
186 << StringUtils::URLEncode(item.c_str()) << "&";
187 iamRolesCount++;
188 }
189 }
190
191 if(m_maintenanceTrackNameHasBeenSet)
192 {
193 ss << "MaintenanceTrackName=" << StringUtils::URLEncode(m_maintenanceTrackName.c_str()) << "&";
194 }
195
196 if(m_snapshotScheduleIdentifierHasBeenSet)
197 {
198 ss << "SnapshotScheduleIdentifier=" << StringUtils::URLEncode(m_snapshotScheduleIdentifier.c_str()) << "&";
199 }
200
201 if(m_numberOfNodesHasBeenSet)
202 {
203 ss << "NumberOfNodes=" << m_numberOfNodes << "&";
204 }
205
206 if(m_availabilityZoneRelocationHasBeenSet)
207 {
208 ss << "AvailabilityZoneRelocation=" << std::boolalpha << m_availabilityZoneRelocation << "&";
209 }
210
211 if(m_aquaConfigurationStatusHasBeenSet)
212 {
213 ss << "AquaConfigurationStatus=" << AquaConfigurationStatusMapper::GetNameForAquaConfigurationStatus(m_aquaConfigurationStatus) << "&";
214 }
215
216 ss << "Version=2012-12-01";
217 return ss.str();
218 }
219
220
DumpBodyToUrl(Aws::Http::URI & uri) const221 void RestoreFromClusterSnapshotRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
222 {
223 uri.SetQueryString(SerializePayload());
224 }
225