Esempio n. 1
0
        public static async Task DestroyRecord(this Route53Helper r53h, string zoneId, string recordName, string recordType, string failover = null, bool throwIfNotFound = true)
        {
            var records = await r53h.GetRecordSetsAsync(zoneId, recordName, recordType, failover : failover, throwIfNotFound : throwIfNotFound);

            if (!throwIfNotFound && records.IsNullOrEmpty())
            {
                return;
            }

            foreach (var record in records)
            {
                await r53h.DeleteResourceRecordSetsAsync(zoneId, record);

                await Task.Delay(1000); //make sure request is porcessed
            }
        }
Esempio n. 2
0
        public static async Task <ResourceRecordSet> GetRecordSet(
            this Route53Helper r53h,
            string zoneId,
            string recordName,
            string recordType,
            string failover      = null,
            bool throwIfNotFound = true)
        {
            var sets = await r53h.GetRecordSetsAsync(zoneId, recordName, recordType, failover, throwIfNotFound : throwIfNotFound);

            if (throwIfNotFound && (sets?.Length ?? 0) != 1)
            {
                throw new Exception($"{nameof(GetRecordSet)} Failed, more then one RecordSet with Name: '{recordName}' and Type: '{recordType}' was found. [{sets.Length}]");
            }

            return(sets?.SingleOrDefault());
        }