pub struct BlobContainerClient { /* private fields */ }Implementations§
Source§impl BlobContainerClient
impl BlobContainerClient
Sourcepub fn new(
container_url: Url,
credential: Option<Arc<dyn TokenCredential>>,
options: Option<BlobContainerClientOptions>,
) -> Result<Self>
pub fn new( container_url: Url, credential: Option<Arc<dyn TokenCredential>>, options: Option<BlobContainerClientOptions>, ) -> Result<Self>
Creates a new BlobContainerClient from a container URL.
§Arguments
container_url- The full URL of the container, for examplehttps://myaccount.blob.core.windows.net/mycontainer. 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 fn blob_client(&self, blob_name: &str) -> BlobClient
pub fn blob_client(&self, blob_name: &str) -> BlobClient
Source§impl BlobContainerClient
impl BlobContainerClient
Sourcepub async fn acquire_lease(
&self,
duration: i32,
options: Option<BlobContainerClientAcquireLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientAcquireLeaseResult, NoFormat>>
pub async fn acquire_lease( &self, duration: i32, options: Option<BlobContainerClientAcquireLeaseOptions<'_>>, ) -> Result<Response<BlobContainerClientAcquireLeaseResult, NoFormat>>
Requests a new lease on the specified container.
§Arguments
duration- Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds.options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlobContainerClientAcquireLeaseResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlobContainerClientAcquireLeaseResult, BlobContainerClientAcquireLeaseResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlobContainerClientAcquireLeaseResult, NoFormat> = 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(lease_id) = response.lease_id()? {
println!("x-ms-lease-id: {:?}", lease_id);
}
Ok(())
}§Available headers
etag() - etaglast_modified() - last-modifiedlease_id() - x-ms-lease-id
Sourcepub async fn break_lease(
&self,
options: Option<BlobContainerClientBreakLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientBreakLeaseResult, NoFormat>>
pub async fn break_lease( &self, options: Option<BlobContainerClientBreakLeaseOptions<'_>>, ) -> Result<Response<BlobContainerClientBreakLeaseResult, NoFormat>>
Ends a lease and ensures that another client can’t acquire a new lease until the current lease period has expired.
§Arguments
options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlobContainerClientBreakLeaseResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlobContainerClientBreakLeaseResult, BlobContainerClientBreakLeaseResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlobContainerClientBreakLeaseResult, NoFormat> = 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(lease_time) = response.lease_time()? {
println!("x-ms-lease-time: {:?}", lease_time);
}
Ok(())
}§Available headers
etag() - etaglast_modified() - last-modifiedlease_time() - x-ms-lease-time
Sourcepub async fn change_lease(
&self,
lease_id: String,
proposed_lease_id: String,
options: Option<BlobContainerClientChangeLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientChangeLeaseResult, NoFormat>>
pub async fn change_lease( &self, lease_id: String, proposed_lease_id: String, options: Option<BlobContainerClientChangeLeaseOptions<'_>>, ) -> Result<Response<BlobContainerClientChangeLeaseResult, NoFormat>>
Change the ID of an existing lease.
§Arguments
lease_id- A lease ID for the resource. The resource must have an active lease and the lease ID must match.proposed_lease_id- The proposed lease ID for the lease.options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlobContainerClientChangeLeaseResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlobContainerClientChangeLeaseResult, BlobContainerClientChangeLeaseResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlobContainerClientChangeLeaseResult, NoFormat> = 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(lease_id) = response.lease_id()? {
println!("x-ms-lease-id: {:?}", lease_id);
}
Ok(())
}§Available headers
etag() - etaglast_modified() - last-modifiedlease_id() - x-ms-lease-id
Sourcepub async fn create(
&self,
options: Option<BlobContainerClientCreateOptions<'_>>,
) -> Result<Response<(), NoFormat>>
pub async fn create( &self, options: Option<BlobContainerClientCreateOptions<'_>>, ) -> Result<Response<(), NoFormat>>
Creates a new container in the specified account. If the container with the same name already exists, the operation fails.
§Arguments
options- Optional parameters for the request.
Sourcepub async fn delete(
&self,
options: Option<BlobContainerClientDeleteOptions<'_>>,
) -> Result<Response<(), NoFormat>>
pub async fn delete( &self, options: Option<BlobContainerClientDeleteOptions<'_>>, ) -> Result<Response<(), NoFormat>>
Lists blobs in the specified container whose tags match a given search expression.
§Arguments
filter_expression- Filters the results to return only blobs whose tags match the specified expression.options- Optional parameters for the request.
Sourcepub async fn get_access_policy(
&self,
options: Option<BlobContainerClientGetAccessPolicyOptions<'_>>,
) -> Result<Response<SignedIdentifiers, XmlFormat>>
pub async fn get_access_policy( &self, options: Option<BlobContainerClientGetAccessPolicyOptions<'_>>, ) -> Result<Response<SignedIdentifiers, XmlFormat>>
Gets the permissions for the specified container.
§Arguments
options- Optional parameters for the request.
§Response Headers
The returned Response implements the SignedIdentifiersHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, XmlFormat}};
use azure_storage_blob::models::{SignedIdentifiers, SignedIdentifiersHeaders};
async fn example() -> Result<()> {
let response: Response<SignedIdentifiers, 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(access) = response.access()? {
println!("x-ms-blob-public-access: {:?}", access);
}
Ok(())
}§Available headers
etag() - etaglast_modified() - last-modifiedaccess() - x-ms-blob-public-access
Sourcepub async fn get_account_info(
&self,
options: Option<BlobContainerClientGetAccountInfoOptions<'_>>,
) -> Result<Response<BlobContainerClientGetAccountInfoResult, NoFormat>>
pub async fn get_account_info( &self, options: Option<BlobContainerClientGetAccountInfoOptions<'_>>, ) -> Result<Response<BlobContainerClientGetAccountInfoResult, NoFormat>>
Returns information about the storage account.
§Arguments
options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlobContainerClientGetAccountInfoResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlobContainerClientGetAccountInfoResult, BlobContainerClientGetAccountInfoResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlobContainerClientGetAccountInfoResult, NoFormat> = unimplemented!();
// Access response headers
if let Some(account_kind) = response.account_kind()? {
println!("x-ms-account-kind: {:?}", account_kind);
}
if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? {
println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled);
}
if let Some(sku_name) = response.sku_name()? {
println!("x-ms-sku-name: {:?}", sku_name);
}
Ok(())
}§Available headers
account_kind() - x-ms-account-kindis_hierarchical_namespace_enabled() - x-ms-is-hns-enabledsku_name() - x-ms-sku-name
Sourcepub async fn get_properties(
&self,
options: Option<BlobContainerClientGetPropertiesOptions<'_>>,
) -> Result<Response<BlobContainerClientGetPropertiesResult, NoFormat>>
pub async fn get_properties( &self, options: Option<BlobContainerClientGetPropertiesOptions<'_>>, ) -> Result<Response<BlobContainerClientGetPropertiesResult, NoFormat>>
Returns all user-defined metadata and system properties for the specified container. The data returned does not include the container’s list of blobs.
§Arguments
options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlobContainerClientGetPropertiesResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlobContainerClientGetPropertiesResult, NoFormat> = 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(access) = response.access()? {
println!("x-ms-blob-public-access: {:?}", access);
}
Ok(())
}§Available headers
etag() - etaglast_modified() - last-modifiedaccess() - x-ms-blob-public-accessdefault_encryption_scope() - x-ms-default-encryption-scopeprevent_encryption_scope_override() - x-ms-deny-encryption-scope-overridehas_immutability_policy() - x-ms-has-immutability-policyhas_legal_hold() - x-ms-has-legal-holdis_immutable_storage_with_versioning_enabled() - x-ms-immutable-storage-with-versioning-enabledduration() - x-ms-lease-durationlease_state() - x-ms-lease-statelease_status() - x-ms-lease-statusmetadata() - x-ms-meta
Sourcepub fn list_blobs(
&self,
options: Option<BlobContainerClientListBlobsOptions<'_>>,
) -> Result<Pager<ListBlobsResponse, XmlFormat>>
pub fn list_blobs( &self, options: Option<BlobContainerClientListBlobsOptions<'_>>, ) -> Result<Pager<ListBlobsResponse, XmlFormat>>
Returns a list of the blobs in the specified container.
§Arguments
options- Optional parameters for the request.
Sourcepub async fn release_lease(
&self,
lease_id: String,
options: Option<BlobContainerClientReleaseLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientReleaseLeaseResult, NoFormat>>
pub async fn release_lease( &self, lease_id: String, options: Option<BlobContainerClientReleaseLeaseOptions<'_>>, ) -> Result<Response<BlobContainerClientReleaseLeaseResult, NoFormat>>
Frees the lease if it’s no longer needed, so that another client can immediately acquire a lease against the container.
§Arguments
lease_id- A lease ID for the resource. The resource must have an active lease and the lease ID must match.options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlobContainerClientReleaseLeaseResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlobContainerClientReleaseLeaseResult, BlobContainerClientReleaseLeaseResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlobContainerClientReleaseLeaseResult, NoFormat> = 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);
}
Ok(())
}§Available headers
etag() - etaglast_modified() - last-modified
Sourcepub async fn renew_lease(
&self,
lease_id: String,
options: Option<BlobContainerClientRenewLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientRenewLeaseResult, NoFormat>>
pub async fn renew_lease( &self, lease_id: String, options: Option<BlobContainerClientRenewLeaseOptions<'_>>, ) -> Result<Response<BlobContainerClientRenewLeaseResult, NoFormat>>
Renews an existing lease.
§Arguments
lease_id- A lease ID for the resource. The resource must have an active lease and the lease ID must match.options- Optional parameters for the request.
§Response Headers
The returned Response implements the BlobContainerClientRenewLeaseResultHeaders trait, which provides
access to response headers. For example:
use azure_core::{Result, http::{Response, NoFormat}};
use azure_storage_blob::models::{BlobContainerClientRenewLeaseResult, BlobContainerClientRenewLeaseResultHeaders};
async fn example() -> Result<()> {
let response: Response<BlobContainerClientRenewLeaseResult, NoFormat> = 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(lease_id) = response.lease_id()? {
println!("x-ms-lease-id: {:?}", lease_id);
}
Ok(())
}§Available headers
etag() - etaglast_modified() - last-modifiedlease_id() - x-ms-lease-id
Sourcepub async fn set_access_policy(
&self,
container_acl: RequestContent<SignedIdentifiers, XmlFormat>,
options: Option<BlobContainerClientSetAccessPolicyOptions<'_>>,
) -> Result<Response<(), NoFormat>>
pub async fn set_access_policy( &self, container_acl: RequestContent<SignedIdentifiers, XmlFormat>, options: Option<BlobContainerClientSetAccessPolicyOptions<'_>>, ) -> Result<Response<(), NoFormat>>
Sets the permissions for the specified container.
§Arguments
container_acl- The access control list for the container.options- Optional parameters for the request.
Sourcepub async fn set_metadata(
&self,
metadata: &HashMap<String, String>,
options: Option<BlobContainerClientSetMetadataOptions<'_>>,
) -> Result<Response<(), NoFormat>>
pub async fn set_metadata( &self, metadata: &HashMap<String, String>, options: Option<BlobContainerClientSetMetadataOptions<'_>>, ) -> Result<Response<(), NoFormat>>
Sets user-defined metadata for the specified container.
§Arguments
metadata- The metadata headers.options- Optional parameters for the request.