toXml method

XmlElement toXml(
  1. String elemName, {
  2. List<XmlAttribute>? attributes,
})

Implementation

_s.XmlElement toXml(String elemName, {List<_s.XmlAttribute>? attributes}) {
  final callerReference = this.callerReference;
  final comment = this.comment;
  final defaultCacheBehavior = this.defaultCacheBehavior;
  final enabled = this.enabled;
  final origins = this.origins;
  final aliases = this.aliases;
  final cacheBehaviors = this.cacheBehaviors;
  final customErrorResponses = this.customErrorResponses;
  final defaultRootObject = this.defaultRootObject;
  final httpVersion = this.httpVersion;
  final isIPV6Enabled = this.isIPV6Enabled;
  final logging = this.logging;
  final priceClass = this.priceClass;
  final restrictions = this.restrictions;
  final viewerCertificate = this.viewerCertificate;
  final webACLId = this.webACLId;
  final $children = <_s.XmlNode>[
    _s.encodeXmlStringValue('CallerReference', callerReference),
    if (aliases != null) aliases.toXml('Aliases'),
    if (defaultRootObject != null)
      _s.encodeXmlStringValue('DefaultRootObject', defaultRootObject),
    origins.toXml('Origins'),
    defaultCacheBehavior.toXml('DefaultCacheBehavior'),
    if (cacheBehaviors != null) cacheBehaviors.toXml('CacheBehaviors'),
    if (customErrorResponses != null)
      customErrorResponses.toXml('CustomErrorResponses'),
    _s.encodeXmlStringValue('Comment', comment),
    if (logging != null) logging.toXml('Logging'),
    if (priceClass != null)
      _s.encodeXmlStringValue('PriceClass', priceClass.toValue()),
    _s.encodeXmlBoolValue('Enabled', enabled),
    if (viewerCertificate != null)
      viewerCertificate.toXml('ViewerCertificate'),
    if (restrictions != null) restrictions.toXml('Restrictions'),
    if (webACLId != null) _s.encodeXmlStringValue('WebACLId', webACLId),
    if (httpVersion != null)
      _s.encodeXmlStringValue('HttpVersion', httpVersion.toValue()),
    if (isIPV6Enabled != null)
      _s.encodeXmlBoolValue('IsIPV6Enabled', isIPV6Enabled),
  ];
  final $attributes = <_s.XmlAttribute>[
    ...?attributes,
  ];
  return _s.XmlElement(
    _s.XmlName(elemName),
    $attributes,
    $children,
  );
}