Ejemplo n.º 1
0
        public void DeleteZoneRecord(string zoneName, DnsRecord record)
        {
            //Null checking
            if (string.IsNullOrWhiteSpace(zoneName))
            {
                throw new ArgumentNullException(nameof(zoneName));
            }
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            //Declare content to be patched
            var content = new List <ZoneRecordsDeleteRequest>
            {
                //Convert record into delete request
                new ZoneRecordsDeleteRequest(record.ToZoneRecordsResponse(MinimumTTL, zoneName))
            };

            //Call API to PATCH record
            ApiPatch($"zones/{zoneName}/records", content.ToJson());
        }
Ejemplo n.º 2
0
        public void AddZoneRecord(string zoneName, DnsRecord record)
        {
            //Null checking
            if (string.IsNullOrWhiteSpace(zoneName))
            {
                throw new ArgumentNullException(nameof(zoneName));
            }
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            //Declare content to be Patched
            var content = new List <ZoneRecordsResponse>
            {
                //Add DnsRecord to it
                record.ToZoneRecordsResponse(MinimumTTL, zoneName)
            };

            Log.WriteInfo("AddZoneRecord content: {0}", content.ToJson());

            //Call API to PATCH record
            ApiPatch($"zones/{zoneName}/records", content.ToJson());
        }