toXml method

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

Implementation

_s.XmlElement toXml(String elemName, {List<_s.XmlAttribute>? attributes}) {
  final bucketName = this.bucketName;
  final prefix = this.prefix;
  final accessControlList = this.accessControlList;
  final cannedACL = this.cannedACL;
  final encryption = this.encryption;
  final storageClass = this.storageClass;
  final tagging = this.tagging;
  final userMetadata = this.userMetadata;
  final $children = <_s.XmlNode>[
    _s.encodeXmlStringValue('BucketName', bucketName),
    _s.encodeXmlStringValue('Prefix', prefix),
    if (encryption != null) encryption.toXml('Encryption'),
    if (cannedACL != null)
      _s.encodeXmlStringValue('CannedACL', cannedACL.toValue()),
    if (accessControlList != null)
      _s.XmlElement(_s.XmlName('AccessControlList'), [],
          accessControlList.map((e) => e.toXml('Grant'))),
    if (tagging != null) tagging.toXml('Tagging'),
    if (userMetadata != null)
      _s.XmlElement(_s.XmlName('UserMetadata'), [],
          userMetadata.map((e) => e.toXml('MetadataEntry'))),
    if (storageClass != null)
      _s.encodeXmlStringValue('StorageClass', storageClass.toValue()),
  ];
  final $attributes = <_s.XmlAttribute>[
    ...?attributes,
  ];
  return _s.XmlElement(
    _s.XmlName(elemName),
    $attributes,
    $children,
  );
}