pub struct BlockBlobClient { /* private fields */ }Implementations§
Source§impl BlockBlobClient
impl BlockBlobClient
Sourcepub fn new(
blob_url: Url,
credential: Option<Arc<dyn TokenCredential>>,
options: Option<BlockBlobClientOptions>,
) -> Result<Self>
pub fn new( blob_url: Url, credential: Option<Arc<dyn TokenCredential>>, options: Option<BlockBlobClientOptions>, ) -> Result<Self>
Creates a new BlockBlobClient from a block blob URL.
§Arguments
blob_url- The full URL of the block blob, for examplehttps://myaccount.blob.core.windows.net/mycontainer/myblob. The caller is responsible for percent-encoding the URL correctly; it will be used as-is.credential- An optional implementation ofTokenCredentialthat can provide an Entra ID token to use when authenticating.options- Optional configuration for the client.
Sourcepub async fn upload(
&self,
content: RequestContent<Bytes, NoFormat>,
options: Option<BlockBlobClientUploadOptions<'_>>,
) -> Result<BlockBlobClientUploadResult>
pub async fn upload( &self, content: RequestContent<Bytes, NoFormat>, options: Option<BlockBlobClientUploadOptions<'_>>, ) -> Result<BlockBlobClientUploadResult>
Uploads content to a block blob, overwriting any existing blob by default.
Updating an existing block blob overwrites any existing metadata on the blob. Use BlockBlobClientUploadOptions::if_not_exists() to fail instead of overwriting.
To perform a partial update of the content of a block blob, use stage_block and commit_block_list directly.
§Arguments
content- The content to upload.options- Optional parameters for the request.
Source§impl BlockBlobClient
impl BlockBlobClient
Sourcepub async fn commit_block_list(
&self,
blocks: RequestContent<BlockLookupList, XmlFormat>,
options: Option<BlockBlobClientCommitBlockListOptions<'_>>,
) -> Result<Response<BlockBlobClientCommitBlockListResult, NoFormat>>
pub async fn commit_block_list( &self, blocks: RequestContent<BlockLookupList, XmlFormat>, options: Option<BlockBlobClientCommitBlockListOptions<'_>>, ) -> Result<Response<BlockBlobClientCommitBlockListResult, NoFormat>>
Writes to the block blob by specifying the list of block IDs that make up the blob.
§Arguments
blocks- Blob blocks.options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlockBlobClientCommitBlockListResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlockBlobClientCommitBlockListResult, BlockBlobClientCommitBlockListResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlockBlobClientCommitBlockListResult, NoFormat> = unimplemented!();
// Access response headers
if let Some(content_md5) = response.content_md5()? {
println!("content-md5: {:?}", content_md5);
}
if let Some(etag) = response.etag()? {
println!("etag: {:?}", etag);
}
if let Some(last_modified) = response.last_modified()? {
println!("last-modified: {:?}", last_modified);
}
Ok(())
}§Available headers
content_md5() - content-md5etag() - etaglast_modified() - last-modifiedcontent_crc64() - x-ms-content-crc64encryption_key_sha256() - x-ms-encryption-key-sha256encryption_scope() - x-ms-encryption-scopeis_server_encrypted() - x-ms-request-server-encryptedversion_id() - x-ms-version-id
Sourcepub async fn get_block_list(
&self,
list_type: BlockListType,
options: Option<BlockBlobClientGetBlockListOptions<'_>>,
) -> Result<Response<BlockList, XmlFormat>>
pub async fn get_block_list( &self, list_type: BlockListType, options: Option<BlockBlobClientGetBlockListOptions<'_>>, ) -> Result<Response<BlockList, XmlFormat>>
Retrieves the list of blocks that have been uploaded as part of the block blob.
§Arguments
list_type- Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together.options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlockListHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, XmlFormat}};
use azure_storage_blob::models::{BlockList, BlockListHeaders};
async fn example() -> Result<()> {
let response: Response<BlockList, XmlFormat> = unimplemented!();
// Access response headers
if let Some(etag) = response.etag()? {
println!("etag: {:?}", etag);
}
if let Some(last_modified) = response.last_modified()? {
println!("last-modified: {:?}", last_modified);
}
if let Some(blob_content_length) = response.blob_content_length()? {
println!("x-ms-blob-content-length: {:?}", blob_content_length);
}
Ok(())
}§Available headers
etag() - etaglast_modified() - last-modifiedblob_content_length() - x-ms-blob-content-length
Sourcepub async fn stage_block(
&self,
block_id: &[u8],
content_length: u64,
body: RequestContent<Bytes, NoFormat>,
options: Option<BlockBlobClientStageBlockOptions<'_>>,
) -> Result<Response<BlockBlobClientStageBlockResult, NoFormat>>
pub async fn stage_block( &self, block_id: &[u8], content_length: u64, body: RequestContent<Bytes, NoFormat>, options: Option<BlockBlobClientStageBlockOptions<'_>>, ) -> Result<Response<BlockBlobClientStageBlockResult, NoFormat>>
Creates a new block of data to be committed as part of a blob.
§Arguments
block_id- A Base64 value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block.content_length- The length of the request.body- The body of the request.options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlockBlobClientStageBlockResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlockBlobClientStageBlockResult, BlockBlobClientStageBlockResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlockBlobClientStageBlockResult, NoFormat> = unimplemented!();
// Access response headers
if let Some(content_md5) = response.content_md5()? {
println!("content-md5: {:?}", content_md5);
}
if let Some(content_crc64) = response.content_crc64()? {
println!("x-ms-content-crc64: {:?}", content_crc64);
}
if let Some(encryption_key_sha256) = response.encryption_key_sha256()? {
println!("x-ms-encryption-key-sha256: {:?}", encryption_key_sha256);
}
Ok(())
}§Available headers
content_md5() - content-md5content_crc64() - x-ms-content-crc64encryption_key_sha256() - x-ms-encryption-key-sha256encryption_scope() - x-ms-encryption-scopeis_server_encrypted() - x-ms-request-server-encrypted
Sourcepub async fn stage_block_from_url(
&self,
block_id: &[u8],
content_length: u64,
source_url: String,
options: Option<BlockBlobClientStageBlockFromUrlOptions<'_>>,
) -> Result<Response<BlockBlobClientStageBlockFromUrlResult, NoFormat>>
pub async fn stage_block_from_url( &self, block_id: &[u8], content_length: u64, source_url: String, options: Option<BlockBlobClientStageBlockFromUrlOptions<'_>>, ) -> Result<Response<BlockBlobClientStageBlockFromUrlResult, NoFormat>>
Creates a new block of data from the specified URL to be committed as part of a blob.
§Arguments
block_id- A Base64 value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block.content_length- The length of the request.source_url- Specifies the URL of the source.options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlockBlobClientStageBlockFromUrlResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockFromUrlResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlockBlobClientStageBlockFromUrlResult, NoFormat> = unimplemented!();
// Access response headers
if let Some(content_md5) = response.content_md5()? {
println!("content-md5: {:?}", content_md5);
}
if let Some(content_crc64) = response.content_crc64()? {
println!("x-ms-content-crc64: {:?}", content_crc64);
}
if let Some(encryption_key_sha256) = response.encryption_key_sha256()? {
println!("x-ms-encryption-key-sha256: {:?}", encryption_key_sha256);
}
Ok(())
}§Available headers
content_md5() - content-md5content_crc64() - x-ms-content-crc64encryption_key_sha256() - x-ms-encryption-key-sha256encryption_scope() - x-ms-encryption-scopeis_server_encrypted() - x-ms-request-server-encrypted
Sourcepub async fn upload_blob_from_url(
&self,
copy_source: String,
options: Option<BlockBlobClientUploadBlobFromUrlOptions<'_>>,
) -> Result<Response<BlockBlobClientUploadBlobFromUrlResult, NoFormat>>
pub async fn upload_blob_from_url( &self, copy_source: String, options: Option<BlockBlobClientUploadBlobFromUrlOptions<'_>>, ) -> Result<Response<BlockBlobClientUploadBlobFromUrlResult, NoFormat>>
Uploads the content from the specified URL to the block blob. If the blob already exists, the data and any existing metadata will be overwritten.
§Arguments
copy_source- Specifies the name of the source URL for the copy operation. The value should be URL-encoded as it would appear in a request URI.options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlockBlobClientUploadBlobFromUrlResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadBlobFromUrlResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlockBlobClientUploadBlobFromUrlResult, NoFormat> = unimplemented!();
// Access response headers
if let Some(content_md5) = response.content_md5()? {
println!("content-md5: {:?}", content_md5);
}
if let Some(etag) = response.etag()? {
println!("etag: {:?}", etag);
}
if let Some(last_modified) = response.last_modified()? {
println!("last-modified: {:?}", last_modified);
}
Ok(())
}§Available headers
content_md5() - content-md5etag() - etaglast_modified() - last-modifiedencryption_key_sha256() - x-ms-encryption-key-sha256encryption_scope() - x-ms-encryption-scopeis_server_encrypted() - x-ms-request-server-encryptedversion_id() - x-ms-version-id