toXml method

XmlNode toXml()

Implementation

XmlNode toXml() {
  final builder = XmlBuilder();
  builder.element(
    'ReplicationRule',
    nest: () {
      if (deleteMarkerReplication != null) {
        builder.element(
          'DeleteMarkerReplication',
          nest: (deleteMarkerReplication!.toXml() as XmlDocument)
              .rootElement
              .children,
        );
      }

      if (destination != null) {
        builder.element(
          'Destination',
          nest: (destination!.toXml() as XmlDocument).rootElement.children,
        );
      }

      if (existingObjectReplication != null) {
        builder.element(
          'ExistingObjectReplication',
          nest: (existingObjectReplication!.toXml() as XmlDocument)
              .rootElement
              .children,
        );
      }

      if (filter != null) {
        builder.element(
          'Filter',
          nest: (filter!.toXml() as XmlDocument).rootElement.children,
        );
      }

      if (iD != null) {
        builder.element('ID', nest: iD);
      }

      if (prefix != null) {
        builder.element('Prefix', nest: prefix);
      }

      if (priority != null) {
        builder.element('Priority', nest: priority.toString());
      }

      if (sourceSelectionCriteria != null) {
        builder.element(
          'SourceSelectionCriteria',
          nest: (sourceSelectionCriteria!.toXml() as XmlDocument)
              .rootElement
              .children,
        );
      }

      if (status != null) {
        builder.element('Status', nest: status);
      }
    },
  );
  return builder.buildDocument();
}