pub struct MicrosoftAzureBuilder { /* private fields */ }azure-base only.Expand description
Configure a connection to Microsoft Azure Blob Storage container using the specified credentials.
§Example
let azure = MicrosoftAzureBuilder::new()
.with_account(ACCOUNT)
.with_access_key(ACCESS_KEY)
.with_container_name(BUCKET_NAME)
.build();Implementations§
Source§impl MicrosoftAzureBuilder
impl MicrosoftAzureBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new MicrosoftAzureBuilder with default values.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create an instance of MicrosoftAzureBuilder with values pre-populated from environment variables.
Variables extracted from environment:
- AZURE_STORAGE_ACCOUNT_NAME: storage account name
- AZURE_STORAGE_ACCOUNT_KEY: storage account master key
- AZURE_STORAGE_ACCESS_KEY: alias for AZURE_STORAGE_ACCOUNT_KEY
- AZURE_STORAGE_CLIENT_ID -> client id for service principal authorization
- AZURE_STORAGE_CLIENT_SECRET -> client secret for service principal authorization
- AZURE_STORAGE_TENANT_ID -> tenant id used in oauth flows
§Example
use object_store::azure::MicrosoftAzureBuilder;
let azure = MicrosoftAzureBuilder::from_env()
.with_container_name("foo")
.build();Sourcepub fn with_url(self, url: impl Into<String>) -> Self
pub fn with_url(self, url: impl Into<String>) -> Self
Parse available connection info form a well-known storage URL.
The supported url schemes are:
abfs[s]://<container>/<path>(according to fsspec)abfs[s]://<file_system>@<account_name>.dfs.core.windows.net/<path>abfs[s]://<file_system>@<account_name>.dfs.fabric.microsoft.com/<path>az://<container>/<path>(according to fsspec)adl://<container>/<path>(according to fsspec)azure://<container>/<path>(custom)https://<account>.dfs.core.windows.nethttps://<account>.blob.core.windows.nethttps://<account>.blob.core.windows.net/<container>https://<account>.dfs.fabric.microsoft.comhttps://<account>.dfs.fabric.microsoft.com/<container>https://<account>.blob.fabric.microsoft.comhttps://<account>.blob.fabric.microsoft.com/<container>
Note: Settings derived from the URL will override any others set on this builder
§Example
use object_store::azure::MicrosoftAzureBuilder;
let azure = MicrosoftAzureBuilder::from_env()
.with_url("abfss://file_system@account.dfs.core.windows.net/")
.build();Sourcepub fn with_config(self, key: AzureConfigKey, value: impl Into<String>) -> Self
pub fn with_config(self, key: AzureConfigKey, value: impl Into<String>) -> Self
Set an option on the builder via a key - value pair.
Sourcepub fn get_config_value(&self, key: &AzureConfigKey) -> Option<String>
pub fn get_config_value(&self, key: &AzureConfigKey) -> Option<String>
Get config value via a AzureConfigKey.
§Example
use object_store::azure::{MicrosoftAzureBuilder, AzureConfigKey};
let builder = MicrosoftAzureBuilder::from_env()
.with_account("foo");
let account_name = builder.get_config_value(&AzureConfigKey::AccountName).unwrap_or_default();
assert_eq!("foo", &account_name);Sourcepub fn with_account(self, account: impl Into<String>) -> Self
pub fn with_account(self, account: impl Into<String>) -> Self
Set the Azure Account (required)
Sourcepub fn with_container_name(self, container_name: impl Into<String>) -> Self
pub fn with_container_name(self, container_name: impl Into<String>) -> Self
Set the Azure Container Name (required)
Sourcepub fn with_access_key(self, access_key: impl Into<String>) -> Self
pub fn with_access_key(self, access_key: impl Into<String>) -> Self
Set the Azure Access Key (required - one of access key, bearer token, or client credentials)
Set a static bearer token to be used for authorizing requests
Set a client secret used for client secret authorization
Sourcepub fn with_client_id(self, client_id: impl Into<String>) -> Self
pub fn with_client_id(self, client_id: impl Into<String>) -> Self
Sets the client id for use in client secret or k8s federated credential flow
Sourcepub fn with_client_secret(self, client_secret: impl Into<String>) -> Self
pub fn with_client_secret(self, client_secret: impl Into<String>) -> Self
Sets the client secret for use in client secret flow
Sourcepub fn with_tenant_id(self, tenant_id: impl Into<String>) -> Self
pub fn with_tenant_id(self, tenant_id: impl Into<String>) -> Self
Sets the tenant id for use in client secret or k8s federated credential flow
Set query pairs appended to the url for shared access signature authorization
Sourcepub fn with_credentials(self, credentials: AzureCredentialProvider) -> Self
pub fn with_credentials(self, credentials: AzureCredentialProvider) -> Self
Set the credential provider overriding any other options
Sourcepub fn with_crypto_provider(self, provider: Arc<dyn CryptoProvider>) -> Self
pub fn with_crypto_provider(self, provider: Arc<dyn CryptoProvider>) -> Self
The CryptoProvider to use
Sourcepub fn with_use_emulator(self, use_emulator: bool) -> Self
pub fn with_use_emulator(self, use_emulator: bool) -> Self
Set if the Azure emulator should be used (defaults to false)
Sourcepub fn with_endpoint(self, endpoint: String) -> Self
pub fn with_endpoint(self, endpoint: String) -> Self
Override the endpoint used to communicate with blob storage
Defaults to https://{account}.blob.core.windows.net
By default, only HTTPS schemes are enabled. To connect to an HTTP endpoint, enable
Self::with_allow_http.
Sourcepub fn with_use_fabric_endpoint(self, use_fabric_endpoint: bool) -> Self
pub fn with_use_fabric_endpoint(self, use_fabric_endpoint: bool) -> Self
Set if Microsoft Fabric url scheme should be used (defaults to false)
When disabled the url scheme used is https://{account}.blob.core.windows.net
When enabled the url scheme used is https://{account}.dfs.fabric.microsoft.com
Note: Self::with_endpoint will take precedence over this option
Sourcepub fn with_allow_http(self, allow_http: bool) -> Self
pub fn with_allow_http(self, allow_http: bool) -> Self
Sets what protocol is allowed
If allow_http is :
- false (default): Only HTTPS are allowed
- true: HTTP and HTTPS are allowed
Sets an alternative authority host for OAuth based authorization
Common hosts for azure clouds are defined in authority_hosts.
Defaults to https://login.microsoftonline.com
Sourcepub fn with_retry(self, retry_config: RetryConfig) -> Self
pub fn with_retry(self, retry_config: RetryConfig) -> Self
Set the retry configuration
Sourcepub fn with_proxy_url(self, proxy_url: impl Into<String>) -> Self
pub fn with_proxy_url(self, proxy_url: impl Into<String>) -> Self
Set the proxy_url to be used by the underlying client
Sourcepub fn with_proxy_ca_certificate(
self,
proxy_ca_certificate: impl Into<String>,
) -> Self
pub fn with_proxy_ca_certificate( self, proxy_ca_certificate: impl Into<String>, ) -> Self
Set a trusted proxy CA certificate
Sourcepub fn with_proxy_excludes(self, proxy_excludes: impl Into<String>) -> Self
pub fn with_proxy_excludes(self, proxy_excludes: impl Into<String>) -> Self
Set a list of hosts to exclude from proxy connections
Sourcepub fn with_client_options(self, options: ClientOptions) -> Self
pub fn with_client_options(self, options: ClientOptions) -> Self
Sets the client options, overriding any already set
Sourcepub fn with_msi_endpoint(self, msi_endpoint: impl Into<String>) -> Self
pub fn with_msi_endpoint(self, msi_endpoint: impl Into<String>) -> Self
Sets the endpoint for acquiring managed identity token
Sourcepub fn with_federated_token_file(
self,
federated_token_file: impl Into<String>,
) -> Self
pub fn with_federated_token_file( self, federated_token_file: impl Into<String>, ) -> Self
Sets a file path for acquiring azure federated identity token in k8s
requires client_id and tenant_id to be set
Sourcepub fn with_use_azure_cli(self, use_azure_cli: bool) -> Self
pub fn with_use_azure_cli(self, use_azure_cli: bool) -> Self
Set if the Azure Cli should be used for acquiring access token
Sourcepub fn with_credential_type(self, credential_type: impl Into<String>) -> Self
pub fn with_credential_type(self, credential_type: impl Into<String>) -> Self
Set the credential type to use for authentication.
When multiple credential configurations are present (e.g. both workload identity and client secret), this forces the builder to use a specific credential type instead of relying on the default resolution order.
Supported values: auto, bearer_token, access_key, client_secret,
workload_identity, sas_token, azure_cli, managed_identity.
Sourcepub fn with_skip_signature(self, skip_signature: bool) -> Self
pub fn with_skip_signature(self, skip_signature: bool) -> Self
If enabled, MicrosoftAzure will not fetch credentials and will not sign requests
This can be useful when interacting with public containers
Sourcepub fn with_disable_tagging(self, ignore: bool) -> Self
pub fn with_disable_tagging(self, ignore: bool) -> Self
If set to true will ignore any tags provided to put_opts
Sourcepub fn with_encryption_key(self, key: impl Into<String>) -> Self
pub fn with_encryption_key(self, key: impl Into<String>) -> Self
Set the customer-provided encryption key (CPK) used to encrypt blob content.
key must be a base64-encoded 256-bit AES key (the decoded value must be
exactly 32 bytes). The same key must be supplied on every subsequent read,
write, or copy of any blob created with it; if the key is lost or omitted
the data is unrecoverable. CPK material is sent to Azure on every request,
so the configured endpoint must use HTTPS.
Only a subset of Blob storage operations support CPK
(see the Azure documentation). When CPK is enabled, copy
switches from the asynchronous Copy Blob API to Put Blob From URL,
which is synchronous and limits the source blob to 5,000 MiB.
Sourcepub fn with_http_connector<C: HttpConnector>(self, connector: C) -> Self
pub fn with_http_connector<C: HttpConnector>(self, connector: C) -> Self
The HttpConnector to use
On non-WASM32 platforms uses reqwest by default, on WASM32 platforms must be provided
Sourcepub fn build(self) -> Result<MicrosoftAzure>
pub fn build(self) -> Result<MicrosoftAzure>
Configure a connection to container with given name on Microsoft Azure Blob store.
Trait Implementations§
Source§impl Clone for MicrosoftAzureBuilder
impl Clone for MicrosoftAzureBuilder
Source§fn clone(&self) -> MicrosoftAzureBuilder
fn clone(&self) -> MicrosoftAzureBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MicrosoftAzureBuilder
impl Debug for MicrosoftAzureBuilder
Source§impl Default for MicrosoftAzureBuilder
impl Default for MicrosoftAzureBuilder
Source§fn default() -> MicrosoftAzureBuilder
fn default() -> MicrosoftAzureBuilder
Auto Trait Implementations§
impl !Freeze for MicrosoftAzureBuilder
impl !RefUnwindSafe for MicrosoftAzureBuilder
impl !UnwindSafe for MicrosoftAzureBuilder
impl Send for MicrosoftAzureBuilder
impl Sync for MicrosoftAzureBuilder
impl Unpin for MicrosoftAzureBuilder
impl UnsafeUnpin for MicrosoftAzureBuilder
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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