Show / Hide Table of Contents

Interface IAzureBlobProvider

Encapsulates functionality to interact with Azure blob storage.

Namespace: CrashCABN.DataAccess
Assembly: CrashCABN.DataAccess.Blobs.Abstractions.dll
Syntax
public interface IAzureBlobProvider

Methods

View Source

BlobExistsAsync(Uri)

Checks if the blob exists for downloading.

Declaration
Task<bool> BlobExistsAsync(Uri blobUri)
Parameters
Type Name Description
Uri blobUri

The absolute blob URI.

Returns
Type Description
Task<bool>

True if it exists.

View Source

CopyBlobFromUriAsync(Uri, Uri)

Uploads a copy of the source blob to the given blob URI.

Declaration
Task CopyBlobFromUriAsync(Uri destinationUri, Uri sourceUri)
Parameters
Type Name Description
Uri destinationUri

The blob URI to upload to.

Uri sourceUri

The blob URI to copy from.

Returns
Type Description
Task

A task representing the asynchronous operation.

View Source

CreateContainerIfNotExistsAsync(Uri)

Creates the container for the given blob, if it doesn't already exist.

Declaration
Task CreateContainerIfNotExistsAsync(Uri blobUri)
Parameters
Type Name Description
Uri blobUri

The full URL to the Azure storage container and folder to search in.

Returns
Type Description
Task

A task that completes once the container is created.

View Source

DeleteBlobIfExistsAsync(Uri)

Deletes the blob if it exists.

Declaration
Task DeleteBlobIfExistsAsync(Uri blobUri)
Parameters
Type Name Description
Uri blobUri

The absolute blob URI.

Returns
Type Description
Task

A task representing the asynchronous operation.

View Source

GenerateReadOnlySASUriAsync(Uri, DateTimeOffset)

Generates a read-only URI with a SAS token to access the given blob.

Declaration
Task<Uri> GenerateReadOnlySASUriAsync(Uri sourceUri, DateTimeOffset expiresOn)
Parameters
Type Name Description
Uri sourceUri

The blob URI to use.

DateTimeOffset expiresOn

When the SAS token should expire.

Returns
Type Description
Task<Uri>

The SAS token URI.

View Source

GetBlobPropertiesAsync(Uri)

Gets the blob properties if it exists.

Declaration
Task<(long Size, byte[] Hash, DateTimeOffset LastModified)?> GetBlobPropertiesAsync(Uri blobUri)
Parameters
Type Name Description
Uri blobUri

The absolute blob URI.

Returns
Type Description
Task<(long Size, byte[] Hash, DateTimeOffset LastModified)?>

The blob size, content hash, and last modified timestamp, or null if it doesn't exist.

View Source

GetBlobStreamAndHashAsync(Uri)

Retrieves the blob stream for downloading and a content hash.

Declaration
Task<(Stream Stream, byte[] Hash)> GetBlobStreamAndHashAsync(Uri blobUri)
Parameters
Type Name Description
Uri blobUri

The absolute blob URI.

Returns
Type Description
Task<(Stream Stream, byte[] Hash)>

The stream for downloading and a content hash.

View Source

GetBlobStreamAsync(Uri)

Retrieves the blob stream for downloading.

Declaration
Task<Stream> GetBlobStreamAsync(Uri blobUri)
Parameters
Type Name Description
Uri blobUri

The absolute blob URI.

Returns
Type Description
Task<Stream>

The stream for downloading.

View Source

ListBlobsInPathAsync(Uri)

Lists the blobs in the given container path.

Declaration
IAsyncEnumerable<string> ListBlobsInPathAsync(Uri blobUri)
Parameters
Type Name Description
Uri blobUri

The full URL to the Azure storage container and folder to search in.

Returns
Type Description
IAsyncEnumerable<string>

An enumeration containing the full path of each blob.

View Source

WriteBlobStreamAsync(Uri, Stream)

Uploads the stream to the given blob URI.

Declaration
Task WriteBlobStreamAsync(Uri blobUri, Stream content)
Parameters
Type Name Description
Uri blobUri

The absolute blob URI.

Stream content

The stream for uploading.

Returns
Type Description
Task

A task representing the asynchronous operation.

Extension Methods

IAzureBlobProviderExtensions.GetBlobStreamAndIdAsync(IAzureBlobProvider, Uri)
IAzureBlobProviderExtensions.GetBlobStringAndHashAsync(IAzureBlobProvider, Uri)
IAzureBlobProviderExtensions.GetBlobStringAndIdAsync(IAzureBlobProvider, Uri)
IAzureBlobProviderExtensions.GetBlobStringAsync(IAzureBlobProvider, Uri)
IAzureBlobProviderExtensions.WriteBlobStringAsync(IAzureBlobProvider, Uri, string)
  • View Source
In this article
Back to top Generated by DocFX