/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include using namespace Aws::Utils::Xml; using namespace Aws::Utils; namespace Aws { namespace ElastiCache { namespace Model { ReservedCacheNodesOffering::ReservedCacheNodesOffering() : m_reservedCacheNodesOfferingIdHasBeenSet(false), m_cacheNodeTypeHasBeenSet(false), m_duration(0), m_durationHasBeenSet(false), m_fixedPrice(0.0), m_fixedPriceHasBeenSet(false), m_usagePrice(0.0), m_usagePriceHasBeenSet(false), m_productDescriptionHasBeenSet(false), m_offeringTypeHasBeenSet(false), m_recurringChargesHasBeenSet(false) { } ReservedCacheNodesOffering::ReservedCacheNodesOffering(const XmlNode& xmlNode) : m_reservedCacheNodesOfferingIdHasBeenSet(false), m_cacheNodeTypeHasBeenSet(false), m_duration(0), m_durationHasBeenSet(false), m_fixedPrice(0.0), m_fixedPriceHasBeenSet(false), m_usagePrice(0.0), m_usagePriceHasBeenSet(false), m_productDescriptionHasBeenSet(false), m_offeringTypeHasBeenSet(false), m_recurringChargesHasBeenSet(false) { *this = xmlNode; } ReservedCacheNodesOffering& ReservedCacheNodesOffering::operator =(const XmlNode& xmlNode) { XmlNode resultNode = xmlNode; if(!resultNode.IsNull()) { XmlNode reservedCacheNodesOfferingIdNode = resultNode.FirstChild("ReservedCacheNodesOfferingId"); if(!reservedCacheNodesOfferingIdNode.IsNull()) { m_reservedCacheNodesOfferingId = Aws::Utils::Xml::DecodeEscapedXmlText(reservedCacheNodesOfferingIdNode.GetText()); m_reservedCacheNodesOfferingIdHasBeenSet = true; } XmlNode cacheNodeTypeNode = resultNode.FirstChild("CacheNodeType"); if(!cacheNodeTypeNode.IsNull()) { m_cacheNodeType = Aws::Utils::Xml::DecodeEscapedXmlText(cacheNodeTypeNode.GetText()); m_cacheNodeTypeHasBeenSet = true; } XmlNode durationNode = resultNode.FirstChild("Duration"); if(!durationNode.IsNull()) { m_duration = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(durationNode.GetText()).c_str()).c_str()); m_durationHasBeenSet = true; } XmlNode fixedPriceNode = resultNode.FirstChild("FixedPrice"); if(!fixedPriceNode.IsNull()) { m_fixedPrice = StringUtils::ConvertToDouble(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(fixedPriceNode.GetText()).c_str()).c_str()); m_fixedPriceHasBeenSet = true; } XmlNode usagePriceNode = resultNode.FirstChild("UsagePrice"); if(!usagePriceNode.IsNull()) { m_usagePrice = StringUtils::ConvertToDouble(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(usagePriceNode.GetText()).c_str()).c_str()); m_usagePriceHasBeenSet = true; } XmlNode productDescriptionNode = resultNode.FirstChild("ProductDescription"); if(!productDescriptionNode.IsNull()) { m_productDescription = Aws::Utils::Xml::DecodeEscapedXmlText(productDescriptionNode.GetText()); m_productDescriptionHasBeenSet = true; } XmlNode offeringTypeNode = resultNode.FirstChild("OfferingType"); if(!offeringTypeNode.IsNull()) { m_offeringType = Aws::Utils::Xml::DecodeEscapedXmlText(offeringTypeNode.GetText()); m_offeringTypeHasBeenSet = true; } XmlNode recurringChargesNode = resultNode.FirstChild("RecurringCharges"); if(!recurringChargesNode.IsNull()) { XmlNode recurringChargesMember = recurringChargesNode.FirstChild("RecurringCharge"); while(!recurringChargesMember.IsNull()) { m_recurringCharges.push_back(recurringChargesMember); recurringChargesMember = recurringChargesMember.NextNode("RecurringCharge"); } m_recurringChargesHasBeenSet = true; } } return *this; } void ReservedCacheNodesOffering::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const { if(m_reservedCacheNodesOfferingIdHasBeenSet) { oStream << location << index << locationValue << ".ReservedCacheNodesOfferingId=" << StringUtils::URLEncode(m_reservedCacheNodesOfferingId.c_str()) << "&"; } if(m_cacheNodeTypeHasBeenSet) { oStream << location << index << locationValue << ".CacheNodeType=" << StringUtils::URLEncode(m_cacheNodeType.c_str()) << "&"; } if(m_durationHasBeenSet) { oStream << location << index << locationValue << ".Duration=" << m_duration << "&"; } if(m_fixedPriceHasBeenSet) { oStream << location << index << locationValue << ".FixedPrice=" << StringUtils::URLEncode(m_fixedPrice) << "&"; } if(m_usagePriceHasBeenSet) { oStream << location << index << locationValue << ".UsagePrice=" << StringUtils::URLEncode(m_usagePrice) << "&"; } if(m_productDescriptionHasBeenSet) { oStream << location << index << locationValue << ".ProductDescription=" << StringUtils::URLEncode(m_productDescription.c_str()) << "&"; } if(m_offeringTypeHasBeenSet) { oStream << location << index << locationValue << ".OfferingType=" << StringUtils::URLEncode(m_offeringType.c_str()) << "&"; } if(m_recurringChargesHasBeenSet) { unsigned recurringChargesIdx = 1; for(auto& item : m_recurringCharges) { Aws::StringStream recurringChargesSs; recurringChargesSs << location << index << locationValue << ".RecurringCharge." << recurringChargesIdx++; item.OutputToStream(oStream, recurringChargesSs.str().c_str()); } } } void ReservedCacheNodesOffering::OutputToStream(Aws::OStream& oStream, const char* location) const { if(m_reservedCacheNodesOfferingIdHasBeenSet) { oStream << location << ".ReservedCacheNodesOfferingId=" << StringUtils::URLEncode(m_reservedCacheNodesOfferingId.c_str()) << "&"; } if(m_cacheNodeTypeHasBeenSet) { oStream << location << ".CacheNodeType=" << StringUtils::URLEncode(m_cacheNodeType.c_str()) << "&"; } if(m_durationHasBeenSet) { oStream << location << ".Duration=" << m_duration << "&"; } if(m_fixedPriceHasBeenSet) { oStream << location << ".FixedPrice=" << StringUtils::URLEncode(m_fixedPrice) << "&"; } if(m_usagePriceHasBeenSet) { oStream << location << ".UsagePrice=" << StringUtils::URLEncode(m_usagePrice) << "&"; } if(m_productDescriptionHasBeenSet) { oStream << location << ".ProductDescription=" << StringUtils::URLEncode(m_productDescription.c_str()) << "&"; } if(m_offeringTypeHasBeenSet) { oStream << location << ".OfferingType=" << StringUtils::URLEncode(m_offeringType.c_str()) << "&"; } if(m_recurringChargesHasBeenSet) { unsigned recurringChargesIdx = 1; for(auto& item : m_recurringCharges) { Aws::StringStream recurringChargesSs; recurringChargesSs << location << ".RecurringCharge." << recurringChargesIdx++; item.OutputToStream(oStream, recurringChargesSs.str().c_str()); } } } } // namespace Model } // namespace ElastiCache } // namespace Aws