pub struct Azblob { /* private fields */ }Expand description
§Capabilities
This service can be used to:
- stat
- read
- write
- append
- create_dir
- delete
- copy
- rename
- list
- presign
- blocking
§Configuration
root: Set the work dir for backend.container: Set the container name for backend.endpoint: Set the endpoint for backend.account_name: Set the account_name for backend.account_key: Set the account_key for backend.
Refer to public API docs for more information.
§Examples
This example works on Azurite for local developments.
§Start local blob service
docker run -p 10000:10000 mcr.microsoft.com/azure-storage/azurite
az storage container create --name test --connection-string "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;"§Init OpenDAL Operator
§Via Builder
use std::sync::Arc;
use anyhow::Result;
use opendal::services::Azblob;
use opendal::Operator;
#[tokio::main]
async fn main() -> Result<()> {
// Create azblob backend builder.
let mut builder = Azblob::default()
// Set the root for azblob, all operations will happen under this root.
//
// NOTE: the root must be absolute path.
.root("/path/to/dir")
// Set the container name, this is required.
.container("test")
// Set the endpoint, this is required.
//
// For examples:
// - "http://127.0.0.1:10000/devstoreaccount1"
// - "https://accountname.blob.core.windows.net"
.endpoint("http://127.0.0.1:10000/devstoreaccount1")
// Set the account_name and account_key.
//
// OpenDAL will try load credential from the env.
// If credential not set and no valid credential in env, OpenDAL will
// send request without signing like anonymous user.
.account_name("devstoreaccount1")
.account_key("Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==");
// `Accessor` provides the low level APIs, we will use `Operator` normally.
let op: Operator = Operator::new(builder)?.finish();
Ok(())
}Implementations§
Source§impl AzblobBuilder
impl AzblobBuilder
Sourcepub fn root(self, root: &str) -> Self
Available on crate feature services-azblob only.
pub fn root(self, root: &str) -> Self
services-azblob only.Set root of this backend.
All operations will happen under this root.
Sourcepub fn container(self, container: &str) -> Self
Available on crate feature services-azblob only.
pub fn container(self, container: &str) -> Self
services-azblob only.Set container name of this backend.
Sourcepub fn endpoint(self, endpoint: &str) -> Self
Available on crate feature services-azblob only.
pub fn endpoint(self, endpoint: &str) -> Self
services-azblob only.Set endpoint of this backend
Endpoint must be full uri, e.g.
- Azblob:
https://accountname.blob.core.windows.net - Azurite:
http://127.0.0.1:10000/devstoreaccount1
Sourcepub fn account_name(self, account_name: &str) -> Self
Available on crate feature services-azblob only.
pub fn account_name(self, account_name: &str) -> Self
services-azblob only.Set account_name of this backend.
- If account_name is set, we will take user’s input first.
- If not, we will try to load it from environment.
Sourcepub fn account_key(self, account_key: &str) -> Self
Available on crate feature services-azblob only.
pub fn account_key(self, account_key: &str) -> Self
services-azblob only.Set account_key of this backend.
- If account_key is set, we will take user’s input first.
- If not, we will try to load it from environment.
Sourcepub fn encryption_key(self, v: &str) -> Self
Available on crate feature services-azblob only.
pub fn encryption_key(self, v: &str) -> Self
services-azblob only.Set encryption_key of this backend.
§Args
v: Base64-encoded key that matches algorithm specified in encryption_algorithm.
§Note
This function is the low-level setting for SSE related features.
SSE related options should be set carefully to make them works.
Please use server_side_encryption_with_* helpers if even possible.
Sourcepub fn encryption_key_sha256(self, v: &str) -> Self
Available on crate feature services-azblob only.
pub fn encryption_key_sha256(self, v: &str) -> Self
services-azblob only.Set encryption_key_sha256 of this backend.
§Args
v: Base64-encoded SHA256 digest of the key specified in encryption_key.
§Note
This function is the low-level setting for SSE related features.
SSE related options should be set carefully to make them works.
Please use server_side_encryption_with_* helpers if even possible.
Sourcepub fn encryption_algorithm(self, v: &str) -> Self
Available on crate feature services-azblob only.
pub fn encryption_algorithm(self, v: &str) -> Self
services-azblob only.Set encryption_algorithm of this backend.
§Args
v: server-side encryption algorithm. (Available values: AES256)
§Note
This function is the low-level setting for SSE related features.
SSE related options should be set carefully to make them works.
Please use server_side_encryption_with_* helpers if even possible.
Sourcepub fn server_side_encryption_with_customer_key(self, key: &[u8]) -> Self
Available on crate feature services-azblob only.
pub fn server_side_encryption_with_customer_key(self, key: &[u8]) -> Self
services-azblob only.Enable server side encryption with customer key.
As known as: CPK
§Args
key: Base64-encoded SHA256 digest of the key specified in encryption_key.
§Note
Function that helps the user to set the server-side customer-provided encryption key, the key’s SHA256, and the algorithm. See Server-side encryption with customer-provided keys (CPK) for more info.
Sourcepub fn sas_token(self, sas_token: &str) -> Self
Available on crate feature services-azblob only.
pub fn sas_token(self, sas_token: &str) -> Self
services-azblob only.Set sas_token of this backend.
- If sas_token is set, we will take user’s input first.
- If not, we will try to load it from environment.
See Grant limited access to Azure Storage resources using shared access signatures (SAS) for more info.
Sourcepub fn http_client(self, client: HttpClient) -> Self
👎Deprecated since 0.53.0: Use Operator::update_http_client insteadAvailable on crate feature services-azblob only.
pub fn http_client(self, client: HttpClient) -> Self
Operator::update_http_client insteadservices-azblob only.Specify the http client that used by this service.
§Notes
This API is part of OpenDAL’s Raw API. HttpClient could be changed
during minor updates.
Sourcepub fn batch_max_operations(self, batch_max_operations: usize) -> Self
Available on crate feature services-azblob only.
pub fn batch_max_operations(self, batch_max_operations: usize) -> Self
services-azblob only.Set maximum batch operations of this backend.
Sourcepub fn from_connection_string(conn: &str) -> Result<Self>
Available on crate feature services-azblob only.
pub fn from_connection_string(conn: &str) -> Result<Self>
services-azblob only.from_connection_string will make a builder from connection string
connection string looks like:
DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;
TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;Or
DefaultEndpointsProtocol=https;
AccountName=storagesample;
AccountKey=<account-key>;
EndpointSuffix=core.chinacloudapi.cn;For reference: Configure Azure Storage connection strings
§Note
Connection strings can only configure the endpoint, account name and authentication information. Users still need to configure container name.
Trait Implementations§
Source§impl Builder for AzblobBuilder
Available on crate feature services-azblob only.
impl Builder for AzblobBuilder
services-azblob only.Source§impl Clone for AzblobBuilder
Available on crate feature services-azblob only.
impl Clone for AzblobBuilder
services-azblob only.Source§fn clone(&self) -> AzblobBuilder
fn clone(&self) -> AzblobBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AzblobBuilder
Available on crate feature services-azblob only.
impl Debug for AzblobBuilder
services-azblob only.Source§impl Default for AzblobBuilder
Available on crate feature services-azblob only.
impl Default for AzblobBuilder
services-azblob only.Source§fn default() -> AzblobBuilder
fn default() -> AzblobBuilder
Auto Trait Implementations§
impl Freeze for AzblobBuilder
impl !RefUnwindSafe for AzblobBuilder
impl Send for AzblobBuilder
impl Sync for AzblobBuilder
impl Unpin for AzblobBuilder
impl !UnwindSafe for AzblobBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.