1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/cloudformation/model/UpdateStackSetRequest.h>
7 #include <aws/core/utils/StringUtils.h>
8 #include <aws/core/utils/memory/stl/AWSStringStream.h>
9 
10 using namespace Aws::CloudFormation::Model;
11 using namespace Aws::Utils;
12 
UpdateStackSetRequest()13 UpdateStackSetRequest::UpdateStackSetRequest() :
14     m_stackSetNameHasBeenSet(false),
15     m_descriptionHasBeenSet(false),
16     m_templateBodyHasBeenSet(false),
17     m_templateURLHasBeenSet(false),
18     m_usePreviousTemplate(false),
19     m_usePreviousTemplateHasBeenSet(false),
20     m_parametersHasBeenSet(false),
21     m_capabilitiesHasBeenSet(false),
22     m_tagsHasBeenSet(false),
23     m_operationPreferencesHasBeenSet(false),
24     m_administrationRoleARNHasBeenSet(false),
25     m_executionRoleNameHasBeenSet(false),
26     m_deploymentTargetsHasBeenSet(false),
27     m_permissionModel(PermissionModels::NOT_SET),
28     m_permissionModelHasBeenSet(false),
29     m_autoDeploymentHasBeenSet(false),
30     m_operationId(Aws::Utils::UUID::RandomUUID()),
31     m_operationIdHasBeenSet(true),
32     m_accountsHasBeenSet(false),
33     m_regionsHasBeenSet(false),
34     m_callAs(CallAs::NOT_SET),
35     m_callAsHasBeenSet(false)
36 {
37 }
38 
SerializePayload() const39 Aws::String UpdateStackSetRequest::SerializePayload() const
40 {
41   Aws::StringStream ss;
42   ss << "Action=UpdateStackSet&";
43   if(m_stackSetNameHasBeenSet)
44   {
45     ss << "StackSetName=" << StringUtils::URLEncode(m_stackSetName.c_str()) << "&";
46   }
47 
48   if(m_descriptionHasBeenSet)
49   {
50     ss << "Description=" << StringUtils::URLEncode(m_description.c_str()) << "&";
51   }
52 
53   if(m_templateBodyHasBeenSet)
54   {
55     ss << "TemplateBody=" << StringUtils::URLEncode(m_templateBody.c_str()) << "&";
56   }
57 
58   if(m_templateURLHasBeenSet)
59   {
60     ss << "TemplateURL=" << StringUtils::URLEncode(m_templateURL.c_str()) << "&";
61   }
62 
63   if(m_usePreviousTemplateHasBeenSet)
64   {
65     ss << "UsePreviousTemplate=" << std::boolalpha << m_usePreviousTemplate << "&";
66   }
67 
68   if(m_parametersHasBeenSet)
69   {
70     unsigned parametersCount = 1;
71     for(auto& item : m_parameters)
72     {
73       item.OutputToStream(ss, "Parameters.member.", parametersCount, "");
74       parametersCount++;
75     }
76   }
77 
78   if(m_capabilitiesHasBeenSet)
79   {
80     unsigned capabilitiesCount = 1;
81     for(auto& item : m_capabilities)
82     {
83       ss << "Capabilities.member." << capabilitiesCount << "="
84           << StringUtils::URLEncode(CapabilityMapper::GetNameForCapability(item).c_str()) << "&";
85       capabilitiesCount++;
86     }
87   }
88 
89   if(m_tagsHasBeenSet)
90   {
91     unsigned tagsCount = 1;
92     for(auto& item : m_tags)
93     {
94       item.OutputToStream(ss, "Tags.member.", tagsCount, "");
95       tagsCount++;
96     }
97   }
98 
99   if(m_operationPreferencesHasBeenSet)
100   {
101     m_operationPreferences.OutputToStream(ss, "OperationPreferences");
102   }
103 
104   if(m_administrationRoleARNHasBeenSet)
105   {
106     ss << "AdministrationRoleARN=" << StringUtils::URLEncode(m_administrationRoleARN.c_str()) << "&";
107   }
108 
109   if(m_executionRoleNameHasBeenSet)
110   {
111     ss << "ExecutionRoleName=" << StringUtils::URLEncode(m_executionRoleName.c_str()) << "&";
112   }
113 
114   if(m_deploymentTargetsHasBeenSet)
115   {
116     m_deploymentTargets.OutputToStream(ss, "DeploymentTargets");
117   }
118 
119   if(m_permissionModelHasBeenSet)
120   {
121     ss << "PermissionModel=" << PermissionModelsMapper::GetNameForPermissionModels(m_permissionModel) << "&";
122   }
123 
124   if(m_autoDeploymentHasBeenSet)
125   {
126     m_autoDeployment.OutputToStream(ss, "AutoDeployment");
127   }
128 
129   if(m_operationIdHasBeenSet)
130   {
131     ss << "OperationId=" << StringUtils::URLEncode(m_operationId.c_str()) << "&";
132   }
133 
134   if(m_accountsHasBeenSet)
135   {
136     unsigned accountsCount = 1;
137     for(auto& item : m_accounts)
138     {
139       ss << "Accounts.member." << accountsCount << "="
140           << StringUtils::URLEncode(item.c_str()) << "&";
141       accountsCount++;
142     }
143   }
144 
145   if(m_regionsHasBeenSet)
146   {
147     unsigned regionsCount = 1;
148     for(auto& item : m_regions)
149     {
150       ss << "Regions.member." << regionsCount << "="
151           << StringUtils::URLEncode(item.c_str()) << "&";
152       regionsCount++;
153     }
154   }
155 
156   if(m_callAsHasBeenSet)
157   {
158     ss << "CallAs=" << CallAsMapper::GetNameForCallAs(m_callAs) << "&";
159   }
160 
161   ss << "Version=2010-05-15";
162   return ss.str();
163 }
164 
165 
DumpBodyToUrl(Aws::Http::URI & uri) const166 void  UpdateStackSetRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
167 {
168   uri.SetQueryString(SerializePayload());
169 }
170