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/RestoreDBClusterToPointInTimeRequest.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 
RestoreDBClusterToPointInTimeRequest()13 RestoreDBClusterToPointInTimeRequest::RestoreDBClusterToPointInTimeRequest() :
14     m_dBClusterIdentifierHasBeenSet(false),
15     m_restoreTypeHasBeenSet(false),
16     m_sourceDBClusterIdentifierHasBeenSet(false),
17     m_restoreToTimeHasBeenSet(false),
18     m_useLatestRestorableTime(false),
19     m_useLatestRestorableTimeHasBeenSet(false),
20     m_port(0),
21     m_portHasBeenSet(false),
22     m_dBSubnetGroupNameHasBeenSet(false),
23     m_optionGroupNameHasBeenSet(false),
24     m_vpcSecurityGroupIdsHasBeenSet(false),
25     m_tagsHasBeenSet(false),
26     m_kmsKeyIdHasBeenSet(false),
27     m_enableIAMDatabaseAuthentication(false),
28     m_enableIAMDatabaseAuthenticationHasBeenSet(false),
29     m_backtrackWindow(0),
30     m_backtrackWindowHasBeenSet(false),
31     m_enableCloudwatchLogsExportsHasBeenSet(false),
32     m_dBClusterParameterGroupNameHasBeenSet(false),
33     m_deletionProtection(false),
34     m_deletionProtectionHasBeenSet(false),
35     m_copyTagsToSnapshot(false),
36     m_copyTagsToSnapshotHasBeenSet(false),
37     m_domainHasBeenSet(false),
38     m_domainIAMRoleNameHasBeenSet(false),
39     m_scalingConfigurationHasBeenSet(false),
40     m_engineModeHasBeenSet(false)
41 {
42 }
43 
SerializePayload() const44 Aws::String RestoreDBClusterToPointInTimeRequest::SerializePayload() const
45 {
46   Aws::StringStream ss;
47   ss << "Action=RestoreDBClusterToPointInTime&";
48   if(m_dBClusterIdentifierHasBeenSet)
49   {
50     ss << "DBClusterIdentifier=" << StringUtils::URLEncode(m_dBClusterIdentifier.c_str()) << "&";
51   }
52 
53   if(m_restoreTypeHasBeenSet)
54   {
55     ss << "RestoreType=" << StringUtils::URLEncode(m_restoreType.c_str()) << "&";
56   }
57 
58   if(m_sourceDBClusterIdentifierHasBeenSet)
59   {
60     ss << "SourceDBClusterIdentifier=" << StringUtils::URLEncode(m_sourceDBClusterIdentifier.c_str()) << "&";
61   }
62 
63   if(m_restoreToTimeHasBeenSet)
64   {
65     ss << "RestoreToTime=" << StringUtils::URLEncode(m_restoreToTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
66   }
67 
68   if(m_useLatestRestorableTimeHasBeenSet)
69   {
70     ss << "UseLatestRestorableTime=" << std::boolalpha << m_useLatestRestorableTime << "&";
71   }
72 
73   if(m_portHasBeenSet)
74   {
75     ss << "Port=" << m_port << "&";
76   }
77 
78   if(m_dBSubnetGroupNameHasBeenSet)
79   {
80     ss << "DBSubnetGroupName=" << StringUtils::URLEncode(m_dBSubnetGroupName.c_str()) << "&";
81   }
82 
83   if(m_optionGroupNameHasBeenSet)
84   {
85     ss << "OptionGroupName=" << StringUtils::URLEncode(m_optionGroupName.c_str()) << "&";
86   }
87 
88   if(m_vpcSecurityGroupIdsHasBeenSet)
89   {
90     unsigned vpcSecurityGroupIdsCount = 1;
91     for(auto& item : m_vpcSecurityGroupIds)
92     {
93       ss << "VpcSecurityGroupIds.member." << vpcSecurityGroupIdsCount << "="
94           << StringUtils::URLEncode(item.c_str()) << "&";
95       vpcSecurityGroupIdsCount++;
96     }
97   }
98 
99   if(m_tagsHasBeenSet)
100   {
101     unsigned tagsCount = 1;
102     for(auto& item : m_tags)
103     {
104       item.OutputToStream(ss, "Tags.member.", tagsCount, "");
105       tagsCount++;
106     }
107   }
108 
109   if(m_kmsKeyIdHasBeenSet)
110   {
111     ss << "KmsKeyId=" << StringUtils::URLEncode(m_kmsKeyId.c_str()) << "&";
112   }
113 
114   if(m_enableIAMDatabaseAuthenticationHasBeenSet)
115   {
116     ss << "EnableIAMDatabaseAuthentication=" << std::boolalpha << m_enableIAMDatabaseAuthentication << "&";
117   }
118 
119   if(m_backtrackWindowHasBeenSet)
120   {
121     ss << "BacktrackWindow=" << m_backtrackWindow << "&";
122   }
123 
124   if(m_enableCloudwatchLogsExportsHasBeenSet)
125   {
126     unsigned enableCloudwatchLogsExportsCount = 1;
127     for(auto& item : m_enableCloudwatchLogsExports)
128     {
129       ss << "EnableCloudwatchLogsExports.member." << enableCloudwatchLogsExportsCount << "="
130           << StringUtils::URLEncode(item.c_str()) << "&";
131       enableCloudwatchLogsExportsCount++;
132     }
133   }
134 
135   if(m_dBClusterParameterGroupNameHasBeenSet)
136   {
137     ss << "DBClusterParameterGroupName=" << StringUtils::URLEncode(m_dBClusterParameterGroupName.c_str()) << "&";
138   }
139 
140   if(m_deletionProtectionHasBeenSet)
141   {
142     ss << "DeletionProtection=" << std::boolalpha << m_deletionProtection << "&";
143   }
144 
145   if(m_copyTagsToSnapshotHasBeenSet)
146   {
147     ss << "CopyTagsToSnapshot=" << std::boolalpha << m_copyTagsToSnapshot << "&";
148   }
149 
150   if(m_domainHasBeenSet)
151   {
152     ss << "Domain=" << StringUtils::URLEncode(m_domain.c_str()) << "&";
153   }
154 
155   if(m_domainIAMRoleNameHasBeenSet)
156   {
157     ss << "DomainIAMRoleName=" << StringUtils::URLEncode(m_domainIAMRoleName.c_str()) << "&";
158   }
159 
160   if(m_scalingConfigurationHasBeenSet)
161   {
162     m_scalingConfiguration.OutputToStream(ss, "ScalingConfiguration");
163   }
164 
165   if(m_engineModeHasBeenSet)
166   {
167     ss << "EngineMode=" << StringUtils::URLEncode(m_engineMode.c_str()) << "&";
168   }
169 
170   ss << "Version=2014-10-31";
171   return ss.str();
172 }
173 
174 
DumpBodyToUrl(Aws::Http::URI & uri) const175 void  RestoreDBClusterToPointInTimeRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
176 {
177   uri.SetQueryString(SerializePayload());
178 }
179