1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/cloudformation/model/DescribePublisherResult.h>
7 #include <aws/core/utils/xml/XmlSerializer.h>
8 #include <aws/core/AmazonWebServiceResult.h>
9 #include <aws/core/utils/StringUtils.h>
10 #include <aws/core/utils/logging/LogMacros.h>
11 
12 #include <utility>
13 
14 using namespace Aws::CloudFormation::Model;
15 using namespace Aws::Utils::Xml;
16 using namespace Aws::Utils::Logging;
17 using namespace Aws::Utils;
18 using namespace Aws;
19 
DescribePublisherResult()20 DescribePublisherResult::DescribePublisherResult() :
21     m_publisherStatus(PublisherStatus::NOT_SET),
22     m_identityProvider(IdentityProvider::NOT_SET)
23 {
24 }
25 
DescribePublisherResult(const Aws::AmazonWebServiceResult<XmlDocument> & result)26 DescribePublisherResult::DescribePublisherResult(const Aws::AmazonWebServiceResult<XmlDocument>& result) :
27     m_publisherStatus(PublisherStatus::NOT_SET),
28     m_identityProvider(IdentityProvider::NOT_SET)
29 {
30   *this = result;
31 }
32 
operator =(const Aws::AmazonWebServiceResult<XmlDocument> & result)33 DescribePublisherResult& DescribePublisherResult::operator =(const Aws::AmazonWebServiceResult<XmlDocument>& result)
34 {
35   const XmlDocument& xmlDocument = result.GetPayload();
36   XmlNode rootNode = xmlDocument.GetRootElement();
37   XmlNode resultNode = rootNode;
38   if (!rootNode.IsNull() && (rootNode.GetName() != "DescribePublisherResult"))
39   {
40     resultNode = rootNode.FirstChild("DescribePublisherResult");
41   }
42 
43   if(!resultNode.IsNull())
44   {
45     XmlNode publisherIdNode = resultNode.FirstChild("PublisherId");
46     if(!publisherIdNode.IsNull())
47     {
48       m_publisherId = Aws::Utils::Xml::DecodeEscapedXmlText(publisherIdNode.GetText());
49     }
50     XmlNode publisherStatusNode = resultNode.FirstChild("PublisherStatus");
51     if(!publisherStatusNode.IsNull())
52     {
53       m_publisherStatus = PublisherStatusMapper::GetPublisherStatusForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(publisherStatusNode.GetText()).c_str()).c_str());
54     }
55     XmlNode identityProviderNode = resultNode.FirstChild("IdentityProvider");
56     if(!identityProviderNode.IsNull())
57     {
58       m_identityProvider = IdentityProviderMapper::GetIdentityProviderForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(identityProviderNode.GetText()).c_str()).c_str());
59     }
60     XmlNode publisherProfileNode = resultNode.FirstChild("PublisherProfile");
61     if(!publisherProfileNode.IsNull())
62     {
63       m_publisherProfile = Aws::Utils::Xml::DecodeEscapedXmlText(publisherProfileNode.GetText());
64     }
65   }
66 
67   if (!rootNode.IsNull()) {
68     XmlNode responseMetadataNode = rootNode.FirstChild("ResponseMetadata");
69     m_responseMetadata = responseMetadataNode;
70     AWS_LOGSTREAM_DEBUG("Aws::CloudFormation::Model::DescribePublisherResult", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() );
71   }
72   return *this;
73 }
74