DeleteBucketAsync() public method

Initiates the asynchronous execution of the DeleteBucket operation.
public DeleteBucketAsync ( DeleteBucketRequest request, System cancellationToken = default(CancellationToken) ) : Task
request Amazon.S3.Model.DeleteBucketRequest Container for the necessary parameters to execute the DeleteBucket operation.
cancellationToken System /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
return Task
        public override async Task DoAction(string RoleARN)
        {
            await base.DoAction(RoleARN);

            var logger = LogManager.GetCurrentClassLogger();


            Parallel.ForEach(SharedLibrary.Utilities.GetRegions(), (region) =>
            {
                logger.Debug($"Checking S3 buckets in region {region.DisplayName }");

                var creds = SharedLibrary.Utilities.AssumeRole(RoleARN, region);

                Amazon.S3.AmazonS3Client client = new Amazon.S3.AmazonS3Client(creds, region);

                var listBucketsResult = client.ListBucketsAsync(new ListBucketsRequest {
                }).Result;

                foreach (var bucket in listBucketsResult.Buckets)
                {
                    try
                    {
                        var bucketLocationResult = client.GetBucketLocationAsync(new GetBucketLocationRequest {
                            BucketName = bucket.BucketName
                        }).Result;

                        var bucketRegion = RegionEndpoint.GetBySystemName(bucketLocationResult.Location.Value);

                        Amazon.S3.AmazonS3Client localClient = new Amazon.S3.AmazonS3Client(creds, bucketRegion);

                        EmptyBucket(localClient, bucket.BucketName).Wait();

                        var deleteBucketResult = localClient.DeleteBucketAsync(new DeleteBucketRequest {
                            BucketName = bucket.BucketName, BucketRegion = bucketLocationResult.Location
                        }).Result;


                        logger.Debug($"Bucket {bucket.BucketName} in region {region.DisplayName} deleted.");
                    }
                    catch
                    { }
                }
            });
        }