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 SourceBlobExistsAsync(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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |