C# Class BlobStorage.Advanced

Advanced samples for Blob storage, including samples demonstrating a variety of client library classes and methods.
Show file Open project: Azure-Samples/storage-blob-dotnet-getting-started

Public Methods

Method Description
CallBlobAdvancedSamples ( ) : System.Threading.Tasks.Task

Calls the advanced samples for Blob storage.

Private Methods

Method Description
AddContainerMetadataAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : System.Threading.Tasks.Task

Add some sample metadata to the container.

CallBlobClientSamples ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient ) : System.Threading.Tasks.Task

Calls samples that demonstrate how to use the Blob service client (CloudBlobClient) object.

CallBlobSamples ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : System.Threading.Tasks.Task

Calls samples that demonstrate how to work with blobs.

CallContainerSamples ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : System.Threading.Tasks.Task

Calls samples that demonstrate how to work with a blob container.

CallSasSamples ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : System.Threading.Tasks.Task

Calls shared access signature samples for both containers and blobs.

ConfigureBlobAnalyticsAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient ) : System.Threading.Tasks.Task

Configures logging and metrics for Blob storage, as well as the default service version. Note that if you have already enabled analytics for your storage account, running this sample will change those settings. For that reason, it's best to run with a test storage account if possible. The sample saves your settings and resets them after it has completed running.

CopyBlockBlobAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : System.Threading.Tasks.Task

Gets a reference to a blob created previously, and copies it to a new blob in the same container.

CopyLargeBlockBlobAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, int sizeInMb ) : System.Threading.Tasks.Task

Creates a large block blob, and copies it to a new blob in the same container. If the copy operation does not complete within the specified interval, abort the copy operation.

CorsSample ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient ) : System.Threading.Tasks.Task

Query the Cross-Origin Resource Sharing (CORS) rules for the Queue service

CreateBlockBlobSnapshotAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : System.Threading.Tasks.Task

Creates a new blob and takes a snapshot of the blob.

CreateNestedBlockBlobsAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, short numberOfLevels, short numberOfBlobsPerLevel ) : System.Threading.Tasks.Task

Creates the specified number of nested block blobs at a specified number of levels.

CreateRandomlyNamedBlockBlobAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : Task

Creates a randomly named block blob.

CreateSampleContainerAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient ) : Task

Creates a sample container for use in the sample application.

CreateSequentiallyNamedBlockBlobsAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, int numberOfBlobs ) : System.Threading.Tasks.Task

Creates the specified number of sequentially named block blobs, in a flat structure.

CreateSharedAccessPolicyAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, string policyName ) : System.Threading.Tasks.Task

Creates a shared access policy on the container.

DeleteContainersWithPrefixAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient, string prefix ) : System.Threading.Tasks.Task

Deletes containers starting with specified prefix. Note that the ListContainers method is called synchronously, for the purposes of the sample. However, in a real-world application using the async/await pattern, best practices recommend using asynchronous methods consistently.

GetBlobSasUri ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, string blobName, string policyName = null ) : string

Returns a URI containing a SAS for the blob.

GetContainerSasUri ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, string storedPolicyName = null ) : string

Returns a URI containing a SAS for the blob container.

GetExistingBlobReference ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, string blobName ) : void

Gets a reference to a blob by making a request to the service. Note that the GetBlobReferenceFromServer method is called synchronously, for the purposes of the sample. However, in a real-world application using the async/await pattern, best practices recommend using asynchronous methods consistently.

GetExistingBlobReferenceAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, string blobName ) : System.Threading.Tasks.Task

Gets a reference to a blob by making a request to the service.

GetRandomBuffer ( int size ) : byte[]
GetServiceStatsForSecondaryAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient ) : System.Threading.Tasks.Task

Gets the Blob service stats for the secondary endpoint for an RA-GRS (read-access geo-redundant) storage account.

ListAllContainers ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient, string prefix ) : void

Lists all containers in the storage account. Note that the ListContainers method is called synchronously, for the purposes of the sample. However, in a real-world application using the async/await pattern, best practices recommend using asynchronous methods consistently.

ListBlobsFlatListingAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, int segmentSize ) : System.Threading.Tasks.Task

Lists blobs in the specified container using a flat listing, with an optional segment size specified, and writes their properties and metadata to the console window. The flat listing returns a segment containing all of the blobs matching the listing criteria. In a flat listing, blobs are not organized by virtual directory.

ListBlobsFromServiceClient ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient, string prefix ) : void

Lists blobs beginning with the specified prefix, which must include the container name. Note that the ListBlobs method is called synchronously, for the purposes of the sample. However, in a real-world application using the async/await pattern, best practices recommend using asynchronous methods consistently.

ListBlobsFromServiceClientAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient, string prefix ) : System.Threading.Tasks.Task

Lists blobs beginning with the specified prefix, which must include the container name.

ListBlobsHierarchicalListingAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, string prefix ) : System.Threading.Tasks.Task

Lists blobs in the specified container using a hierarchical listing, and calls this method recursively to return the contents of each virtual directory. Reads the properties on each blob or virtual directory returned and writes them to the console window.

ListContainersWithPrefixAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient, string prefix ) : System.Threading.Tasks.Task

Lists containers in the storage account whose names begin with the specified prefix, and return container metadata as part of the listing operation.

ManageContainerLeasesAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient ) : System.Threading.Tasks.Task

Demonstrates container lease states: available, breaking, broken, and expired. A lease is used in each example to delete the container.

PageRangesSample ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : System.Threading.Tasks.Task

Get a list of valid page ranges for a page blob

PrintBlobPropertiesAndMetadata ( Microsoft.WindowsAzure.Storage.Blob.CloudBlob blob ) : void

Reads the blob's properties.

PrintContainerLeaseProperties ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : void

Reads the lease properties for the container.

PrintContainerPropertiesAndMetadata ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : void

Reads the container's properties.

PrintServiceClientProperties ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient ) : void

Prints properties for the Blob service client to the console window.

PrintVirtualDirectoryProperties ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobDirectory dir ) : void

Reads the virtual directory's properties.

ReadBlockListAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob blob ) : System.Threading.Tasks.Task

Reads the blob's block list, and indicates whether the blob has been committed.

SetAnonymousAccessLevelAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, BlobContainerPublicAccessType accessType ) : System.Threading.Tasks.Task

Sets the anonymous access level.

TestBlobSASAsync ( string sasUri, string blobContent ) : System.Threading.Tasks.Task

Tests a blob SAS to determine which operations it allows.

TestContainerSASAsync ( string sasUri, string blobName, string blobContent ) : System.Threading.Tasks.Task

Tests a container SAS to determine which operations it allows.

UploadBlobInBlocksAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container ) : System.Threading.Tasks.Task

Uploads the blob as a set of 256 KB blocks.

UploadByteArrayAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, long numBytes ) : System.Threading.Tasks.Task

Uploads an array of bytes to a new blob.

Method Details

CallBlobAdvancedSamples() public static method

Calls the advanced samples for Blob storage.
public static CallBlobAdvancedSamples ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task