diff --git a/Cargo.lock b/Cargo.lock index 289136ca88..e3dd1a4b22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -512,6 +512,7 @@ dependencies = [ "tracing", "typespec_client_core", "url", + "urlencoding", "uuid", ] @@ -3255,6 +3256,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf-8" version = "0.7.6" diff --git a/sdk/storage/.dict.txt b/sdk/storage/.dict.txt index 665bc04c7c..4de6e93636 100644 --- a/sdk/storage/.dict.txt +++ b/sdk/storage/.dict.txt @@ -12,7 +12,9 @@ immutabilitypolicy incrementalcopy legalhold missingcontainer +numofmessages pagelist +peekonly policyid prevsnapshot RAGRS @@ -25,7 +27,6 @@ testblob3 testblob4 testcontainer uncommittedblobs +urlencoding westus yourtagname -numofmessages -peekonly diff --git a/sdk/storage/azure_storage_blob/Cargo.toml b/sdk/storage/azure_storage_blob/Cargo.toml index 6ef074ae46..d69b276974 100644 --- a/sdk/storage/azure_storage_blob/Cargo.toml +++ b/sdk/storage/azure_storage_blob/Cargo.toml @@ -23,6 +23,7 @@ serde.workspace = true serde_json.workspace = true typespec_client_core = { workspace = true, features = ["derive"] } url.workspace = true +urlencoding = "2.1.3" uuid.workspace = true [lints] diff --git a/sdk/storage/azure_storage_blob/sdk/storage/azure_storage_blob/tsp-location.yaml b/sdk/storage/azure_storage_blob/sdk/storage/azure_storage_blob/tsp-location.yaml new file mode 100644 index 0000000000..dd505078bc --- /dev/null +++ b/sdk/storage/azure_storage_blob/sdk/storage/azure_storage_blob/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/storage/Microsoft.BlobStorage +commit: 309e0ffb479980eea4b44f294ea4c50549848867 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/storage/azure_storage_blob/src/clients/append_blob_client.rs b/sdk/storage/azure_storage_blob/src/clients/append_blob_client.rs index 47244cb279..ad2feff861 100644 --- a/sdk/storage/azure_storage_blob/src/clients/append_blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/append_blob_client.rs @@ -9,6 +9,7 @@ use crate::{ AppendBlobClientCreateOptions, AppendBlobClientCreateResult, AppendBlobClientSealOptions, AppendBlobClientSealResult, }, + parsers::parse_url_name_components, pipeline::StorageHeadersPolicy, AppendBlobClientOptions, BlobClientOptions, }; @@ -24,8 +25,10 @@ use std::sync::Arc; /// A client to interact with a specific Azure storage Append blob, although that blob may not yet exist. pub struct AppendBlobClient { - pub(crate) endpoint: Url, - pub(crate) client: GeneratedAppendBlobClient, + pub(super) endpoint: Url, + pub(super) client: GeneratedAppendBlobClient, + pub(super) container_name: String, + pub(super) blob_name: String, } impl AppendBlobClient { @@ -53,16 +56,25 @@ impl AppendBlobClient { .per_call_policies .push(storage_headers_policy); - let client = GeneratedAppendBlobClient::new( - endpoint, - credential, - container_name, - blob_name, - Some(options), - )?; + let mut url = Url::parse(endpoint)?; + if !url.scheme().starts_with("http") { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + format!("{url} must use http(s)"), + )); + } + + // Build Blob URL, Url crate handles encoding only path params + url.path_segments_mut() + .expect("Cannot be base") + .extend([&container_name, &blob_name]); + + let client = GeneratedAppendBlobClient::new(url.as_str(), credential, Some(options))?; Ok(Self { - endpoint: endpoint.parse()?, + endpoint: client.endpoint().clone(), client, + container_name, + blob_name, }) } @@ -73,12 +85,12 @@ impl AppendBlobClient { /// Gets the container name of the Storage account this client is connected to. pub fn container_name(&self) -> &str { - &self.client.container_name + &self.container_name } /// Gets the blob name of the Storage account this client is connected to. pub fn blob_name(&self) -> &str { - &self.client.blob_name + &self.blob_name } /// Creates a new Append blob. diff --git a/sdk/storage/azure_storage_blob/src/clients/blob_client.rs b/sdk/storage/azure_storage_blob/src/clients/blob_client.rs index 81e2df2940..cc5b400316 100644 --- a/sdk/storage/azure_storage_blob/src/clients/blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/blob_client.rs @@ -2,7 +2,10 @@ // Licensed under the MIT License. use crate::{ + generated::clients::AppendBlobClient as GeneratedAppendBlobClient, generated::clients::BlobClient as GeneratedBlobClient, + generated::clients::BlockBlobClient as GeneratedBlockBlobClient, + generated::clients::PageBlobClient as GeneratedPageBlobClient, generated::models::{ BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, BlobClientDownloadResult, BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, @@ -19,6 +22,7 @@ use crate::{ BlobTags, BlockBlobClientCommitBlockListOptions, BlockBlobClientUploadOptions, BlockList, BlockListType, BlockLookupList, StorageErrorCode, }, + parsers::{build_blob_url, parse_url_name_components}, pipeline::StorageHeadersPolicy, AppendBlobClient, BlobClientOptions, BlockBlobClient, PageBlobClient, }; @@ -27,54 +31,109 @@ use azure_core::{ error::ErrorKind, http::{ policies::{BearerTokenCredentialPolicy, Policy}, - AsyncResponse, JsonFormat, NoFormat, RequestContent, Response, StatusCode, Url, XmlFormat, + AsyncResponse, JsonFormat, NoFormat, Pipeline, RequestContent, Response, StatusCode, Url, + XmlFormat, }, - Bytes, Result, + tracing, Bytes, Result, }; use std::collections::HashMap; use std::sync::Arc; -/// A client to interact with a specific Azure storage blob, although that blob may not yet exist. +/// A client to interact with a specific Azure Storage blob, although that blob may not yet exist. pub struct BlobClient { - pub(super) endpoint: Url, pub(super) client: GeneratedBlobClient, + pub(super) container_name: String, + pub(super) blob_name: String, } +impl GeneratedBlobClient { + #[tracing::new("Storage.Blob.Blob")] + pub fn from_url( + blob_url: &str, + credential: Option>, + options: Option, + ) -> Result { + let mut options = options.unwrap_or_default(); + + let storage_headers_policy = Arc::new(StorageHeadersPolicy); + options + .client_options + .per_call_policies + .push(storage_headers_policy); + + let per_retry_policies = if let Some(token_credential) = credential { + if !blob_url.starts_with("https://") { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + format!("{blob_url} must use http(s)"), + )); + } + let auth_policy: Arc = Arc::new(BearerTokenCredentialPolicy::new( + token_credential, + vec!["https://storage.azure.com/.default"], + )); + vec![auth_policy] + } else { + Vec::default() + }; + + let pipeline = Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + options.client_options.clone(), + Vec::default(), + per_retry_policies, + None, + ); + + Ok(Self { + // This is the crux of the issue. We have now resolved the encoding to align with other Storage SDK offerings + // However because the generated code has to build a Request model that expects a Url type, we will always get our '/' encoded as '%2F' + endpoint: Url::parse(blob_url)?, + version: options.version, + pipeline, + }) + } +} impl BlobClient { - /// Creates a new BlobClient, using Entra ID authentication. + /// Creates a new BlobClient. /// /// # 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. + /// * `credential` - An optional implementation of [`TokenCredential`] that can provide an Entra ID token to use when authenticating. /// * `options` - Optional configuration for the client. pub fn new( endpoint: &str, container_name: String, blob_name: String, - credential: Arc, + credential: Option>, options: Option, ) -> Result { - let mut options = options.unwrap_or_default(); + let blob_url = build_blob_url(endpoint, &container_name, &blob_name); - let storage_headers_policy = Arc::new(StorageHeadersPolicy); - options - .client_options - .per_call_policies - .push(storage_headers_policy); - - let client = GeneratedBlobClient::new( - endpoint, - credential, + let client = GeneratedBlobClient::from_url(&blob_url, credential, options)?; + Ok(Self { + client, container_name, blob_name, - Some(options), - )?; + }) + } + + pub fn from_blob_url( + blob_url: &str, + credential: Option>, + options: Option, + ) -> Result { + let (container_name, blob_name) = parse_url_name_components(blob_url)?; + let client = GeneratedBlobClient::from_url(blob_url, credential, options)?; + Ok(Self { - endpoint: endpoint.parse()?, client, + container_name, + blob_name, }) } @@ -85,7 +144,14 @@ impl BlobClient { pub fn append_blob_client(&self) -> AppendBlobClient { AppendBlobClient { endpoint: self.client.endpoint.clone(), - client: self.client.get_append_blob_client(), + client: GeneratedAppendBlobClient { + endpoint: self.client.endpoint.clone(), + pipeline: self.client.pipeline.clone(), + version: self.client.version.clone(), + tracer: self.client.tracer.clone(), + }, + container_name: self.container_name().to_string(), + blob_name: self.blob_name().to_string(), } } @@ -96,7 +162,14 @@ impl BlobClient { pub fn block_blob_client(&self) -> BlockBlobClient { BlockBlobClient { endpoint: self.client.endpoint.clone(), - client: self.client.get_block_blob_client(), + client: GeneratedBlockBlobClient { + endpoint: self.client.endpoint.clone(), + pipeline: self.client.pipeline.clone(), + version: self.client.version.clone(), + tracer: self.client.tracer.clone(), + }, + container_name: self.container_name().to_string(), + blob_name: self.blob_name().to_string(), } } @@ -107,23 +180,31 @@ impl BlobClient { pub fn page_blob_client(&self) -> PageBlobClient { PageBlobClient { endpoint: self.client.endpoint.clone(), - client: self.client.get_page_blob_client(), + client: GeneratedPageBlobClient { + endpoint: self.client.endpoint.clone(), + pipeline: self.client.pipeline.clone(), + version: self.client.version.clone(), + tracer: self.client.tracer.clone(), + }, + container_name: self.container_name().to_string(), + blob_name: self.blob_name().to_string(), } } - /// Gets the endpoint of the Storage account this client is connected to. - pub fn endpoint(&self) -> &Url { - &self.endpoint + //TODO: This should be a &str, therefore generated code needs to be changed here to hold a &str on the struct and not a Url type + /// Gets the full URL of the Storage blob this client is connected to. + pub fn blob_url(&self) -> &Url { + &self.client.endpoint } /// Gets the container name of the Storage account this client is connected to. pub fn container_name(&self) -> &str { - &self.client.container_name + &self.container_name } /// Gets the blob name of the Storage account this client is connected to. pub fn blob_name(&self) -> &str { - &self.client.blob_name + &self.blob_name } /// Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. @@ -183,8 +264,8 @@ impl BlobClient { options.if_none_match = Some(String::from("*")); } - self.client - .get_block_blob_client() + self.block_blob_client() + .client .upload(data, content_length, Some(options)) .await } diff --git a/sdk/storage/azure_storage_blob/src/clients/blob_container_client.rs b/sdk/storage/azure_storage_blob/src/clients/blob_container_client.rs index 6f91dd500e..56a6bf5011 100644 --- a/sdk/storage/azure_storage_blob/src/clients/blob_container_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/blob_container_client.rs @@ -2,24 +2,23 @@ // Licensed under the MIT License. use crate::{ - generated::clients::BlobContainerClient as GeneratedBlobContainerClient, + generated::clients::BlobClient as GeneratedBlobClient, + generated::clients::ContainerClient as GeneratedBlobContainerClient, generated::models::{ - BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult, - BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult, - BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult, - BlobContainerClientRenewLeaseResult, - }, - models::{ - BlobContainerClientAcquireLeaseOptions, BlobContainerClientBreakLeaseOptions, - BlobContainerClientChangeLeaseOptions, BlobContainerClientCreateOptions, - BlobContainerClientDeleteOptions, BlobContainerClientFindBlobsByTagsOptions, - BlobContainerClientGetAccountInfoOptions, BlobContainerClientGetPropertiesOptions, - BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientReleaseLeaseOptions, - BlobContainerClientRenewLeaseOptions, BlobContainerClientSetMetadataOptions, - FilterBlobSegment, ListBlobsFlatSegmentResponse, StorageErrorCode, + ContainerClientAcquireLeaseOptions, ContainerClientAcquireLeaseResult, + ContainerClientBreakLeaseOptions, ContainerClientBreakLeaseResult, + ContainerClientChangeLeaseOptions, ContainerClientChangeLeaseResult, + ContainerClientCreateOptions, ContainerClientDeleteOptions, + ContainerClientFindBlobsByTagsOptions, ContainerClientGetAccountInfoOptions, + ContainerClientGetAccountInfoResult, ContainerClientGetPropertiesOptions, + ContainerClientGetPropertiesResult, ContainerClientListBlobFlatSegmentOptions, + ContainerClientReleaseLeaseOptions, ContainerClientReleaseLeaseResult, + ContainerClientRenewLeaseOptions, ContainerClientRenewLeaseResult, + ContainerClientSetMetadataOptions, }, + models::{FilterBlobSegment, ListBlobsFlatSegmentResponse, StorageErrorCode}, pipeline::StorageHeadersPolicy, - BlobClient, BlobContainerClientOptions, + BlobClient, ContainerClientOptions, }; use azure_core::{ credentials::TokenCredential, @@ -36,6 +35,7 @@ use std::{collections::HashMap, sync::Arc}; pub struct BlobContainerClient { pub(super) endpoint: Url, pub(super) client: GeneratedBlobContainerClient, + pub(super) container_name: String, } impl BlobContainerClient { @@ -51,7 +51,7 @@ impl BlobContainerClient { endpoint: &str, container_name: String, credential: Arc, - options: Option, + options: Option, ) -> Result { let mut options = options.unwrap_or_default(); @@ -61,16 +61,24 @@ impl BlobContainerClient { .per_call_policies .push(storage_headers_policy); - let client = GeneratedBlobContainerClient::new( - endpoint, - credential.clone(), - container_name.clone(), - Some(options), - )?; + let mut url = Url::parse(endpoint)?; + if !url.scheme().starts_with("http") { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + format!("{url} must use http(s)"), + )); + } + + // Build Container URL, Url crate handles encoding only path params + url.path_segments_mut() + .expect("Cannot be base") + .push(&container_name); + let client = GeneratedBlobContainerClient::new(url.as_str(), credential, Some(options))?; Ok(Self { - endpoint: endpoint.parse()?, + endpoint: client.endpoint().clone(), client, + container_name, }) } @@ -80,9 +88,23 @@ impl BlobContainerClient { /// /// * `blob_name` - The name of the blob. pub fn blob_client(&self, blob_name: String) -> BlobClient { + let mut blob_url = self.endpoint.clone(); + blob_url + .path_segments_mut() + .expect("Cannot be base") + .push(&blob_name); + + let client = GeneratedBlobClient { + endpoint: blob_url.clone(), + pipeline: self.client.pipeline.clone(), + version: self.client.version.clone(), + tracer: self.client.tracer.clone(), + }; + BlobClient { - endpoint: self.client.endpoint.clone(), - client: self.client.get_blob_client(blob_name), + client, + container_name: self.container_name.clone(), + blob_name, } } @@ -93,7 +115,7 @@ impl BlobContainerClient { /// Gets the container name of the Storage account this client is connected to. pub fn container_name(&self) -> &str { - &self.client.container_name + &self.container_name } /// Creates a new container under the specified account. If the container with the same name already exists, the operation fails. @@ -103,7 +125,7 @@ impl BlobContainerClient { /// * `options` - Optional configuration for the request. pub async fn create_container( &self, - options: Option>, + options: Option>, ) -> Result> { self.client.create(options).await } @@ -119,7 +141,7 @@ impl BlobContainerClient { pub async fn set_metadata( &self, metadata: HashMap, - options: Option>, + options: Option>, ) -> Result> { self.client.set_metadata(metadata, options).await } @@ -131,7 +153,7 @@ impl BlobContainerClient { /// * `options` - Optional configuration for the request. pub async fn delete_container( &self, - options: Option>, + options: Option>, ) -> Result> { self.client.delete(options).await } @@ -144,8 +166,8 @@ impl BlobContainerClient { /// * `options` - Optional configuration for the request. pub async fn get_properties( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { self.client.get_properties(options).await } @@ -156,7 +178,7 @@ impl BlobContainerClient { /// * `options` - Optional configuration for the request. pub fn list_blobs( &self, - options: Option>, + options: Option>, ) -> Result>> { self.client.list_blob_flat_segment(options) } @@ -179,7 +201,7 @@ impl BlobContainerClient { pub async fn find_blobs_by_tags( &self, filter_expression: &str, - options: Option>, + options: Option>, ) -> Result> { self.client .find_blobs_by_tags(filter_expression, options) @@ -196,8 +218,8 @@ impl BlobContainerClient { pub async fn acquire_lease( &self, duration: i32, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { self.client.acquire_lease(duration, options).await } @@ -209,8 +231,8 @@ impl BlobContainerClient { /// * `options` - Optional configuration for the request. pub async fn break_lease( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { self.client.break_lease(options).await } @@ -226,8 +248,8 @@ impl BlobContainerClient { &self, lease_id: String, proposed_lease_id: String, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { self.client .change_lease(lease_id, proposed_lease_id, options) .await @@ -244,8 +266,8 @@ impl BlobContainerClient { pub async fn release_lease( &self, lease_id: String, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { self.client.release_lease(lease_id, options).await } @@ -259,8 +281,8 @@ impl BlobContainerClient { pub async fn renew_lease( &self, lease_id: String, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { self.client.renew_lease(lease_id, options).await } @@ -272,8 +294,8 @@ impl BlobContainerClient { /// * `options` - Optional configuration for the request. pub async fn get_account_info( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { self.client.get_account_info(options).await } diff --git a/sdk/storage/azure_storage_blob/src/clients/blob_service_client.rs b/sdk/storage/azure_storage_blob/src/clients/blob_service_client.rs index 08648d7ca5..83b04941d2 100644 --- a/sdk/storage/azure_storage_blob/src/clients/blob_service_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/blob_service_client.rs @@ -2,16 +2,17 @@ // Licensed under the MIT License. use crate::{ - generated::clients::BlobServiceClient as GeneratedBlobServiceClient, - generated::models::BlobServiceClientGetAccountInfoResult, + generated::clients::ContainerClient as GeneratedBlobContainerClient, + generated::clients::ServiceClient as GeneratedBlobServiceClient, + generated::models::ServiceClientGetAccountInfoResult, models::{ - BlobServiceClientFindBlobsByTagsOptions, BlobServiceClientGetAccountInfoOptions, - BlobServiceClientGetPropertiesOptions, BlobServiceClientListContainersSegmentOptions, - BlobServiceClientSetPropertiesOptions, BlobServiceProperties, FilterBlobSegment, - ListContainersSegmentResponse, + BlobServiceProperties, FilterBlobSegment, ListContainersSegmentResponse, + ServiceClientFindBlobsByTagsOptions, ServiceClientGetAccountInfoOptions, + ServiceClientGetPropertiesOptions, ServiceClientListContainersSegmentOptions, + ServiceClientSetPropertiesOptions, }, pipeline::StorageHeadersPolicy, - BlobContainerClient, BlobServiceClientOptions, + BlobContainerClient, ServiceClientOptions, }; use azure_core::{ credentials::TokenCredential, @@ -40,7 +41,7 @@ impl BlobServiceClient { pub fn new( endpoint: &str, credential: Arc, - options: Option, + options: Option, ) -> Result { let mut options = options.unwrap_or_default(); @@ -50,10 +51,12 @@ impl BlobServiceClient { .per_call_policies .push(storage_headers_policy); - let client = GeneratedBlobServiceClient::new(endpoint, credential.clone(), Some(options))?; + let url = Url::parse(endpoint)?; + let client = + GeneratedBlobServiceClient::new(url.as_str(), credential.clone(), Some(options))?; Ok(Self { - endpoint: endpoint.parse()?, + endpoint: client.endpoint().clone(), client, }) } @@ -64,9 +67,23 @@ impl BlobServiceClient { /// /// * `container_name` - The name of the container. pub fn blob_container_client(&self, container_name: String) -> BlobContainerClient { + let mut container_url = self.endpoint.clone(); + container_url + .path_segments_mut() + .expect("Cannot be base") + .push(&container_name); + + let client = GeneratedBlobContainerClient { + endpoint: container_url.clone(), + pipeline: self.client.pipeline.clone(), + version: self.client.version.clone(), + tracer: self.client.tracer.clone(), + }; + BlobContainerClient { - endpoint: self.client.endpoint.clone(), - client: self.client.get_blob_container_client(container_name), + endpoint: container_url, + client, + container_name, } } @@ -82,7 +99,7 @@ impl BlobServiceClient { /// * `options` - Optional configuration for the request. pub async fn get_properties( &self, - options: Option>, + options: Option>, ) -> Result> { self.client.get_properties(options).await } @@ -94,7 +111,7 @@ impl BlobServiceClient { /// * `options` - Optional configuration for the request. pub fn list_containers( &self, - options: Option>, + options: Option>, ) -> Result>> { self.client.list_containers_segment(options) } @@ -117,7 +134,7 @@ impl BlobServiceClient { pub async fn find_blobs_by_tags( &self, filter_expression: &str, - options: Option>, + options: Option>, ) -> Result> { self.client .find_blobs_by_tags(filter_expression, options) @@ -133,7 +150,7 @@ impl BlobServiceClient { pub async fn set_properties( &self, storage_service_properties: RequestContent, - options: Option>, + options: Option>, ) -> Result> { self.client .set_properties(storage_service_properties, options) @@ -148,8 +165,8 @@ impl BlobServiceClient { /// * `options` - Optional configuration for the request. pub async fn get_account_info( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { self.client.get_account_info(options).await } } diff --git a/sdk/storage/azure_storage_blob/src/clients/block_blob_client.rs b/sdk/storage/azure_storage_blob/src/clients/block_blob_client.rs index 5e51224bd6..a716131e00 100644 --- a/sdk/storage/azure_storage_blob/src/clients/block_blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/block_blob_client.rs @@ -30,8 +30,10 @@ use std::sync::Arc; /// A client to interact with a specific Azure storage Block blob, although that blob may not yet exist. pub struct BlockBlobClient { - pub(crate) endpoint: Url, - pub(crate) client: GeneratedBlockBlobClient, + pub(super) endpoint: Url, + pub(super) client: GeneratedBlockBlobClient, + pub(super) container_name: String, + pub(super) blob_name: String, } impl BlockBlobClient { @@ -59,16 +61,25 @@ impl BlockBlobClient { .per_call_policies .push(storage_headers_policy); - let client = GeneratedBlockBlobClient::new( - endpoint, - credential, - container_name, - blob_name, - Some(options), - )?; + let mut url = Url::parse(endpoint)?; + if !url.scheme().starts_with("http") { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + format!("{url} must use http(s)"), + )); + } + + // Build Blob URL, Url crate handles encoding only path params + url.path_segments_mut() + .expect("Cannot be base") + .extend([&container_name, &blob_name]); + + let client = GeneratedBlockBlobClient::new(url.as_str(), credential, Some(options))?; Ok(Self { - endpoint: endpoint.parse()?, + endpoint: client.endpoint().clone(), client, + container_name, + blob_name, }) } @@ -79,12 +90,12 @@ impl BlockBlobClient { /// Gets the container name of the Storage account this client is connected to. pub fn container_name(&self) -> &str { - &self.client.container_name + &self.container_name } /// Gets the blob name of the Storage account this client is connected to. pub fn blob_name(&self) -> &str { - &self.client.blob_name + &self.blob_name } /// Writes to a blob based on blocks specified by the list of IDs and content that make up the blob. diff --git a/sdk/storage/azure_storage_blob/src/clients/mod.rs b/sdk/storage/azure_storage_blob/src/clients/mod.rs index 4b310f4a63..a476f72600 100644 --- a/sdk/storage/azure_storage_blob/src/clients/mod.rs +++ b/sdk/storage/azure_storage_blob/src/clients/mod.rs @@ -18,6 +18,6 @@ pub use block_blob_client::BlockBlobClient; pub use page_blob_client::PageBlobClient; pub use crate::generated::clients::{ - AppendBlobClientOptions, BlobClientOptions, BlobContainerClientOptions, - BlobServiceClientOptions, BlockBlobClientOptions, PageBlobClientOptions, + AppendBlobClientOptions, BlobClientOptions, BlockBlobClientOptions, ContainerClientOptions, + PageBlobClientOptions, ServiceClientOptions, }; diff --git a/sdk/storage/azure_storage_blob/src/clients/page_blob_client.rs b/sdk/storage/azure_storage_blob/src/clients/page_blob_client.rs index 3784bfe4ca..8cbff8cff1 100644 --- a/sdk/storage/azure_storage_blob/src/clients/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/page_blob_client.rs @@ -27,8 +27,10 @@ use std::sync::Arc; /// A client to interact with a specific Azure storage Page blob, although that blob may not yet exist. pub struct PageBlobClient { - pub(crate) endpoint: Url, - pub(crate) client: GeneratedPageBlobClient, + pub(super) endpoint: Url, + pub(super) client: GeneratedPageBlobClient, + pub(super) container_name: String, + pub(super) blob_name: String, } impl PageBlobClient { @@ -56,16 +58,25 @@ impl PageBlobClient { .per_call_policies .push(storage_headers_policy); - let client = GeneratedPageBlobClient::new( - endpoint, - credential, - container_name, - blob_name, - Some(options), - )?; + let mut url = Url::parse(endpoint)?; + if !url.scheme().starts_with("http") { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + format!("{url} must use http(s)"), + )); + } + + // Build Blob URL, Url crate handles encoding only path params + url.path_segments_mut() + .expect("Cannot be base") + .extend([&container_name, &blob_name]); + + let client = GeneratedPageBlobClient::new(url.as_str(), credential, Some(options))?; Ok(Self { - endpoint: endpoint.parse()?, + endpoint: client.endpoint().clone(), client, + container_name, + blob_name, }) } @@ -76,12 +87,12 @@ impl PageBlobClient { /// Gets the container name of the Storage account this client is connected to. pub fn container_name(&self) -> &str { - &self.client.container_name + &self.container_name } /// Gets the blob name of the Storage account this client is connected to. pub fn blob_name(&self) -> &str { - &self.client.blob_name + &self.blob_name } /// Creates a new Page blob. diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/append_blob_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/append_blob_client.rs index 3261f4c969..4de80a0bdf 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/append_blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/append_blob_client.rs @@ -26,8 +26,6 @@ use std::sync::Arc; #[tracing::client] pub struct AppendBlobClient { - pub(crate) blob_name: String, - pub(crate) container_name: String, pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, @@ -50,15 +48,11 @@ impl AppendBlobClient { /// * `endpoint` - Service host /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. - /// * `blob_name` - The name of the blob. /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob.Container.Blob.AppendBlob")] + #[tracing::new("Storage.Blob.AppendBlob")] pub fn new( endpoint: &str, credential: Arc, - container_name: String, - blob_name: String, options: Option, ) -> Result { let options = options.unwrap_or_default(); @@ -74,8 +68,6 @@ impl AppendBlobClient { vec!["https://storage.azure.com/.default"], )); Ok(Self { - blob_name, - container_name, endpoint, version: options.version, pipeline: Pipeline::new( @@ -138,7 +130,7 @@ impl AppendBlobClient { /// * [`is_server_encrypted`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// /// [`AppendBlobClientAppendBlockResultHeaders`]: crate::generated::models::AppendBlobClientAppendBlockResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.AppendBlob.appendBlock")] + #[tracing::function("Storage.Blob.AppendBlob.appendBlock")] pub async fn append_block( &self, body: RequestContent, @@ -148,10 +140,6 @@ impl AppendBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "appendblock"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -280,7 +268,7 @@ impl AppendBlobClient { /// * [`is_server_encrypted`()](crate::generated::models::AppendBlobClientAppendBlockFromUrlResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// /// [`AppendBlobClientAppendBlockFromUrlResultHeaders`]: crate::generated::models::AppendBlobClientAppendBlockFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.AppendBlob.appendBlockFromUrl")] + #[tracing::function("Storage.Blob.AppendBlob.appendBlockFromUrl")] pub async fn append_block_from_url( &self, source_url: String, @@ -290,10 +278,6 @@ impl AppendBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "appendblock") .append_key_only("fromUrl"); @@ -440,7 +424,7 @@ impl AppendBlobClient { /// * [`version_id`()](crate::generated::models::AppendBlobClientCreateResultHeaders::version_id) - x-ms-version-id /// /// [`AppendBlobClientCreateResultHeaders`]: crate::generated::models::AppendBlobClientCreateResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.AppendBlob.create")] + #[tracing::function("Storage.Blob.AppendBlob.create")] pub async fn create( &self, options: Option>, @@ -448,10 +432,6 @@ impl AppendBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; if let Some(timeout) = options.timeout { url.query_pairs_mut() .append_pair("timeout", &timeout.to_string()); @@ -590,7 +570,7 @@ impl AppendBlobClient { /// * [`is_sealed`()](crate::generated::models::AppendBlobClientSealResultHeaders::is_sealed) - x-ms-blob-sealed /// /// [`AppendBlobClientSealResultHeaders`]: crate::generated::models::AppendBlobClientSealResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.AppendBlob.seal")] + #[tracing::function("Storage.Blob.AppendBlob.seal")] pub async fn seal( &self, options: Option>, @@ -598,10 +578,6 @@ impl AppendBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "seal"); if let Some(timeout) = options.timeout { url.query_pairs_mut() diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/blob_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/blob_client.rs index 9e0b8a2586..ccdce7853d 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/blob_client.rs @@ -3,26 +3,22 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use crate::generated::{ - clients::{AppendBlobClient, BlockBlobClient, PageBlobClient}, - models::{ - AccessTier, BlobClientAbortCopyFromUrlOptions, BlobClientAbortCopyFromUrlResult, - BlobClientAcquireLeaseOptions, BlobClientAcquireLeaseResult, BlobClientBreakLeaseOptions, - BlobClientBreakLeaseResult, BlobClientChangeLeaseOptions, BlobClientChangeLeaseResult, - BlobClientCopyFromUrlOptions, BlobClientCopyFromUrlResult, BlobClientCreateSnapshotOptions, - BlobClientCreateSnapshotResult, BlobClientDeleteImmutabilityPolicyOptions, - BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteOptions, - BlobClientDownloadOptions, BlobClientDownloadResult, BlobClientGetAccountInfoOptions, - BlobClientGetAccountInfoResult, BlobClientGetPropertiesOptions, - BlobClientGetPropertiesResult, BlobClientGetTagsOptions, BlobClientReleaseLeaseOptions, - BlobClientReleaseLeaseResult, BlobClientRenewLeaseOptions, BlobClientRenewLeaseResult, - BlobClientSetExpiryOptions, BlobClientSetExpiryResult, - BlobClientSetImmutabilityPolicyOptions, BlobClientSetImmutabilityPolicyResult, - BlobClientSetLegalHoldOptions, BlobClientSetLegalHoldResult, BlobClientSetMetadataOptions, - BlobClientSetPropertiesOptions, BlobClientSetTagsOptions, BlobClientSetTierOptions, - BlobClientStartCopyFromUrlOptions, BlobClientStartCopyFromUrlResult, - BlobClientUndeleteOptions, BlobClientUndeleteResult, BlobExpiryOptions, BlobTags, - }, +use crate::generated::models::{ + AccessTier, BlobClientAbortCopyFromUrlOptions, BlobClientAbortCopyFromUrlResult, + BlobClientAcquireLeaseOptions, BlobClientAcquireLeaseResult, BlobClientBreakLeaseOptions, + BlobClientBreakLeaseResult, BlobClientChangeLeaseOptions, BlobClientChangeLeaseResult, + BlobClientCopyFromUrlOptions, BlobClientCopyFromUrlResult, BlobClientCreateSnapshotOptions, + BlobClientCreateSnapshotResult, BlobClientDeleteImmutabilityPolicyOptions, + BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteOptions, BlobClientDownloadOptions, + BlobClientDownloadResult, BlobClientGetAccountInfoOptions, BlobClientGetAccountInfoResult, + BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, BlobClientGetTagsOptions, + BlobClientReleaseLeaseOptions, BlobClientReleaseLeaseResult, BlobClientRenewLeaseOptions, + BlobClientRenewLeaseResult, BlobClientSetExpiryOptions, BlobClientSetExpiryResult, + BlobClientSetImmutabilityPolicyOptions, BlobClientSetImmutabilityPolicyResult, + BlobClientSetLegalHoldOptions, BlobClientSetLegalHoldResult, BlobClientSetMetadataOptions, + BlobClientSetPropertiesOptions, BlobClientSetTagsOptions, BlobClientSetTierOptions, + BlobClientStartCopyFromUrlOptions, BlobClientStartCopyFromUrlResult, BlobClientUndeleteOptions, + BlobClientUndeleteResult, BlobExpiryOptions, BlobTags, }; use azure_core::{ base64::encode, @@ -41,8 +37,6 @@ use std::{collections::HashMap, sync::Arc}; #[tracing::client] pub struct BlobClient { - pub(crate) blob_name: String, - pub(crate) container_name: String, pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, @@ -65,15 +59,11 @@ impl BlobClient { /// * `endpoint` - Service host /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. - /// * `blob_name` - The name of the blob. /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob.Container.Blob")] + #[tracing::new("Storage.Blob.Blob")] pub fn new( endpoint: &str, credential: Arc, - container_name: String, - blob_name: String, options: Option, ) -> Result { let options = options.unwrap_or_default(); @@ -89,8 +79,6 @@ impl BlobClient { vec!["https://storage.azure.com/.default"], )); Ok(Self { - blob_name, - container_name, endpoint, version: options.version, pipeline: Pipeline::new( @@ -139,7 +127,7 @@ impl BlobClient { /// * [`date`()](crate::generated::models::BlobClientAbortCopyFromUrlResultHeaders::date) - Date /// /// [`BlobClientAbortCopyFromUrlResultHeaders`]: crate::generated::models::BlobClientAbortCopyFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.abortCopyFromUrl")] + #[tracing::function("Storage.Blob.Blob.abortCopyFromUrl")] pub async fn abort_copy_from_url( &self, copy_id: &str, @@ -148,10 +136,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "copy") .append_key_only("copyid"); @@ -225,7 +209,7 @@ impl BlobClient { /// * [`lease_id`()](crate::generated::models::BlobClientAcquireLeaseResultHeaders::lease_id) - x-ms-lease-id /// /// [`BlobClientAcquireLeaseResultHeaders`]: crate::generated::models::BlobClientAcquireLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.acquireLease")] + #[tracing::function("Storage.Blob.Blob.acquireLease")] pub async fn acquire_lease( &self, duration: i32, @@ -234,10 +218,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_key_only("acquire") .append_pair("comp", "lease"); @@ -323,7 +303,7 @@ impl BlobClient { /// * [`lease_time`()](crate::generated::models::BlobClientBreakLeaseResultHeaders::lease_time) - x-ms-lease-time /// /// [`BlobClientBreakLeaseResultHeaders`]: crate::generated::models::BlobClientBreakLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.breakLease")] + #[tracing::function("Storage.Blob.Blob.breakLease")] pub async fn break_lease( &self, options: Option>, @@ -331,10 +311,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_key_only("break") .append_pair("comp", "lease"); @@ -422,7 +398,7 @@ impl BlobClient { /// * [`lease_id`()](crate::generated::models::BlobClientChangeLeaseResultHeaders::lease_id) - x-ms-lease-id /// /// [`BlobClientChangeLeaseResultHeaders`]: crate::generated::models::BlobClientChangeLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.changeLease")] + #[tracing::function("Storage.Blob.Blob.changeLease")] pub async fn change_lease( &self, lease_id: String, @@ -432,10 +408,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_key_only("change") .append_pair("comp", "lease"); @@ -528,7 +500,7 @@ impl BlobClient { /// * [`version_id`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::version_id) - x-ms-version-id /// /// [`BlobClientCopyFromUrlResultHeaders`]: crate::generated::models::BlobClientCopyFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.copyFromUrl")] + #[tracing::function("Storage.Blob.Blob.copyFromUrl")] pub async fn copy_from_url( &self, copy_source: String, @@ -537,10 +509,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "copy") .append_key_only("sync"); @@ -688,7 +656,7 @@ impl BlobClient { /// * [`version_id`()](crate::generated::models::BlobClientCreateSnapshotResultHeaders::version_id) - x-ms-version-id /// /// [`BlobClientCreateSnapshotResultHeaders`]: crate::generated::models::BlobClientCreateSnapshotResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.createSnapshot")] + #[tracing::function("Storage.Blob.Blob.createSnapshot")] pub async fn create_snapshot( &self, options: Option>, @@ -696,10 +664,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "snapshot"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -778,7 +742,7 @@ impl BlobClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.Blob.delete")] + #[tracing::function("Storage.Blob.Blob.delete")] pub async fn delete( &self, options: Option>, @@ -786,10 +750,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; if let Some(blob_delete_type) = options.blob_delete_type { url.query_pairs_mut() .append_pair("deletetype", blob_delete_type.as_ref()); @@ -875,7 +835,7 @@ impl BlobClient { /// * [`date`()](crate::generated::models::BlobClientDeleteImmutabilityPolicyResultHeaders::date) - Date /// /// [`BlobClientDeleteImmutabilityPolicyResultHeaders`]: crate::generated::models::BlobClientDeleteImmutabilityPolicyResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.deleteImmutabilityPolicy")] + #[tracing::function("Storage.Blob.Blob.deleteImmutabilityPolicy")] pub async fn delete_immutability_policy( &self, options: Option>, @@ -883,10 +843,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "immutabilityPolicies"); if let Some(snapshot) = options.snapshot { @@ -930,7 +886,7 @@ impl BlobClient { /// /// ## Response Headers /// - /// The returned [`AsyncResponse`](azure_core::http::AsyncResponse) implements the [`BlobClientDownloadResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientDownloadResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run @@ -993,7 +949,7 @@ impl BlobClient { /// * [`version_id`()](crate::generated::models::BlobClientDownloadResultHeaders::version_id) - x-ms-version-id /// /// [`BlobClientDownloadResultHeaders`]: crate::generated::models::BlobClientDownloadResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.download")] + #[tracing::function("Storage.Blob.Blob.download")] pub async fn download( &self, options: Option>, @@ -1001,10 +957,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; if let Some(snapshot) = options.snapshot { url.query_pairs_mut().append_pair("snapshot", &snapshot); } @@ -1102,26 +1054,27 @@ impl BlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers + /// if let Some(date) = response.date()? { + /// println!("Date: {:?}", date); + /// } /// 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 + /// * [`date`()](crate::generated::models::BlobClientGetAccountInfoResultHeaders::date) - Date /// * [`account_kind`()](crate::generated::models::BlobClientGetAccountInfoResultHeaders::account_kind) - x-ms-account-kind /// * [`is_hierarchical_namespace_enabled`()](crate::generated::models::BlobClientGetAccountInfoResultHeaders::is_hierarchical_namespace_enabled) - x-ms-is-hns-enabled /// * [`sku_name`()](crate::generated::models::BlobClientGetAccountInfoResultHeaders::sku_name) - x-ms-sku-name /// /// [`BlobClientGetAccountInfoResultHeaders`]: crate::generated::models::BlobClientGetAccountInfoResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.getAccountInfo")] + #[tracing::function("Storage.Blob.Blob.getAccountInfo")] pub async fn get_account_info( &self, options: Option>, @@ -1129,10 +1082,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_key_only("blob") .append_pair("comp", "properties") @@ -1163,42 +1112,6 @@ impl BlobClient { Ok(rsp.into()) } - /// Returns a new instance of AppendBlobClient. - #[tracing::subclient] - pub fn get_append_blob_client(&self) -> AppendBlobClient { - AppendBlobClient { - blob_name: self.blob_name.clone(), - container_name: self.container_name.clone(), - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - - /// Returns a new instance of BlockBlobClient. - #[tracing::subclient] - pub fn get_block_blob_client(&self) -> BlockBlobClient { - BlockBlobClient { - blob_name: self.blob_name.clone(), - container_name: self.container_name.clone(), - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - - /// Returns a new instance of PageBlobClient. - #[tracing::subclient] - pub fn get_page_blob_client(&self) -> PageBlobClient { - PageBlobClient { - blob_name: self.blob_name.clone(), - container_name: self.container_name.clone(), - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - /// The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the /// blob. It does not return the content of the blob. /// @@ -1276,7 +1189,7 @@ impl BlobClient { /// * [`version_id`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::version_id) - x-ms-version-id /// /// [`BlobClientGetPropertiesResultHeaders`]: crate::generated::models::BlobClientGetPropertiesResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.getProperties")] + #[tracing::function("Storage.Blob.Blob.getProperties")] pub async fn get_properties( &self, options: Option>, @@ -1284,10 +1197,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; if let Some(snapshot) = options.snapshot { url.query_pairs_mut().append_pair("snapshot", &snapshot); } @@ -1377,7 +1286,7 @@ impl BlobClient { /// * [`date`()](crate::generated::models::BlobTagsHeaders::date) - Date /// /// [`BlobTagsHeaders`]: crate::generated::models::BlobTagsHeaders - #[tracing::function("Storage.Blob.Container.Blob.getTags")] + #[tracing::function("Storage.Blob.Blob.getTags")] pub async fn get_tags( &self, options: Option>, @@ -1385,10 +1294,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "tags"); if let Some(snapshot) = options.snapshot { url.query_pairs_mut().append_pair("snapshot", &snapshot); @@ -1464,7 +1369,7 @@ impl BlobClient { /// * [`etag`()](crate::generated::models::BlobClientReleaseLeaseResultHeaders::etag) - etag /// /// [`BlobClientReleaseLeaseResultHeaders`]: crate::generated::models::BlobClientReleaseLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.releaseLease")] + #[tracing::function("Storage.Blob.Blob.releaseLease")] pub async fn release_lease( &self, lease_id: String, @@ -1473,10 +1378,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "lease") .append_key_only("release"); @@ -1561,7 +1462,7 @@ impl BlobClient { /// * [`lease_id`()](crate::generated::models::BlobClientRenewLeaseResultHeaders::lease_id) - x-ms-lease-id /// /// [`BlobClientRenewLeaseResultHeaders`]: crate::generated::models::BlobClientRenewLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.renewLease")] + #[tracing::function("Storage.Blob.Blob.renewLease")] pub async fn renew_lease( &self, lease_id: String, @@ -1570,10 +1471,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "lease") .append_key_only("renew"); @@ -1657,7 +1554,7 @@ impl BlobClient { /// * [`etag`()](crate::generated::models::BlobClientSetExpiryResultHeaders::etag) - etag /// /// [`BlobClientSetExpiryResultHeaders`]: crate::generated::models::BlobClientSetExpiryResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.setExpiry")] + #[tracing::function("Storage.Blob.Blob.setExpiry")] pub async fn set_expiry( &self, expiry_options: BlobExpiryOptions, @@ -1666,10 +1563,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "expiry"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -1737,7 +1630,7 @@ impl BlobClient { /// * [`immutability_policy_expires_on`()](crate::generated::models::BlobClientSetImmutabilityPolicyResultHeaders::immutability_policy_expires_on) - x-ms-immutability-policy-until-date /// /// [`BlobClientSetImmutabilityPolicyResultHeaders`]: crate::generated::models::BlobClientSetImmutabilityPolicyResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.setImmutabilityPolicy")] + #[tracing::function("Storage.Blob.Blob.setImmutabilityPolicy")] pub async fn set_immutability_policy( &self, options: Option>, @@ -1745,10 +1638,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "immutabilityPolicies"); if let Some(snapshot) = options.snapshot { @@ -1831,7 +1720,7 @@ impl BlobClient { /// * [`legal_hold`()](crate::generated::models::BlobClientSetLegalHoldResultHeaders::legal_hold) - x-ms-legal-hold /// /// [`BlobClientSetLegalHoldResultHeaders`]: crate::generated::models::BlobClientSetLegalHoldResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.setLegalHold")] + #[tracing::function("Storage.Blob.Blob.setLegalHold")] pub async fn set_legal_hold( &self, legal_hold: bool, @@ -1840,10 +1729,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "legalhold"); if let Some(snapshot) = options.snapshot { url.query_pairs_mut().append_pair("snapshot", &snapshot); @@ -1884,7 +1769,7 @@ impl BlobClient { /// /// * `metadata` - The metadata headers. /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.Blob.setMetadata")] + #[tracing::function("Storage.Blob.Blob.setMetadata")] pub async fn set_metadata( &self, metadata: HashMap, @@ -1893,10 +1778,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "metadata"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -1965,7 +1846,7 @@ impl BlobClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.Blob.setProperties")] + #[tracing::function("Storage.Blob.Blob.setProperties")] pub async fn set_properties( &self, options: Option>, @@ -1973,10 +1854,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_key_only("SetHTTPHeaders") .append_pair("comp", "properties"); @@ -2048,7 +1925,7 @@ impl BlobClient { /// /// * `tags` - The blob tags. /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.Blob.setTags")] + #[tracing::function("Storage.Blob.Blob.setTags")] pub async fn set_tags( &self, tags: RequestContent, @@ -2057,10 +1934,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "tags"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -2112,7 +1985,7 @@ impl BlobClient { /// /// * `tier` - Indicates the tier to be set on the blob. /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.Blob.setTier")] + #[tracing::function("Storage.Blob.Blob.setTier")] pub async fn set_tier( &self, tier: AccessTier, @@ -2121,10 +1994,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "tier"); if let Some(snapshot) = options.snapshot { url.query_pairs_mut().append_pair("snapshot", &snapshot); @@ -2210,7 +2079,7 @@ impl BlobClient { /// * [`version_id`()](crate::generated::models::BlobClientStartCopyFromUrlResultHeaders::version_id) - x-ms-version-id /// /// [`BlobClientStartCopyFromUrlResultHeaders`]: crate::generated::models::BlobClientStartCopyFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.startCopyFromUrl")] + #[tracing::function("Storage.Blob.Blob.startCopyFromUrl")] pub async fn start_copy_from_url( &self, copy_source: String, @@ -2219,10 +2088,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; if let Some(timeout) = options.timeout { url.query_pairs_mut() .append_pair("timeout", &timeout.to_string()); @@ -2350,7 +2215,7 @@ impl BlobClient { /// * [`date`()](crate::generated::models::BlobClientUndeleteResultHeaders::date) - Date /// /// [`BlobClientUndeleteResultHeaders`]: crate::generated::models::BlobClientUndeleteResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.undelete")] + #[tracing::function("Storage.Blob.Blob.undelete")] pub async fn undelete( &self, options: Option>, @@ -2358,10 +2223,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "undelete"); if let Some(timeout) = options.timeout { url.query_pairs_mut() diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/block_blob_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/block_blob_client.rs index 29115f7aeb..de4983fd6c 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/block_blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/block_blob_client.rs @@ -29,8 +29,6 @@ use std::sync::Arc; #[tracing::client] pub struct BlockBlobClient { - pub(crate) blob_name: String, - pub(crate) container_name: String, pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, @@ -53,15 +51,11 @@ impl BlockBlobClient { /// * `endpoint` - Service host /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. - /// * `blob_name` - The name of the blob. /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob.Container.Blob.BlockBlob")] + #[tracing::new("Storage.Blob.BlockBlob")] pub fn new( endpoint: &str, credential: Arc, - container_name: String, - blob_name: String, options: Option, ) -> Result { let options = options.unwrap_or_default(); @@ -77,8 +71,6 @@ impl BlockBlobClient { vec!["https://storage.azure.com/.default"], )); Ok(Self { - blob_name, - container_name, endpoint, version: options.version, pipeline: Pipeline::new( @@ -144,7 +136,7 @@ impl BlockBlobClient { /// * [`version_id`()](crate::generated::models::BlockBlobClientCommitBlockListResultHeaders::version_id) - x-ms-version-id /// /// [`BlockBlobClientCommitBlockListResultHeaders`]: crate::generated::models::BlockBlobClientCommitBlockListResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.commitBlockList")] + #[tracing::function("Storage.Blob.BlockBlob.commitBlockList")] pub async fn commit_block_list( &self, blocks: RequestContent, @@ -153,10 +145,6 @@ impl BlockBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "blocklist"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -306,7 +294,7 @@ impl BlockBlobClient { /// * [`blob_content_length`()](crate::generated::models::BlockListHeaders::blob_content_length) - x-ms-blob-content-length /// /// [`BlockListHeaders`]: crate::generated::models::BlockListHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.getBlockList")] + #[tracing::function("Storage.Blob.BlockBlob.getBlockList")] pub async fn get_block_list( &self, list_type: BlockListType, @@ -315,10 +303,6 @@ impl BlockBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "blocklist"); url.query_pairs_mut() .append_pair("blocklisttype", list_type.as_ref()); @@ -421,7 +405,7 @@ impl BlockBlobClient { /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientQueryResultHeaders::is_server_encrypted) - x-ms-server-encrypted /// /// [`BlockBlobClientQueryResultHeaders`]: crate::generated::models::BlockBlobClientQueryResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.query")] + #[tracing::function("Storage.Blob.BlockBlob.query")] pub async fn query( &self, query_request: RequestContent, @@ -430,10 +414,6 @@ impl BlockBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "query"); if let Some(snapshot) = options.snapshot { url.query_pairs_mut().append_pair("snapshot", &snapshot); @@ -539,7 +519,7 @@ impl BlockBlobClient { /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// /// [`BlockBlobClientStageBlockResultHeaders`]: crate::generated::models::BlockBlobClientStageBlockResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.stageBlock")] + #[tracing::function("Storage.Blob.BlockBlob.stageBlock")] pub async fn stage_block( &self, block_id: &[u8], @@ -550,10 +530,6 @@ impl BlockBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "block"); url.query_pairs_mut() .append_pair("blockid", &encode(block_id)); @@ -663,7 +639,7 @@ impl BlockBlobClient { /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// /// [`BlockBlobClientStageBlockFromUrlResultHeaders`]: crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.stageBlockFromUrl")] + #[tracing::function("Storage.Blob.BlockBlob.stageBlockFromUrl")] pub async fn stage_block_from_url( &self, block_id: &[u8], @@ -674,10 +650,6 @@ impl BlockBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "block") .append_key_only("fromURL"); @@ -807,7 +779,7 @@ impl BlockBlobClient { /// * [`version_id`()](crate::generated::models::BlockBlobClientUploadResultHeaders::version_id) - x-ms-version-id /// /// [`BlockBlobClientUploadResultHeaders`]: crate::generated::models::BlockBlobClientUploadResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.upload")] + #[tracing::function("Storage.Blob.BlockBlob.upload")] pub async fn upload( &self, body: RequestContent, @@ -817,10 +789,6 @@ impl BlockBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; if let Some(timeout) = options.timeout { url.query_pairs_mut() .append_pair("timeout", &timeout.to_string()); @@ -968,18 +936,19 @@ impl BlockBlobClient { /// if let Some(content_md5) = response.content_md5()? { /// println!("Content-MD5: {:?}", content_md5); /// } + /// if let Some(date) = response.date()? { + /// println!("Date: {:?}", date); + /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); /// } - /// if let Some(etag) = response.etag()? { - /// println!("etag: {:?}", etag); - /// } /// Ok(()) /// } /// ``` /// /// ### Available headers /// * [`content_md5`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::content_md5) - Content-MD5 + /// * [`date`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::date) - Date /// * [`last_modified`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::last_modified) - Last-Modified /// * [`etag`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::etag) - etag /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 @@ -988,7 +957,7 @@ impl BlockBlobClient { /// * [`version_id`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::version_id) - x-ms-version-id /// /// [`BlockBlobClientUploadBlobFromUrlResultHeaders`]: crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.uploadBlobFromUrl")] + #[tracing::function("Storage.Blob.BlockBlob.uploadBlobFromUrl")] pub async fn upload_blob_from_url( &self, copy_source: String, @@ -997,10 +966,6 @@ impl BlockBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_key_only("BlockBlob") .append_key_only("fromUrl"); diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/container_client.rs similarity index 80% rename from sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs rename to sdk/storage/azure_storage_blob/src/generated/clients/container_client.rs index 61219aa03c..13ca825b88 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/container_client.rs @@ -3,26 +3,21 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use crate::generated::{ - clients::BlobClient, - models::{ - BlobContainerClientAcquireLeaseOptions, BlobContainerClientAcquireLeaseResult, - BlobContainerClientBreakLeaseOptions, BlobContainerClientBreakLeaseResult, - BlobContainerClientChangeLeaseOptions, BlobContainerClientChangeLeaseResult, - BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, - BlobContainerClientFindBlobsByTagsOptions, BlobContainerClientGetAccessPolicyOptions, - BlobContainerClientGetAccountInfoOptions, BlobContainerClientGetAccountInfoResult, - BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, - BlobContainerClientListBlobFlatSegmentOptions, - BlobContainerClientListBlobHierarchySegmentOptions, BlobContainerClientReleaseLeaseOptions, - BlobContainerClientReleaseLeaseResult, BlobContainerClientRenameOptions, - BlobContainerClientRenameResult, BlobContainerClientRenewLeaseOptions, - BlobContainerClientRenewLeaseResult, BlobContainerClientRestoreOptions, - BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyOptions, - BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetMetadataOptions, - FilterBlobSegment, ListBlobsFlatSegmentResponse, ListBlobsHierarchySegmentResponse, - SignedIdentifier, - }, +use crate::generated::models::{ + ContainerClientAcquireLeaseOptions, ContainerClientAcquireLeaseResult, + ContainerClientBreakLeaseOptions, ContainerClientBreakLeaseResult, + ContainerClientChangeLeaseOptions, ContainerClientChangeLeaseResult, + ContainerClientCreateOptions, ContainerClientDeleteOptions, + ContainerClientFindBlobsByTagsOptions, ContainerClientGetAccessPolicyOptions, + ContainerClientGetAccountInfoOptions, ContainerClientGetAccountInfoResult, + ContainerClientGetPropertiesOptions, ContainerClientGetPropertiesResult, + ContainerClientListBlobFlatSegmentOptions, ContainerClientListBlobHierarchySegmentOptions, + ContainerClientReleaseLeaseOptions, ContainerClientReleaseLeaseResult, + ContainerClientRenameOptions, ContainerClientRenameResult, ContainerClientRenewLeaseOptions, + ContainerClientRenewLeaseResult, ContainerClientRestoreOptions, ContainerClientRestoreResult, + ContainerClientSetAccessPolicyOptions, ContainerClientSetAccessPolicyResult, + ContainerClientSetMetadataOptions, FilterBlobSegment, ListBlobsFlatSegmentResponse, + ListBlobsHierarchySegmentResponse, SignedIdentifier, }; use azure_core::{ credentials::TokenCredential, @@ -40,38 +35,35 @@ use azure_core::{ use std::{collections::HashMap, sync::Arc}; #[tracing::client] -pub struct BlobContainerClient { - pub(crate) container_name: String, +pub struct ContainerClient { pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, } -/// Options used when creating a `BlobContainerClient` +/// Options used when creating a `ContainerClient` #[derive(Clone, SafeDebug)] -pub struct BlobContainerClientOptions { +pub struct ContainerClientOptions { /// Allows customization of the client. pub client_options: ClientOptions, /// Specifies the version of the operation to use for this request. pub version: String, } -impl BlobContainerClient { - /// Creates a new BlobContainerClient, using Entra ID authentication. +impl ContainerClient { + /// Creates a new ContainerClient, using Entra ID authentication. /// /// # Arguments /// /// * `endpoint` - Service host /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. /// * `options` - Optional configuration for the client. #[tracing::new("Storage.Blob.Container")] pub fn new( endpoint: &str, credential: Arc, - container_name: String, - options: Option, + options: Option, ) -> Result { let options = options.unwrap_or_default(); let endpoint = Url::parse(endpoint)?; @@ -86,7 +78,6 @@ impl BlobContainerClient { vec!["https://storage.azure.com/.default"], )); Ok(Self { - container_name, endpoint, version: options.version, pipeline: Pipeline::new( @@ -116,14 +107,14 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientAcquireLeaseResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientAcquireLeaseResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientAcquireLeaseResult, BlobContainerClientAcquireLeaseResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientAcquireLeaseResult, ContainerClientAcquireLeaseResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); @@ -139,21 +130,20 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`last_modified`()](crate::generated::models::BlobContainerClientAcquireLeaseResultHeaders::last_modified) - Last-Modified - /// * [`etag`()](crate::generated::models::BlobContainerClientAcquireLeaseResultHeaders::etag) - etag - /// * [`lease_id`()](crate::generated::models::BlobContainerClientAcquireLeaseResultHeaders::lease_id) - x-ms-lease-id + /// * [`last_modified`()](crate::generated::models::ContainerClientAcquireLeaseResultHeaders::last_modified) - Last-Modified + /// * [`etag`()](crate::generated::models::ContainerClientAcquireLeaseResultHeaders::etag) - etag + /// * [`lease_id`()](crate::generated::models::ContainerClientAcquireLeaseResultHeaders::lease_id) - x-ms-lease-id /// - /// [`BlobContainerClientAcquireLeaseResultHeaders`]: crate::generated::models::BlobContainerClientAcquireLeaseResultHeaders + /// [`ContainerClientAcquireLeaseResultHeaders`]: crate::generated::models::ContainerClientAcquireLeaseResultHeaders #[tracing::function("Storage.Blob.Container.acquireLease")] pub async fn acquire_lease( &self, duration: i32, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_key_only("acquire") .append_pair("comp", "lease") @@ -203,14 +193,14 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientBreakLeaseResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientBreakLeaseResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientBreakLeaseResult, BlobContainerClientBreakLeaseResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientBreakLeaseResult, ContainerClientBreakLeaseResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); @@ -226,20 +216,19 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`last_modified`()](crate::generated::models::BlobContainerClientBreakLeaseResultHeaders::last_modified) - Last-Modified - /// * [`etag`()](crate::generated::models::BlobContainerClientBreakLeaseResultHeaders::etag) - etag - /// * [`lease_time`()](crate::generated::models::BlobContainerClientBreakLeaseResultHeaders::lease_time) - x-ms-lease-time + /// * [`last_modified`()](crate::generated::models::ContainerClientBreakLeaseResultHeaders::last_modified) - Last-Modified + /// * [`etag`()](crate::generated::models::ContainerClientBreakLeaseResultHeaders::etag) - etag + /// * [`lease_time`()](crate::generated::models::ContainerClientBreakLeaseResultHeaders::lease_time) - x-ms-lease-time /// - /// [`BlobContainerClientBreakLeaseResultHeaders`]: crate::generated::models::BlobContainerClientBreakLeaseResultHeaders + /// [`ContainerClientBreakLeaseResultHeaders`]: crate::generated::models::ContainerClientBreakLeaseResultHeaders #[tracing::function("Storage.Blob.Container.breakLease")] pub async fn break_lease( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_key_only("break") .append_pair("comp", "lease") @@ -291,14 +280,14 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientChangeLeaseResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientChangeLeaseResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientChangeLeaseResult, BlobContainerClientChangeLeaseResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientChangeLeaseResult, ContainerClientChangeLeaseResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); @@ -314,22 +303,21 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`last_modified`()](crate::generated::models::BlobContainerClientChangeLeaseResultHeaders::last_modified) - Last-Modified - /// * [`etag`()](crate::generated::models::BlobContainerClientChangeLeaseResultHeaders::etag) - etag - /// * [`lease_id`()](crate::generated::models::BlobContainerClientChangeLeaseResultHeaders::lease_id) - x-ms-lease-id + /// * [`last_modified`()](crate::generated::models::ContainerClientChangeLeaseResultHeaders::last_modified) - Last-Modified + /// * [`etag`()](crate::generated::models::ContainerClientChangeLeaseResultHeaders::etag) - etag + /// * [`lease_id`()](crate::generated::models::ContainerClientChangeLeaseResultHeaders::lease_id) - x-ms-lease-id /// - /// [`BlobContainerClientChangeLeaseResultHeaders`]: crate::generated::models::BlobContainerClientChangeLeaseResultHeaders + /// [`ContainerClientChangeLeaseResultHeaders`]: crate::generated::models::ContainerClientChangeLeaseResultHeaders #[tracing::function("Storage.Blob.Container.changeLease")] pub async fn change_lease( &self, lease_id: String, proposed_lease_id: String, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_key_only("change") .append_pair("comp", "lease") @@ -378,12 +366,11 @@ impl BlobContainerClient { #[tracing::function("Storage.Blob.Container.create")] pub async fn create( &self, - options: Option>, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut().append_pair("restype", "container"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -437,12 +424,11 @@ impl BlobContainerClient { #[tracing::function("Storage.Blob.Container.delete")] pub async fn delete( &self, - options: Option>, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut().append_pair("restype", "container"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -490,12 +476,11 @@ impl BlobContainerClient { pub async fn find_blobs_by_tags( &self, filter_expression: &str, - options: Option>, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_pair("comp", "blobs") .append_pair("restype", "container"); @@ -585,12 +570,11 @@ impl BlobContainerClient { #[tracing::function("Storage.Blob.Container.getAccessPolicy")] pub async fn get_access_policy( &self, - options: Option>, + options: Option>, ) -> Result, XmlFormat>> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_pair("comp", "acl") .append_pair("restype", "container"); @@ -632,43 +616,43 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientGetAccountInfoResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientGetAccountInfoResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientGetAccountInfoResult, BlobContainerClientGetAccountInfoResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientGetAccountInfoResult, ContainerClientGetAccountInfoResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers + /// if let Some(date) = response.date()? { + /// println!("Date: {:?}", date); + /// } /// 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`()](crate::generated::models::BlobContainerClientGetAccountInfoResultHeaders::account_kind) - x-ms-account-kind - /// * [`is_hierarchical_namespace_enabled`()](crate::generated::models::BlobContainerClientGetAccountInfoResultHeaders::is_hierarchical_namespace_enabled) - x-ms-is-hns-enabled - /// * [`sku_name`()](crate::generated::models::BlobContainerClientGetAccountInfoResultHeaders::sku_name) - x-ms-sku-name + /// * [`date`()](crate::generated::models::ContainerClientGetAccountInfoResultHeaders::date) - Date + /// * [`account_kind`()](crate::generated::models::ContainerClientGetAccountInfoResultHeaders::account_kind) - x-ms-account-kind + /// * [`is_hierarchical_namespace_enabled`()](crate::generated::models::ContainerClientGetAccountInfoResultHeaders::is_hierarchical_namespace_enabled) - x-ms-is-hns-enabled + /// * [`sku_name`()](crate::generated::models::ContainerClientGetAccountInfoResultHeaders::sku_name) - x-ms-sku-name /// - /// [`BlobContainerClientGetAccountInfoResultHeaders`]: crate::generated::models::BlobContainerClientGetAccountInfoResultHeaders + /// [`ContainerClientGetAccountInfoResultHeaders`]: crate::generated::models::ContainerClientGetAccountInfoResultHeaders #[tracing::function("Storage.Blob.Container.getAccountInfo")] pub async fn get_account_info( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_pair("comp", "properties") .append_pair("restype", "account"); @@ -698,22 +682,6 @@ impl BlobContainerClient { Ok(rsp.into()) } - /// Returns a new instance of BlobClient. - /// - /// # Arguments - /// - /// * `blob_name` - The name of the blob. - #[tracing::subclient] - pub fn get_blob_client(&self, blob_name: String) -> BlobClient { - BlobClient { - blob_name, - container_name: self.container_name.clone(), - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - /// returns all user-defined metadata and system properties for the specified container. The data returned does not include /// the container's list of blobs /// @@ -723,14 +691,14 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientGetPropertiesResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientGetPropertiesResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientGetPropertiesResult, ContainerClientGetPropertiesResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); @@ -746,29 +714,28 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`last_modified`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::last_modified) - Last-Modified - /// * [`etag`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::etag) - etag - /// * [`access`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::access) - x-ms-blob-public-access - /// * [`default_encryption_scope`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::default_encryption_scope) - x-ms-default-encryption-scope - /// * [`prevent_encryption_scope_override`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::prevent_encryption_scope_override) - x-ms-deny-encryption-scope-override - /// * [`has_immutability_policy`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::has_immutability_policy) - x-ms-has-immutability-policy - /// * [`has_legal_hold`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::has_legal_hold) - x-ms-has-legal-hold - /// * [`is_immutable_storage_with_versioning_enabled`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::is_immutable_storage_with_versioning_enabled) - x-ms-immutable-storage-with-versioning-enabled - /// * [`duration`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::duration) - x-ms-lease-duration - /// * [`lease_state`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::lease_state) - x-ms-lease-state - /// * [`lease_status`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::lease_status) - x-ms-lease-status - /// * [`metadata`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::metadata) - x-ms-meta - /// - /// [`BlobContainerClientGetPropertiesResultHeaders`]: crate::generated::models::BlobContainerClientGetPropertiesResultHeaders + /// * [`last_modified`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::last_modified) - Last-Modified + /// * [`etag`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::etag) - etag + /// * [`access`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::access) - x-ms-blob-public-access + /// * [`default_encryption_scope`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::default_encryption_scope) - x-ms-default-encryption-scope + /// * [`prevent_encryption_scope_override`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::prevent_encryption_scope_override) - x-ms-deny-encryption-scope-override + /// * [`has_immutability_policy`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::has_immutability_policy) - x-ms-has-immutability-policy + /// * [`has_legal_hold`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::has_legal_hold) - x-ms-has-legal-hold + /// * [`is_immutable_storage_with_versioning_enabled`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::is_immutable_storage_with_versioning_enabled) - x-ms-immutable-storage-with-versioning-enabled + /// * [`duration`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::duration) - x-ms-lease-duration + /// * [`lease_state`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::lease_state) - x-ms-lease-state + /// * [`lease_status`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::lease_status) - x-ms-lease-status + /// * [`metadata`()](crate::generated::models::ContainerClientGetPropertiesResultHeaders::metadata) - x-ms-meta + /// + /// [`ContainerClientGetPropertiesResultHeaders`]: crate::generated::models::ContainerClientGetPropertiesResultHeaders #[tracing::function("Storage.Blob.Container.getProperties")] pub async fn get_properties( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut().append_pair("restype", "container"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -830,12 +797,11 @@ impl BlobContainerClient { #[tracing::function("Storage.Blob.Container.listBlobFlatSegment")] pub fn list_blob_flat_segment( &self, - options: Option>, + options: Option>, ) -> Result>> { let options = options.unwrap_or_default().into_owned(); let pipeline = self.pipeline.clone(); let mut first_url = self.endpoint.clone(); - first_url = first_url.join(&self.container_name)?; first_url .query_pairs_mut() .append_pair("comp", "list") @@ -955,12 +921,11 @@ impl BlobContainerClient { pub fn list_blob_hierarchy_segment( &self, delimiter: &str, - options: Option>, + options: Option>, ) -> Result>> { let options = options.unwrap_or_default().into_owned(); let pipeline = self.pipeline.clone(); let mut first_url = self.endpoint.clone(); - first_url = first_url.join(&self.container_name)?; first_url .query_pairs_mut() .append_pair("comp", "list") @@ -1058,14 +1023,14 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientReleaseLeaseResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientReleaseLeaseResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientReleaseLeaseResult, BlobContainerClientReleaseLeaseResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientReleaseLeaseResult, ContainerClientReleaseLeaseResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); @@ -1078,20 +1043,19 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`last_modified`()](crate::generated::models::BlobContainerClientReleaseLeaseResultHeaders::last_modified) - Last-Modified - /// * [`etag`()](crate::generated::models::BlobContainerClientReleaseLeaseResultHeaders::etag) - etag + /// * [`last_modified`()](crate::generated::models::ContainerClientReleaseLeaseResultHeaders::last_modified) - Last-Modified + /// * [`etag`()](crate::generated::models::ContainerClientReleaseLeaseResultHeaders::etag) - etag /// - /// [`BlobContainerClientReleaseLeaseResultHeaders`]: crate::generated::models::BlobContainerClientReleaseLeaseResultHeaders + /// [`ContainerClientReleaseLeaseResultHeaders`]: crate::generated::models::ContainerClientReleaseLeaseResultHeaders #[tracing::function("Storage.Blob.Container.releaseLease")] pub async fn release_lease( &self, lease_id: String, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_pair("comp", "lease") .append_key_only("release") @@ -1139,14 +1103,14 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientRenameResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientRenameResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientRenameResult, BlobContainerClientRenameResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientRenameResult, ContainerClientRenameResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(date) = response.date()? { /// println!("Date: {:?}", date); @@ -1156,19 +1120,18 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientRenameResultHeaders::date) - Date + /// * [`date`()](crate::generated::models::ContainerClientRenameResultHeaders::date) - Date /// - /// [`BlobContainerClientRenameResultHeaders`]: crate::generated::models::BlobContainerClientRenameResultHeaders + /// [`ContainerClientRenameResultHeaders`]: crate::generated::models::ContainerClientRenameResultHeaders #[tracing::function("Storage.Blob.Container.rename")] pub async fn rename( &self, source_container_name: String, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_pair("comp", "rename") .append_pair("restype", "container"); @@ -1212,14 +1175,14 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientRenewLeaseResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientRenewLeaseResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientRenewLeaseResult, BlobContainerClientRenewLeaseResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientRenewLeaseResult, ContainerClientRenewLeaseResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); @@ -1235,21 +1198,20 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`last_modified`()](crate::generated::models::BlobContainerClientRenewLeaseResultHeaders::last_modified) - Last-Modified - /// * [`etag`()](crate::generated::models::BlobContainerClientRenewLeaseResultHeaders::etag) - etag - /// * [`lease_id`()](crate::generated::models::BlobContainerClientRenewLeaseResultHeaders::lease_id) - x-ms-lease-id + /// * [`last_modified`()](crate::generated::models::ContainerClientRenewLeaseResultHeaders::last_modified) - Last-Modified + /// * [`etag`()](crate::generated::models::ContainerClientRenewLeaseResultHeaders::etag) - etag + /// * [`lease_id`()](crate::generated::models::ContainerClientRenewLeaseResultHeaders::lease_id) - x-ms-lease-id /// - /// [`BlobContainerClientRenewLeaseResultHeaders`]: crate::generated::models::BlobContainerClientRenewLeaseResultHeaders + /// [`ContainerClientRenewLeaseResultHeaders`]: crate::generated::models::ContainerClientRenewLeaseResultHeaders #[tracing::function("Storage.Blob.Container.renewLease")] pub async fn renew_lease( &self, lease_id: String, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_pair("comp", "lease") .append_key_only("renew") @@ -1296,14 +1258,14 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientRestoreResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientRestoreResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientRestoreResult, BlobContainerClientRestoreResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientRestoreResult, ContainerClientRestoreResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(date) = response.date()? { /// println!("Date: {:?}", date); @@ -1313,18 +1275,17 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientRestoreResultHeaders::date) - Date + /// * [`date`()](crate::generated::models::ContainerClientRestoreResultHeaders::date) - Date /// - /// [`BlobContainerClientRestoreResultHeaders`]: crate::generated::models::BlobContainerClientRestoreResultHeaders + /// [`ContainerClientRestoreResultHeaders`]: crate::generated::models::ContainerClientRestoreResultHeaders #[tracing::function("Storage.Blob.Container.restore")] pub async fn restore( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_pair("comp", "undelete") .append_pair("restype", "container"); @@ -1370,14 +1331,14 @@ impl BlobContainerClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientSetAccessPolicyResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ContainerClientSetAccessPolicyResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetAccessPolicyResultHeaders}; + /// use azure_storage_blob::models::{ContainerClientSetAccessPolicyResult, ContainerClientSetAccessPolicyResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(date) = response.date()? { /// println!("Date: {:?}", date); @@ -1393,21 +1354,20 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientSetAccessPolicyResultHeaders::date) - Date - /// * [`last_modified`()](crate::generated::models::BlobContainerClientSetAccessPolicyResultHeaders::last_modified) - Last-Modified - /// * [`etag`()](crate::generated::models::BlobContainerClientSetAccessPolicyResultHeaders::etag) - etag + /// * [`date`()](crate::generated::models::ContainerClientSetAccessPolicyResultHeaders::date) - Date + /// * [`last_modified`()](crate::generated::models::ContainerClientSetAccessPolicyResultHeaders::last_modified) - Last-Modified + /// * [`etag`()](crate::generated::models::ContainerClientSetAccessPolicyResultHeaders::etag) - etag /// - /// [`BlobContainerClientSetAccessPolicyResultHeaders`]: crate::generated::models::BlobContainerClientSetAccessPolicyResultHeaders + /// [`ContainerClientSetAccessPolicyResultHeaders`]: crate::generated::models::ContainerClientSetAccessPolicyResultHeaders #[tracing::function("Storage.Blob.Container.setAccessPolicy")] pub async fn set_access_policy( &self, container_acl: RequestContent, XmlFormat>, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_pair("comp", "acl") .append_pair("restype", "container"); @@ -1460,12 +1420,11 @@ impl BlobContainerClient { pub async fn set_metadata( &self, metadata: HashMap, - options: Option>, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - url = url.join(&self.container_name)?; url.query_pairs_mut() .append_pair("comp", "metadata") .append_pair("restype", "container"); @@ -1505,7 +1464,7 @@ impl BlobContainerClient { } } -impl Default for BlobContainerClientOptions { +impl Default for ContainerClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/mod.rs b/sdk/storage/azure_storage_blob/src/generated/clients/mod.rs index 6d4b55bf7a..8be6edf387 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/mod.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/mod.rs @@ -5,13 +5,13 @@ mod append_blob_client; mod blob_client; -mod blob_container_client; -mod blob_service_client; mod block_blob_client; +mod container_client; mod page_blob_client; +mod service_client; pub use append_blob_client::*; pub use blob_client::*; -pub use blob_container_client::*; -pub use blob_service_client::*; pub use block_blob_client::*; +pub use container_client::*; pub use page_blob_client::*; +pub use service_client::*; diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/page_blob_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/page_blob_client.rs index 9e6d8f3650..dc9be76547 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/page_blob_client.rs @@ -31,8 +31,6 @@ use std::sync::Arc; #[tracing::client] pub struct PageBlobClient { - pub(crate) blob_name: String, - pub(crate) container_name: String, pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, @@ -55,15 +53,11 @@ impl PageBlobClient { /// * `endpoint` - Service host /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. - /// * `blob_name` - The name of the blob. /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob.Container.Blob.PageBlob")] + #[tracing::new("Storage.Blob.PageBlob")] pub fn new( endpoint: &str, credential: Arc, - container_name: String, - blob_name: String, options: Option, ) -> Result { let options = options.unwrap_or_default(); @@ -79,8 +73,6 @@ impl PageBlobClient { vec!["https://storage.azure.com/.default"], )); Ok(Self { - blob_name, - container_name, endpoint, version: options.version, pipeline: Pipeline::new( @@ -138,7 +130,7 @@ impl PageBlobClient { /// * [`content_crc64`()](crate::generated::models::PageBlobClientClearPagesResultHeaders::content_crc64) - x-ms-content-crc64 /// /// [`PageBlobClientClearPagesResultHeaders`]: crate::generated::models::PageBlobClientClearPagesResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.clearPages")] + #[tracing::function("Storage.Blob.PageBlob.clearPages")] pub async fn clear_pages( &self, range: String, @@ -147,10 +139,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_key_only("clear") .append_pair("comp", "page"); @@ -279,7 +267,7 @@ impl PageBlobClient { /// * [`copy_status`()](crate::generated::models::PageBlobClientCopyIncrementalResultHeaders::copy_status) - x-ms-copy-status /// /// [`PageBlobClientCopyIncrementalResultHeaders`]: crate::generated::models::PageBlobClientCopyIncrementalResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.copyIncremental")] + #[tracing::function("Storage.Blob.PageBlob.copyIncremental")] pub async fn copy_incremental( &self, copy_source: String, @@ -288,10 +276,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "incrementalcopy"); if let Some(timeout) = options.timeout { url.query_pairs_mut() @@ -377,7 +361,7 @@ impl PageBlobClient { /// * [`version_id`()](crate::generated::models::PageBlobClientCreateResultHeaders::version_id) - x-ms-version-id /// /// [`PageBlobClientCreateResultHeaders`]: crate::generated::models::PageBlobClientCreateResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.create")] + #[tracing::function("Storage.Blob.PageBlob.create")] pub async fn create( &self, blob_content_length: u64, @@ -386,10 +370,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; if let Some(timeout) = options.timeout { url.query_pairs_mut() .append_pair("timeout", &timeout.to_string()); @@ -538,7 +518,7 @@ impl PageBlobClient { /// * [`blob_content_length`()](crate::generated::models::PageListHeaders::blob_content_length) - x-ms-blob-content-length /// /// [`PageListHeaders`]: crate::generated::models::PageListHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.getPageRanges")] + #[tracing::function("Storage.Blob.PageBlob.getPageRanges")] pub async fn get_page_ranges( &self, options: Option>, @@ -546,10 +526,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "pagelist"); if let Some(marker) = options.marker { url.query_pairs_mut().append_pair("marker", &marker); @@ -646,7 +622,7 @@ impl PageBlobClient { /// * [`blob_content_length`()](crate::generated::models::PageListHeaders::blob_content_length) - x-ms-blob-content-length /// /// [`PageListHeaders`]: crate::generated::models::PageListHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.getPageRangesDiff")] + #[tracing::function("Storage.Blob.PageBlob.getPageRangesDiff")] pub async fn get_page_ranges_diff( &self, options: Option>, @@ -654,10 +630,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "pagelist") .append_key_only("diff"); @@ -764,7 +736,7 @@ impl PageBlobClient { /// * [`blob_sequence_number`()](crate::generated::models::PageBlobClientResizeResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number /// /// [`PageBlobClientResizeResultHeaders`]: crate::generated::models::PageBlobClientResizeResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.resize")] + #[tracing::function("Storage.Blob.PageBlob.resize")] pub async fn resize( &self, blob_content_length: u64, @@ -773,10 +745,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_key_only("Resize") .append_pair("comp", "properties"); @@ -879,7 +847,7 @@ impl PageBlobClient { /// * [`blob_sequence_number`()](crate::generated::models::PageBlobClientSetSequenceNumberResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number /// /// [`PageBlobClientSetSequenceNumberResultHeaders`]: crate::generated::models::PageBlobClientSetSequenceNumberResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.setSequenceNumber")] + #[tracing::function("Storage.Blob.PageBlob.setSequenceNumber")] pub async fn set_sequence_number( &self, sequence_number_action: SequenceNumberActionType, @@ -888,10 +856,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_key_only("UpdateSequenceNumber") .append_pair("comp", "properties"); @@ -993,7 +957,7 @@ impl PageBlobClient { /// * [`is_server_encrypted`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// /// [`PageBlobClientUploadPagesResultHeaders`]: crate::generated::models::PageBlobClientUploadPagesResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.uploadPages")] + #[tracing::function("Storage.Blob.PageBlob.uploadPages")] pub async fn upload_pages( &self, body: RequestContent, @@ -1004,10 +968,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "page") .append_key_only("update"); @@ -1156,7 +1116,7 @@ impl PageBlobClient { /// * [`is_server_encrypted`()](crate::generated::models::PageBlobClientUploadPagesFromUrlResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// /// [`PageBlobClientUploadPagesFromUrlResultHeaders`]: crate::generated::models::PageBlobClientUploadPagesFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.uploadPagesFromUrl")] + #[tracing::function("Storage.Blob.PageBlob.uploadPagesFromUrl")] pub async fn upload_pages_from_url( &self, source_url: String, @@ -1168,10 +1128,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url = url.join(&path)?; url.query_pairs_mut() .append_pair("comp", "page") .append_key_only("fromUrl") diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/service_client.rs similarity index 84% rename from sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs rename to sdk/storage/azure_storage_blob/src/generated/clients/service_client.rs index ae30b93564..b57099e0d7 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/service_client.rs @@ -3,16 +3,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use crate::generated::{ - clients::BlobContainerClient, - models::{ - BlobServiceClientFindBlobsByTagsOptions, BlobServiceClientGetAccountInfoOptions, - BlobServiceClientGetAccountInfoResult, BlobServiceClientGetPropertiesOptions, - BlobServiceClientGetStatisticsOptions, BlobServiceClientGetUserDelegationKeyOptions, - BlobServiceClientListContainersSegmentOptions, BlobServiceClientSetPropertiesOptions, - BlobServiceProperties, FilterBlobSegment, KeyInfo, ListContainersSegmentResponse, - StorageServiceStats, UserDelegationKey, - }, +use crate::generated::models::{ + BlobServiceProperties, FilterBlobSegment, KeyInfo, ListContainersSegmentResponse, + ServiceClientFindBlobsByTagsOptions, ServiceClientGetAccountInfoOptions, + ServiceClientGetAccountInfoResult, ServiceClientGetPropertiesOptions, + ServiceClientGetStatisticsOptions, ServiceClientGetUserDelegationKeyOptions, + ServiceClientListContainersSegmentOptions, ServiceClientSetPropertiesOptions, + StorageServiceStats, UserDelegationKey, }; use azure_core::{ credentials::TokenCredential, @@ -29,23 +26,23 @@ use azure_core::{ use std::sync::Arc; #[tracing::client] -pub struct BlobServiceClient { +pub struct ServiceClient { pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, } -/// Options used when creating a `BlobServiceClient` +/// Options used when creating a `ServiceClient` #[derive(Clone, SafeDebug)] -pub struct BlobServiceClientOptions { +pub struct ServiceClientOptions { /// Allows customization of the client. pub client_options: ClientOptions, /// Specifies the version of the operation to use for this request. pub version: String, } -impl BlobServiceClient { - /// Creates a new BlobServiceClient, using Entra ID authentication. +impl ServiceClient { + /// Creates a new ServiceClient, using Entra ID authentication. /// /// # Arguments /// @@ -53,11 +50,11 @@ impl BlobServiceClient { /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an /// Entra ID token to use when authenticating. /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob")] + #[tracing::new("Storage.Blob.Service")] pub fn new( endpoint: &str, credential: Arc, - options: Option, + options: Option, ) -> Result { let options = options.unwrap_or_default(); let endpoint = Url::parse(endpoint)?; @@ -96,11 +93,11 @@ impl BlobServiceClient { /// /// * `filter_expression` - Filters the results to return only to return only blobs whose tags match the specified expression. /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.findBlobsByTags")] + #[tracing::function("Storage.Blob.Service.findBlobsByTags")] pub async fn find_blobs_by_tags( &self, filter_expression: &str, - options: Option>, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); @@ -160,39 +157,40 @@ impl BlobServiceClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobServiceClientGetAccountInfoResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`ServiceClientGetAccountInfoResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use azure_storage_blob::models::{BlobServiceClientGetAccountInfoResult, BlobServiceClientGetAccountInfoResultHeaders}; + /// use azure_storage_blob::models::{ServiceClientGetAccountInfoResult, ServiceClientGetAccountInfoResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers + /// if let Some(date) = response.date()? { + /// println!("Date: {:?}", date); + /// } /// 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`()](crate::generated::models::BlobServiceClientGetAccountInfoResultHeaders::account_kind) - x-ms-account-kind - /// * [`is_hierarchical_namespace_enabled`()](crate::generated::models::BlobServiceClientGetAccountInfoResultHeaders::is_hierarchical_namespace_enabled) - x-ms-is-hns-enabled - /// * [`sku_name`()](crate::generated::models::BlobServiceClientGetAccountInfoResultHeaders::sku_name) - x-ms-sku-name + /// * [`date`()](crate::generated::models::ServiceClientGetAccountInfoResultHeaders::date) - Date + /// * [`account_kind`()](crate::generated::models::ServiceClientGetAccountInfoResultHeaders::account_kind) - x-ms-account-kind + /// * [`is_hierarchical_namespace_enabled`()](crate::generated::models::ServiceClientGetAccountInfoResultHeaders::is_hierarchical_namespace_enabled) - x-ms-is-hns-enabled + /// * [`sku_name`()](crate::generated::models::ServiceClientGetAccountInfoResultHeaders::sku_name) - x-ms-sku-name /// - /// [`BlobServiceClientGetAccountInfoResultHeaders`]: crate::generated::models::BlobServiceClientGetAccountInfoResultHeaders - #[tracing::function("Storage.Blob.getAccountInfo")] + /// [`ServiceClientGetAccountInfoResultHeaders`]: crate::generated::models::ServiceClientGetAccountInfoResultHeaders + #[tracing::function("Storage.Blob.Service.getAccountInfo")] pub async fn get_account_info( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); @@ -225,31 +223,16 @@ impl BlobServiceClient { Ok(rsp.into()) } - /// Returns a new instance of BlobContainerClient. - /// - /// # Arguments - /// - /// * `container_name` - The name of the container. - #[tracing::subclient] - pub fn get_blob_container_client(&self, container_name: String) -> BlobContainerClient { - BlobContainerClient { - container_name, - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - /// Retrieves properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin /// Resource Sharing) rules. /// /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.getProperties")] + #[tracing::function("Storage.Blob.Service.getProperties")] pub async fn get_properties( &self, - options: Option>, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); @@ -313,10 +296,10 @@ impl BlobServiceClient { /// * [`date`()](crate::generated::models::StorageServiceStatsHeaders::date) - Date /// /// [`StorageServiceStatsHeaders`]: crate::generated::models::StorageServiceStatsHeaders - #[tracing::function("Storage.Blob.getStatistics")] + #[tracing::function("Storage.Blob.Service.getStatistics")] pub async fn get_statistics( &self, - options: Option>, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); @@ -380,11 +363,11 @@ impl BlobServiceClient { /// * [`date`()](crate::generated::models::UserDelegationKeyHeaders::date) - Date /// /// [`UserDelegationKeyHeaders`]: crate::generated::models::UserDelegationKeyHeaders - #[tracing::function("Storage.Blob.getUserDelegationKey")] + #[tracing::function("Storage.Blob.Service.getUserDelegationKey")] pub async fn get_user_delegation_key( &self, key_info: RequestContent, - options: Option>, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); @@ -425,10 +408,10 @@ impl BlobServiceClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.listContainersSegment")] + #[tracing::function("Storage.Blob.Service.listContainersSegment")] pub fn list_containers_segment( &self, - options: Option>, + options: Option>, ) -> Result>> { let options = options.unwrap_or_default().into_owned(); let pipeline = self.pipeline.clone(); @@ -517,13 +500,13 @@ impl BlobServiceClient { /// /// # Arguments /// - /// * `blob_service_properties` - The storage service properties to set. + /// * `storage_service_properties` - The storage service properties to set. /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.setProperties")] + #[tracing::function("Storage.Blob.Service.setProperties")] pub async fn set_properties( &self, - blob_service_properties: RequestContent, - options: Option>, + storage_service_properties: RequestContent, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); @@ -541,7 +524,7 @@ impl BlobServiceClient { request.insert_header("x-ms-client-request-id", client_request_id); } request.insert_header("x-ms-version", &self.version); - request.set_body(blob_service_properties); + request.set_body(storage_service_properties); let rsp = self .pipeline .send( @@ -559,7 +542,7 @@ impl BlobServiceClient { } } -impl Default for BlobServiceClientOptions { +impl Default for ServiceClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), diff --git a/sdk/storage/azure_storage_blob/src/generated/mod.rs b/sdk/storage/azure_storage_blob/src/generated/mod.rs index a978fe1b09..197c37ffe6 100644 --- a/sdk/storage/azure_storage_blob/src/generated/mod.rs +++ b/sdk/storage/azure_storage_blob/src/generated/mod.rs @@ -8,7 +8,7 @@ pub mod clients; /// Contains all the data structures and types used by the client library. pub mod models; pub use clients::{ - AppendBlobClient, AppendBlobClientOptions, BlobClient, BlobClientOptions, BlobContainerClient, - BlobContainerClientOptions, BlobServiceClient, BlobServiceClientOptions, BlockBlobClient, - BlockBlobClientOptions, PageBlobClient, PageBlobClientOptions, + AppendBlobClient, AppendBlobClientOptions, BlobClient, BlobClientOptions, BlockBlobClient, + BlockBlobClientOptions, ContainerClient, ContainerClientOptions, PageBlobClient, + PageBlobClientOptions, ServiceClient, ServiceClientOptions, }; diff --git a/sdk/storage/azure_storage_blob/src/generated/models/header_traits.rs b/sdk/storage/azure_storage_blob/src/generated/models/header_traits.rs index f6e99d85f4..8d82bb3d67 100644 --- a/sdk/storage/azure_storage_blob/src/generated/models/header_traits.rs +++ b/sdk/storage/azure_storage_blob/src/generated/models/header_traits.rs @@ -12,21 +12,21 @@ use super::{ BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, BlobClientSetExpiryResult, BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldResult, BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, - BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult, - BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult, - BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult, - BlobContainerClientRenameResult, BlobContainerClientRenewLeaseResult, - BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyResult, - BlobImmutabilityPolicyMode, BlobServiceClientGetAccountInfoResult, BlobTags, BlobType, - BlockBlobClientCommitBlockListResult, BlockBlobClientQueryResult, - BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult, - BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadResult, BlockList, CopyStatus, - LeaseDuration, LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse, - ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult, - PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult, PageBlobClientResizeResult, - PageBlobClientSetSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult, - PageBlobClientUploadPagesResult, PageList, PublicAccessType, RehydratePriority, - SignedIdentifier, SkuName, StorageServiceStats, UserDelegationKey, + BlobImmutabilityPolicyMode, BlobTags, BlobType, BlockBlobClientCommitBlockListResult, + BlockBlobClientQueryResult, BlockBlobClientStageBlockFromUrlResult, + BlockBlobClientStageBlockResult, BlockBlobClientUploadBlobFromUrlResult, + BlockBlobClientUploadResult, BlockList, ContainerClientAcquireLeaseResult, + ContainerClientBreakLeaseResult, ContainerClientChangeLeaseResult, + ContainerClientGetAccountInfoResult, ContainerClientGetPropertiesResult, + ContainerClientReleaseLeaseResult, ContainerClientRenameResult, + ContainerClientRenewLeaseResult, ContainerClientRestoreResult, + ContainerClientSetAccessPolicyResult, CopyStatus, LeaseDuration, LeaseState, LeaseStatus, + ListBlobsFlatSegmentResponse, ListBlobsHierarchySegmentResponse, + PageBlobClientClearPagesResult, PageBlobClientCopyIncrementalResult, + PageBlobClientCreateResult, PageBlobClientResizeResult, PageBlobClientSetSequenceNumberResult, + PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList, + PublicAccessType, RehydratePriority, ServiceClientGetAccountInfoResult, SignedIdentifier, + SkuName, StorageServiceStats, UserDelegationKey, }; use azure_core::{ base64::decode, @@ -1082,25 +1082,31 @@ impl BlobClientDownloadResultHeaders for AsyncResponse /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers +/// if let Some(date) = response.date()? { +/// println!("Date: {:?}", date); +/// } /// 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(()) /// } /// ``` pub trait BlobClientGetAccountInfoResultHeaders: private::Sealed { + fn date(&self) -> Result>; fn account_kind(&self) -> Result>; fn is_hierarchical_namespace_enabled(&self) -> Result>; fn sku_name(&self) -> Result>; } impl BlobClientGetAccountInfoResultHeaders for Response { + /// UTC date/time value generated by the service that indicates the time at which the response was initiated + fn date(&self) -> Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) + } + /// Identifies the account kind fn account_kind(&self) -> Result> { Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) @@ -1772,135 +1778,75 @@ impl BlobClientUndeleteResultHeaders for Response Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(last_modified) = response.last_modified()? { -/// println!("Last-Modified: {:?}", last_modified); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// if let Some(lease_id) = response.lease_id()? { -/// println!("x-ms-lease-id: {:?}", lease_id); +/// if let Some(date) = response.date()? { +/// println!("Date: {:?}", date); /// } /// Ok(()) /// } /// ``` -pub trait BlobContainerClientAcquireLeaseResultHeaders: private::Sealed { - fn last_modified(&self) -> Result>; - fn etag(&self) -> Result>; - fn lease_id(&self) -> Result>; +pub trait BlobTagsHeaders: private::Sealed { + fn date(&self) -> Result>; } -impl BlobContainerClientAcquireLeaseResultHeaders - for Response -{ - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } - - /// The ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) - } - - /// Uniquely identifies a blobs' lease - fn lease_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_ID) +impl BlobTagsHeaders for Response { + /// UTC date/time value generated by the service that indicates the time at which the response was initiated + fn date(&self) -> Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } -/// Provides access to typed response headers for `BlobContainerClient::break_lease()` +/// Provides access to typed response headers for `BlockBlobClient::commit_block_list()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobContainerClientBreakLeaseResult, BlobContainerClientBreakLeaseResultHeaders}; +/// use azure_storage_blob::models::{BlockBlobClientCommitBlockListResult, BlockBlobClientCommitBlockListResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers +/// if let Some(content_md5) = response.content_md5()? { +/// println!("Content-MD5: {:?}", content_md5); +/// } /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } -/// if let Some(lease_time) = response.lease_time()? { -/// println!("x-ms-lease-time: {:?}", lease_time); -/// } /// Ok(()) /// } /// ``` -pub trait BlobContainerClientBreakLeaseResultHeaders: private::Sealed { +pub trait BlockBlobClientCommitBlockListResultHeaders: private::Sealed { + fn content_md5(&self) -> Result>>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn lease_time(&self) -> Result>; + fn content_crc64(&self) -> Result>>; + fn encryption_key_sha256(&self) -> Result>; + fn encryption_scope(&self) -> Result>; + fn is_server_encrypted(&self) -> Result>; + fn version_id(&self) -> Result>; } -impl BlobContainerClientBreakLeaseResultHeaders - for Response +impl BlockBlobClientCommitBlockListResultHeaders + for Response { - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } - - /// The ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) - } - - /// Approximate time remaining in the lease period, in seconds. - fn lease_time(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_TIME) + /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the + /// client can check for message content integrity. + fn content_md5(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) } -} - -/// Provides access to typed response headers for `BlobContainerClient::change_lease()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobContainerClientChangeLeaseResult, BlobContainerClientChangeLeaseResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(last_modified) = response.last_modified()? { -/// println!("Last-Modified: {:?}", last_modified); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// if let Some(lease_id) = response.lease_id()? { -/// println!("x-ms-lease-id: {:?}", lease_id); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobContainerClientChangeLeaseResultHeaders: private::Sealed { - fn last_modified(&self) -> Result>; - fn etag(&self) -> Result>; - fn lease_id(&self) -> Result>; -} -impl BlobContainerClientChangeLeaseResultHeaders - for Response -{ /// The date/time that the container was last modified. fn last_modified(&self) -> Result> { Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { @@ -1913,140 +1859,236 @@ impl BlobContainerClientChangeLeaseResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// Uniquely identifies a blobs' lease - fn lease_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_ID) + /// This response header is returned so that the client can check for the integrity of the copied content. + fn content_crc64(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) } -} -/// Provides access to typed response headers for `BlobContainerClient::get_account_info()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobContainerClientGetAccountInfoResult, BlobContainerClientGetAccountInfoResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = 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(()) -/// } -/// ``` -pub trait BlobContainerClientGetAccountInfoResultHeaders: private::Sealed { - fn account_kind(&self) -> Result>; - fn is_hierarchical_namespace_enabled(&self) -> Result>; - fn sku_name(&self) -> Result>; -} + /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted + /// with a customer-provided key. + fn encryption_key_sha256(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) + } -impl BlobContainerClientGetAccountInfoResultHeaders - for Response -{ - /// Identifies the account kind - fn account_kind(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) + /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned + /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 + /// header, with the latter calculated from the requested range + fn encryption_scope(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } - /// Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled. - fn is_hierarchical_namespace_enabled(&self) -> Result> { - Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED) + /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified + /// algorithm, and false otherwise. + fn is_server_encrypted(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) } - /// Identifies the sku name of the account - fn sku_name(&self) -> Result> { - Headers::get_optional_as(self.headers(), &SKU_NAME) + /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob + /// version, and may be used in subsequent requests to access this version of the blob. + fn version_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &VERSION_ID) } } -/// Provides access to typed response headers for `BlobContainerClient::get_properties()` +/// Provides access to typed response headers for `BlockBlobClient::query()` /// /// # Examples /// /// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders}; +/// use azure_core::{Result, http::AsyncResponse}; +/// use azure_storage_blob::models::{BlockBlobClientQueryResult, BlockBlobClientQueryResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: AsyncResponse = unimplemented!(); /// // Access response headers -/// if let Some(last_modified) = response.last_modified()? { -/// println!("Last-Modified: {:?}", last_modified); +/// if let Some(accept_ranges) = response.accept_ranges()? { +/// println!("Accept-Ranges: {:?}", accept_ranges); /// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); +/// if let Some(cache_control) = response.cache_control()? { +/// println!("Cache-Control: {:?}", cache_control); /// } -/// if let Some(access) = response.access()? { -/// println!("x-ms-blob-public-access: {:?}", access); +/// if let Some(content_disposition) = response.content_disposition()? { +/// println!("Content-Disposition: {:?}", content_disposition); /// } /// Ok(()) /// } /// ``` -pub trait BlobContainerClientGetPropertiesResultHeaders: private::Sealed { +pub trait BlockBlobClientQueryResultHeaders: private::Sealed { + fn accept_ranges(&self) -> Result>; + fn cache_control(&self) -> Result>; + fn content_disposition(&self) -> Result>; + fn content_encoding(&self) -> Result>; + fn content_language(&self) -> Result>; + fn content_length(&self) -> Result>; + fn content_md5(&self) -> Result>>; + fn content_range(&self) -> Result>; + fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn access(&self) -> Result>; - fn default_encryption_scope(&self) -> Result>; - fn prevent_encryption_scope_override(&self) -> Result>; - fn has_immutability_policy(&self) -> Result>; - fn has_legal_hold(&self) -> Result>; - fn is_immutable_storage_with_versioning_enabled(&self) -> Result>; + fn blob_committed_block_count(&self) -> Result>; + fn blob_content_md5(&self) -> Result>>; + fn blob_sequence_number(&self) -> Result>; + fn blob_type(&self) -> Result>; + fn content_crc64(&self) -> Result>>; + fn copy_completion_time(&self) -> Result>; + fn copy_id(&self) -> Result>; + fn copy_progress(&self) -> Result>; + fn copy_source(&self) -> Result>; + fn copy_status(&self) -> Result>; + fn copy_status_description(&self) -> Result>; + fn encryption_key_sha256(&self) -> Result>; + fn encryption_scope(&self) -> Result>; fn duration(&self) -> Result>; fn lease_state(&self) -> Result>; fn lease_status(&self) -> Result>; fn metadata(&self) -> Result>; + fn is_server_encrypted(&self) -> Result>; } -impl BlobContainerClientGetPropertiesResultHeaders - for Response -{ - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) +impl BlockBlobClientQueryResultHeaders for AsyncResponse { + /// Indicates that the service supports requests for partial blob content. + fn accept_ranges(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ACCEPT_RANGES) } - /// The ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) + /// This header is returned if it was previously specified for the blob. + fn cache_control(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CACHE_CONTROL) } - /// The public access setting for the container. - fn access(&self) -> Result> { - Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS) + /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition + /// response header field conveys additional information about how to process the response payload, and also can be used to + /// attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the + /// response, but instead show a Save As dialog with a filename other than the blob name specified. + fn content_disposition(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CONTENT_DISPOSITION) } - /// The default encryption scope for the container. - fn default_encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &DEFAULT_ENCRYPTION_SCOPE) + /// This header returns the value that was specified for the Content-Encoding request header + fn content_encoding(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CONTENT_ENCODING) } - /// If a blob has a lease and the lease is of infinite duration then the value of this header is set to true, otherwise it - /// is set to false. - fn prevent_encryption_scope_override(&self) -> Result> { - Headers::get_optional_as(self.headers(), &DENY_ENCRYPTION_SCOPE_OVERRIDE) + /// This header returns the value that was specified for the Content-Language request header. + fn content_language(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CONTENT_LANGUAGE) } - /// Indicates whether the container has an immutability policy set on it. - fn has_immutability_policy(&self) -> Result> { - Headers::get_optional_as(self.headers(), &HAS_IMMUTABILITY_POLICY) + /// The number of bytes present in the response body. + fn content_length(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CONTENT_LENGTH) } - /// Indicates whether the container has a legal hold. - fn has_legal_hold(&self) -> Result> { - Headers::get_optional_as(self.headers(), &HAS_LEGAL_HOLD) + /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the + /// client can check for message content integrity. + fn content_md5(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) } - /// Indicates whether version level worm is enabled on a container - fn is_immutable_storage_with_versioning_enabled(&self) -> Result> { - Headers::get_optional_as(self.headers(), &IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED) + /// Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' + /// request header. + fn content_range(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CONTENT_RANGE) + } + + /// UTC date/time value generated by the service that indicates the time at which the response was initiated + fn date(&self) -> Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) + } + + /// The date/time that the container was last modified. + fn last_modified(&self) -> Result> { + Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { + parse_rfc7231(h.as_str()) + }) + } + + /// The ETag contains a value that you can use to perform operations conditionally. + fn etag(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ETAG) + } + + /// The number of committed blocks present in the blob. This header is returned only for append blobs. + fn blob_committed_block_count(&self) -> Result> { + Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT) + } + + /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned + /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 + /// header, with the latter calculated from the requested range + fn blob_content_md5(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &BLOB_CONTENT_MD5, |h| decode(h.as_str())) + } + + /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs. + fn blob_sequence_number(&self) -> Result> { + Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER) + } + + /// The type of the blob. + fn blob_type(&self) -> Result> { + Headers::get_optional_as(self.headers(), &BLOB_TYPE) + } + + /// This response header is returned so that the client can check for the integrity of the copied content. + fn content_crc64(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) + } + + /// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify + /// the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob + /// has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob + /// operation using Set Blob Properties, Put Blob, or Put Block List. + fn copy_completion_time(&self) -> Result> { + Headers::get_optional_with(self.headers(), ©_COMPLETION_TIME, |h| { + parse_rfc7231(h.as_str()) + }) + } + + /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or + /// pass to Abort Copy Blob to abort a pending copy. + fn copy_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_ID) + } + + /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where + /// this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if + /// this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded + /// Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List + fn copy_progress(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_PROGRESS) + } + + /// URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this + /// blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob + /// operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, + /// or Put Block List. + fn copy_source(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE) + } + + /// State of the copy operation identified by x-ms-copy-id. + fn copy_status(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_STATUS) + } + + /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation + /// failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this + /// blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List + fn copy_status_description(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_STATUS_DESCRIPTION) + } + + /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted + /// with a customer-provided key. + fn encryption_key_sha256(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) + } + + /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned + /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 + /// header, with the latter calculated from the requested range + fn encryption_scope(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } /// Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease @@ -2076,186 +2118,190 @@ impl BlobContainerClientGetPropertiesResultHeaders } Ok(values) } -} - -/// Provides access to typed response headers for `BlobContainerClient::release_lease()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobContainerClientReleaseLeaseResult, BlobContainerClientReleaseLeaseResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(last_modified) = response.last_modified()? { -/// println!("Last-Modified: {:?}", last_modified); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobContainerClientReleaseLeaseResultHeaders: private::Sealed { - fn last_modified(&self) -> Result>; - fn etag(&self) -> Result>; -} - -impl BlobContainerClientReleaseLeaseResultHeaders - for Response -{ - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } - /// The ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) + /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified + /// algorithm, and false otherwise. + fn is_server_encrypted(&self) -> Result> { + Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED) } } -/// Provides access to typed response headers for `BlobContainerClient::rename()` +/// Provides access to typed response headers for `BlockBlobClient::stage_block_from_url()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobContainerClientRenameResult, BlobContainerClientRenameResultHeaders}; +/// use azure_storage_blob::models::{BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockFromUrlResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers +/// if let Some(content_md5) = response.content_md5()? { +/// println!("Content-MD5: {:?}", content_md5); +/// } /// if let Some(date) = response.date()? { /// println!("Date: {:?}", date); /// } +/// if let Some(content_crc64) = response.content_crc64()? { +/// println!("x-ms-content-crc64: {:?}", content_crc64); +/// } /// Ok(()) /// } /// ``` -pub trait BlobContainerClientRenameResultHeaders: private::Sealed { +pub trait BlockBlobClientStageBlockFromUrlResultHeaders: private::Sealed { + fn content_md5(&self) -> Result>>; fn date(&self) -> Result>; + fn content_crc64(&self) -> Result>>; + fn encryption_key_sha256(&self) -> Result>; + fn encryption_scope(&self) -> Result>; + fn is_server_encrypted(&self) -> Result>; } -impl BlobContainerClientRenameResultHeaders - for Response +impl BlockBlobClientStageBlockFromUrlResultHeaders + for Response { + /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the + /// client can check for message content integrity. + fn content_md5(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) + } + /// UTC date/time value generated by the service that indicates the time at which the response was initiated fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } + + /// This response header is returned so that the client can check for the integrity of the copied content. + fn content_crc64(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) + } + + /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted + /// with a customer-provided key. + fn encryption_key_sha256(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) + } + + /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned + /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 + /// header, with the latter calculated from the requested range + fn encryption_scope(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) + } + + /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified + /// algorithm, and false otherwise. + fn is_server_encrypted(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) + } } -/// Provides access to typed response headers for `BlobContainerClient::renew_lease()` +/// Provides access to typed response headers for `BlockBlobClient::stage_block()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobContainerClientRenewLeaseResult, BlobContainerClientRenewLeaseResultHeaders}; +/// use azure_storage_blob::models::{BlockBlobClientStageBlockResult, BlockBlobClientStageBlockResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(last_modified) = response.last_modified()? { -/// println!("Last-Modified: {:?}", last_modified); +/// if let Some(content_md5) = response.content_md5()? { +/// println!("Content-MD5: {:?}", content_md5); /// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); +/// if let Some(content_crc64) = response.content_crc64()? { +/// println!("x-ms-content-crc64: {:?}", content_crc64); /// } -/// if let Some(lease_id) = response.lease_id()? { -/// println!("x-ms-lease-id: {:?}", lease_id); +/// if let Some(encryption_key_sha256) = response.encryption_key_sha256()? { +/// println!("x-ms-encryption-key-sha256: {:?}", encryption_key_sha256); /// } /// Ok(()) /// } /// ``` -pub trait BlobContainerClientRenewLeaseResultHeaders: private::Sealed { - fn last_modified(&self) -> Result>; - fn etag(&self) -> Result>; - fn lease_id(&self) -> Result>; +pub trait BlockBlobClientStageBlockResultHeaders: private::Sealed { + fn content_md5(&self) -> Result>>; + fn content_crc64(&self) -> Result>>; + fn encryption_key_sha256(&self) -> Result>; + fn encryption_scope(&self) -> Result>; + fn is_server_encrypted(&self) -> Result>; } -impl BlobContainerClientRenewLeaseResultHeaders - for Response +impl BlockBlobClientStageBlockResultHeaders + for Response { - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) + /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the + /// client can check for message content integrity. + fn content_md5(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) } - /// The ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) + /// This response header is returned so that the client can check for the integrity of the copied content. + fn content_crc64(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) } - /// Uniquely identifies a blobs' lease - fn lease_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_ID) + /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted + /// with a customer-provided key. + fn encryption_key_sha256(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) } -} -/// Provides access to typed response headers for `BlobContainerClient::restore()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobContainerClientRestoreResult, BlobContainerClientRestoreResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("Date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobContainerClientRestoreResultHeaders: private::Sealed { - fn date(&self) -> Result>; -} + /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned + /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 + /// header, with the latter calculated from the requested range + fn encryption_scope(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) + } -impl BlobContainerClientRestoreResultHeaders - for Response -{ - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) + /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified + /// algorithm, and false otherwise. + fn is_server_encrypted(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) } } -/// Provides access to typed response headers for `BlobContainerClient::set_access_policy()` +/// Provides access to typed response headers for `BlockBlobClient::upload_blob_from_url()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetAccessPolicyResultHeaders}; +/// use azure_storage_blob::models::{BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadBlobFromUrlResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers +/// if let Some(content_md5) = response.content_md5()? { +/// println!("Content-MD5: {:?}", content_md5); +/// } /// if let Some(date) = response.date()? { /// println!("Date: {:?}", date); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); /// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } /// Ok(()) /// } /// ``` -pub trait BlobContainerClientSetAccessPolicyResultHeaders: private::Sealed { +pub trait BlockBlobClientUploadBlobFromUrlResultHeaders: private::Sealed { + fn content_md5(&self) -> Result>>; fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn encryption_key_sha256(&self) -> Result>; + fn encryption_scope(&self) -> Result>; + fn is_server_encrypted(&self) -> Result>; + fn version_id(&self) -> Result>; } -impl BlobContainerClientSetAccessPolicyResultHeaders - for Response +impl BlockBlobClientUploadBlobFromUrlResultHeaders + for Response { + /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the + /// client can check for message content integrity. + fn content_md5(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) + } + /// UTC date/time value generated by the service that indicates the time at which the response was initiated fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) @@ -2272,91 +2318,42 @@ impl BlobContainerClientSetAccessPolicyResultHeaders fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) } -} - -/// Provides access to typed response headers for `BlobServiceClient::get_account_info()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlobServiceClientGetAccountInfoResult, BlobServiceClientGetAccountInfoResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = 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(()) -/// } -/// ``` -pub trait BlobServiceClientGetAccountInfoResultHeaders: private::Sealed { - fn account_kind(&self) -> Result>; - fn is_hierarchical_namespace_enabled(&self) -> Result>; - fn sku_name(&self) -> Result>; -} -impl BlobServiceClientGetAccountInfoResultHeaders - for Response -{ - /// Identifies the account kind - fn account_kind(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) + /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted + /// with a customer-provided key. + fn encryption_key_sha256(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) } - /// Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled. - fn is_hierarchical_namespace_enabled(&self) -> Result> { - Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED) + /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned + /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 + /// header, with the latter calculated from the requested range + fn encryption_scope(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } - /// Identifies the sku name of the account - fn sku_name(&self) -> Result> { - Headers::get_optional_as(self.headers(), &SKU_NAME) + /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified + /// algorithm, and false otherwise. + fn is_server_encrypted(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) } -} - -/// Provides access to typed response headers for `BlobClient::get_tags()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, XmlFormat}}; -/// use azure_storage_blob::models::{BlobTags, BlobTagsHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("Date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobTagsHeaders: private::Sealed { - fn date(&self) -> Result>; -} -impl BlobTagsHeaders for Response { - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) + /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob + /// version, and may be used in subsequent requests to access this version of the blob. + fn version_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &VERSION_ID) } } -/// Provides access to typed response headers for `BlockBlobClient::commit_block_list()` +/// Provides access to typed response headers for `BlockBlobClient::upload()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlockBlobClientCommitBlockListResult, BlockBlobClientCommitBlockListResultHeaders}; +/// use azure_storage_blob::models::{BlockBlobClientUploadResult, BlockBlobClientUploadResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(content_md5) = response.content_md5()? { /// println!("Content-MD5: {:?}", content_md5); @@ -2370,20 +2367,17 @@ impl BlobTagsHeaders for Response { /// Ok(()) /// } /// ``` -pub trait BlockBlobClientCommitBlockListResultHeaders: private::Sealed { +pub trait BlockBlobClientUploadResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; fn version_id(&self) -> Result>; } -impl BlockBlobClientCommitBlockListResultHeaders - for Response -{ +impl BlockBlobClientUploadResultHeaders for Response { /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the /// client can check for message content integrity. fn content_md5(&self) -> Result>> { @@ -2402,11 +2396,6 @@ impl BlockBlobClientCommitBlockListResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// This response header is returned so that the client can check for the integrity of the copied content. - fn content_crc64(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) - } - /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted /// with a customer-provided key. fn encryption_key_sha256(&self) -> Result> { @@ -2433,111 +2422,35 @@ impl BlockBlobClientCommitBlockListResultHeaders } } -/// Provides access to typed response headers for `BlockBlobClient::query()` +/// Provides access to typed response headers for `BlockBlobClient::get_block_list()` /// /// # Examples /// /// ```no_run -/// use azure_core::{Result, http::AsyncResponse}; -/// use azure_storage_blob::models::{BlockBlobClientQueryResult, BlockBlobClientQueryResultHeaders}; +/// use azure_core::{Result, http::{Response, XmlFormat}}; +/// use azure_storage_blob::models::{BlockList, BlockListHeaders}; /// async fn example() -> Result<()> { -/// let response: AsyncResponse = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(accept_ranges) = response.accept_ranges()? { -/// println!("Accept-Ranges: {:?}", accept_ranges); +/// if let Some(last_modified) = response.last_modified()? { +/// println!("Last-Modified: {:?}", last_modified); /// } -/// if let Some(cache_control) = response.cache_control()? { -/// println!("Cache-Control: {:?}", cache_control); +/// if let Some(etag) = response.etag()? { +/// println!("etag: {:?}", etag); /// } -/// if let Some(content_disposition) = response.content_disposition()? { -/// println!("Content-Disposition: {:?}", content_disposition); +/// if let Some(blob_content_length) = response.blob_content_length()? { +/// println!("x-ms-blob-content-length: {:?}", blob_content_length); /// } /// Ok(()) /// } /// ``` -pub trait BlockBlobClientQueryResultHeaders: private::Sealed { - fn accept_ranges(&self) -> Result>; - fn cache_control(&self) -> Result>; - fn content_disposition(&self) -> Result>; - fn content_encoding(&self) -> Result>; - fn content_language(&self) -> Result>; - fn content_length(&self) -> Result>; - fn content_md5(&self) -> Result>>; - fn content_range(&self) -> Result>; - fn date(&self) -> Result>; +pub trait BlockListHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn blob_committed_block_count(&self) -> Result>; - fn blob_content_md5(&self) -> Result>>; - fn blob_sequence_number(&self) -> Result>; - fn blob_type(&self) -> Result>; - fn content_crc64(&self) -> Result>>; - fn copy_completion_time(&self) -> Result>; - fn copy_id(&self) -> Result>; - fn copy_progress(&self) -> Result>; - fn copy_source(&self) -> Result>; - fn copy_status(&self) -> Result>; - fn copy_status_description(&self) -> Result>; - fn encryption_key_sha256(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn duration(&self) -> Result>; - fn lease_state(&self) -> Result>; - fn lease_status(&self) -> Result>; - fn metadata(&self) -> Result>; - fn is_server_encrypted(&self) -> Result>; + fn blob_content_length(&self) -> Result>; } -impl BlockBlobClientQueryResultHeaders for AsyncResponse { - /// Indicates that the service supports requests for partial blob content. - fn accept_ranges(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ACCEPT_RANGES) - } - - /// This header is returned if it was previously specified for the blob. - fn cache_control(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CACHE_CONTROL) - } - - /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition - /// response header field conveys additional information about how to process the response payload, and also can be used to - /// attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the - /// response, but instead show a Save As dialog with a filename other than the blob name specified. - fn content_disposition(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_DISPOSITION) - } - - /// This header returns the value that was specified for the Content-Encoding request header - fn content_encoding(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_ENCODING) - } - - /// This header returns the value that was specified for the Content-Language request header. - fn content_language(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_LANGUAGE) - } - - /// The number of bytes present in the response body. - fn content_length(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_LENGTH) - } - - /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the - /// client can check for message content integrity. - fn content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) - } - - /// Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' - /// request header. - fn content_range(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_RANGE) - } - - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } - +impl BlockListHeaders for Response { /// The date/time that the container was last modified. fn last_modified(&self) -> Result> { Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { @@ -2550,272 +2463,334 @@ impl BlockBlobClientQueryResultHeaders for AsyncResponse Result> { - Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT) + /// The size of the blob in bytes. + fn blob_content_length(&self) -> Result> { + Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH) } +} - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn blob_content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &BLOB_CONTENT_MD5, |h| decode(h.as_str())) - } - - /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs. - fn blob_sequence_number(&self) -> Result> { - Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER) - } - - /// The type of the blob. - fn blob_type(&self) -> Result> { - Headers::get_optional_as(self.headers(), &BLOB_TYPE) - } - - /// This response header is returned so that the client can check for the integrity of the copied content. - fn content_crc64(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) - } +/// Provides access to typed response headers for `ContainerClient::acquire_lease()` +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::{Response, NoFormat}}; +/// use azure_storage_blob::models::{ContainerClientAcquireLeaseResult, ContainerClientAcquireLeaseResultHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(last_modified) = response.last_modified()? { +/// println!("Last-Modified: {:?}", last_modified); +/// } +/// if let Some(etag) = response.etag()? { +/// println!("etag: {:?}", etag); +/// } +/// if let Some(lease_id) = response.lease_id()? { +/// println!("x-ms-lease-id: {:?}", lease_id); +/// } +/// Ok(()) +/// } +/// ``` +pub trait ContainerClientAcquireLeaseResultHeaders: private::Sealed { + fn last_modified(&self) -> Result>; + fn etag(&self) -> Result>; + fn lease_id(&self) -> Result>; +} - /// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify - /// the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob - /// has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob - /// operation using Set Blob Properties, Put Blob, or Put Block List. - fn copy_completion_time(&self) -> Result> { - Headers::get_optional_with(self.headers(), ©_COMPLETION_TIME, |h| { +impl ContainerClientAcquireLeaseResultHeaders + for Response +{ + /// The date/time that the container was last modified. + fn last_modified(&self) -> Result> { + Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { parse_rfc7231(h.as_str()) }) } - /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or - /// pass to Abort Copy Blob to abort a pending copy. - fn copy_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_ID) - } - - /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where - /// this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if - /// this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded - /// Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List - fn copy_progress(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_PROGRESS) - } - - /// URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this - /// blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob - /// operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, - /// or Put Block List. - fn copy_source(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE) + /// The ETag contains a value that you can use to perform operations conditionally. + fn etag(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ETAG) } - /// State of the copy operation identified by x-ms-copy-id. - fn copy_status(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_STATUS) + /// Uniquely identifies a blobs' lease + fn lease_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_ID) } +} - /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation - /// failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this - /// blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List - fn copy_status_description(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_STATUS_DESCRIPTION) - } +/// Provides access to typed response headers for `ContainerClient::break_lease()` +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::{Response, NoFormat}}; +/// use azure_storage_blob::models::{ContainerClientBreakLeaseResult, ContainerClientBreakLeaseResultHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(last_modified) = response.last_modified()? { +/// println!("Last-Modified: {:?}", last_modified); +/// } +/// if let Some(etag) = response.etag()? { +/// println!("etag: {:?}", etag); +/// } +/// if let Some(lease_time) = response.lease_time()? { +/// println!("x-ms-lease-time: {:?}", lease_time); +/// } +/// Ok(()) +/// } +/// ``` +pub trait ContainerClientBreakLeaseResultHeaders: private::Sealed { + fn last_modified(&self) -> Result>; + fn etag(&self) -> Result>; + fn lease_time(&self) -> Result>; +} - /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted - /// with a customer-provided key. - fn encryption_key_sha256(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) +impl ContainerClientBreakLeaseResultHeaders + for Response +{ + /// The date/time that the container was last modified. + fn last_modified(&self) -> Result> { + Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { + parse_rfc7231(h.as_str()) + }) } - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) + /// The ETag contains a value that you can use to perform operations conditionally. + fn etag(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ETAG) } - /// 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. A lease duration cannot be changed using renew or change. - fn duration(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_DURATION) + /// Approximate time remaining in the lease period, in seconds. + fn lease_time(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_TIME) } +} - /// Lease state of the blob. - fn lease_state(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_STATE) - } +/// Provides access to typed response headers for `ContainerClient::change_lease()` +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::{Response, NoFormat}}; +/// use azure_storage_blob::models::{ContainerClientChangeLeaseResult, ContainerClientChangeLeaseResultHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(last_modified) = response.last_modified()? { +/// println!("Last-Modified: {:?}", last_modified); +/// } +/// if let Some(etag) = response.etag()? { +/// println!("etag: {:?}", etag); +/// } +/// if let Some(lease_id) = response.lease_id()? { +/// println!("x-ms-lease-id: {:?}", lease_id); +/// } +/// Ok(()) +/// } +/// ``` +pub trait ContainerClientChangeLeaseResultHeaders: private::Sealed { + fn last_modified(&self) -> Result>; + fn etag(&self) -> Result>; + fn lease_id(&self) -> Result>; +} - /// The lease status of the blob. - fn lease_status(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_STATUS) +impl ContainerClientChangeLeaseResultHeaders + for Response +{ + /// The date/time that the container was last modified. + fn last_modified(&self) -> Result> { + Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { + parse_rfc7231(h.as_str()) + }) } - /// The metadata headers. - fn metadata(&self) -> Result> { - let mut values = HashMap::new(); - for h in self.headers().iter() { - let name = h.0.as_str(); - if name.len() > META.len() && name.starts_with(META) { - values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned()); - } - } - Ok(values) + /// The ETag contains a value that you can use to perform operations conditionally. + fn etag(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ETAG) } - /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified - /// algorithm, and false otherwise. - fn is_server_encrypted(&self) -> Result> { - Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED) + /// Uniquely identifies a blobs' lease + fn lease_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_ID) } } -/// Provides access to typed response headers for `BlockBlobClient::stage_block_from_url()` +/// Provides access to typed response headers for `ContainerClient::get_account_info()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockFromUrlResultHeaders}; +/// use azure_storage_blob::models::{ContainerClientGetAccountInfoResult, ContainerClientGetAccountInfoResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(content_md5) = response.content_md5()? { -/// println!("Content-MD5: {:?}", content_md5); -/// } /// if let Some(date) = response.date()? { /// println!("Date: {:?}", date); /// } -/// if let Some(content_crc64) = response.content_crc64()? { -/// println!("x-ms-content-crc64: {:?}", content_crc64); +/// 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); /// } /// Ok(()) /// } /// ``` -pub trait BlockBlobClientStageBlockFromUrlResultHeaders: private::Sealed { - fn content_md5(&self) -> Result>>; +pub trait ContainerClientGetAccountInfoResultHeaders: private::Sealed { fn date(&self) -> Result>; - fn content_crc64(&self) -> Result>>; - fn encryption_key_sha256(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn is_server_encrypted(&self) -> Result>; + fn account_kind(&self) -> Result>; + fn is_hierarchical_namespace_enabled(&self) -> Result>; + fn sku_name(&self) -> Result>; } -impl BlockBlobClientStageBlockFromUrlResultHeaders - for Response +impl ContainerClientGetAccountInfoResultHeaders + for Response { - /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the - /// client can check for message content integrity. - fn content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) - } - /// UTC date/time value generated by the service that indicates the time at which the response was initiated fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } - /// This response header is returned so that the client can check for the integrity of the copied content. - fn content_crc64(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) - } - - /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted - /// with a customer-provided key. - fn encryption_key_sha256(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) + /// Identifies the account kind + fn account_kind(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) } - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) + /// Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled. + fn is_hierarchical_namespace_enabled(&self) -> Result> { + Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED) } - /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified - /// algorithm, and false otherwise. - fn is_server_encrypted(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) + /// Identifies the sku name of the account + fn sku_name(&self) -> Result> { + Headers::get_optional_as(self.headers(), &SKU_NAME) } } -/// Provides access to typed response headers for `BlockBlobClient::stage_block()` +/// Provides access to typed response headers for `ContainerClient::get_properties()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlockBlobClientStageBlockResult, BlockBlobClientStageBlockResultHeaders}; +/// use azure_storage_blob::models::{ContainerClientGetPropertiesResult, ContainerClientGetPropertiesResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(content_md5) = response.content_md5()? { -/// println!("Content-MD5: {:?}", content_md5); +/// if let Some(last_modified) = response.last_modified()? { +/// println!("Last-Modified: {:?}", last_modified); /// } -/// if let Some(content_crc64) = response.content_crc64()? { -/// println!("x-ms-content-crc64: {:?}", content_crc64); +/// if let Some(etag) = response.etag()? { +/// println!("etag: {:?}", etag); /// } -/// if let Some(encryption_key_sha256) = response.encryption_key_sha256()? { -/// println!("x-ms-encryption-key-sha256: {:?}", encryption_key_sha256); +/// if let Some(access) = response.access()? { +/// println!("x-ms-blob-public-access: {:?}", access); /// } /// Ok(()) /// } /// ``` -pub trait BlockBlobClientStageBlockResultHeaders: private::Sealed { - fn content_md5(&self) -> Result>>; - fn content_crc64(&self) -> Result>>; - fn encryption_key_sha256(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn is_server_encrypted(&self) -> Result>; +pub trait ContainerClientGetPropertiesResultHeaders: private::Sealed { + fn last_modified(&self) -> Result>; + fn etag(&self) -> Result>; + fn access(&self) -> Result>; + fn default_encryption_scope(&self) -> Result>; + fn prevent_encryption_scope_override(&self) -> Result>; + fn has_immutability_policy(&self) -> Result>; + fn has_legal_hold(&self) -> Result>; + fn is_immutable_storage_with_versioning_enabled(&self) -> Result>; + fn duration(&self) -> Result>; + fn lease_state(&self) -> Result>; + fn lease_status(&self) -> Result>; + fn metadata(&self) -> Result>; } -impl BlockBlobClientStageBlockResultHeaders - for Response -{ - /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the - /// client can check for message content integrity. - fn content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) +impl ContainerClientGetPropertiesResultHeaders + for Response +{ + /// The date/time that the container was last modified. + fn last_modified(&self) -> Result> { + Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { + parse_rfc7231(h.as_str()) + }) + } + + /// The ETag contains a value that you can use to perform operations conditionally. + fn etag(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ETAG) + } + + /// The public access setting for the container. + fn access(&self) -> Result> { + Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS) + } + + /// The default encryption scope for the container. + fn default_encryption_scope(&self) -> Result> { + Headers::get_optional_as(self.headers(), &DEFAULT_ENCRYPTION_SCOPE) + } + + /// If a blob has a lease and the lease is of infinite duration then the value of this header is set to true, otherwise it + /// is set to false. + fn prevent_encryption_scope_override(&self) -> Result> { + Headers::get_optional_as(self.headers(), &DENY_ENCRYPTION_SCOPE_OVERRIDE) + } + + /// Indicates whether the container has an immutability policy set on it. + fn has_immutability_policy(&self) -> Result> { + Headers::get_optional_as(self.headers(), &HAS_IMMUTABILITY_POLICY) } - /// This response header is returned so that the client can check for the integrity of the copied content. - fn content_crc64(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) + /// Indicates whether the container has a legal hold. + fn has_legal_hold(&self) -> Result> { + Headers::get_optional_as(self.headers(), &HAS_LEGAL_HOLD) } - /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted - /// with a customer-provided key. - fn encryption_key_sha256(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) + /// Indicates whether version level worm is enabled on a container + fn is_immutable_storage_with_versioning_enabled(&self) -> Result> { + Headers::get_optional_as(self.headers(), &IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED) } - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) + /// 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. A lease duration cannot be changed using renew or change. + fn duration(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_DURATION) } - /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified - /// algorithm, and false otherwise. - fn is_server_encrypted(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) + /// Lease state of the blob. + fn lease_state(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_STATE) + } + + /// The lease status of the blob. + fn lease_status(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_STATUS) + } + + /// The metadata headers. + fn metadata(&self) -> Result> { + let mut values = HashMap::new(); + for h in self.headers().iter() { + let name = h.0.as_str(); + if name.len() > META.len() && name.starts_with(META) { + values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned()); + } + } + Ok(values) } } -/// Provides access to typed response headers for `BlockBlobClient::upload_blob_from_url()` +/// Provides access to typed response headers for `ContainerClient::release_lease()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadBlobFromUrlResultHeaders}; +/// use azure_storage_blob::models::{ContainerClientReleaseLeaseResult, ContainerClientReleaseLeaseResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(content_md5) = response.content_md5()? { -/// println!("Content-MD5: {:?}", content_md5); -/// } /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); /// } @@ -2825,25 +2800,14 @@ impl BlockBlobClientStageBlockResultHeaders /// Ok(()) /// } /// ``` -pub trait BlockBlobClientUploadBlobFromUrlResultHeaders: private::Sealed { - fn content_md5(&self) -> Result>>; +pub trait ContainerClientReleaseLeaseResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn encryption_key_sha256(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn is_server_encrypted(&self) -> Result>; - fn version_id(&self) -> Result>; } -impl BlockBlobClientUploadBlobFromUrlResultHeaders - for Response +impl ContainerClientReleaseLeaseResultHeaders + for Response { - /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the - /// client can check for message content integrity. - fn content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) - } - /// The date/time that the container was last modified. fn last_modified(&self) -> Result> { Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { @@ -2855,72 +2819,66 @@ impl BlockBlobClientUploadBlobFromUrlResultHeaders fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) } +} - /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted - /// with a customer-provided key. - fn encryption_key_sha256(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) - } - - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) - } - - /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified - /// algorithm, and false otherwise. - fn is_server_encrypted(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) - } +/// Provides access to typed response headers for `ContainerClient::rename()` +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::{Response, NoFormat}}; +/// use azure_storage_blob::models::{ContainerClientRenameResult, ContainerClientRenameResultHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(date) = response.date()? { +/// println!("Date: {:?}", date); +/// } +/// Ok(()) +/// } +/// ``` +pub trait ContainerClientRenameResultHeaders: private::Sealed { + fn date(&self) -> Result>; +} - /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob - /// version, and may be used in subsequent requests to access this version of the blob. - fn version_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &VERSION_ID) +impl ContainerClientRenameResultHeaders for Response { + /// UTC date/time value generated by the service that indicates the time at which the response was initiated + fn date(&self) -> Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } -/// Provides access to typed response headers for `BlockBlobClient::upload()` +/// Provides access to typed response headers for `ContainerClient::renew_lease()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use azure_storage_blob::models::{BlockBlobClientUploadResult, BlockBlobClientUploadResultHeaders}; +/// use azure_storage_blob::models::{ContainerClientRenewLeaseResult, ContainerClientRenewLeaseResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(content_md5) = response.content_md5()? { -/// println!("Content-MD5: {:?}", content_md5); -/// } /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } +/// if let Some(lease_id) = response.lease_id()? { +/// println!("x-ms-lease-id: {:?}", lease_id); +/// } /// Ok(()) /// } /// ``` -pub trait BlockBlobClientUploadResultHeaders: private::Sealed { - fn content_md5(&self) -> Result>>; +pub trait ContainerClientRenewLeaseResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn encryption_key_sha256(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn is_server_encrypted(&self) -> Result>; - fn version_id(&self) -> Result>; + fn lease_id(&self) -> Result>; } -impl BlockBlobClientUploadResultHeaders for Response { - /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the - /// client can check for message content integrity. - fn content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str())) - } - +impl ContainerClientRenewLeaseResultHeaders + for Response +{ /// The date/time that the container was last modified. fn last_modified(&self) -> Result> { Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { @@ -2933,61 +2891,75 @@ impl BlockBlobClientUploadResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) - } - - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) + /// Uniquely identifies a blobs' lease + fn lease_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_ID) } +} - /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified - /// algorithm, and false otherwise. - fn is_server_encrypted(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) - } +/// Provides access to typed response headers for `ContainerClient::restore()` +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::{Response, NoFormat}}; +/// use azure_storage_blob::models::{ContainerClientRestoreResult, ContainerClientRestoreResultHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(date) = response.date()? { +/// println!("Date: {:?}", date); +/// } +/// Ok(()) +/// } +/// ``` +pub trait ContainerClientRestoreResultHeaders: private::Sealed { + fn date(&self) -> Result>; +} - /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob - /// version, and may be used in subsequent requests to access this version of the blob. - fn version_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &VERSION_ID) +impl ContainerClientRestoreResultHeaders for Response { + /// UTC date/time value generated by the service that indicates the time at which the response was initiated + fn date(&self) -> Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } -/// Provides access to typed response headers for `BlockBlobClient::get_block_list()` +/// Provides access to typed response headers for `ContainerClient::set_access_policy()` /// /// # Examples /// /// ```no_run -/// use azure_core::{Result, http::{Response, XmlFormat}}; -/// use azure_storage_blob::models::{BlockList, BlockListHeaders}; +/// use azure_core::{Result, http::{Response, NoFormat}}; +/// use azure_storage_blob::models::{ContainerClientSetAccessPolicyResult, ContainerClientSetAccessPolicyResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers +/// if let Some(date) = response.date()? { +/// println!("Date: {:?}", date); +/// } /// if let Some(last_modified) = response.last_modified()? { /// println!("Last-Modified: {:?}", last_modified); /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } -/// if let Some(blob_content_length) = response.blob_content_length()? { -/// println!("x-ms-blob-content-length: {:?}", blob_content_length); -/// } /// Ok(()) /// } /// ``` -pub trait BlockListHeaders: private::Sealed { +pub trait ContainerClientSetAccessPolicyResultHeaders: private::Sealed { + fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn blob_content_length(&self) -> Result>; } -impl BlockListHeaders for Response { +impl ContainerClientSetAccessPolicyResultHeaders + for Response +{ + /// UTC date/time value generated by the service that indicates the time at which the response was initiated + fn date(&self) -> Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) + } + /// The date/time that the container was last modified. fn last_modified(&self) -> Result> { Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { @@ -2999,14 +2971,9 @@ impl BlockListHeaders for Response { fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) } - - /// The size of the blob in bytes. - fn blob_content_length(&self) -> Result> { - Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH) - } } -/// Provides access to typed response headers for `BlobContainerClient::list_blob_flat_segment()` +/// Provides access to typed response headers for `ContainerClient::list_blob_flat_segment()` /// /// # Examples /// @@ -3033,7 +3000,7 @@ impl ListBlobsFlatSegmentResponseHeaders for Response { } } -/// Provides access to typed response headers for `BlobServiceClient::get_statistics()` +/// Provides access to typed response headers for `ServiceClient::get_account_info()` +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::{Response, NoFormat}}; +/// use azure_storage_blob::models::{ServiceClientGetAccountInfoResult, ServiceClientGetAccountInfoResultHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(date) = response.date()? { +/// println!("Date: {:?}", date); +/// } +/// 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); +/// } +/// Ok(()) +/// } +/// ``` +pub trait ServiceClientGetAccountInfoResultHeaders: private::Sealed { + fn date(&self) -> Result>; + fn account_kind(&self) -> Result>; + fn is_hierarchical_namespace_enabled(&self) -> Result>; + fn sku_name(&self) -> Result>; +} + +impl ServiceClientGetAccountInfoResultHeaders + for Response +{ + /// UTC date/time value generated by the service that indicates the time at which the response was initiated + fn date(&self) -> Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) + } + + /// Identifies the account kind + fn account_kind(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) + } + + /// Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled. + fn is_hierarchical_namespace_enabled(&self) -> Result> { + Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED) + } + + /// Identifies the sku name of the account + fn sku_name(&self) -> Result> { + Headers::get_optional_as(self.headers(), &SKU_NAME) + } +} + +/// Provides access to typed response headers for `ServiceClient::get_statistics()` /// /// # Examples /// @@ -3586,7 +3606,7 @@ impl StorageServiceStatsHeaders for Response { } } -/// Provides access to typed response headers for `BlobServiceClient::get_user_delegation_key()` +/// Provides access to typed response headers for `ServiceClient::get_user_delegation_key()` /// /// # Examples /// @@ -3613,7 +3633,7 @@ impl UserDelegationKeyHeaders for Response { } } -/// Provides access to typed response headers for `BlobContainerClient::get_access_policy()` +/// Provides access to typed response headers for `ContainerClient::get_access_policy()` /// /// # Examples /// @@ -3676,21 +3696,21 @@ mod private { BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, BlobClientSetExpiryResult, BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldResult, - BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, - BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult, - BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult, - BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult, - BlobContainerClientRenameResult, BlobContainerClientRenewLeaseResult, - BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyResult, - BlobServiceClientGetAccountInfoResult, BlobTags, BlockBlobClientCommitBlockListResult, - BlockBlobClientQueryResult, BlockBlobClientStageBlockFromUrlResult, - BlockBlobClientStageBlockResult, BlockBlobClientUploadBlobFromUrlResult, - BlockBlobClientUploadResult, BlockList, ListBlobsFlatSegmentResponse, + BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, BlobTags, + BlockBlobClientCommitBlockListResult, BlockBlobClientQueryResult, + BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult, + BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadResult, BlockList, + ContainerClientAcquireLeaseResult, ContainerClientBreakLeaseResult, + ContainerClientChangeLeaseResult, ContainerClientGetAccountInfoResult, + ContainerClientGetPropertiesResult, ContainerClientReleaseLeaseResult, + ContainerClientRenameResult, ContainerClientRenewLeaseResult, ContainerClientRestoreResult, + ContainerClientSetAccessPolicyResult, ListBlobsFlatSegmentResponse, ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult, PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult, PageBlobClientResizeResult, PageBlobClientSetSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList, - SignedIdentifier, StorageServiceStats, UserDelegationKey, + ServiceClientGetAccountInfoResult, SignedIdentifier, StorageServiceStats, + UserDelegationKey, }; use azure_core::http::{AsyncResponse, NoFormat, Response, XmlFormat}; @@ -3718,17 +3738,6 @@ mod private { impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response {} @@ -3736,6 +3745,16 @@ mod private { impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response {} @@ -3746,6 +3765,7 @@ mod private { impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response {} + impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response, XmlFormat> {} diff --git a/sdk/storage/azure_storage_blob/src/generated/models/method_options.rs b/sdk/storage/azure_storage_blob/src/generated/models/method_options.rs index 3115d42fb7..7dea71c5eb 100644 --- a/sdk/storage/azure_storage_blob/src/generated/models/method_options.rs +++ b/sdk/storage/azure_storage_blob/src/generated/models/method_options.rs @@ -1126,85 +1126,81 @@ pub struct BlobClientUndeleteOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlobContainerClient::acquire_lease()` +/// Options to be passed to `BlockBlobClient::commit_block_list()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientAcquireLeaseOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, +pub struct BlockBlobClientCommitBlockListOptions<'a> { + /// Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read + /// request. + pub blob_cache_control: Option, - /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. - pub if_modified_since: Option, + /// Optional. Sets the blob's content disposition. If specified, this property is stored with the blob and returned with a + /// read request. + pub blob_content_disposition: Option, - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. - pub if_unmodified_since: Option, + /// Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read + /// request. + pub blob_content_encoding: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read + /// request. + pub blob_content_language: Option, - /// Optional. The proposed lease ID for the container. - pub proposed_lease_id: Option, + /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks + /// were validated when each was uploaded. + pub blob_content_md5: Option>, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. + pub blob_content_type: Option, -/// Options to be passed to `BlobContainerClient::break_lease()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientBreakLeaseOptions<'a> { - /// For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - /// This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on - /// the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for - /// longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after - /// the remaining lease period elapses, and an infinite lease breaks immediately. - pub break_period: Option, + /// Optional. Used to set blob tags in various blob operations. + pub blob_tags_string: Option, /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. - pub if_modified_since: Option, + /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is + /// AES256. + pub encryption_algorithm: Option, - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. - pub if_unmodified_since: Option, + /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_key: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided + /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated + /// with a client token, this header should be specified using the SHA256 hash of the encryption key. + pub encryption_key_sha256: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_scope: Option, -/// Options to be passed to `BlobContainerClient::change_lease()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientChangeLeaseOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, + /// A condition that must be met in order for the request to be processed. + pub if_match: Option, /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. pub if_modified_since: Option, + /// A condition that must be met in order for the request to be processed. + pub if_none_match: Option, + + /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + pub if_tags: Option, + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Specifies the date time when the blobs immutability policy is set to expire. + pub immutability_policy_expiry: Option, -/// Options to be passed to `BlobContainerClient::create()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientCreateOptions<'a> { - /// The public access setting for the container. - pub access: Option, + /// Specifies the immutability policy mode to set on the blob. + pub immutability_policy_mode: Option, - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, + /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. + pub lease_id: Option, - /// Optional. Version 2019-07-07 and later. Specifies the default encryption scope to set on the container and use for all - /// future writes. - pub default_encryption_scope: Option, + /// Specified if a legal hold should be set on the blob. + pub legal_hold: Option, /// The metadata headers. pub metadata: Option>, @@ -1212,25 +1208,28 @@ pub struct BlobContainerClientCreateOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// If a blob has a lease and the lease is of infinite duration then the value of this header is set to true, otherwise it - /// is set to false. - pub prevent_encryption_scope_override: Option, + /// The tier to be set on the blob. + pub tier: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, + + /// Specify the transactional crc64 for the body, to be validated by the service. + pub transactional_content_crc64: Option>, + + /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks + /// were validated when each was uploaded. + pub transactional_content_md5: Option>, } -/// Options to be passed to `BlobContainerClient::delete()` +/// Options to be passed to `BlockBlobClient::get_block_list()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientDeleteOptions<'a> { +pub struct BlockBlobClientGetBlockListOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. - pub if_modified_since: Option, - - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. - pub if_unmodified_since: Option, + /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + pub if_tags: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -1238,41 +1237,47 @@ pub struct BlobContainerClientDeleteOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, + /// The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more + /// information on working with blob snapshots, see [Creating a Snapshot of a Blob.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob) + pub snapshot: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } -/// Options to be passed to `BlobContainerClient::find_blobs_by_tags()` +/// Options to be passed to `BlockBlobClient::query()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientFindBlobsByTagsOptions<'a> { +pub struct BlockBlobClientQueryOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Include this parameter to specify one or more datasets to include in the response. - pub include: Option>, + /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is + /// AES256. + pub encryption_algorithm: Option, - /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The - /// operation returns the NextMarker value within the response body if the listing operation did not return all containers - /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in - /// a subsequent call to request the next page of list items. The marker value is opaque to the client. - pub marker: Option, + /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_key: Option, - /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value - /// greater than 5000, the server will return up to 5000 items. - pub maxresults: Option, + /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided + /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated + /// with a client token, this header should be specified using the SHA256 hash of the encryption key. + pub encryption_key_sha256: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// A condition that must be met in order for the request to be processed. + pub if_match: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. + pub if_modified_since: Option, -/// Options to be passed to `BlobContainerClient::get_access_policy()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientGetAccessPolicyOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, + /// A condition that must be met in order for the request to be processed. + pub if_none_match: Option, + + /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + pub if_tags: Option, + + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. + pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -1280,28 +1285,36 @@ pub struct BlobContainerClientGetAccessPolicyOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, + /// The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more + /// information on working with blob snapshots, see [Creating a Snapshot of a Blob.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob) + pub snapshot: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } -/// Options to be passed to `BlobContainerClient::get_account_info()` +/// Options to be passed to `BlockBlobClient::stage_block()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientGetAccountInfoOptions<'a> { +pub struct BlockBlobClientStageBlockOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is + /// AES256. + pub encryption_algorithm: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_key: Option, -/// Options to be passed to `BlobContainerClient::get_properties()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientGetPropertiesOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, + /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided + /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated + /// with a client token, this header should be specified using the SHA256 hash of the encryption key. + pub encryption_key_sha256: Option, + + /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_scope: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -1309,359 +1322,190 @@ pub struct BlobContainerClientGetPropertiesOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, + /// Required if the request body is a structured message. Specifies the message schema version and properties. + pub structured_body_type: Option, + + /// Required if the request body is a structured message. Specifies the length of the blob/file content inside the message + /// body. Will always be smaller than Content-Length. + pub structured_content_length: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, + + /// Specify the transactional crc64 for the body, to be validated by the service. + pub transactional_content_crc64: Option>, + + /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks + /// were validated when each was uploaded. + pub transactional_content_md5: Option>, } -/// Options to be passed to `BlobContainerClient::list_blob_flat_segment()` +/// Options to be passed to `BlockBlobClient::stage_block_from_url()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientListBlobFlatSegmentOptions<'a> { +pub struct BlockBlobClientStageBlockFromUrlOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Include this parameter to specify one or more datasets to include in the response. - pub include: Option>, + /// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. + pub copy_source_authorization: Option, - /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The - /// operation returns the NextMarker value within the response body if the listing operation did not return all containers - /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in - /// a subsequent call to request the next page of list items. The marker value is opaque to the client. - pub marker: Option, + /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is + /// AES256. + pub encryption_algorithm: Option, - /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value - /// greater than 5000, the server will return up to 5000 items. - pub maxresults: Option, + /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_key: Option, + + /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided + /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated + /// with a client token, this header should be specified using the SHA256 hash of the encryption key. + pub encryption_key_sha256: Option, + + /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_scope: Option, + + /// Valid value is backup + pub file_request_intent: Option, + + /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. + pub lease_id: Option, /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Filters the results to return only containers whose name begins with the specified prefix. - pub prefix: Option, + /// Specify the crc64 calculated for the range of bytes that must be read from the copy source. + pub source_content_crc64: Option>, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Specify the md5 calculated for the range of bytes that must be read from the copy source. + pub source_content_md5: Option>, -impl BlobContainerClientListBlobFlatSegmentOptions<'_> { - /// Transforms this [`BlobContainerClientListBlobFlatSegmentOptions`] into a new `BlobContainerClientListBlobFlatSegmentOptions` that owns the underlying data, cloning it if necessary. - pub fn into_owned(self) -> BlobContainerClientListBlobFlatSegmentOptions<'static> { - BlobContainerClientListBlobFlatSegmentOptions { - client_request_id: self.client_request_id, - include: self.include, - marker: self.marker, - maxresults: self.maxresults, - method_options: ClientMethodOptions { - context: self.method_options.context.into_owned(), - }, - prefix: self.prefix, - timeout: self.timeout, - } - } -} - -/// Options to be passed to `BlobContainerClient::list_blob_hierarchy_segment()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientListBlobHierarchySegmentOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, - - /// Include this parameter to specify one or more datasets to include in the response. - pub include: Option>, - - /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The - /// operation returns the NextMarker value within the response body if the listing operation did not return all containers - /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in - /// a subsequent call to request the next page of list items. The marker value is opaque to the client. - pub marker: Option, - - /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value - /// greater than 5000, the server will return up to 5000 items. - pub maxresults: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// Filters the results to return only containers whose name begins with the specified prefix. - pub prefix: Option, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -impl BlobContainerClientListBlobHierarchySegmentOptions<'_> { - /// Transforms this [`BlobContainerClientListBlobHierarchySegmentOptions`] into a new `BlobContainerClientListBlobHierarchySegmentOptions` that owns the underlying data, cloning it if necessary. - pub fn into_owned(self) -> BlobContainerClientListBlobHierarchySegmentOptions<'static> { - BlobContainerClientListBlobHierarchySegmentOptions { - client_request_id: self.client_request_id, - include: self.include, - marker: self.marker, - maxresults: self.maxresults, - method_options: ClientMethodOptions { - context: self.method_options.context.into_owned(), - }, - prefix: self.prefix, - timeout: self.timeout, - } - } -} + /// Specify an ETag value to operate only on blobs with a matching value. + pub source_if_match: Option, -/// Options to be passed to `BlobContainerClient::release_lease()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientReleaseLeaseOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, + /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. + pub source_if_modified_since: Option, - /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. - pub if_modified_since: Option, + /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. + pub source_if_none_match: Option, - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. - pub if_unmodified_since: Option, + /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. + pub source_if_unmodified_since: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Bytes of source data in the specified range. + pub source_range: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } -/// Options to be passed to `BlobContainerClient::rename()` +/// Options to be passed to `BlockBlobClient::upload()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientRenameOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. - pub source_lease_id: Option, +pub struct BlockBlobClientUploadOptions<'a> { + /// Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read + /// request. + pub blob_cache_control: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Optional. Sets the blob's content disposition. If specified, this property is stored with the blob and returned with a + /// read request. + pub blob_content_disposition: Option, -/// Options to be passed to `BlobContainerClient::renew_lease()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientRenewLeaseOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, + /// Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read + /// request. + pub blob_content_encoding: Option, - /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. - pub if_modified_since: Option, + /// Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read + /// request. + pub blob_content_language: Option, - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. - pub if_unmodified_since: Option, + /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks + /// were validated when each was uploaded. + pub blob_content_md5: Option>, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. + pub blob_content_type: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Optional. Used to set blob tags in various blob operations. + pub blob_tags_string: Option, -/// Options to be passed to `BlobContainerClient::restore()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientRestoreOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Optional. Version 2019-12-12 and later. Specifies the name of the deleted container to restore. - pub deleted_container_name: Option, - - /// Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. - pub deleted_container_version: Option, + /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is + /// AES256. + pub encryption_algorithm: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_key: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided + /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated + /// with a client token, this header should be specified using the SHA256 hash of the encryption key. + pub encryption_key_sha256: Option, -/// Options to be passed to `BlobContainerClient::set_access_policy()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientSetAccessPolicyOptions<'a> { - /// The public access setting for the container. - pub access: Option, + /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_scope: Option, - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, + /// A condition that must be met in order for the request to be processed. + pub if_match: Option, /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. pub if_modified_since: Option, - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. - pub if_unmodified_since: Option, - - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. - pub lease_id: Option, + /// A condition that must be met in order for the request to be processed. + pub if_none_match: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + pub if_tags: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. + pub if_unmodified_since: Option, -/// Options to be passed to `BlobContainerClient::set_metadata()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientSetMetadataOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, + /// Specifies the date time when the blobs immutability policy is set to expire. + pub immutability_policy_expiry: Option, - /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. - pub if_modified_since: Option, + /// Specifies the immutability policy mode to set on the blob. + pub immutability_policy_mode: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -/// Options to be passed to `BlobServiceClient::find_blobs_by_tags()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobServiceClientFindBlobsByTagsOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, - - /// Include this parameter to specify one or more datasets to include in the response. - pub include: Option>, - - /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The - /// operation returns the NextMarker value within the response body if the listing operation did not return all containers - /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in - /// a subsequent call to request the next page of list items. The marker value is opaque to the client. - pub marker: Option, - - /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value - /// greater than 5000, the server will return up to 5000 items. - pub maxresults: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -/// Options to be passed to `BlobServiceClient::get_account_info()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobServiceClientGetAccountInfoOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -/// Options to be passed to `BlobServiceClient::get_properties()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobServiceClientGetPropertiesOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -/// Options to be passed to `BlobServiceClient::get_statistics()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobServiceClientGetStatisticsOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Specified if a legal hold should be set on the blob. + pub legal_hold: Option, -/// Options to be passed to `BlobServiceClient::get_user_delegation_key()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobServiceClientGetUserDelegationKeyOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, + /// The metadata headers. + pub metadata: Option>, /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -/// Options to be passed to `BlobServiceClient::list_containers_segment()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobServiceClientListContainersSegmentOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, - - /// Include this parameter to specify that the container's metadata be returned as part of the response body. - pub include: Option>, - - /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The - /// operation returns the NextMarker value within the response body if the listing operation did not return all containers - /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in - /// a subsequent call to request the next page of list items. The marker value is opaque to the client. - pub marker: Option, - - /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value - /// greater than 5000, the server will return up to 5000 items. - pub maxresults: Option, + /// Required if the request body is a structured message. Specifies the message schema version and properties. + pub structured_body_type: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Required if the request body is a structured message. Specifies the length of the blob/file content inside the message + /// body. Will always be smaller than Content-Length. + pub structured_content_length: Option, - /// Filters the results to return only containers whose name begins with the specified prefix. - pub prefix: Option, + /// The tier to be set on the blob. + pub tier: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, -} - -impl BlobServiceClientListContainersSegmentOptions<'_> { - /// Transforms this [`BlobServiceClientListContainersSegmentOptions`] into a new `BlobServiceClientListContainersSegmentOptions` that owns the underlying data, cloning it if necessary. - pub fn into_owned(self) -> BlobServiceClientListContainersSegmentOptions<'static> { - BlobServiceClientListContainersSegmentOptions { - client_request_id: self.client_request_id, - include: self.include, - marker: self.marker, - maxresults: self.maxresults, - method_options: ClientMethodOptions { - context: self.method_options.context.into_owned(), - }, - prefix: self.prefix, - timeout: self.timeout, - } - } -} -/// Options to be passed to `BlobServiceClient::set_properties()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobServiceClientSetPropertiesOptions<'a> { - /// An opaque, globally-unique, client-generated string identifier for the request. - pub client_request_id: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Specify the transactional crc64 for the body, to be validated by the service. + pub transactional_content_crc64: Option>, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, + /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks + /// were validated when each was uploaded. + pub transactional_content_md5: Option>, } -/// Options to be passed to `BlockBlobClient::commit_block_list()` +/// Options to be passed to `BlockBlobClient::upload_blob_from_url()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientCommitBlockListOptions<'a> { +pub struct BlockBlobClientUploadBlobFromUrlOptions<'a> { /// Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read /// request. pub blob_cache_control: Option, @@ -1691,6 +1535,15 @@ pub struct BlockBlobClientCommitBlockListOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, + /// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. + pub copy_source_authorization: Option, + + /// Optional, default is true. Indicates if properties from the source blob should be copied. + pub copy_source_blob_properties: Option, + + /// Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags. + pub copy_source_tags: Option, + /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is /// AES256. pub encryption_algorithm: Option, @@ -1708,6 +1561,9 @@ pub struct BlockBlobClientCommitBlockListOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, + /// Valid value is backup + pub file_request_intent: Option, + /// A condition that must be met in order for the request to be processed. pub if_match: Option, @@ -1723,92 +1579,147 @@ pub struct BlockBlobClientCommitBlockListOptions<'a> { /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, - /// Specifies the date time when the blobs immutability policy is set to expire. - pub immutability_policy_expiry: Option, - - /// Specifies the immutability policy mode to set on the blob. - pub immutability_policy_mode: Option, - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, - /// Specified if a legal hold should be set on the blob. - pub legal_hold: Option, - /// The metadata headers. pub metadata: Option>, /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, + /// Specify the md5 calculated for the range of bytes that must be read from the copy source. + pub source_content_md5: Option>, + + /// Specify an ETag value to operate only on blobs with a matching value. + pub source_if_match: Option, + + /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. + pub source_if_modified_since: Option, + + /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. + pub source_if_none_match: Option, + + /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + pub source_if_tags: Option, + + /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. + pub source_if_unmodified_since: Option, + /// The tier to be set on the blob. pub tier: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, - /// Specify the transactional crc64 for the body, to be validated by the service. - pub transactional_content_crc64: Option>, - /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks /// were validated when each was uploaded. pub transactional_content_md5: Option>, } -/// Options to be passed to `BlockBlobClient::get_block_list()` +/// Options to be passed to `ContainerClient::acquire_lease()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientGetBlockListOptions<'a> { +pub struct ContainerClientAcquireLeaseOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, + /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. + pub if_modified_since: Option, - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. - pub lease_id: Option, + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. + pub if_unmodified_since: Option, /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more - /// information on working with blob snapshots, see [Creating a Snapshot of a Blob.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob) - pub snapshot: Option, + /// Optional. The proposed lease ID for the container. + pub proposed_lease_id: Option, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +/// Options to be passed to `ContainerClient::break_lease()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientBreakLeaseOptions<'a> { + /// For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. + /// This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on + /// the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for + /// longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after + /// the remaining lease period elapses, and an infinite lease breaks immediately. + pub break_period: Option, + + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. + pub if_modified_since: Option, + + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. + pub if_unmodified_since: Option, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +/// Options to be passed to `ContainerClient::change_lease()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientChangeLeaseOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. + pub if_modified_since: Option, + + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. + pub if_unmodified_since: Option, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +/// Options to be passed to `ContainerClient::create()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientCreateOptions<'a> { + /// The public access setting for the container. + pub access: Option, + + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// Optional. Version 2019-07-07 and later. Specifies the default encryption scope to set on the container and use for all + /// future writes. + pub default_encryption_scope: Option, + + /// The metadata headers. + pub metadata: Option>, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// If a blob has a lease and the lease is of infinite duration then the value of this header is set to true, otherwise it + /// is set to false. + pub prevent_encryption_scope_override: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } -/// Options to be passed to `BlockBlobClient::query()` +/// Options to be passed to `ContainerClient::delete()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientQueryOptions<'a> { +pub struct ContainerClientDeleteOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is - /// AES256. - pub encryption_algorithm: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_key: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided - /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated - /// with a client token, this header should be specified using the SHA256 hash of the encryption key. - pub encryption_key_sha256: Option, - - /// A condition that must be met in order for the request to be processed. - pub if_match: Option, - /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. pub if_modified_since: Option, - /// A condition that must be met in order for the request to be processed. - pub if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, @@ -1818,36 +1729,41 @@ pub struct BlockBlobClientQueryOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more - /// information on working with blob snapshots, see [Creating a Snapshot of a Blob.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob) - pub snapshot: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } -/// Options to be passed to `BlockBlobClient::stage_block()` +/// Options to be passed to `ContainerClient::find_blobs_by_tags()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientStageBlockOptions<'a> { +pub struct ContainerClientFindBlobsByTagsOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is - /// AES256. - pub encryption_algorithm: Option, + /// Include this parameter to specify one or more datasets to include in the response. + pub include: Option>, - /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_key: Option, + /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The + /// operation returns the NextMarker value within the response body if the listing operation did not return all containers + /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in + /// a subsequent call to request the next page of list items. The marker value is opaque to the client. + pub marker: Option, - /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided - /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated - /// with a client token, this header should be specified using the SHA256 hash of the encryption key. - pub encryption_key_sha256: Option, + /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value + /// greater than 5000, the server will return up to 5000 items. + pub maxresults: Option, - /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_scope: Option, + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +/// Options to be passed to `ContainerClient::get_access_policy()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientGetAccessPolicyOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -1855,52 +1771,28 @@ pub struct BlockBlobClientStageBlockOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Required if the request body is a structured message. Specifies the message schema version and properties. - pub structured_body_type: Option, - - /// Required if the request body is a structured message. Specifies the length of the blob/file content inside the message - /// body. Will always be smaller than Content-Length. - pub structured_content_length: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, - - /// Specify the transactional crc64 for the body, to be validated by the service. - pub transactional_content_crc64: Option>, - - /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks - /// were validated when each was uploaded. - pub transactional_content_md5: Option>, } -/// Options to be passed to `BlockBlobClient::stage_block_from_url()` +/// Options to be passed to `ContainerClient::get_account_info()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientStageBlockFromUrlOptions<'a> { +pub struct ContainerClientGetAccountInfoOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. - pub copy_source_authorization: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is - /// AES256. - pub encryption_algorithm: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_key: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided - /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated - /// with a client token, this header should be specified using the SHA256 hash of the encryption key. - pub encryption_key_sha256: Option, + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, - /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_scope: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} - /// Valid value is backup - pub file_request_intent: Option, +/// Options to be passed to `ContainerClient::get_properties()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientGetPropertiesOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -1908,246 +1800,217 @@ pub struct BlockBlobClientStageBlockFromUrlOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Specify the crc64 calculated for the range of bytes that must be read from the copy source. - pub source_content_crc64: Option>, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} - /// Specify the md5 calculated for the range of bytes that must be read from the copy source. - pub source_content_md5: Option>, +/// Options to be passed to `ContainerClient::list_blob_flat_segment()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientListBlobFlatSegmentOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, - /// Specify an ETag value to operate only on blobs with a matching value. - pub source_if_match: Option, + /// Include this parameter to specify one or more datasets to include in the response. + pub include: Option>, - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_modified_since: Option, + /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The + /// operation returns the NextMarker value within the response body if the listing operation did not return all containers + /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in + /// a subsequent call to request the next page of list items. The marker value is opaque to the client. + pub marker: Option, - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_none_match: Option, + /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value + /// greater than 5000, the server will return up to 5000 items. + pub maxresults: Option, - /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. - pub source_if_unmodified_since: Option, + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, - /// Bytes of source data in the specified range. - pub source_range: Option, + /// Filters the results to return only containers whose name begins with the specified prefix. + pub prefix: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } -/// Options to be passed to `BlockBlobClient::upload()` +impl ContainerClientListBlobFlatSegmentOptions<'_> { + /// Transforms this [`ContainerClientListBlobFlatSegmentOptions`] into a new `ContainerClientListBlobFlatSegmentOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> ContainerClientListBlobFlatSegmentOptions<'static> { + ContainerClientListBlobFlatSegmentOptions { + client_request_id: self.client_request_id, + include: self.include, + marker: self.marker, + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + prefix: self.prefix, + timeout: self.timeout, + } + } +} + +/// Options to be passed to `ContainerClient::list_blob_hierarchy_segment()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientUploadOptions<'a> { - /// Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read - /// request. - pub blob_cache_control: Option, +pub struct ContainerClientListBlobHierarchySegmentOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, - /// Optional. Sets the blob's content disposition. If specified, this property is stored with the blob and returned with a - /// read request. - pub blob_content_disposition: Option, + /// Include this parameter to specify one or more datasets to include in the response. + pub include: Option>, - /// Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read - /// request. - pub blob_content_encoding: Option, + /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The + /// operation returns the NextMarker value within the response body if the listing operation did not return all containers + /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in + /// a subsequent call to request the next page of list items. The marker value is opaque to the client. + pub marker: Option, - /// Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read - /// request. - pub blob_content_language: Option, + /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value + /// greater than 5000, the server will return up to 5000 items. + pub maxresults: Option, - /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks - /// were validated when each was uploaded. - pub blob_content_md5: Option>, + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, - /// Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. - pub blob_content_type: Option, + /// Filters the results to return only containers whose name begins with the specified prefix. + pub prefix: Option, - /// Optional. Used to set blob tags in various blob operations. - pub blob_tags_string: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +impl ContainerClientListBlobHierarchySegmentOptions<'_> { + /// Transforms this [`ContainerClientListBlobHierarchySegmentOptions`] into a new `ContainerClientListBlobHierarchySegmentOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> ContainerClientListBlobHierarchySegmentOptions<'static> { + ContainerClientListBlobHierarchySegmentOptions { + client_request_id: self.client_request_id, + include: self.include, + marker: self.marker, + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + prefix: self.prefix, + timeout: self.timeout, + } + } +} +/// Options to be passed to `ContainerClient::release_lease()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientReleaseLeaseOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is - /// AES256. - pub encryption_algorithm: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_key: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided - /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated - /// with a client token, this header should be specified using the SHA256 hash of the encryption key. - pub encryption_key_sha256: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_scope: Option, - - /// A condition that must be met in order for the request to be processed. - pub if_match: Option, - /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. pub if_modified_since: Option, - /// A condition that must be met in order for the request to be processed. - pub if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, - /// Specifies the date time when the blobs immutability policy is set to expire. - pub immutability_policy_expiry: Option, - - /// Specifies the immutability policy mode to set on the blob. - pub immutability_policy_mode: Option, - - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. - pub lease_id: Option, + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, - /// Specified if a legal hold should be set on the blob. - pub legal_hold: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} - /// The metadata headers. - pub metadata: Option>, +/// Options to be passed to `ContainerClient::rename()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientRenameOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Required if the request body is a structured message. Specifies the message schema version and properties. - pub structured_body_type: Option, - - /// Required if the request body is a structured message. Specifies the length of the blob/file content inside the message - /// body. Will always be smaller than Content-Length. - pub structured_content_length: Option, - - /// The tier to be set on the blob. - pub tier: Option, + /// A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. + pub source_lease_id: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, - - /// Specify the transactional crc64 for the body, to be validated by the service. - pub transactional_content_crc64: Option>, - - /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks - /// were validated when each was uploaded. - pub transactional_content_md5: Option>, } -/// Options to be passed to `BlockBlobClient::upload_blob_from_url()` +/// Options to be passed to `ContainerClient::renew_lease()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientUploadBlobFromUrlOptions<'a> { - /// Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read - /// request. - pub blob_cache_control: Option, - - /// Optional. Sets the blob's content disposition. If specified, this property is stored with the blob and returned with a - /// read request. - pub blob_content_disposition: Option, - - /// Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read - /// request. - pub blob_content_encoding: Option, +pub struct ContainerClientRenewLeaseOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, - /// Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read - /// request. - pub blob_content_language: Option, + /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. + pub if_modified_since: Option, - /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks - /// were validated when each was uploaded. - pub blob_content_md5: Option>, + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. + pub if_unmodified_since: Option, - /// Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. - pub blob_content_type: Option, + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, - /// Optional. Used to set blob tags in various blob operations. - pub blob_tags_string: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} +/// Options to be passed to `ContainerClient::restore()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientRestoreOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. - pub copy_source_authorization: Option, - - /// Optional, default is true. Indicates if properties from the source blob should be copied. - pub copy_source_blob_properties: Option, - - /// Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags. - pub copy_source_tags: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is - /// AES256. - pub encryption_algorithm: Option, + /// Optional. Version 2019-12-12 and later. Specifies the name of the deleted container to restore. + pub deleted_container_name: Option, - /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_key: Option, + /// Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. + pub deleted_container_version: Option, - /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided - /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated - /// with a client token, this header should be specified using the SHA256 hash of the encryption key. - pub encryption_key_sha256: Option, + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, - /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_scope: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} - /// Valid value is backup - pub file_request_intent: Option, +/// Options to be passed to `ContainerClient::set_access_policy()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientSetAccessPolicyOptions<'a> { + /// The public access setting for the container. + pub access: Option, - /// A condition that must be met in order for the request to be processed. - pub if_match: Option, + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. pub if_modified_since: Option, - /// A condition that must be met in order for the request to be processed. - pub if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, - /// The metadata headers. - pub metadata: Option>, - /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Specify the md5 calculated for the range of bytes that must be read from the copy source. - pub source_content_md5: Option>, - - /// Specify an ETag value to operate only on blobs with a matching value. - pub source_if_match: Option, - - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_modified_since: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_none_match: Option, +/// Options to be passed to `ContainerClient::set_metadata()` +#[derive(Clone, Default, SafeDebug)] +pub struct ContainerClientSetMetadataOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub source_if_tags: Option, + /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. + pub if_modified_since: Option, - /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. - pub source_if_unmodified_since: Option, + /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. + pub lease_id: Option, - /// The tier to be set on the blob. - pub tier: Option, + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, - - /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks - /// were validated when each was uploaded. - pub transactional_content_md5: Option>, } /// Options to be passed to `PageBlobClient::clear_pages()` @@ -2668,3 +2531,140 @@ pub struct PageBlobClientUploadPagesFromUrlOptions<'a> { /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } + +/// Options to be passed to `ServiceClient::find_blobs_by_tags()` +#[derive(Clone, Default, SafeDebug)] +pub struct ServiceClientFindBlobsByTagsOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// Include this parameter to specify one or more datasets to include in the response. + pub include: Option>, + + /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The + /// operation returns the NextMarker value within the response body if the listing operation did not return all containers + /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in + /// a subsequent call to request the next page of list items. The marker value is opaque to the client. + pub marker: Option, + + /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value + /// greater than 5000, the server will return up to 5000 items. + pub maxresults: Option, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +/// Options to be passed to `ServiceClient::get_account_info()` +#[derive(Clone, Default, SafeDebug)] +pub struct ServiceClientGetAccountInfoOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +/// Options to be passed to `ServiceClient::get_properties()` +#[derive(Clone, Default, SafeDebug)] +pub struct ServiceClientGetPropertiesOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +/// Options to be passed to `ServiceClient::get_statistics()` +#[derive(Clone, Default, SafeDebug)] +pub struct ServiceClientGetStatisticsOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +/// Options to be passed to `ServiceClient::get_user_delegation_key()` +#[derive(Clone, Default, SafeDebug)] +pub struct ServiceClientGetUserDelegationKeyOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +/// Options to be passed to `ServiceClient::list_containers_segment()` +#[derive(Clone, Default, SafeDebug)] +pub struct ServiceClientListContainersSegmentOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// Include this parameter to specify that the container's metadata be returned as part of the response body. + pub include: Option>, + + /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The + /// operation returns the NextMarker value within the response body if the listing operation did not return all containers + /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in + /// a subsequent call to request the next page of list items. The marker value is opaque to the client. + pub marker: Option, + + /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value + /// greater than 5000, the server will return up to 5000 items. + pub maxresults: Option, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// Filters the results to return only containers whose name begins with the specified prefix. + pub prefix: Option, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} + +impl ServiceClientListContainersSegmentOptions<'_> { + /// Transforms this [`ServiceClientListContainersSegmentOptions`] into a new `ServiceClientListContainersSegmentOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> ServiceClientListContainersSegmentOptions<'static> { + ServiceClientListContainersSegmentOptions { + client_request_id: self.client_request_id, + include: self.include, + marker: self.marker, + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + prefix: self.prefix, + timeout: self.timeout, + } + } +} + +/// Options to be passed to `ServiceClient::set_properties()` +#[derive(Clone, Default, SafeDebug)] +pub struct ServiceClientSetPropertiesOptions<'a> { + /// An opaque, globally-unique, client-generated string identifier for the request. + pub client_request_id: Option, + + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, + + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} diff --git a/sdk/storage/azure_storage_blob/src/generated/models/pub_models.rs b/sdk/storage/azure_storage_blob/src/generated/models/pub_models.rs index feba35cbf9..250266ccdd 100644 --- a/sdk/storage/azure_storage_blob/src/generated/models/pub_models.rs +++ b/sdk/storage/azure_storage_blob/src/generated/models/pub_models.rs @@ -167,46 +167,6 @@ pub struct BlobClientStartCopyFromUrlResult; #[derive(SafeDebug)] pub struct BlobClientUndeleteResult; -/// Contains results for `BlobContainerClient::acquire_lease()` -#[derive(SafeDebug)] -pub struct BlobContainerClientAcquireLeaseResult; - -/// Contains results for `BlobContainerClient::break_lease()` -#[derive(SafeDebug)] -pub struct BlobContainerClientBreakLeaseResult; - -/// Contains results for `BlobContainerClient::change_lease()` -#[derive(SafeDebug)] -pub struct BlobContainerClientChangeLeaseResult; - -/// Contains results for `BlobContainerClient::get_account_info()` -#[derive(SafeDebug)] -pub struct BlobContainerClientGetAccountInfoResult; - -/// Contains results for `BlobContainerClient::get_properties()` -#[derive(SafeDebug)] -pub struct BlobContainerClientGetPropertiesResult; - -/// Contains results for `BlobContainerClient::release_lease()` -#[derive(SafeDebug)] -pub struct BlobContainerClientReleaseLeaseResult; - -/// Contains results for `BlobContainerClient::rename()` -#[derive(SafeDebug)] -pub struct BlobContainerClientRenameResult; - -/// Contains results for `BlobContainerClient::renew_lease()` -#[derive(SafeDebug)] -pub struct BlobContainerClientRenewLeaseResult; - -/// Contains results for `BlobContainerClient::restore()` -#[derive(SafeDebug)] -pub struct BlobContainerClientRestoreResult; - -/// Contains results for `BlobContainerClient::set_access_policy()` -#[derive(SafeDebug)] -pub struct BlobContainerClientSetAccessPolicyResult; - /// The blob flat list segment. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] @@ -541,10 +501,6 @@ pub struct BlobPropertiesInternal { pub tag_count: Option, } -/// Contains results for `BlobServiceClient::get_account_info()` -#[derive(SafeDebug)] -pub struct BlobServiceClientGetAccountInfoResult; - /// The service properties. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[serde(rename = "StorageServiceProperties")] @@ -731,6 +687,46 @@ pub struct ClearRange { pub start: Option, } +/// Contains results for `ContainerClient::acquire_lease()` +#[derive(SafeDebug)] +pub struct ContainerClientAcquireLeaseResult; + +/// Contains results for `ContainerClient::break_lease()` +#[derive(SafeDebug)] +pub struct ContainerClientBreakLeaseResult; + +/// Contains results for `ContainerClient::change_lease()` +#[derive(SafeDebug)] +pub struct ContainerClientChangeLeaseResult; + +/// Contains results for `ContainerClient::get_account_info()` +#[derive(SafeDebug)] +pub struct ContainerClientGetAccountInfoResult; + +/// Contains results for `ContainerClient::get_properties()` +#[derive(SafeDebug)] +pub struct ContainerClientGetPropertiesResult; + +/// Contains results for `ContainerClient::release_lease()` +#[derive(SafeDebug)] +pub struct ContainerClientReleaseLeaseResult; + +/// Contains results for `ContainerClient::rename()` +#[derive(SafeDebug)] +pub struct ContainerClientRenameResult; + +/// Contains results for `ContainerClient::renew_lease()` +#[derive(SafeDebug)] +pub struct ContainerClientRenewLeaseResult; + +/// Contains results for `ContainerClient::restore()` +#[derive(SafeDebug)] +pub struct ContainerClientRestoreResult; + +/// Contains results for `ContainerClient::set_access_policy()` +#[derive(SafeDebug)] +pub struct ContainerClientSetAccessPolicyResult; + /// An Azure Storage container. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] @@ -1289,6 +1285,10 @@ pub struct RetentionPolicy { pub enabled: Option, } +/// Contains results for `ServiceClient::get_account_info()` +#[derive(SafeDebug)] +pub struct ServiceClientGetAccountInfoResult; + /// The signed identifier. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[serde(rename = "SignedIdentifier")] diff --git a/sdk/storage/azure_storage_blob/src/models/mod.rs b/sdk/storage/azure_storage_blob/src/models/mod.rs index 68354de9e6..984696595e 100644 --- a/sdk/storage/azure_storage_blob/src/models/mod.rs +++ b/sdk/storage/azure_storage_blob/src/models/mod.rs @@ -30,30 +30,10 @@ pub use crate::generated::models::{ BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTagsOptions, BlobClientSetTierOptions, BlobClientStartCopyFromUrlResult, BlobClientStartCopyFromUrlResultHeaders, BlobClientUndeleteResult, - BlobClientUndeleteResultHeaders, BlobContainerClientAcquireLeaseOptions, - BlobContainerClientAcquireLeaseResult, BlobContainerClientAcquireLeaseResultHeaders, - BlobContainerClientBreakLeaseOptions, BlobContainerClientBreakLeaseResult, - BlobContainerClientBreakLeaseResultHeaders, BlobContainerClientChangeLeaseOptions, - BlobContainerClientChangeLeaseResult, BlobContainerClientChangeLeaseResultHeaders, - BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, - BlobContainerClientFindBlobsByTagsOptions, BlobContainerClientGetAccountInfoOptions, - BlobContainerClientGetAccountInfoResult, BlobContainerClientGetAccountInfoResultHeaders, - BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, - BlobContainerClientGetPropertiesResultHeaders, BlobContainerClientListBlobFlatSegmentOptions, - BlobContainerClientReleaseLeaseOptions, BlobContainerClientReleaseLeaseResult, - BlobContainerClientReleaseLeaseResultHeaders, BlobContainerClientRenameResult, - BlobContainerClientRenameResultHeaders, BlobContainerClientRenewLeaseOptions, - BlobContainerClientRenewLeaseResult, BlobContainerClientRenewLeaseResultHeaders, - BlobContainerClientRestoreResult, BlobContainerClientRestoreResultHeaders, - BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetAccessPolicyResultHeaders, - BlobContainerClientSetMetadataOptions, BlobCopySourceTags, BlobDeleteType, BlobExpiryOptions, + BlobClientUndeleteResultHeaders, BlobCopySourceTags, BlobDeleteType, BlobExpiryOptions, BlobFlatListSegment, BlobImmutabilityPolicyMode, BlobItemInternal, BlobMetadata, BlobName, - BlobPropertiesInternal, BlobServiceClientFindBlobsByTagsOptions, - BlobServiceClientGetAccountInfoOptions, BlobServiceClientGetAccountInfoResult, - BlobServiceClientGetAccountInfoResultHeaders, BlobServiceClientGetPropertiesOptions, - BlobServiceClientListContainersSegmentOptions, BlobServiceClientSetPropertiesOptions, - BlobServiceProperties, BlobTag, BlobTags, BlobTagsHeaders, BlobType, Block, - BlockBlobClientCommitBlockListOptions, BlockBlobClientCommitBlockListResult, + BlobPropertiesInternal, BlobServiceProperties, BlobTag, BlobTags, BlobTagsHeaders, BlobType, + Block, BlockBlobClientCommitBlockListOptions, BlockBlobClientCommitBlockListResult, BlockBlobClientCommitBlockListResultHeaders, BlockBlobClientGetBlockListOptions, BlockBlobClientQueryResult, BlockBlobClientQueryResultHeaders, BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockFromUrlResultHeaders, @@ -61,8 +41,24 @@ pub use crate::generated::models::{ BlockBlobClientStageBlockResultHeaders, BlockBlobClientUploadBlobFromUrlOptions, BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadBlobFromUrlResultHeaders, BlockBlobClientUploadOptions, BlockBlobClientUploadResult, BlockBlobClientUploadResultHeaders, - BlockList, BlockListHeaders, BlockListType, BlockLookupList, ContainerItem, CopyStatus, - CorsRule, DeleteSnapshotsOptionType, EncryptionAlgorithmType, FileShareTokenIntent, + BlockList, BlockListHeaders, BlockListType, BlockLookupList, + ContainerClientAcquireLeaseOptions, ContainerClientAcquireLeaseResult, + ContainerClientAcquireLeaseResultHeaders, ContainerClientBreakLeaseOptions, + ContainerClientBreakLeaseResult, ContainerClientBreakLeaseResultHeaders, + ContainerClientChangeLeaseOptions, ContainerClientChangeLeaseResult, + ContainerClientChangeLeaseResultHeaders, ContainerClientCreateOptions, + ContainerClientDeleteOptions, ContainerClientFindBlobsByTagsOptions, + ContainerClientGetAccountInfoOptions, ContainerClientGetAccountInfoResult, + ContainerClientGetAccountInfoResultHeaders, ContainerClientGetPropertiesOptions, + ContainerClientGetPropertiesResult, ContainerClientGetPropertiesResultHeaders, + ContainerClientListBlobFlatSegmentOptions, ContainerClientReleaseLeaseOptions, + ContainerClientReleaseLeaseResult, ContainerClientReleaseLeaseResultHeaders, + ContainerClientRenameResult, ContainerClientRenameResultHeaders, + ContainerClientRenewLeaseOptions, ContainerClientRenewLeaseResult, + ContainerClientRenewLeaseResultHeaders, ContainerClientRestoreResult, + ContainerClientRestoreResultHeaders, ContainerClientSetAccessPolicyResult, + ContainerClientSetAccessPolicyResultHeaders, ContainerClientSetMetadataOptions, ContainerItem, + CopyStatus, CorsRule, DeleteSnapshotsOptionType, EncryptionAlgorithmType, FileShareTokenIntent, FilterBlobItem, FilterBlobSegment, FilterBlobsIncludeItem, GeoReplicationStatusType, ImmutabilityPolicyMode, LeaseDuration, LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse, ListBlobsFlatSegmentResponseHeaders, ListBlobsHierarchySegmentResponse, @@ -79,8 +75,12 @@ pub use crate::generated::models::{ PageBlobClientUploadPagesFromUrlResultHeaders, PageBlobClientUploadPagesOptions, PageBlobClientUploadPagesResult, PageBlobClientUploadPagesResultHeaders, PageList, PageListHeaders, PremiumPageBlobAccessTier, PublicAccessType, QueryRequestType, QueryType, - RehydratePriority, RetentionPolicy, SequenceNumberActionType, SignedIdentifier, SkuName, - StaticWebsite, StorageErrorCode, StorageServiceStats, StorageServiceStatsHeaders, - UserDelegationKey, UserDelegationKeyHeaders, VecSignedIdentifierHeaders, + RehydratePriority, RetentionPolicy, SequenceNumberActionType, + ServiceClientFindBlobsByTagsOptions, ServiceClientGetAccountInfoOptions, + ServiceClientGetAccountInfoResult, ServiceClientGetAccountInfoResultHeaders, + ServiceClientGetPropertiesOptions, ServiceClientListContainersSegmentOptions, + ServiceClientSetPropertiesOptions, SignedIdentifier, SkuName, StaticWebsite, StorageErrorCode, + StorageServiceStats, StorageServiceStatsHeaders, UserDelegationKey, UserDelegationKeyHeaders, + VecSignedIdentifierHeaders, }; pub use extensions::*; diff --git a/sdk/storage/azure_storage_blob/src/parsers.rs b/sdk/storage/azure_storage_blob/src/parsers.rs index 9bfed276b1..bffb51c030 100644 --- a/sdk/storage/azure_storage_blob/src/parsers.rs +++ b/sdk/storage/azure_storage_blob/src/parsers.rs @@ -4,6 +4,7 @@ use crate::models::{BlobTag, BlobTags}; use std::collections::HashMap; use std::io::{Error, ErrorKind}; +use url::Url; /// Takes in an offset and a length, verifies alignment to a 512-byte boundary, and /// returns the HTTP range in String format. @@ -60,3 +61,457 @@ pub fn format_filter_expression(tags: &HashMap) -> Result String { + // Remove trailing slash from endpoint if present + let endpoint = endpoint.trim_end_matches('/'); + + // URL-encode the container name + let encoded_container_name = urlencoding::encode(container_name); + + // Split blob name by '/' and encode each segment individually + let encoded_blob_segments: Vec = blob_name + .split('/') + .map(|segment| urlencoding::encode(segment).into_owned()) + .collect(); + let encoded_blob_name = encoded_blob_segments.join("/"); + + format!( + "{}/{}/{}", + endpoint, encoded_container_name, encoded_blob_name + ) +} + +/// Parses the container name and blob name from a full blob URL. +/// +/// # Arguments +/// +/// * `url` - The URL to parse. +pub(crate) fn parse_url_name_components(url: &str) -> azure_core::Result<(String, String)> { + // Find the path part of the URL (after the domain) + // Look for the third '/' which starts the path + let mut slash_count = 0; + let mut path_start = 0; + + for (idx, c) in url.char_indices() { + if c == '/' { + slash_count += 1; + if slash_count == 3 { + path_start = idx + 1; + break; + } + } + } + + if slash_count < 3 { + return Err(azure_core::Error::new( + azure_core::error::ErrorKind::Other, + "Invalid URL format: missing path.", + )); + } + + // Extract the path, excluding query string (anything after '?') + let path = &url[path_start..]; + let path = if let Some(query_start) = path.find('?') { + &path[..query_start] + } else { + path + }; + + // Find the first '/' in the path to split container name and blob name + let slash_pos = path.find('/').ok_or_else(|| { + azure_core::Error::new( + azure_core::error::ErrorKind::Other, + "URL must contain both container name and blob name.", + ) + })?; + + let container_encoded = &path[..slash_pos]; + let blob_encoded = &path[slash_pos + 1..]; + + if blob_encoded.is_empty() { + return Err(azure_core::Error::new( + azure_core::error::ErrorKind::Other, + "Blob name cannot be empty.", + )); + } + + // URL decode both components + let container_name = urlencoding::decode(container_encoded).map_err(|e| { + azure_core::Error::new( + azure_core::error::ErrorKind::Other, + format!("Failed to decode container name: {}", e), + ) + })?; + + let blob_name = urlencoding::decode(blob_encoded).map_err(|e| { + azure_core::Error::new( + azure_core::error::ErrorKind::Other, + format!("Failed to decode blob name: {}", e), + ) + })?; + + Ok((container_name.into_owned(), blob_name.into_owned())) +} + +// TODO: Remove later, but need these for sanity checking while we discuss how to move forward with this design +#[cfg(test)] +mod tests { + use super::*; + + // Basic tests for baseline understanding + #[test] + fn simple_blob_name() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "myblob.txt", + ); + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/myblob.txt" + ); + } + + #[test] + fn blob_name_with_single_path() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder/myblob.txt", + ); + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder/myblob.txt" + ); + } + + // Path preservation tests - the critical functionality + #[test] + fn nested_paths_basic() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder/subfolder/another/myblob.txt", + ); + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder/subfolder/another/myblob.txt" + ); + } + + #[test] + fn nested_paths_with_spaces() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "my folder/sub folder/file name.txt", + ); + // Spaces encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/my%20folder/sub%20folder/file%20name.txt" + ); + } + + #[test] + fn nested_paths_with_leading_trailing_spaces() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + " folder / subfolder / file.txt ", + ); + // Spaces encoded everywhere, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/%20%20folder%20%20/%20%20subfolder%20%20/%20%20file.txt%20%20" + ); + } + + #[test] + fn nested_paths_with_special_chars() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder1/folder&2/file?name.txt", + ); + // Special characters encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder1/folder%262/file%3Fname.txt" + ); + } + + #[test] + fn nested_paths_with_query_string_chars() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "api/v1/users?id=123&name=test/data.json", + ); + // Query characters encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/api/v1/users%3Fid%3D123%26name%3Dtest/data.json" + ); + } + + #[test] + fn nested_paths_with_hash_fragments() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "docs/v1/page#section1/subsection#2/file.txt", + ); + // Hash characters encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/docs/v1/page%23section1/subsection%232/file.txt" + ); + } + + #[test] + fn nested_paths_with_semicolons() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder;version/subfolder;data/file;v2.txt", + ); + // Semicolons encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder%3Bversion/subfolder%3Bdata/file%3Bv2.txt" + ); + } + + #[test] + fn nested_paths_with_at_signs() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "users/user@domain.com/files/doc@v1.txt", + ); + // @ signs encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/users/user%40domain.com/files/doc%40v1.txt" + ); + } + + #[test] + fn nested_paths_with_pipes() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "data|2024/logs|prod/file|output.txt", + ); + // Pipes encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/data%7C2024/logs%7Cprod/file%7Coutput.txt" + ); + } + + #[test] + fn nested_paths_with_commas() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "data,backups/logs,archive/file,v1.txt", + ); + // Commas encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/data%2Cbackups/logs%2Carchive/file%2Cv1.txt" + ); + } + + #[test] + fn nested_paths_with_encoded_slashes() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder/file%2Fname/subfolder/data%2Fmore.txt", + ); + // Already encoded slashes re-encoded to %252F, real slashes preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder/file%252Fname/subfolder/data%252Fmore.txt" + ); + } + + #[test] + fn nested_paths_with_plus_signs() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder+data/sub+folder/file+name.txt", + ); + // Plus signs encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder%2Bdata/sub%2Bfolder/file%2Bname.txt" + ); + } + + #[test] + fn nested_paths_with_equals_signs() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "data=v1/logs=prod/file=output.txt", + ); + // Equals signs encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/data%3Dv1/logs%3Dprod/file%3Doutput.txt" + ); + } + + #[test] + fn deeply_nested_paths_with_mixed_special_chars() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "level1/level 2/level&3/level?4/level#5/file name & data?test=1#section.txt", + ); + // All special chars encoded, all paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/level1/level%202/level%263/level%3F4/level%235/file%20name%20%26%20data%3Ftest%3D1%23section.txt" + ); + } + + #[test] + fn nested_paths_comprehensive_url_unsafe_chars() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "dir&1/dir?2/dir=3/dir#4/dir;5/dir,6/dir@7/dir|8/file.txt", + ); + // Every special char encoded, every path preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/dir%261/dir%3F2/dir%3D3/dir%234/dir%3B5/dir%2C6/dir%407/dir%7C8/file.txt" + ); + } + + #[test] + fn nested_paths_with_parentheses_and_brackets() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder(1)/subfolder[2]/file{name}.txt", + ); + // Parentheses and brackets encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder%281%29/subfolder%5B2%5D/file%7Bname%7D.txt" + ); + } + + #[test] + fn nested_paths_with_percent_signs() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder%20test/sub%folder/file%name.txt", + ); + // Percent signs encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder%2520test/sub%25folder/file%25name.txt" + ); + } + + #[test] + fn nested_paths_with_backslashes() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder\\windows/sub\\path/file\\name.txt", + ); + // Backslashes encoded, forward slashes preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder%5Cwindows/sub%5Cpath/file%5Cname.txt" + ); + } + + #[test] + fn very_deep_nesting_ten_levels() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "l1/l2/l3/l4/l5/l6/l7/l8/l9/l10/file.txt", + ); + // All 10 levels of paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/l1/l2/l3/l4/l5/l6/l7/l8/l9/l10/file.txt" + ); + } + + #[test] + fn nested_paths_with_unicode_chars() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder/文件夹/unterordner/файл.txt", + ); + // Unicode chars encoded, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder/%E6%96%87%E4%BB%B6%E5%A4%B9/unterordner/%D1%84%D0%B0%D0%B9%D0%BB.txt" + ); + } + + #[test] + fn nested_paths_empty_segments() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "folder//subfolder///file.txt", + ); + // Empty segments preserved as empty between slashes + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder//subfolder///file.txt" + ); + } + + #[test] + fn nested_paths_all_edge_cases_combined() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net", + "mycontainer", + "user@domain/logs|2024/file name & data/test?query=val#section/output;v2/data,final/result%2Fencoded/file(1)[2]{3}.txt", + ); + // Kitchen sink test: all special chars encoded, all 8 path separators preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/user%40domain/logs%7C2024/file%20name%20%26%20data/test%3Fquery%3Dval%23section/output%3Bv2/data%2Cfinal/result%252Fencoded/file%281%29%5B2%5D%7B3%7D.txt" + ); + } + + #[test] + fn endpoint_with_trailing_slash() { + let url = build_blob_url( + "https://myaccount.blob.core.windows.net/", + "mycontainer", + "folder/subfolder/myblob.txt", + ); + // Trailing slash handled, paths preserved + assert_eq!( + url, + "https://myaccount.blob.core.windows.net/mycontainer/folder/subfolder/myblob.txt" + ); + } +} diff --git a/sdk/storage/azure_storage_blob/tests/append_blob_client.rs b/sdk/storage/azure_storage_blob/tests/append_blob_client.rs index dbd1d35ba4..6d7000ea1d 100644 --- a/sdk/storage/azure_storage_blob/tests/append_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/append_blob_client.rs @@ -65,7 +65,7 @@ async fn test_append_block(ctx: TestContext) -> Result<(), Box> { assert!(status_code.is_success()); assert_eq!(17, content_length.unwrap()); block_1.extend(&block_2); - assert_eq!(block_1, response_body.collect().await?.to_vec()); + assert_eq!(block_1, response_body.collect().await?); container_client.delete_container(None).await?; Ok(()) @@ -79,18 +79,12 @@ async fn test_append_block_from_url(ctx: TestContext) -> Result<(), Box Result<(), Box Result<(), Box> { // Assert assert!(status_code.is_success()); assert_eq!(0, content_length.unwrap()); - assert_eq!(b"".to_vec(), response_body.collect().await?.to_vec()); + assert_eq!(b"".to_vec(), response_body.collect().await?); container_client.delete_container(None).await?; Ok(()) diff --git a/sdk/storage/azure_storage_blob/tests/blob_client.rs b/sdk/storage/azure_storage_blob/tests/blob_client.rs index 100d21f52f..3ca3d38183 100644 --- a/sdk/storage/azure_storage_blob/tests/blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/blob_client.rs @@ -2,20 +2,26 @@ // Licensed under the MIT License. use azure_core::{ - http::{RequestContent, StatusCode}, + http::{RequestContent, StatusCode, Url}, Bytes, }; -use azure_core_test::{recorded, Matcher, TestContext}; -use azure_storage_blob::models::{ - AccessTier, AccountKind, BlobClientAcquireLeaseResultHeaders, - BlobClientChangeLeaseResultHeaders, BlobClientDownloadOptions, BlobClientDownloadResultHeaders, - BlobClientGetAccountInfoResultHeaders, BlobClientGetPropertiesOptions, - BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, - BlobClientSetPropertiesOptions, BlobClientSetTierOptions, BlockBlobClientUploadOptions, - LeaseState, +use azure_core_test::{recorded, Matcher, TestContext, TestMode}; +use azure_storage_blob::{ + models::{ + AccessTier, AccountKind, BlobClientAcquireLeaseResultHeaders, + BlobClientChangeLeaseResultHeaders, BlobClientDownloadOptions, + BlobClientDownloadResultHeaders, BlobClientGetAccountInfoResultHeaders, + BlobClientGetPropertiesOptions, BlobClientGetPropertiesResultHeaders, + BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions, + BlockBlobClientUploadOptions, ContainerClientCreateOptions, LeaseState, PublicAccessType, + }, + BlobClient, }; -use azure_storage_blob_test::{create_test_blob, get_blob_name, get_container_client}; +use azure_storage_blob_test::{ + create_test_blob, get_blob_name, get_blob_service_client, get_container_client, +}; +use futures::TryStreamExt; use std::{collections::HashMap, error::Error, time::Duration}; use tokio::time; @@ -112,10 +118,7 @@ async fn test_upload_blob(ctx: TestContext) -> Result<(), Box> { let (status_code, _, response_body) = response.deconstruct(); assert!(status_code.is_success()); assert_eq!(17, content_length.unwrap()); - assert_eq!( - Bytes::from_static(data), - response_body.collect().await?.as_ref() - ); + assert_eq!(Bytes::from_static(data), response_body.collect().await?); // Overwrite Scenarios let new_data = b"hello overwritten rusty world"; @@ -152,10 +155,7 @@ async fn test_upload_blob(ctx: TestContext) -> Result<(), Box> { let (status_code, _, response_body) = response.deconstruct(); assert!(status_code.is_success()); assert_eq!(29, content_length.unwrap()); - assert_eq!( - Bytes::from_static(new_data), - response_body.collect().await?.as_ref() - ); + assert_eq!(Bytes::from_static(new_data), response_body.collect().await?); container_client.delete_container(None).await?; Ok(()) @@ -209,7 +209,7 @@ async fn test_download_blob(ctx: TestContext) -> Result<(), Box> { assert_eq!(17, content_length.unwrap()); assert_eq!( b"hello rusty world".to_vec(), - response_body.collect().await?.to_vec(), + response_body.collect().await? ); container_client.delete_container(None).await?; @@ -427,7 +427,7 @@ async fn test_leased_blob_operations(ctx: TestContext) -> Result<(), Box Result<(), Box> { Ok(()) } + +#[recorded::test] +async fn test_public_access(ctx: TestContext) -> Result<(), Box> { + // Mark as playback-only + if ctx.recording().test_mode() != TestMode::Playback { + return Ok(()); + } + + // Arrange + let recording = ctx.recording(); + let container_client = get_container_client(recording, false).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + + let public_access_create_options = ContainerClientCreateOptions { + access: Some(PublicAccessType::Blob), + ..Default::default() + }; + container_client + .create_container(Some(public_access_create_options)) + .await?; + + create_test_blob(&blob_client, None, None).await?; + + // Unauthenticated Blob Client + let endpoint = format!( + "https://{}.blob.core.windows.net/", + recording.var("AZURE_STORAGE_ACCOUNT_NAME", None).as_str() + ); + let unauthenticated_blob_client = BlobClient::new( + &endpoint, + blob_client.container_name().to_string(), + blob_client.blob_name().to_string(), + None, + None, + )?; + + // Act + let response = unauthenticated_blob_client.get_properties(None).await?; + + // Assert + let lease_state = response.lease_state()?; + let content_length = response.content_length()?; + let etag = response.etag()?; + let creation_time = response.creation_time()?; + + assert_eq!(LeaseState::Available, lease_state.unwrap()); + assert_eq!(17, content_length.unwrap()); + assert!(etag.is_some()); + assert!(creation_time.is_some()); + assert!(unauthenticated_blob_client.exists().await?); + + container_client.delete_container(None).await?; + Ok(()) +} + +#[recorded::test] +async fn test_encoding_edge_cases(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let service_client = get_blob_service_client(recording)?; + let blob_url = format!( + "https://{}.blob.core.windows.net/", + recording.var("AZURE_STORAGE_ACCOUNT_NAME", None).as_str() + ); + + // // [Simple Case - Baseline] + // let test_names_simple = ("test-container-simple", "test_blob_encoding"); + // let container_client_1 = service_client.blob_container_client(test_names_simple.0.into()); + // let blob_client_1 = container_client_1.blob_client(test_names_simple.1.into()); + // container_client_1.create_container(None).await?; + // create_test_blob(&blob_client_1, None, None).await?; + // blob_client_1.get_properties(None).await?; + // assert_eq!(test_names_simple.0, container_client_1.container_name()); + // assert_eq!(test_names_simple.0, blob_client_1.container_name()); + // assert_eq!(test_names_simple.1, blob_client_1.blob_name()); + + // let blob_client_1_manual = BlobClient::new( + // &blob_url, + // test_names_simple.0.into(), + // test_names_simple.1.into(), + // Some(recording.credential()), + // None, + // )?; + // blob_client_1_manual.get_properties(None).await?; + // assert_eq!(test_names_simple.0, blob_client_1_manual.container_name()); + // assert_eq!(test_names_simple.1, blob_client_1_manual.blob_name()); + + // let mut list_blobs_response = container_client_1.list_blobs(None)?; + + // let page = list_blobs_response.try_next().await?; + // let list_blob_segment_response = page.unwrap().into_body()?; + // let blob_list = list_blob_segment_response.segment.blob_items; + // for blob in blob_list { + // let listed_blob_name = blob.name.unwrap().content.unwrap(); + // assert_eq!( + // test_names_simple.1, &listed_blob_name, + // "Blob name returned from list_blobs differs from expected blob name. [{}] [{}]", + // test_names_simple.1, listed_blob_name + // ); + // } + + // // [Comprehensive Space Handling - leading, trailing, consecutive, and embedded] + // let test_names_spaces = ( + // "test-container-spaces", + // " leading with multiple spaces trailing ", + // ); + // let container_client_2 = service_client.blob_container_client(test_names_spaces.0.into()); + // let blob_client_2 = container_client_2.blob_client(test_names_spaces.1.into()); + // container_client_2.create_container(None).await?; + // create_test_blob(&blob_client_2, None, None).await?; + // blob_client_2.get_properties(None).await?; + // assert_eq!(test_names_spaces.0, container_client_2.container_name()); + // assert_eq!(test_names_spaces.0, blob_client_2.container_name()); + // assert_eq!(test_names_spaces.1, blob_client_2.blob_name()); + + // let blob_client_2_manual = BlobClient::new( + // &blob_url, + // test_names_spaces.0.into(), + // test_names_spaces.1.into(), + // Some(recording.credential()), + // None, + // )?; + // blob_client_2_manual.get_properties(None).await?; + // assert_eq!(test_names_spaces.0, blob_client_2_manual.container_name()); + // assert_eq!(test_names_spaces.1, blob_client_2_manual.blob_name()); + + // // [URL-Unsafe and Delimiter Characters - &, ?, =, #, ;, comma, @, |] + // let test_names_unsafe = ( + // "test-container-unsafe", + // "file¶m?query=val#frag;ver,data@email|pipe.txt", + // ); + // let container_client_3 = service_client.blob_container_client(test_names_unsafe.0.into()); + // let blob_client_3 = container_client_3.blob_client(test_names_unsafe.1.into()); + // container_client_3.create_container(None).await?; + // create_test_blob(&blob_client_3, None, None).await?; + // blob_client_3.get_properties(None).await?; + // assert_eq!(test_names_unsafe.0, container_client_3.container_name()); + // assert_eq!(test_names_unsafe.0, blob_client_3.container_name()); + // assert_eq!(test_names_unsafe.1, blob_client_3.blob_name()); + + // let blob_client_3_manual = BlobClient::new( + // &blob_url, + // test_names_unsafe.0.into(), + // test_names_unsafe.1.into(), + // Some(recording.credential()), + // None, + // )?; + // blob_client_3_manual.get_properties(None).await?; + // assert_eq!(test_names_unsafe.0, blob_client_3_manual.container_name()); + // assert_eq!(test_names_unsafe.1, blob_client_3_manual.blob_name()); + + // let mut list_blobs_response = container_client_3.list_blobs(None)?; + + // let page = list_blobs_response.try_next().await?; + // let list_blob_segment_response = page.unwrap().into_body()?; + // let blob_list = list_blob_segment_response.segment.blob_items; + // for blob in blob_list { + // let listed_blob_name = blob.name.unwrap().content.unwrap(); + // assert_eq!( + // test_names_unsafe.1, &listed_blob_name, + // "Blob name returned from list_blobs differs from expected blob name. [{}] [{}]", + // test_names_unsafe.1, listed_blob_name + // ); + // } + + // [Path Separators - forward slashes, backslashes mixed, and encoded forward slash] + let test_names_paths = ( + "test-container-paths4", + "folder/subfolder\\file/mixed\\paths%2Fencoded.txt", + ); + let container_client_4 = service_client.blob_container_client(test_names_paths.0.into()); + let blob_client_4 = container_client_4.blob_client(test_names_paths.1.into()); + container_client_4.create_container(None).await?; + create_test_blob(&blob_client_4, None, None).await?; + blob_client_4.get_properties(None).await?; + assert_eq!(test_names_paths.0, container_client_4.container_name()); + assert_eq!(test_names_paths.0, blob_client_4.container_name()); + assert_eq!(test_names_paths.1, blob_client_4.blob_name()); + + let blob_client_4_manual = BlobClient::new( + &blob_url, + test_names_paths.0.into(), + test_names_paths.1.into(), + Some(recording.credential()), + None, + )?; + blob_client_4_manual.get_properties(None).await?; + assert_eq!(test_names_paths.0, blob_client_4_manual.container_name()); + assert_eq!(test_names_paths.1, blob_client_4_manual.blob_name()); + + let mut list_blobs_response = container_client_4.list_blobs(None)?; + + let page = list_blobs_response.try_next().await?; + let list_blob_segment_response = page.unwrap().into_body()?; + let blob_list = list_blob_segment_response.segment.blob_items; + for blob in blob_list { + let listed_blob_name = blob.name.unwrap().content.unwrap(); + assert_eq!( + test_names_paths.1, &listed_blob_name, + "Blob name returned from list_blobs differs from expected blob name. [{}] [{}]", + test_names_paths.1, listed_blob_name + ); + } + + // // [Percent Encoding - literal %, already-encoded, and mixed encoding] + // let test_names_percent = ( + // "test-container-percent", + // "50%off-%20encoded-my%20file (2).txt", + // ); + // let container_client_5 = service_client.blob_container_client(test_names_percent.0.into()); + // let blob_client_5 = container_client_5.blob_client(test_names_percent.1.into()); + // container_client_5.create_container(None).await?; + // create_test_blob(&blob_client_5, None, None).await?; + // blob_client_5.get_properties(None).await?; + // assert_eq!(test_names_percent.0, container_client_5.container_name()); + // assert_eq!(test_names_percent.0, blob_client_5.container_name()); + // assert_eq!(test_names_percent.1, blob_client_5.blob_name()); + + // let blob_client_5_manual = BlobClient::new( + // &blob_url, + // test_names_percent.0.into(), + // test_names_percent.1.into(), + // Some(recording.credential()), + // None, + // )?; + // blob_client_5_manual.get_properties(None).await?; + // assert_eq!(test_names_percent.0, blob_client_5_manual.container_name()); + // assert_eq!(test_names_percent.1, blob_client_5_manual.blob_name()); + + // let mut list_blobs_response = container_client_5.list_blobs(None)?; + + // let page = list_blobs_response.try_next().await?; + // let list_blob_segment_response = page.unwrap().into_body()?; + // let blob_list = list_blob_segment_response.segment.blob_items; + // for blob in blob_list { + // let listed_blob_name = blob.name.unwrap().content.unwrap(); + // assert_eq!( + // test_names_percent.1, &listed_blob_name, + // "Blob name returned from list_blobs differs from expected blob name. [{}] [{}]", + // test_names_percent.1, listed_blob_name + // ); + // } + + // // [Special Characters - brackets, braces, quotes, apostrophes, angle brackets, asterisks, starting/ending with special chars, consecutive special chars] + // let test_names_special = ( + // "test-container-special", + // "***file[1]''test''_with...special~~~chars<>{{{copy}}}***.txt!!!", + // ); + // let container_client_6 = service_client.blob_container_client(test_names_special.0.into()); + // let blob_client_6 = container_client_6.blob_client(test_names_special.1.into()); + // container_client_6.create_container(None).await?; + // create_test_blob(&blob_client_6, None, None).await?; + // blob_client_6.get_properties(None).await?; + // assert_eq!(test_names_special.0, container_client_6.container_name()); + // assert_eq!(test_names_special.0, blob_client_6.container_name()); + // assert_eq!(test_names_special.1, blob_client_6.blob_name()); + + // let blob_client_6_manual = BlobClient::new( + // &blob_url, + // test_names_special.0.into(), + // test_names_special.1.into(), + // Some(recording.credential()), + // None, + // )?; + // blob_client_6_manual.get_properties(None).await?; + // assert_eq!(test_names_special.0, blob_client_6_manual.container_name()); + // assert_eq!(test_names_special.1, blob_client_6_manual.blob_name()); + + // let mut list_blobs_response = container_client_6.list_blobs(None)?; + + // let page = list_blobs_response.try_next().await?; + // let list_blob_segment_response = page.unwrap().into_body()?; + // let blob_list = list_blob_segment_response.segment.blob_items; + // for blob in blob_list { + // let listed_blob_name = blob.name.unwrap().content.unwrap(); + // assert_eq!( + // test_names_special.1, &listed_blob_name, + // "Blob name returned from list_blobs differs from expected blob name. [{}] [{}]", + // test_names_special.1, listed_blob_name + // ); + // } + + // // [Advanced Encoding - unicode, emojis, accents, multi-byte chars, plus signs, form encoding] + // let test_names_advanced = ( + // "test-container-advanced", + // "café+🦀+カニのフェリス~émoji+plus~tilde.txt", + // ); + // let container_client_7 = service_client.blob_container_client(test_names_advanced.0.into()); + // let blob_client_7 = container_client_7.blob_client(test_names_advanced.1.into()); + // container_client_7.create_container(None).await?; + // create_test_blob(&blob_client_7, None, None).await?; + // blob_client_7.get_properties(None).await?; + // assert_eq!(test_names_advanced.0, container_client_7.container_name()); + // assert_eq!(test_names_advanced.0, blob_client_7.container_name()); + // assert_eq!(test_names_advanced.1, blob_client_7.blob_name()); + + // let blob_client_7_manual = BlobClient::new( + // &blob_url, + // test_names_advanced.0.into(), + // test_names_advanced.1.into(), + // Some(recording.credential()), + // None, + // )?; + // blob_client_7_manual.get_properties(None).await?; + // assert_eq!(test_names_advanced.0, blob_client_7_manual.container_name()); + // assert_eq!(test_names_advanced.1, blob_client_7_manual.blob_name()); + + // let mut list_blobs_response = container_client_7.list_blobs(None)?; + + // let page = list_blobs_response.try_next().await?; + // let list_blob_segment_response = page.unwrap().into_body()?; + // let blob_list = list_blob_segment_response.segment.blob_items; + // for blob in blob_list { + // let listed_blob_name = blob.name.unwrap().content.unwrap(); + // assert_eq!( + // test_names_advanced.1, &listed_blob_name, + // "Blob name returned from list_blobs differs from expected blob name. [{}] [{}]", + // test_names_advanced.1, listed_blob_name + // ); + // } + + // Cleanup all containers + // container_client_1.delete_container(None).await?; + // container_client_2.delete_container(None).await?; + // container_client_3.delete_container(None).await?; + container_client_4.delete_container(None).await?; + // container_client_5.delete_container(None).await?; + // container_client_6.delete_container(None).await?; + // container_client_7.delete_container(None).await?; + + Ok(()) +} + +// #[recorded::test] +// async fn test_sas(ctx: TestContext) -> Result<(), Box> { +// // SAS +// let blob_url = ""; + +// let sas_blob_client = BlobClient::from_blob_url(blob_url, None, None)?; +// println!( +// "Container Name:{}, Blob Name:{}", +// sas_blob_client.container_name(), +// sas_blob_client.blob_name() +// ); + +// let blob_properties = sas_blob_client.get_properties(None).await?; +// let content_length = blob_properties.content_length()?; +// assert_eq!(11, content_length.unwrap()); + +// Ok(()) +// } diff --git a/sdk/storage/azure_storage_blob/tests/blob_container_client.rs b/sdk/storage/azure_storage_blob/tests/blob_container_client.rs index 35f860700f..276aa3227b 100644 --- a/sdk/storage/azure_storage_blob/tests/blob_container_client.rs +++ b/sdk/storage/azure_storage_blob/tests/blob_container_client.rs @@ -5,10 +5,10 @@ use azure_core::http::{RequestContent, StatusCode}; use azure_core_test::{recorded, Matcher, TestContext, TestMode}; use azure_storage_blob::format_filter_expression; use azure_storage_blob::models::{ - AccountKind, BlobContainerClientAcquireLeaseResultHeaders, - BlobContainerClientChangeLeaseResultHeaders, BlobContainerClientGetAccountInfoResultHeaders, - BlobContainerClientGetPropertiesResultHeaders, BlobContainerClientListBlobFlatSegmentOptions, - BlobContainerClientSetMetadataOptions, BlobType, BlockBlobClientUploadOptions, LeaseState, + AccountKind, BlobType, BlockBlobClientUploadOptions, ContainerClientAcquireLeaseResultHeaders, + ContainerClientChangeLeaseResultHeaders, ContainerClientGetAccountInfoResultHeaders, + ContainerClientGetPropertiesResultHeaders, ContainerClientListBlobFlatSegmentOptions, + ContainerClientSetMetadataOptions, LeaseState, }; use azure_storage_blob_test::{ create_test_blob, get_blob_name, get_blob_service_client, get_container_client, @@ -168,7 +168,7 @@ async fn test_list_blobs_with_continuation(ctx: TestContext) -> Result<(), Box Result<(), Box Result<(), Box Result<(), Box> { #[recorded::test] async fn test_find_blobs_by_tags_container(ctx: TestContext) -> Result<(), Box> { // Recording Setup - let recording = ctx.recording(); - recording.set_matcher(Matcher::HeaderlessMatcher).await?; - let container_client = get_container_client(recording, true).await?; + ctx.recording() + .set_matcher(Matcher::HeaderlessMatcher) + .await?; + let container_client = get_container_client(ctx.recording(), true).await?; // Create Test Blobs with Tags - let blob1_name = get_blob_name(recording); + let blob1_name = get_blob_name(ctx.recording()); create_test_blob( &container_client.blob_client(blob1_name.clone()), Some(RequestContent::from("hello world".as_bytes().into())), @@ -348,7 +349,7 @@ async fn test_find_blobs_by_tags_container(ctx: TestContext) -> Result<(), Box Result<(), Box Result<(), Box Result<(), container_clients.push(container_client); } - let list_containers_options = BlobServiceClientListContainersSegmentOptions { + let list_containers_options = ServiceClientListContainersSegmentOptions { maxresults: Some(2), ..Default::default() }; diff --git a/sdk/storage/azure_storage_blob/tests/block_blob_client.rs b/sdk/storage/azure_storage_blob/tests/block_blob_client.rs index cb17cc69a9..2e16c95483 100644 --- a/sdk/storage/azure_storage_blob/tests/block_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/block_blob_client.rs @@ -97,7 +97,7 @@ async fn test_block_list(ctx: TestContext) -> Result<(), Box> { assert_eq!(9, content_length.unwrap()); assert_eq!( Bytes::from_static(b"AAABBBCCC"), - response_body.collect().await?.as_ref(), + response_body.collect().await? ); assert_eq!( 3, @@ -124,12 +124,6 @@ async fn test_upload_blob_from_url(ctx: TestContext) -> Result<(), Box Result<(), Box Result<(), Box Result<(), Box Result<(), Box Result<(), Box> { let (status_code, _, response_body) = response.deconstruct(); assert!(status_code.is_success()); assert_eq!(512, content_length.unwrap()); - assert_eq!(data, response_body.collect().await?.to_vec()); + assert_eq!(data, response_body.collect().await?); container_client.delete_container(None).await?; Ok(()) @@ -112,7 +112,7 @@ async fn test_clear_page(ctx: TestContext) -> Result<(), Box> { let (status_code, _, response_body) = response.deconstruct(); assert!(status_code.is_success()); assert_eq!(512, content_length.unwrap()); - assert_eq!(vec![0; 512], response_body.collect().await?.to_vec()); + assert_eq!(vec![0; 512], response_body.collect().await?); container_client.delete_container(None).await?; Ok(()) @@ -159,7 +159,7 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { let (status_code, _, response_body) = response.deconstruct(); assert!(status_code.is_success()); assert_eq!(512, content_length.unwrap()); - assert_eq!(vec![b'A'; 512], response_body.collect().await?.to_vec()); + assert_eq!(vec![b'A'; 512], response_body.collect().await?); container_client.delete_container(None).await?; Ok(()) @@ -232,12 +232,6 @@ async fn test_upload_page_from_url(ctx: TestContext) -> Result<(), Box Result<(), Box Result<(), Box String { /// * `recording` - A reference to a Recording instance. pub fn get_blob_service_client(recording: &Recording) -> Result { let (options, endpoint) = recorded_test_setup(recording); - let service_client_options = BlobServiceClientOptions { + let service_client_options = ServiceClientOptions { client_options: options.clone(), ..Default::default() }; @@ -80,7 +80,7 @@ pub async fn get_container_client( ) -> Result { let container_name = get_container_name(recording); let (options, endpoint) = recorded_test_setup(recording); - let container_client_options = BlobContainerClientOptions { + let container_client_options = ContainerClientOptions { client_options: options.clone(), ..Default::default() };