124 lines
3.5 KiB
C++
124 lines
3.5 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/elasticache/model/Event.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 ElastiCache
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Event::Event() :
|
|||
|
|
m_sourceIdentifierHasBeenSet(false),
|
|||
|
|
m_sourceType(SourceType::NOT_SET),
|
|||
|
|
m_sourceTypeHasBeenSet(false),
|
|||
|
|
m_messageHasBeenSet(false),
|
|||
|
|
m_dateHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Event::Event(const XmlNode& xmlNode) :
|
|||
|
|
m_sourceIdentifierHasBeenSet(false),
|
|||
|
|
m_sourceType(SourceType::NOT_SET),
|
|||
|
|
m_sourceTypeHasBeenSet(false),
|
|||
|
|
m_messageHasBeenSet(false),
|
|||
|
|
m_dateHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = xmlNode;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Event& Event::operator =(const XmlNode& xmlNode)
|
|||
|
|
{
|
|||
|
|
XmlNode resultNode = xmlNode;
|
|||
|
|
|
|||
|
|
if(!resultNode.IsNull())
|
|||
|
|
{
|
|||
|
|
XmlNode sourceIdentifierNode = resultNode.FirstChild("SourceIdentifier");
|
|||
|
|
if(!sourceIdentifierNode.IsNull())
|
|||
|
|
{
|
|||
|
|
m_sourceIdentifier = Aws::Utils::Xml::DecodeEscapedXmlText(sourceIdentifierNode.GetText());
|
|||
|
|
m_sourceIdentifierHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
XmlNode sourceTypeNode = resultNode.FirstChild("SourceType");
|
|||
|
|
if(!sourceTypeNode.IsNull())
|
|||
|
|
{
|
|||
|
|
m_sourceType = SourceTypeMapper::GetSourceTypeForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(sourceTypeNode.GetText()).c_str()).c_str());
|
|||
|
|
m_sourceTypeHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
XmlNode messageNode = resultNode.FirstChild("Message");
|
|||
|
|
if(!messageNode.IsNull())
|
|||
|
|
{
|
|||
|
|
m_message = Aws::Utils::Xml::DecodeEscapedXmlText(messageNode.GetText());
|
|||
|
|
m_messageHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
XmlNode dateNode = resultNode.FirstChild("Date");
|
|||
|
|
if(!dateNode.IsNull())
|
|||
|
|
{
|
|||
|
|
m_date = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(dateNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
|
|||
|
|
m_dateHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Event::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
|
|||
|
|
{
|
|||
|
|
if(m_sourceIdentifierHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << index << locationValue << ".SourceIdentifier=" << StringUtils::URLEncode(m_sourceIdentifier.c_str()) << "&";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_sourceTypeHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << index << locationValue << ".SourceType=" << SourceTypeMapper::GetNameForSourceType(m_sourceType) << "&";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_messageHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << index << locationValue << ".Message=" << StringUtils::URLEncode(m_message.c_str()) << "&";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_dateHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << index << locationValue << ".Date=" << StringUtils::URLEncode(m_date.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Event::OutputToStream(Aws::OStream& oStream, const char* location) const
|
|||
|
|
{
|
|||
|
|
if(m_sourceIdentifierHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << ".SourceIdentifier=" << StringUtils::URLEncode(m_sourceIdentifier.c_str()) << "&";
|
|||
|
|
}
|
|||
|
|
if(m_sourceTypeHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << ".SourceType=" << SourceTypeMapper::GetNameForSourceType(m_sourceType) << "&";
|
|||
|
|
}
|
|||
|
|
if(m_messageHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << ".Message=" << StringUtils::URLEncode(m_message.c_str()) << "&";
|
|||
|
|
}
|
|||
|
|
if(m_dateHasBeenSet)
|
|||
|
|
{
|
|||
|
|
oStream << location << ".Date=" << StringUtils::URLEncode(m_date.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace ElastiCache
|
|||
|
|
} // namespace Aws
|