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/TransitGatewayVpcAttachment.cpp

245 lines
7.8 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/TransitGatewayVpcAttachment.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
{
TransitGatewayVpcAttachment::TransitGatewayVpcAttachment() :
m_transitGatewayAttachmentIdHasBeenSet(false),
m_transitGatewayIdHasBeenSet(false),
m_vpcIdHasBeenSet(false),
m_vpcOwnerIdHasBeenSet(false),
m_state(TransitGatewayAttachmentState::NOT_SET),
m_stateHasBeenSet(false),
m_subnetIdsHasBeenSet(false),
m_creationTimeHasBeenSet(false),
m_optionsHasBeenSet(false),
m_tagsHasBeenSet(false)
{
}
TransitGatewayVpcAttachment::TransitGatewayVpcAttachment(const XmlNode& xmlNode) :
m_transitGatewayAttachmentIdHasBeenSet(false),
m_transitGatewayIdHasBeenSet(false),
m_vpcIdHasBeenSet(false),
m_vpcOwnerIdHasBeenSet(false),
m_state(TransitGatewayAttachmentState::NOT_SET),
m_stateHasBeenSet(false),
m_subnetIdsHasBeenSet(false),
m_creationTimeHasBeenSet(false),
m_optionsHasBeenSet(false),
m_tagsHasBeenSet(false)
{
*this = xmlNode;
}
TransitGatewayVpcAttachment& TransitGatewayVpcAttachment::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode transitGatewayAttachmentIdNode = resultNode.FirstChild("transitGatewayAttachmentId");
if(!transitGatewayAttachmentIdNode.IsNull())
{
m_transitGatewayAttachmentId = Aws::Utils::Xml::DecodeEscapedXmlText(transitGatewayAttachmentIdNode.GetText());
m_transitGatewayAttachmentIdHasBeenSet = true;
}
XmlNode transitGatewayIdNode = resultNode.FirstChild("transitGatewayId");
if(!transitGatewayIdNode.IsNull())
{
m_transitGatewayId = Aws::Utils::Xml::DecodeEscapedXmlText(transitGatewayIdNode.GetText());
m_transitGatewayIdHasBeenSet = true;
}
XmlNode vpcIdNode = resultNode.FirstChild("vpcId");
if(!vpcIdNode.IsNull())
{
m_vpcId = Aws::Utils::Xml::DecodeEscapedXmlText(vpcIdNode.GetText());
m_vpcIdHasBeenSet = true;
}
XmlNode vpcOwnerIdNode = resultNode.FirstChild("vpcOwnerId");
if(!vpcOwnerIdNode.IsNull())
{
m_vpcOwnerId = Aws::Utils::Xml::DecodeEscapedXmlText(vpcOwnerIdNode.GetText());
m_vpcOwnerIdHasBeenSet = true;
}
XmlNode stateNode = resultNode.FirstChild("state");
if(!stateNode.IsNull())
{
m_state = TransitGatewayAttachmentStateMapper::GetTransitGatewayAttachmentStateForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(stateNode.GetText()).c_str()).c_str());
m_stateHasBeenSet = true;
}
XmlNode subnetIdsNode = resultNode.FirstChild("subnetIds");
if(!subnetIdsNode.IsNull())
{
XmlNode subnetIdsMember = subnetIdsNode.FirstChild("item");
while(!subnetIdsMember.IsNull())
{
m_subnetIds.push_back(subnetIdsMember.GetText());
subnetIdsMember = subnetIdsMember.NextNode("item");
}
m_subnetIdsHasBeenSet = true;
}
XmlNode creationTimeNode = resultNode.FirstChild("creationTime");
if(!creationTimeNode.IsNull())
{
m_creationTime = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(creationTimeNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
m_creationTimeHasBeenSet = true;
}
XmlNode optionsNode = resultNode.FirstChild("options");
if(!optionsNode.IsNull())
{
m_options = optionsNode;
m_optionsHasBeenSet = true;
}
XmlNode tagsNode = resultNode.FirstChild("tagSet");
if(!tagsNode.IsNull())
{
XmlNode tagsMember = tagsNode.FirstChild("item");
while(!tagsMember.IsNull())
{
m_tags.push_back(tagsMember);
tagsMember = tagsMember.NextNode("item");
}
m_tagsHasBeenSet = true;
}
}
return *this;
}
void TransitGatewayVpcAttachment::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(m_transitGatewayAttachmentIdHasBeenSet)
{
oStream << location << index << locationValue << ".TransitGatewayAttachmentId=" << StringUtils::URLEncode(m_transitGatewayAttachmentId.c_str()) << "&";
}
if(m_transitGatewayIdHasBeenSet)
{
oStream << location << index << locationValue << ".TransitGatewayId=" << StringUtils::URLEncode(m_transitGatewayId.c_str()) << "&";
}
if(m_vpcIdHasBeenSet)
{
oStream << location << index << locationValue << ".VpcId=" << StringUtils::URLEncode(m_vpcId.c_str()) << "&";
}
if(m_vpcOwnerIdHasBeenSet)
{
oStream << location << index << locationValue << ".VpcOwnerId=" << StringUtils::URLEncode(m_vpcOwnerId.c_str()) << "&";
}
if(m_stateHasBeenSet)
{
oStream << location << index << locationValue << ".State=" << TransitGatewayAttachmentStateMapper::GetNameForTransitGatewayAttachmentState(m_state) << "&";
}
if(m_subnetIdsHasBeenSet)
{
unsigned subnetIdsIdx = 1;
for(auto& item : m_subnetIds)
{
oStream << location << index << locationValue << ".SubnetIds." << subnetIdsIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&";
}
}
if(m_creationTimeHasBeenSet)
{
oStream << location << index << locationValue << ".CreationTime=" << StringUtils::URLEncode(m_creationTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
}
if(m_optionsHasBeenSet)
{
Aws::StringStream optionsLocationAndMemberSs;
optionsLocationAndMemberSs << location << index << locationValue << ".Options";
m_options.OutputToStream(oStream, optionsLocationAndMemberSs.str().c_str());
}
if(m_tagsHasBeenSet)
{
unsigned tagsIdx = 1;
for(auto& item : m_tags)
{
Aws::StringStream tagsSs;
tagsSs << location << index << locationValue << ".TagSet." << tagsIdx++;
item.OutputToStream(oStream, tagsSs.str().c_str());
}
}
}
void TransitGatewayVpcAttachment::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(m_transitGatewayAttachmentIdHasBeenSet)
{
oStream << location << ".TransitGatewayAttachmentId=" << StringUtils::URLEncode(m_transitGatewayAttachmentId.c_str()) << "&";
}
if(m_transitGatewayIdHasBeenSet)
{
oStream << location << ".TransitGatewayId=" << StringUtils::URLEncode(m_transitGatewayId.c_str()) << "&";
}
if(m_vpcIdHasBeenSet)
{
oStream << location << ".VpcId=" << StringUtils::URLEncode(m_vpcId.c_str()) << "&";
}
if(m_vpcOwnerIdHasBeenSet)
{
oStream << location << ".VpcOwnerId=" << StringUtils::URLEncode(m_vpcOwnerId.c_str()) << "&";
}
if(m_stateHasBeenSet)
{
oStream << location << ".State=" << TransitGatewayAttachmentStateMapper::GetNameForTransitGatewayAttachmentState(m_state) << "&";
}
if(m_subnetIdsHasBeenSet)
{
unsigned subnetIdsIdx = 1;
for(auto& item : m_subnetIds)
{
oStream << location << ".SubnetIds." << subnetIdsIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&";
}
}
if(m_creationTimeHasBeenSet)
{
oStream << location << ".CreationTime=" << StringUtils::URLEncode(m_creationTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
}
if(m_optionsHasBeenSet)
{
Aws::String optionsLocationAndMember(location);
optionsLocationAndMember += ".Options";
m_options.OutputToStream(oStream, optionsLocationAndMember.c_str());
}
if(m_tagsHasBeenSet)
{
unsigned tagsIdx = 1;
for(auto& item : m_tags)
{
Aws::StringStream tagsSs;
tagsSs << location << ".TagSet." << tagsIdx++;
item.OutputToStream(oStream, tagsSs.str().c_str());
}
}
}
} // namespace Model
} // namespace EC2
} // namespace Aws