Struct BlobClient

Source
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

Source

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 example https://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 of TokenCredential that can provide an Entra ID token to use when authenticating.
  • options - Optional configuration for the client.
Source

pub fn endpoint(&self) -> &Url

Gets the endpoint of the Storage account this client is connected to.

Source

pub fn container_name(&self) -> &str

Gets the container name of the Storage account this client is connected to.

Source

pub fn blob_name(&self) -> &str

Gets the blob name of the Storage account this client is connected to.

Source

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.
Source

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.
Source

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.
Source

pub async fn delete( &self, options: Option<BlobClientDeleteOptions<'_>>, ) -> Result<Response<()>>

Deletes the blob.

§Arguments
  • options - Optional configuration for the request.
Source

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.
Source

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, the block_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.
Source

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.

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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,