toXml method

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

Implementation

_s.XmlElement toXml(String elemName, {List<_s.XmlAttribute>? attributes}) {
  final domainName = this.domainName;
  final id = this.id;
  final connectionAttempts = this.connectionAttempts;
  final connectionTimeout = this.connectionTimeout;
  final customHeaders = this.customHeaders;
  final customOriginConfig = this.customOriginConfig;
  final originPath = this.originPath;
  final s3OriginConfig = this.s3OriginConfig;
  final $children = <_s.XmlNode>[
    _s.encodeXmlStringValue('Id', id),
    _s.encodeXmlStringValue('DomainName', domainName),
    if (originPath != null) _s.encodeXmlStringValue('OriginPath', originPath),
    if (customHeaders != null) customHeaders.toXml('CustomHeaders'),
    if (s3OriginConfig != null) s3OriginConfig.toXml('S3OriginConfig'),
    if (customOriginConfig != null)
      customOriginConfig.toXml('CustomOriginConfig'),
    if (connectionAttempts != null)
      _s.encodeXmlIntValue('ConnectionAttempts', connectionAttempts),
    if (connectionTimeout != null)
      _s.encodeXmlIntValue('ConnectionTimeout', connectionTimeout),
  ];
  final $attributes = <_s.XmlAttribute>[
    ...?attributes,
  ];
  return _s.XmlElement(
    _s.XmlName(elemName),
    $attributes,
    $children,
  );
}