toXml method

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

Implementation

_s.XmlElement toXml(String elemName, {List<_s.XmlAttribute>? attributes}) {
  final name = this.name;
  final type = this.type;
  final aliasTarget = this.aliasTarget;
  final failover = this.failover;
  final geoLocation = this.geoLocation;
  final healthCheckId = this.healthCheckId;
  final multiValueAnswer = this.multiValueAnswer;
  final region = this.region;
  final resourceRecords = this.resourceRecords;
  final setIdentifier = this.setIdentifier;
  final ttl = this.ttl;
  final trafficPolicyInstanceId = this.trafficPolicyInstanceId;
  final weight = this.weight;
  final $children = <_s.XmlNode>[
    _s.encodeXmlStringValue('Name', name),
    _s.encodeXmlStringValue('Type', type.toValue()),
    if (setIdentifier != null)
      _s.encodeXmlStringValue('SetIdentifier', setIdentifier),
    if (weight != null) _s.encodeXmlIntValue('Weight', weight),
    if (region != null) _s.encodeXmlStringValue('Region', region.toValue()),
    if (geoLocation != null) geoLocation.toXml('GeoLocation'),
    if (failover != null)
      _s.encodeXmlStringValue('Failover', failover.toValue()),
    if (multiValueAnswer != null)
      _s.encodeXmlBoolValue('MultiValueAnswer', multiValueAnswer),
    if (ttl != null) _s.encodeXmlIntValue('TTL', ttl),
    if (resourceRecords != null)
      _s.XmlElement(_s.XmlName('ResourceRecords'), [],
          resourceRecords.map((e) => e.toXml('ResourceRecord'))),
    if (aliasTarget != null) aliasTarget.toXml('AliasTarget'),
    if (healthCheckId != null)
      _s.encodeXmlStringValue('HealthCheckId', healthCheckId),
    if (trafficPolicyInstanceId != null)
      _s.encodeXmlStringValue(
          'TrafficPolicyInstanceId', trafficPolicyInstanceId),
  ];
  final $attributes = <_s.XmlAttribute>[
    ...?attributes,
  ];
  return _s.XmlElement(
    _s.XmlName(elemName),
    $attributes,
    $children,
  );
}