1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/neptune/model/EventCategoriesMap.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 Neptune
19 {
20 namespace Model
21 {
22 
EventCategoriesMap()23 EventCategoriesMap::EventCategoriesMap() :
24     m_sourceTypeHasBeenSet(false),
25     m_eventCategoriesHasBeenSet(false)
26 {
27 }
28 
EventCategoriesMap(const XmlNode & xmlNode)29 EventCategoriesMap::EventCategoriesMap(const XmlNode& xmlNode) :
30     m_sourceTypeHasBeenSet(false),
31     m_eventCategoriesHasBeenSet(false)
32 {
33   *this = xmlNode;
34 }
35 
operator =(const XmlNode & xmlNode)36 EventCategoriesMap& EventCategoriesMap::operator =(const XmlNode& xmlNode)
37 {
38   XmlNode resultNode = xmlNode;
39 
40   if(!resultNode.IsNull())
41   {
42     XmlNode sourceTypeNode = resultNode.FirstChild("SourceType");
43     if(!sourceTypeNode.IsNull())
44     {
45       m_sourceType = Aws::Utils::Xml::DecodeEscapedXmlText(sourceTypeNode.GetText());
46       m_sourceTypeHasBeenSet = true;
47     }
48     XmlNode eventCategoriesNode = resultNode.FirstChild("EventCategories");
49     if(!eventCategoriesNode.IsNull())
50     {
51       XmlNode eventCategoriesMember = eventCategoriesNode.FirstChild("EventCategory");
52       while(!eventCategoriesMember.IsNull())
53       {
54         m_eventCategories.push_back(eventCategoriesMember.GetText());
55         eventCategoriesMember = eventCategoriesMember.NextNode("EventCategory");
56       }
57 
58       m_eventCategoriesHasBeenSet = true;
59     }
60   }
61 
62   return *this;
63 }
64 
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const65 void EventCategoriesMap::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
66 {
67   if(m_sourceTypeHasBeenSet)
68   {
69       oStream << location << index << locationValue << ".SourceType=" << StringUtils::URLEncode(m_sourceType.c_str()) << "&";
70   }
71 
72   if(m_eventCategoriesHasBeenSet)
73   {
74       unsigned eventCategoriesIdx = 1;
75       for(auto& item : m_eventCategories)
76       {
77         oStream << location << index << locationValue << ".EventCategory." << eventCategoriesIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&";
78       }
79   }
80 
81 }
82 
OutputToStream(Aws::OStream & oStream,const char * location) const83 void EventCategoriesMap::OutputToStream(Aws::OStream& oStream, const char* location) const
84 {
85   if(m_sourceTypeHasBeenSet)
86   {
87       oStream << location << ".SourceType=" << StringUtils::URLEncode(m_sourceType.c_str()) << "&";
88   }
89   if(m_eventCategoriesHasBeenSet)
90   {
91       unsigned eventCategoriesIdx = 1;
92       for(auto& item : m_eventCategories)
93       {
94         oStream << location << ".EventCategory." << eventCategoriesIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&";
95       }
96   }
97 }
98 
99 } // namespace Model
100 } // namespace Neptune
101 } // namespace Aws
102