1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/redshift/model/AccountWithRestoreAccess.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 Redshift
19 {
20 namespace Model
21 {
22 
AccountWithRestoreAccess()23 AccountWithRestoreAccess::AccountWithRestoreAccess() :
24     m_accountIdHasBeenSet(false),
25     m_accountAliasHasBeenSet(false)
26 {
27 }
28 
AccountWithRestoreAccess(const XmlNode & xmlNode)29 AccountWithRestoreAccess::AccountWithRestoreAccess(const XmlNode& xmlNode) :
30     m_accountIdHasBeenSet(false),
31     m_accountAliasHasBeenSet(false)
32 {
33   *this = xmlNode;
34 }
35 
operator =(const XmlNode & xmlNode)36 AccountWithRestoreAccess& AccountWithRestoreAccess::operator =(const XmlNode& xmlNode)
37 {
38   XmlNode resultNode = xmlNode;
39 
40   if(!resultNode.IsNull())
41   {
42     XmlNode accountIdNode = resultNode.FirstChild("AccountId");
43     if(!accountIdNode.IsNull())
44     {
45       m_accountId = Aws::Utils::Xml::DecodeEscapedXmlText(accountIdNode.GetText());
46       m_accountIdHasBeenSet = true;
47     }
48     XmlNode accountAliasNode = resultNode.FirstChild("AccountAlias");
49     if(!accountAliasNode.IsNull())
50     {
51       m_accountAlias = Aws::Utils::Xml::DecodeEscapedXmlText(accountAliasNode.GetText());
52       m_accountAliasHasBeenSet = true;
53     }
54   }
55 
56   return *this;
57 }
58 
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const59 void AccountWithRestoreAccess::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
60 {
61   if(m_accountIdHasBeenSet)
62   {
63       oStream << location << index << locationValue << ".AccountId=" << StringUtils::URLEncode(m_accountId.c_str()) << "&";
64   }
65 
66   if(m_accountAliasHasBeenSet)
67   {
68       oStream << location << index << locationValue << ".AccountAlias=" << StringUtils::URLEncode(m_accountAlias.c_str()) << "&";
69   }
70 
71 }
72 
OutputToStream(Aws::OStream & oStream,const char * location) const73 void AccountWithRestoreAccess::OutputToStream(Aws::OStream& oStream, const char* location) const
74 {
75   if(m_accountIdHasBeenSet)
76   {
77       oStream << location << ".AccountId=" << StringUtils::URLEncode(m_accountId.c_str()) << "&";
78   }
79   if(m_accountAliasHasBeenSet)
80   {
81       oStream << location << ".AccountAlias=" << StringUtils::URLEncode(m_accountAlias.c_str()) << "&";
82   }
83 }
84 
85 } // namespace Model
86 } // namespace Redshift
87 } // namespace Aws
88