1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/ec2/model/ModifySpotFleetRequestRequest.h>
7 #include <aws/core/utils/StringUtils.h>
8 #include <aws/core/utils/memory/stl/AWSStringStream.h>
9 
10 using namespace Aws::EC2::Model;
11 using namespace Aws::Utils;
12 
ModifySpotFleetRequestRequest()13 ModifySpotFleetRequestRequest::ModifySpotFleetRequestRequest() :
14     m_excessCapacityTerminationPolicy(ExcessCapacityTerminationPolicy::NOT_SET),
15     m_excessCapacityTerminationPolicyHasBeenSet(false),
16     m_launchTemplateConfigsHasBeenSet(false),
17     m_spotFleetRequestIdHasBeenSet(false),
18     m_targetCapacity(0),
19     m_targetCapacityHasBeenSet(false),
20     m_onDemandTargetCapacity(0),
21     m_onDemandTargetCapacityHasBeenSet(false),
22     m_contextHasBeenSet(false)
23 {
24 }
25 
SerializePayload() const26 Aws::String ModifySpotFleetRequestRequest::SerializePayload() const
27 {
28   Aws::StringStream ss;
29   ss << "Action=ModifySpotFleetRequest&";
30   if(m_excessCapacityTerminationPolicyHasBeenSet)
31   {
32     ss << "ExcessCapacityTerminationPolicy=" << ExcessCapacityTerminationPolicyMapper::GetNameForExcessCapacityTerminationPolicy(m_excessCapacityTerminationPolicy) << "&";
33   }
34 
35   if(m_launchTemplateConfigsHasBeenSet)
36   {
37     unsigned launchTemplateConfigsCount = 1;
38     for(auto& item : m_launchTemplateConfigs)
39     {
40       item.OutputToStream(ss, "LaunchTemplateConfig.", launchTemplateConfigsCount, "");
41       launchTemplateConfigsCount++;
42     }
43   }
44 
45   if(m_spotFleetRequestIdHasBeenSet)
46   {
47     ss << "SpotFleetRequestId=" << StringUtils::URLEncode(m_spotFleetRequestId.c_str()) << "&";
48   }
49 
50   if(m_targetCapacityHasBeenSet)
51   {
52     ss << "TargetCapacity=" << m_targetCapacity << "&";
53   }
54 
55   if(m_onDemandTargetCapacityHasBeenSet)
56   {
57     ss << "OnDemandTargetCapacity=" << m_onDemandTargetCapacity << "&";
58   }
59 
60   if(m_contextHasBeenSet)
61   {
62     ss << "Context=" << StringUtils::URLEncode(m_context.c_str()) << "&";
63   }
64 
65   ss << "Version=2016-11-15";
66   return ss.str();
67 }
68 
69 
DumpBodyToUrl(Aws::Http::URI & uri) const70 void  ModifySpotFleetRequestRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
71 {
72   uri.SetQueryString(SerializePayload());
73 }
74