azure_storage_blobs::prelude

Struct BlobClient

source
pub struct BlobClient { /* private fields */ }
Expand description

A client for handling blobs

For a full list of operations available on blobs, check out the Azure documentation.

Implementations§

source§

impl BlobClient

source

pub fn from_sas_url(url: &Url) -> Result<Self>

source

pub fn get(&self) -> GetBlobBuilder

Stream a blob in chunks.

By default, blobs are downloaded in 1MB chunks to reduce the impact of intermittent network issues while downloading large blobs.

source

pub async fn get_content(&self) -> Result<Vec<u8>>

Return an entire blob.

source

pub fn get_properties(&self) -> GetPropertiesBuilder

Get all user-defined metadata, standard HTTP properties, and system properties for the blob.

source

pub fn set_properties(&self) -> SetPropertiesBuilder

Set blob properties.

Several properties are cleared from the blob if not passed. Consider calling set_from_blob_properties with existing blob properties.

source

pub fn get_metadata(&self) -> GetMetadataBuilder

Get all user-defined metadata for the blob.

source

pub fn set_metadata(&self) -> SetMetadataBuilder

Set all user-defined metadata of the blob

source

pub fn set_blob_tier(&self, access_tier: AccessTier) -> SetBlobTierBuilder

Set the access tier on the blob.

source

pub fn set_blob_expiry(&self, blob_expiry: BlobExpiry) -> SetBlobExpiryBuilder

Set an expiry time on an existing blob.

This operation is only allowed on Hierarchical Namespace enabled accounts.

ref: https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-expiry

source

pub fn put_page_blob(&self, length: u128) -> PutPageBlobBuilder

Creates a new page blob.

source

pub fn put_append_blob(&self) -> PutAppendBlobBuilder

Creates a new append blob.

source

pub fn put_block_blob(&self, body: impl Into<Body>) -> PutBlockBlobBuilder

Creates a new block blob, or update the content of an existing block blob.

source

pub fn copy(&self, copy_source: Url) -> CopyBlobBuilder

Copy the blob to a destination within the storage account.

source

pub fn copy_from_url(&self, copy_source: Url) -> CopyBlobFromUrlBuilder

Copy the blob to a destination within the storage account synchronously.

source

pub fn acquire_lease<LD: Into<LeaseDuration>>( &self, lease_duration: LD, ) -> AcquireLeaseBuilder

Create a lease on the blob to lock for write and delete operations.

source

pub fn break_lease(&self) -> BreakLeaseBuilder

End the lease but ensure that another client cannot acquire a new lease until the current lease period has expired.

source

pub fn delete(&self) -> DeleteBlobBuilder

Delete the blob.

source

pub fn delete_snapshot(&self, snapshot: Snapshot) -> DeleteBlobSnapshotBuilder

Delete a snapshot of the blob.

source

pub fn delete_version_id( &self, version_id: VersionId, ) -> DeleteBlobVersionBuilder

Delete the blob at a specific version.

source

pub fn put_block( &self, block_id: impl Into<BlockId>, body: impl Into<Body>, ) -> PutBlockBuilder

Creates a new block to be committed as part of a block blob.

source

pub fn put_block_url( &self, block_id: impl Into<BlockId>, copy_source: Url, ) -> PutBlockUrlBuilder

Creates a new block to be committed as part of a block blob, from a URL.

source

pub fn get_block_list(&self) -> GetBlockListBuilder

Retrieve the list of blocks that have been uploaded as part of a block blob.

source

pub fn get_tags(&self) -> GetTagsBuilder

Retrieve the user-defined tags for the specified blob, version, or snapshot.

source

pub fn set_tags(&self, tags: impl Into<Tags>) -> SetTagsBuilder

Set user-defined tags for the specified blob, version, or snapshot.

source

pub fn put_block_list(&self, block_list: BlockList) -> PutBlockListBuilder

Write a block blob by specifying the list of block IDs that make up the blob.

In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation.

source

pub fn put_page( &self, ba512_range: BA512Range, content: impl Into<Body>, ) -> PutPageBuilder

Write a range of pages to a page blob.

source

pub fn get_page_ranges(&self) -> GetPageRangesBuilder

Return the list of valid page ranges for a page blob or snapshot of a page blob.

source

pub fn append_block(&self, body: impl Into<Body>) -> AppendBlockBuilder

Commits a new block of data to the end of an existing append blob.

source

pub fn clear_page(&self, ba512_range: BA512Range) -> ClearPageBuilder

Clear range of pages in a page blob.

source

pub async fn user_delegation_shared_access_signature( &self, permissions: BlobSasPermissions, user_delegation_key: &UserDeligationKey, ) -> Result<BlobSharedAccessSignature>

source

pub async fn shared_access_signature( &self, permissions: BlobSasPermissions, expiry: OffsetDateTime, ) -> Result<BlobSharedAccessSignature>

Create a shared access signature.

source

pub fn generate_signed_blob_url<T>(&self, signature: &T) -> Result<Url>
where T: SasToken,

Create a signed blob url

source

pub async fn exists(&self) -> Result<bool>

Check whether blob exists.

source

pub fn snapshot(&self) -> SnapshotBlobBuilder

Create a blob snapshot

source

pub fn blob_name(&self) -> &str

source

pub fn blob_lease_client(&self, lease_id: LeaseId) -> BlobLeaseClient

Turn into a BlobLeaseClient

source

pub fn container_client(&self) -> &ContainerClient

source

pub fn url(&self) -> Result<Url>

Full URL for the blob.

Trait Implementations§

source§

impl Clone for BlobClient

source§

fn clone(&self) -> BlobClient

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BlobClient

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T