Exemplo n.º 1
0
        /// <summary>
        /// Returns the YAML representation of a <see cref="ZoneData"/>.
        /// </summary>
        public static string ToYaml(this ZoneData zoneData)
        {
            if (zoneData == null)
            {
                throw new ArgumentNullException(nameof(zoneData));
            }

            var writer = new StringWriter();

            return(writer.SerializeYaml(zoneData).ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the YAML representation of a collection of <see cref="ZoneData"/>.
        /// </summary>
        /// <typeparam name="TWriter">The type of the <paramref name="writer"/>.</typeparam>
        /// <returns>The <paramref name="writer"/> to allow for fluent usage.</returns>
        public static TWriter SerializeYaml <TWriter>(
            this TWriter writer,
            ZoneData zoneData)
            where TWriter : TextWriter
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }
            if (zoneData == null)
            {
                throw new ArgumentNullException(nameof(zoneData));
            }

            return(writer
                   .SerializeYaml(zoneData.Zone)
                   .SerializeYaml(zoneData.DnsRecords, "dns_records"));
        }