setNtp static method

XmlDocumentFragment setNtp(
  1. NtpInformation ntpInformation
)

XML for the setNtp

Implementation

static XmlDocumentFragment setNtp(NtpInformation ntpInformation) {
  builder.element(
    'SetNTP',
    nest: () {
      builder.namespaceUri(null, Xmlns.tds);

      ntpInformation.fromDhcp.toString().buildXml(builder, tag: 'FromDHCP');

      for (var ntp in ntpInformation.ntpManual ?? <Ntp>[]) {
        builder.element(
          'NTPManual',
          nest: () {
            ntp.type.buildXml(builder, tag: 'Type');

            if (ntp.iPv4Address != null) {
              ntp.iPv4Address!.buildXml(builder, tag: 'IPv4Address');
            }

            if (ntp.iPv6Address != null) {
              ntp.iPv6Address!.buildXml(builder, tag: 'IPv6Address');
            }

            if (ntp.dnsName != null) {
              ntp.dnsName!.buildXml(builder, tag: 'DNSname');
            }
          },
        );
      }
    },
  );

  return builder.buildFragment();
}