pub struct BlobClient { /* private fields */ }
Expand description
A client to interact with a specific Azure storage blob, although that blob may not yet exist.
Implementations§
Source§impl BlobClient
impl BlobClient
Sourcepub fn new(
endpoint: &str,
container_name: String,
blob_name: String,
credential: Arc<dyn TokenCredential>,
options: Option<BlobClientOptions>,
) -> Result<Self>
pub fn new( endpoint: &str, container_name: String, blob_name: String, credential: Arc<dyn TokenCredential>, options: Option<BlobClientOptions>, ) -> Result<Self>
Creates a new BlobClient, using Entra ID authentication.
§Arguments
endpoint
- The full URL of the Azure storage account, for examplehttps://myaccount.blob.core.windows.net/
container_name
- The name of the container containing this blob.blob_name
- The name of the blob to interact with.credential
- An implementation ofTokenCredential
that can provide an Entra ID token to use when authenticating.options
- Optional configuration for the client.
Sourcepub fn endpoint(&self) -> &Url
pub fn endpoint(&self) -> &Url
Gets the endpoint of the Storage account this client is connected to.
Sourcepub fn container_name(&self) -> &str
pub fn container_name(&self) -> &str
Gets the container name of the Storage account this client is connected to.
Sourcepub fn blob_name(&self) -> &str
pub fn blob_name(&self) -> &str
Gets the blob name of the Storage account this client is connected to.
Sourcepub async fn get_properties(
&self,
options: Option<BlobClientGetPropertiesOptions<'_>>,
) -> Result<Response<BlobClientGetPropertiesResult>>
pub async fn get_properties( &self, options: Option<BlobClientGetPropertiesOptions<'_>>, ) -> Result<Response<BlobClientGetPropertiesResult>>
Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. The data returned does not include the content of the blob.
§Arguments
options
- Optional configuration for the request.
Sourcepub async fn download(
&self,
options: Option<BlobClientDownloadOptions<'_>>,
) -> Result<Response<BlobClientDownloadResult>>
pub async fn download( &self, options: Option<BlobClientDownloadOptions<'_>>, ) -> Result<Response<BlobClientDownloadResult>>
Downloads a blob from the service, including its metadata and properties.
§Arguments
options
- Optional configuration for the request.
Sourcepub async fn upload(
&self,
data: RequestContent<Bytes>,
overwrite: bool,
content_length: u64,
options: Option<BlockBlobClientUploadOptions<'_>>,
) -> Result<Response<BlockBlobClientUploadResult>>
pub async fn upload( &self, data: RequestContent<Bytes>, overwrite: bool, content_length: u64, options: Option<BlockBlobClientUploadOptions<'_>>, ) -> Result<Response<BlockBlobClientUploadResult>>
Creates a new blob from a data source.
§Arguments
data
- The blob data to upload.overwrite
- Whether the blob to be uploaded should overwrite the current data. If True,upload_blob
will overwrite the existing data. If False, the operation will fail with ResourceExistsError.content_length
- Total length of the blob data to be uploaded.options
- Optional configuration for the request.
Sourcepub async fn delete(
&self,
options: Option<BlobClientDeleteOptions<'_>>,
) -> Result<Response<()>>
pub async fn delete( &self, options: Option<BlobClientDeleteOptions<'_>>, ) -> Result<Response<()>>
Sourcepub async fn commit_block_list(
&self,
blocks: RequestContent<BlockLookupList>,
options: Option<BlockBlobClientCommitBlockListOptions<'_>>,
) -> Result<Response<BlockBlobClientCommitBlockListResult>>
pub async fn commit_block_list( &self, blocks: RequestContent<BlockLookupList>, options: Option<BlockBlobClientCommitBlockListOptions<'_>>, ) -> Result<Response<BlockBlobClientCommitBlockListResult>>
Writes to a blob based on blocks specified by the list of IDs and content that make up the blob.
§Arguments
blocks
- The list of Blob blocks to commit.options
- Optional configuration for the request.
Sourcepub async fn stage_block(
&self,
block_id: Vec<u8>,
content_length: u64,
body: RequestContent<Bytes>,
options: Option<BlockBlobClientStageBlockOptions<'_>>,
) -> Result<Response<BlockBlobClientStageBlockResult>>
pub async fn stage_block( &self, block_id: Vec<u8>, content_length: u64, body: RequestContent<Bytes>, options: Option<BlockBlobClientStageBlockOptions<'_>>, ) -> Result<Response<BlockBlobClientStageBlockResult>>
Creates a new block to be later committed as part of a blob.
§Arguments
block_id
- The unique identifier for the block. The identifier should be less than or equal to 64 bytes in size. For a given blob, theblock_id
must be the same size for each block.content_length
- Total length of the blob data to be staged.data
- The content of the block.options
- Optional configuration for the request.
Sourcepub async fn get_block_list(
&self,
list_type: BlockListType,
options: Option<BlockBlobClientGetBlockListOptions<'_>>,
) -> Result<Response<BlockList>>
pub async fn get_block_list( &self, list_type: BlockListType, options: Option<BlockBlobClientGetBlockListOptions<'_>>, ) -> Result<Response<BlockList>>
Retrieves the list of blocks that have been uploaded as part of a block blob.
§Arguments
list_type
- Specifies whether to return the list of committed blocks, uncommitted blocks, or both lists together.options
- Optional configuration for the request.