/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include using namespace Aws::Utils::Xml; using namespace Aws::Utils; namespace Aws { namespace EC2 { namespace Model { RequestSpotLaunchSpecification::RequestSpotLaunchSpecification() : m_securityGroupIdsHasBeenSet(false), m_securityGroupsHasBeenSet(false), m_addressingTypeHasBeenSet(false), m_blockDeviceMappingsHasBeenSet(false), m_ebsOptimized(false), m_ebsOptimizedHasBeenSet(false), m_iamInstanceProfileHasBeenSet(false), m_imageIdHasBeenSet(false), m_instanceType(InstanceType::NOT_SET), m_instanceTypeHasBeenSet(false), m_kernelIdHasBeenSet(false), m_keyNameHasBeenSet(false), m_monitoringHasBeenSet(false), m_networkInterfacesHasBeenSet(false), m_placementHasBeenSet(false), m_ramdiskIdHasBeenSet(false), m_subnetIdHasBeenSet(false), m_userDataHasBeenSet(false) { } RequestSpotLaunchSpecification::RequestSpotLaunchSpecification(const XmlNode& xmlNode) : m_securityGroupIdsHasBeenSet(false), m_securityGroupsHasBeenSet(false), m_addressingTypeHasBeenSet(false), m_blockDeviceMappingsHasBeenSet(false), m_ebsOptimized(false), m_ebsOptimizedHasBeenSet(false), m_iamInstanceProfileHasBeenSet(false), m_imageIdHasBeenSet(false), m_instanceType(InstanceType::NOT_SET), m_instanceTypeHasBeenSet(false), m_kernelIdHasBeenSet(false), m_keyNameHasBeenSet(false), m_monitoringHasBeenSet(false), m_networkInterfacesHasBeenSet(false), m_placementHasBeenSet(false), m_ramdiskIdHasBeenSet(false), m_subnetIdHasBeenSet(false), m_userDataHasBeenSet(false) { *this = xmlNode; } RequestSpotLaunchSpecification& RequestSpotLaunchSpecification::operator =(const XmlNode& xmlNode) { XmlNode resultNode = xmlNode; if(!resultNode.IsNull()) { XmlNode securityGroupIdsNode = resultNode.FirstChild("SecurityGroupId"); if(!securityGroupIdsNode.IsNull()) { XmlNode securityGroupIdsMember = securityGroupIdsNode.FirstChild("item"); while(!securityGroupIdsMember.IsNull()) { m_securityGroupIds.push_back(securityGroupIdsMember.GetText()); securityGroupIdsMember = securityGroupIdsMember.NextNode("item"); } m_securityGroupIdsHasBeenSet = true; } XmlNode securityGroupsNode = resultNode.FirstChild("SecurityGroup"); if(!securityGroupsNode.IsNull()) { XmlNode securityGroupsMember = securityGroupsNode.FirstChild("item"); while(!securityGroupsMember.IsNull()) { m_securityGroups.push_back(securityGroupsMember.GetText()); securityGroupsMember = securityGroupsMember.NextNode("item"); } m_securityGroupsHasBeenSet = true; } XmlNode addressingTypeNode = resultNode.FirstChild("addressingType"); if(!addressingTypeNode.IsNull()) { m_addressingType = Aws::Utils::Xml::DecodeEscapedXmlText(addressingTypeNode.GetText()); m_addressingTypeHasBeenSet = true; } XmlNode blockDeviceMappingsNode = resultNode.FirstChild("blockDeviceMapping"); if(!blockDeviceMappingsNode.IsNull()) { XmlNode blockDeviceMappingsMember = blockDeviceMappingsNode.FirstChild("item"); while(!blockDeviceMappingsMember.IsNull()) { m_blockDeviceMappings.push_back(blockDeviceMappingsMember); blockDeviceMappingsMember = blockDeviceMappingsMember.NextNode("item"); } m_blockDeviceMappingsHasBeenSet = true; } XmlNode ebsOptimizedNode = resultNode.FirstChild("ebsOptimized"); if(!ebsOptimizedNode.IsNull()) { m_ebsOptimized = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(ebsOptimizedNode.GetText()).c_str()).c_str()); m_ebsOptimizedHasBeenSet = true; } XmlNode iamInstanceProfileNode = resultNode.FirstChild("iamInstanceProfile"); if(!iamInstanceProfileNode.IsNull()) { m_iamInstanceProfile = iamInstanceProfileNode; m_iamInstanceProfileHasBeenSet = true; } XmlNode imageIdNode = resultNode.FirstChild("imageId"); if(!imageIdNode.IsNull()) { m_imageId = Aws::Utils::Xml::DecodeEscapedXmlText(imageIdNode.GetText()); m_imageIdHasBeenSet = true; } XmlNode instanceTypeNode = resultNode.FirstChild("instanceType"); if(!instanceTypeNode.IsNull()) { m_instanceType = InstanceTypeMapper::GetInstanceTypeForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(instanceTypeNode.GetText()).c_str()).c_str()); m_instanceTypeHasBeenSet = true; } XmlNode kernelIdNode = resultNode.FirstChild("kernelId"); if(!kernelIdNode.IsNull()) { m_kernelId = Aws::Utils::Xml::DecodeEscapedXmlText(kernelIdNode.GetText()); m_kernelIdHasBeenSet = true; } XmlNode keyNameNode = resultNode.FirstChild("keyName"); if(!keyNameNode.IsNull()) { m_keyName = Aws::Utils::Xml::DecodeEscapedXmlText(keyNameNode.GetText()); m_keyNameHasBeenSet = true; } XmlNode monitoringNode = resultNode.FirstChild("monitoring"); if(!monitoringNode.IsNull()) { m_monitoring = monitoringNode; m_monitoringHasBeenSet = true; } XmlNode networkInterfacesNode = resultNode.FirstChild("NetworkInterface"); if(!networkInterfacesNode.IsNull()) { XmlNode networkInterfacesMember = networkInterfacesNode.FirstChild("item"); while(!networkInterfacesMember.IsNull()) { m_networkInterfaces.push_back(networkInterfacesMember); networkInterfacesMember = networkInterfacesMember.NextNode("item"); } m_networkInterfacesHasBeenSet = true; } XmlNode placementNode = resultNode.FirstChild("placement"); if(!placementNode.IsNull()) { m_placement = placementNode; m_placementHasBeenSet = true; } XmlNode ramdiskIdNode = resultNode.FirstChild("ramdiskId"); if(!ramdiskIdNode.IsNull()) { m_ramdiskId = Aws::Utils::Xml::DecodeEscapedXmlText(ramdiskIdNode.GetText()); m_ramdiskIdHasBeenSet = true; } XmlNode subnetIdNode = resultNode.FirstChild("subnetId"); if(!subnetIdNode.IsNull()) { m_subnetId = Aws::Utils::Xml::DecodeEscapedXmlText(subnetIdNode.GetText()); m_subnetIdHasBeenSet = true; } XmlNode userDataNode = resultNode.FirstChild("userData"); if(!userDataNode.IsNull()) { m_userData = Aws::Utils::Xml::DecodeEscapedXmlText(userDataNode.GetText()); m_userDataHasBeenSet = true; } } return *this; } void RequestSpotLaunchSpecification::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const { if(m_securityGroupIdsHasBeenSet) { unsigned securityGroupIdsIdx = 1; for(auto& item : m_securityGroupIds) { oStream << location << index << locationValue << ".SecurityGroupId." << securityGroupIdsIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&"; } } if(m_securityGroupsHasBeenSet) { unsigned securityGroupsIdx = 1; for(auto& item : m_securityGroups) { oStream << location << index << locationValue << ".SecurityGroup." << securityGroupsIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&"; } } if(m_addressingTypeHasBeenSet) { oStream << location << index << locationValue << ".AddressingType=" << StringUtils::URLEncode(m_addressingType.c_str()) << "&"; } if(m_blockDeviceMappingsHasBeenSet) { unsigned blockDeviceMappingsIdx = 1; for(auto& item : m_blockDeviceMappings) { Aws::StringStream blockDeviceMappingsSs; blockDeviceMappingsSs << location << index << locationValue << ".BlockDeviceMapping." << blockDeviceMappingsIdx++; item.OutputToStream(oStream, blockDeviceMappingsSs.str().c_str()); } } if(m_ebsOptimizedHasBeenSet) { oStream << location << index << locationValue << ".EbsOptimized=" << std::boolalpha << m_ebsOptimized << "&"; } if(m_iamInstanceProfileHasBeenSet) { Aws::StringStream iamInstanceProfileLocationAndMemberSs; iamInstanceProfileLocationAndMemberSs << location << index << locationValue << ".IamInstanceProfile"; m_iamInstanceProfile.OutputToStream(oStream, iamInstanceProfileLocationAndMemberSs.str().c_str()); } if(m_imageIdHasBeenSet) { oStream << location << index << locationValue << ".ImageId=" << StringUtils::URLEncode(m_imageId.c_str()) << "&"; } if(m_instanceTypeHasBeenSet) { oStream << location << index << locationValue << ".InstanceType=" << InstanceTypeMapper::GetNameForInstanceType(m_instanceType) << "&"; } if(m_kernelIdHasBeenSet) { oStream << location << index << locationValue << ".KernelId=" << StringUtils::URLEncode(m_kernelId.c_str()) << "&"; } if(m_keyNameHasBeenSet) { oStream << location << index << locationValue << ".KeyName=" << StringUtils::URLEncode(m_keyName.c_str()) << "&"; } if(m_monitoringHasBeenSet) { Aws::StringStream monitoringLocationAndMemberSs; monitoringLocationAndMemberSs << location << index << locationValue << ".Monitoring"; m_monitoring.OutputToStream(oStream, monitoringLocationAndMemberSs.str().c_str()); } if(m_networkInterfacesHasBeenSet) { unsigned networkInterfacesIdx = 1; for(auto& item : m_networkInterfaces) { Aws::StringStream networkInterfacesSs; networkInterfacesSs << location << index << locationValue << ".NetworkInterface." << networkInterfacesIdx++; item.OutputToStream(oStream, networkInterfacesSs.str().c_str()); } } if(m_placementHasBeenSet) { Aws::StringStream placementLocationAndMemberSs; placementLocationAndMemberSs << location << index << locationValue << ".Placement"; m_placement.OutputToStream(oStream, placementLocationAndMemberSs.str().c_str()); } if(m_ramdiskIdHasBeenSet) { oStream << location << index << locationValue << ".RamdiskId=" << StringUtils::URLEncode(m_ramdiskId.c_str()) << "&"; } if(m_subnetIdHasBeenSet) { oStream << location << index << locationValue << ".SubnetId=" << StringUtils::URLEncode(m_subnetId.c_str()) << "&"; } if(m_userDataHasBeenSet) { oStream << location << index << locationValue << ".UserData=" << StringUtils::URLEncode(m_userData.c_str()) << "&"; } } void RequestSpotLaunchSpecification::OutputToStream(Aws::OStream& oStream, const char* location) const { if(m_securityGroupIdsHasBeenSet) { unsigned securityGroupIdsIdx = 1; for(auto& item : m_securityGroupIds) { oStream << location << ".SecurityGroupId." << securityGroupIdsIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&"; } } if(m_securityGroupsHasBeenSet) { unsigned securityGroupsIdx = 1; for(auto& item : m_securityGroups) { oStream << location << ".SecurityGroup." << securityGroupsIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&"; } } if(m_addressingTypeHasBeenSet) { oStream << location << ".AddressingType=" << StringUtils::URLEncode(m_addressingType.c_str()) << "&"; } if(m_blockDeviceMappingsHasBeenSet) { unsigned blockDeviceMappingsIdx = 1; for(auto& item : m_blockDeviceMappings) { Aws::StringStream blockDeviceMappingsSs; blockDeviceMappingsSs << location << ".BlockDeviceMapping." << blockDeviceMappingsIdx++; item.OutputToStream(oStream, blockDeviceMappingsSs.str().c_str()); } } if(m_ebsOptimizedHasBeenSet) { oStream << location << ".EbsOptimized=" << std::boolalpha << m_ebsOptimized << "&"; } if(m_iamInstanceProfileHasBeenSet) { Aws::String iamInstanceProfileLocationAndMember(location); iamInstanceProfileLocationAndMember += ".IamInstanceProfile"; m_iamInstanceProfile.OutputToStream(oStream, iamInstanceProfileLocationAndMember.c_str()); } if(m_imageIdHasBeenSet) { oStream << location << ".ImageId=" << StringUtils::URLEncode(m_imageId.c_str()) << "&"; } if(m_instanceTypeHasBeenSet) { oStream << location << ".InstanceType=" << InstanceTypeMapper::GetNameForInstanceType(m_instanceType) << "&"; } if(m_kernelIdHasBeenSet) { oStream << location << ".KernelId=" << StringUtils::URLEncode(m_kernelId.c_str()) << "&"; } if(m_keyNameHasBeenSet) { oStream << location << ".KeyName=" << StringUtils::URLEncode(m_keyName.c_str()) << "&"; } if(m_monitoringHasBeenSet) { Aws::String monitoringLocationAndMember(location); monitoringLocationAndMember += ".Monitoring"; m_monitoring.OutputToStream(oStream, monitoringLocationAndMember.c_str()); } if(m_networkInterfacesHasBeenSet) { unsigned networkInterfacesIdx = 1; for(auto& item : m_networkInterfaces) { Aws::StringStream networkInterfacesSs; networkInterfacesSs << location << ".NetworkInterface." << networkInterfacesIdx++; item.OutputToStream(oStream, networkInterfacesSs.str().c_str()); } } if(m_placementHasBeenSet) { Aws::String placementLocationAndMember(location); placementLocationAndMember += ".Placement"; m_placement.OutputToStream(oStream, placementLocationAndMember.c_str()); } if(m_ramdiskIdHasBeenSet) { oStream << location << ".RamdiskId=" << StringUtils::URLEncode(m_ramdiskId.c_str()) << "&"; } if(m_subnetIdHasBeenSet) { oStream << location << ".SubnetId=" << StringUtils::URLEncode(m_subnetId.c_str()) << "&"; } if(m_userDataHasBeenSet) { oStream << location << ".UserData=" << StringUtils::URLEncode(m_userData.c_str()) << "&"; } } } // namespace Model } // namespace EC2 } // namespace Aws