/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include using namespace Aws::EC2::Model; using namespace Aws::Utils::Xml; using namespace Aws::Utils::Logging; using namespace Aws::Utils; using namespace Aws; ImportImageResponse::ImportImageResponse() : m_encrypted(false) { } ImportImageResponse::ImportImageResponse(const Aws::AmazonWebServiceResult& result) : m_encrypted(false) { *this = result; } ImportImageResponse& ImportImageResponse::operator =(const Aws::AmazonWebServiceResult& result) { const XmlDocument& xmlDocument = result.GetPayload(); XmlNode rootNode = xmlDocument.GetRootElement(); XmlNode resultNode = rootNode; if (!rootNode.IsNull() && (rootNode.GetName() != "ImportImageResponse")) { resultNode = rootNode.FirstChild("ImportImageResponse"); } if(!resultNode.IsNull()) { XmlNode architectureNode = resultNode.FirstChild("architecture"); if(!architectureNode.IsNull()) { m_architecture = Aws::Utils::Xml::DecodeEscapedXmlText(architectureNode.GetText()); } XmlNode descriptionNode = resultNode.FirstChild("description"); if(!descriptionNode.IsNull()) { m_description = Aws::Utils::Xml::DecodeEscapedXmlText(descriptionNode.GetText()); } XmlNode encryptedNode = resultNode.FirstChild("encrypted"); if(!encryptedNode.IsNull()) { m_encrypted = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(encryptedNode.GetText()).c_str()).c_str()); } XmlNode hypervisorNode = resultNode.FirstChild("hypervisor"); if(!hypervisorNode.IsNull()) { m_hypervisor = Aws::Utils::Xml::DecodeEscapedXmlText(hypervisorNode.GetText()); } XmlNode imageIdNode = resultNode.FirstChild("imageId"); if(!imageIdNode.IsNull()) { m_imageId = Aws::Utils::Xml::DecodeEscapedXmlText(imageIdNode.GetText()); } XmlNode importTaskIdNode = resultNode.FirstChild("importTaskId"); if(!importTaskIdNode.IsNull()) { m_importTaskId = Aws::Utils::Xml::DecodeEscapedXmlText(importTaskIdNode.GetText()); } XmlNode kmsKeyIdNode = resultNode.FirstChild("kmsKeyId"); if(!kmsKeyIdNode.IsNull()) { m_kmsKeyId = Aws::Utils::Xml::DecodeEscapedXmlText(kmsKeyIdNode.GetText()); } XmlNode licenseTypeNode = resultNode.FirstChild("licenseType"); if(!licenseTypeNode.IsNull()) { m_licenseType = Aws::Utils::Xml::DecodeEscapedXmlText(licenseTypeNode.GetText()); } XmlNode platformNode = resultNode.FirstChild("platform"); if(!platformNode.IsNull()) { m_platform = Aws::Utils::Xml::DecodeEscapedXmlText(platformNode.GetText()); } XmlNode progressNode = resultNode.FirstChild("progress"); if(!progressNode.IsNull()) { m_progress = Aws::Utils::Xml::DecodeEscapedXmlText(progressNode.GetText()); } XmlNode snapshotDetailsNode = resultNode.FirstChild("snapshotDetailSet"); if(!snapshotDetailsNode.IsNull()) { XmlNode snapshotDetailsMember = snapshotDetailsNode.FirstChild("item"); while(!snapshotDetailsMember.IsNull()) { m_snapshotDetails.push_back(snapshotDetailsMember); snapshotDetailsMember = snapshotDetailsMember.NextNode("item"); } } XmlNode statusNode = resultNode.FirstChild("status"); if(!statusNode.IsNull()) { m_status = Aws::Utils::Xml::DecodeEscapedXmlText(statusNode.GetText()); } XmlNode statusMessageNode = resultNode.FirstChild("statusMessage"); if(!statusMessageNode.IsNull()) { m_statusMessage = Aws::Utils::Xml::DecodeEscapedXmlText(statusMessageNode.GetText()); } XmlNode licenseSpecificationsNode = resultNode.FirstChild("licenseSpecifications"); if(!licenseSpecificationsNode.IsNull()) { XmlNode licenseSpecificationsMember = licenseSpecificationsNode.FirstChild("item"); while(!licenseSpecificationsMember.IsNull()) { m_licenseSpecifications.push_back(licenseSpecificationsMember); licenseSpecificationsMember = licenseSpecificationsMember.NextNode("item"); } } XmlNode tagsNode = resultNode.FirstChild("tagSet"); if(!tagsNode.IsNull()) { XmlNode tagsMember = tagsNode.FirstChild("item"); while(!tagsMember.IsNull()) { m_tags.push_back(tagsMember); tagsMember = tagsMember.NextNode("item"); } } XmlNode usageOperationNode = resultNode.FirstChild("usageOperation"); if(!usageOperationNode.IsNull()) { m_usageOperation = Aws::Utils::Xml::DecodeEscapedXmlText(usageOperationNode.GetText()); } } if (!rootNode.IsNull()) { XmlNode requestIdNode = rootNode.FirstChild("requestId"); if (!requestIdNode.IsNull()) { m_responseMetadata.SetRequestId(StringUtils::Trim(requestIdNode.GetText().c_str())); } AWS_LOGSTREAM_DEBUG("Aws::EC2::Model::ImportImageResponse", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() ); } return *this; }