/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::EC2::Model; using namespace Aws::Utils; CreateCapacityReservationRequest::CreateCapacityReservationRequest() : m_clientTokenHasBeenSet(false), m_instanceTypeHasBeenSet(false), m_instancePlatform(CapacityReservationInstancePlatform::NOT_SET), m_instancePlatformHasBeenSet(false), m_availabilityZoneHasBeenSet(false), m_availabilityZoneIdHasBeenSet(false), m_tenancy(CapacityReservationTenancy::NOT_SET), m_tenancyHasBeenSet(false), m_instanceCount(0), m_instanceCountHasBeenSet(false), m_ebsOptimized(false), m_ebsOptimizedHasBeenSet(false), m_ephemeralStorage(false), m_ephemeralStorageHasBeenSet(false), m_endDateHasBeenSet(false), m_endDateType(EndDateType::NOT_SET), m_endDateTypeHasBeenSet(false), m_instanceMatchCriteria(InstanceMatchCriteria::NOT_SET), m_instanceMatchCriteriaHasBeenSet(false), m_tagSpecificationsHasBeenSet(false), m_dryRun(false), m_dryRunHasBeenSet(false), m_outpostArnHasBeenSet(false), m_placementGroupArnHasBeenSet(false) { } Aws::String CreateCapacityReservationRequest::SerializePayload() const { Aws::StringStream ss; ss << "Action=CreateCapacityReservation&"; if(m_clientTokenHasBeenSet) { ss << "ClientToken=" << StringUtils::URLEncode(m_clientToken.c_str()) << "&"; } if(m_instanceTypeHasBeenSet) { ss << "InstanceType=" << StringUtils::URLEncode(m_instanceType.c_str()) << "&"; } if(m_instancePlatformHasBeenSet) { ss << "InstancePlatform=" << CapacityReservationInstancePlatformMapper::GetNameForCapacityReservationInstancePlatform(m_instancePlatform) << "&"; } if(m_availabilityZoneHasBeenSet) { ss << "AvailabilityZone=" << StringUtils::URLEncode(m_availabilityZone.c_str()) << "&"; } if(m_availabilityZoneIdHasBeenSet) { ss << "AvailabilityZoneId=" << StringUtils::URLEncode(m_availabilityZoneId.c_str()) << "&"; } if(m_tenancyHasBeenSet) { ss << "Tenancy=" << CapacityReservationTenancyMapper::GetNameForCapacityReservationTenancy(m_tenancy) << "&"; } if(m_instanceCountHasBeenSet) { ss << "InstanceCount=" << m_instanceCount << "&"; } if(m_ebsOptimizedHasBeenSet) { ss << "EbsOptimized=" << std::boolalpha << m_ebsOptimized << "&"; } if(m_ephemeralStorageHasBeenSet) { ss << "EphemeralStorage=" << std::boolalpha << m_ephemeralStorage << "&"; } if(m_endDateHasBeenSet) { ss << "EndDate=" << StringUtils::URLEncode(m_endDate.ToGmtString(Aws::Utils::DateFormat::ISO_8601).c_str()) << "&"; } if(m_endDateTypeHasBeenSet) { ss << "EndDateType=" << EndDateTypeMapper::GetNameForEndDateType(m_endDateType) << "&"; } if(m_instanceMatchCriteriaHasBeenSet) { ss << "InstanceMatchCriteria=" << InstanceMatchCriteriaMapper::GetNameForInstanceMatchCriteria(m_instanceMatchCriteria) << "&"; } if(m_tagSpecificationsHasBeenSet) { unsigned tagSpecificationsCount = 1; for(auto& item : m_tagSpecifications) { item.OutputToStream(ss, "TagSpecifications.", tagSpecificationsCount, ""); tagSpecificationsCount++; } } if(m_dryRunHasBeenSet) { ss << "DryRun=" << std::boolalpha << m_dryRun << "&"; } if(m_outpostArnHasBeenSet) { ss << "OutpostArn=" << StringUtils::URLEncode(m_outpostArn.c_str()) << "&"; } if(m_placementGroupArnHasBeenSet) { ss << "PlacementGroupArn=" << StringUtils::URLEncode(m_placementGroupArn.c_str()) << "&"; } ss << "Version=2016-11-15"; return ss.str(); } void CreateCapacityReservationRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const { uri.SetQueryString(SerializePayload()); }