Ejemplo n.º 1
0
        /// <summary>
        /// Delete a hosted zone.
        /// </summary>
        /// <param name="hostedZoneId">The ID of the hosted zone that contains the resource record sets that you want to delete</param>
        /// <param name="settings">The <see cref="Route53Settings"/> required to connect to Route53.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        public async Task <bool> DeleteHostedZone(string hostedZoneId, Route53Settings settings, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (String.IsNullOrEmpty(hostedZoneId))
            {
                throw new ArgumentNullException("hostedZoneId");
            }



            DeleteHostedZoneRequest request = new DeleteHostedZoneRequest(hostedZoneId);

            AmazonRoute53Client      client   = this.GetClient(settings);
            DeleteHostedZoneResponse response = await client.DeleteHostedZoneAsync(request);

            if (response.HttpStatusCode == HttpStatusCode.OK)
            {
                await this.WaitForChange(client, response.ChangeInfo.Id, 10000, 60);

                _Log.Verbose("deleted hosted zone");
                return(true);
            }
            else
            {
                _Log.Error("Could not delete hosted zone");
                return(false);
            }
        }