111 lines
3.8 KiB
C++
111 lines
3.8 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/autoscaling/model/InstanceMetadataOptions.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 AutoScaling
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
InstanceMetadataOptions::InstanceMetadataOptions() :
|
|||
|
|
m_httpTokens(InstanceMetadataHttpTokensState::NOT_SET),
|
|||
|
|
m_httpTokensHasBeenSet(false),
|
|||
|
|
m_httpPutResponseHopLimit(0),
|
|||
|
|
m_httpPutResponseHopLimitHasBeenSet(false),
|
|||
|
|
m_httpEndpoint(InstanceMetadataEndpointState::NOT_SET),
|
|||
|
|
m_httpEndpointHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
InstanceMetadataOptions::InstanceMetadataOptions(const XmlNode& xmlNode) :
|
|||
|
|
m_httpTokens(InstanceMetadataHttpTokensState::NOT_SET),
|
|||
|
|
m_httpTokensHasBeenSet(false),
|
|||
|
|
m_httpPutResponseHopLimit(0),
|
|||
|
|
m_httpPutResponseHopLimitHasBeenSet(false),
|
|||
|
|
m_httpEndpoint(InstanceMetadataEndpointState::NOT_SET),
|
|||
|
|
m_httpEndpointHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = xmlNode;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
InstanceMetadataOptions& InstanceMetadataOptions::operator =(const XmlNode& xmlNode)
|
|||
|
|
{
|
|||
|
|
XmlNode resultNode = xmlNode;
|
|||
|
|
|
|||
|
|
if(!resultNode.IsNull())
|
|||
|
|
{
|
|||
|
|
XmlNode httpTokensNode = resultNode.FirstChild("HttpTokens");
|
|||
|
|
if(!httpTokensNode.IsNull())
|
|||
|
|
{
|
|||
|
|
m_httpTokens = InstanceMetadataHttpTokensStateMapper::GetInstanceMetadataHttpTokensStateForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(httpTokensNode.GetText()).c_str()).c_str());
|
|||
|
|
m_httpTokensHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
XmlNode httpPutResponseHopLimitNode = resultNode.FirstChild("HttpPutResponseHopLimit");
|
|||
|
|
if(!httpPutResponseHopLimitNode.IsNull())
|
|||
|
|
{
|
|||
|
|
m_httpPutResponseHopLimit = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(httpPutResponseHopLimitNode.GetText()).c_str()).c_str());
|
|||
|
|
m_httpPutResponseHopLimitHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
XmlNode httpEndpointNode = resultNode.FirstChild("HttpEndpoint");
|
|||
|
|
if(!httpEndpointNode.IsNull())
|
|||
|
|
{
|
|||
|
|
m_httpEndpoint = InstanceMetadataEndpointStateMapper::GetInstanceMetadataEndpointStateForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(httpEndpointNode.GetText()).c_str()).c_str());
|
|||
|
|
m_httpEndpointHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void InstanceMetadataOptions::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
|
|||
|
|
{
|
|||
|
|
if(m_httpTokensHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << index << locationValue << ".HttpTokens=" << InstanceMetadataHttpTokensStateMapper::GetNameForInstanceMetadataHttpTokensState(m_httpTokens) << "&";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_httpPutResponseHopLimitHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << index << locationValue << ".HttpPutResponseHopLimit=" << m_httpPutResponseHopLimit << "&";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_httpEndpointHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << index << locationValue << ".HttpEndpoint=" << InstanceMetadataEndpointStateMapper::GetNameForInstanceMetadataEndpointState(m_httpEndpoint) << "&";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void InstanceMetadataOptions::OutputToStream(Aws::OStream& oStream, const char* location) const
|
|||
|
|
{
|
|||
|
|
if(m_httpTokensHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << ".HttpTokens=" << InstanceMetadataHttpTokensStateMapper::GetNameForInstanceMetadataHttpTokensState(m_httpTokens) << "&";
|
|||
|
|
}
|
|||
|
|
if(m_httpPutResponseHopLimitHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << ".HttpPutResponseHopLimit=" << m_httpPutResponseHopLimit << "&";
|
|||
|
|
}
|
|||
|
|
if(m_httpEndpointHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << ".HttpEndpoint=" << InstanceMetadataEndpointStateMapper::GetNameForInstanceMetadataEndpointState(m_httpEndpoint) << "&";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace AutoScaling
|
|||
|
|
} // namespace Aws
|