1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/route53/model/HostedZoneConfig.h>
7 #include <aws/core/utils/xml/XmlSerializer.h>
8 #include <aws/core/utils/StringUtils.h>
9 #include <aws/core/utils/memory/stl/AWSStringStream.h>
10 
11 #include <utility>
12 
13 using namespace Aws::Utils::Xml;
14 using namespace Aws::Utils;
15 
16 namespace Aws
17 {
18 namespace Route53
19 {
20 namespace Model
21 {
22 
HostedZoneConfig()23 HostedZoneConfig::HostedZoneConfig() :
24     m_commentHasBeenSet(false),
25     m_privateZone(false),
26     m_privateZoneHasBeenSet(false)
27 {
28 }
29 
HostedZoneConfig(const XmlNode & xmlNode)30 HostedZoneConfig::HostedZoneConfig(const XmlNode& xmlNode) :
31     m_commentHasBeenSet(false),
32     m_privateZone(false),
33     m_privateZoneHasBeenSet(false)
34 {
35   *this = xmlNode;
36 }
37 
operator =(const XmlNode & xmlNode)38 HostedZoneConfig& HostedZoneConfig::operator =(const XmlNode& xmlNode)
39 {
40   XmlNode resultNode = xmlNode;
41 
42   if(!resultNode.IsNull())
43   {
44     XmlNode commentNode = resultNode.FirstChild("Comment");
45     if(!commentNode.IsNull())
46     {
47       m_comment = Aws::Utils::Xml::DecodeEscapedXmlText(commentNode.GetText());
48       m_commentHasBeenSet = true;
49     }
50     XmlNode privateZoneNode = resultNode.FirstChild("PrivateZone");
51     if(!privateZoneNode.IsNull())
52     {
53       m_privateZone = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(privateZoneNode.GetText()).c_str()).c_str());
54       m_privateZoneHasBeenSet = true;
55     }
56   }
57 
58   return *this;
59 }
60 
AddToNode(XmlNode & parentNode) const61 void HostedZoneConfig::AddToNode(XmlNode& parentNode) const
62 {
63   Aws::StringStream ss;
64   if(m_commentHasBeenSet)
65   {
66    XmlNode commentNode = parentNode.CreateChildElement("Comment");
67    commentNode.SetText(m_comment);
68   }
69 
70   if(m_privateZoneHasBeenSet)
71   {
72    XmlNode privateZoneNode = parentNode.CreateChildElement("PrivateZone");
73    ss << std::boolalpha << m_privateZone;
74    privateZoneNode.SetText(ss.str());
75    ss.str("");
76   }
77 
78 }
79 
80 } // namespace Model
81 } // namespace Route53
82 } // namespace Aws
83