This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/support/aws-sdk-cpp-master/aws-cpp-sdk-ec2/source/model/SpotPrice.cpp

143 lines
4.7 KiB
C++
Raw Normal View History

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/ec2/model/SpotPrice.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
namespace Aws
{
namespace EC2
{
namespace Model
{
SpotPrice::SpotPrice() :
m_availabilityZoneHasBeenSet(false),
m_instanceType(InstanceType::NOT_SET),
m_instanceTypeHasBeenSet(false),
m_productDescription(RIProductDescription::NOT_SET),
m_productDescriptionHasBeenSet(false),
m_spotPriceHasBeenSet(false),
m_timestampHasBeenSet(false)
{
}
SpotPrice::SpotPrice(const XmlNode& xmlNode) :
m_availabilityZoneHasBeenSet(false),
m_instanceType(InstanceType::NOT_SET),
m_instanceTypeHasBeenSet(false),
m_productDescription(RIProductDescription::NOT_SET),
m_productDescriptionHasBeenSet(false),
m_spotPriceHasBeenSet(false),
m_timestampHasBeenSet(false)
{
*this = xmlNode;
}
SpotPrice& SpotPrice::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode availabilityZoneNode = resultNode.FirstChild("availabilityZone");
if(!availabilityZoneNode.IsNull())
{
m_availabilityZone = Aws::Utils::Xml::DecodeEscapedXmlText(availabilityZoneNode.GetText());
m_availabilityZoneHasBeenSet = 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 productDescriptionNode = resultNode.FirstChild("productDescription");
if(!productDescriptionNode.IsNull())
{
m_productDescription = RIProductDescriptionMapper::GetRIProductDescriptionForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(productDescriptionNode.GetText()).c_str()).c_str());
m_productDescriptionHasBeenSet = true;
}
XmlNode spotPriceNode = resultNode.FirstChild("spotPrice");
if(!spotPriceNode.IsNull())
{
m_spotPrice = Aws::Utils::Xml::DecodeEscapedXmlText(spotPriceNode.GetText());
m_spotPriceHasBeenSet = true;
}
XmlNode timestampNode = resultNode.FirstChild("timestamp");
if(!timestampNode.IsNull())
{
m_timestamp = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(timestampNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
m_timestampHasBeenSet = true;
}
}
return *this;
}
void SpotPrice::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(m_availabilityZoneHasBeenSet)
{
oStream << location << index << locationValue << ".AvailabilityZone=" << StringUtils::URLEncode(m_availabilityZone.c_str()) << "&";
}
if(m_instanceTypeHasBeenSet)
{
oStream << location << index << locationValue << ".InstanceType=" << InstanceTypeMapper::GetNameForInstanceType(m_instanceType) << "&";
}
if(m_productDescriptionHasBeenSet)
{
oStream << location << index << locationValue << ".ProductDescription=" << RIProductDescriptionMapper::GetNameForRIProductDescription(m_productDescription) << "&";
}
if(m_spotPriceHasBeenSet)
{
oStream << location << index << locationValue << ".SpotPrice=" << StringUtils::URLEncode(m_spotPrice.c_str()) << "&";
}
if(m_timestampHasBeenSet)
{
oStream << location << index << locationValue << ".Timestamp=" << StringUtils::URLEncode(m_timestamp.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
}
}
void SpotPrice::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(m_availabilityZoneHasBeenSet)
{
oStream << location << ".AvailabilityZone=" << StringUtils::URLEncode(m_availabilityZone.c_str()) << "&";
}
if(m_instanceTypeHasBeenSet)
{
oStream << location << ".InstanceType=" << InstanceTypeMapper::GetNameForInstanceType(m_instanceType) << "&";
}
if(m_productDescriptionHasBeenSet)
{
oStream << location << ".ProductDescription=" << RIProductDescriptionMapper::GetNameForRIProductDescription(m_productDescription) << "&";
}
if(m_spotPriceHasBeenSet)
{
oStream << location << ".SpotPrice=" << StringUtils::URLEncode(m_spotPrice.c_str()) << "&";
}
if(m_timestampHasBeenSet)
{
oStream << location << ".Timestamp=" << StringUtils::URLEncode(m_timestamp.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
}
}
} // namespace Model
} // namespace EC2
} // namespace Aws