Elastacloud.AzureManagement.Fluent.Clients.BlobClient.DeleteBlob C# (CSharp) Method

DeleteBlob() public method

Deletes a blob
public DeleteBlob ( string blobName ) : void
blobName string The name of a valid blob
return void
        public void DeleteBlob(string blobName)
        {
            LoadKeyIfNotExists();
            var deleteblob = new DeleteBlobCommand(ContainerName, blobName)
            {
                AccountName = AccountName,
                AccountKey = AccountKey
            };
            deleteblob.Execute();
        }

Usage Example

Example #1
0
        /// <summary>
        /// Cleans up any disks which don't have an attached VM
        /// </summary>
        public void CleanupUnattachedDisks()
        {
            // get all of the disks in the subscription
            var command = new GetVirtualDisksCommand()
            {
                SubscriptionId = SubscriptionId,
                Certificate    = ManagementCertificate
            };

            command.Execute();
            var disks = command.Disks;

            // initiate the blob delete

            // iterate through the disks and clean up the unattached ones
            foreach (var disk in disks)
            {
                // make sure the disk is unattached
                if (disk.VM != null)
                {
                    continue;
                }
                // get the blob details
                string      storageAccount = ParseBlobDetails(disk.MediaLink);
                IBlobClient blobClient     = new BlobClient(SubscriptionId, StorageContainerName, storageAccount, ManagementCertificate);
                DeleteNamedVirtualMachineDisk(disk.Name);
                Trace.WriteLine(String.Format("Deleting disk with name {0}", disk.Name));
                // delete the underlying blob
                blobClient.DeleteBlob(StorageFileName);
                Trace.WriteLine(String.Format("Deleting disk with name {0}", StorageFileName));
            }
        }
All Usage Examples Of Elastacloud.AzureManagement.Fluent.Clients.BlobClient::DeleteBlob