From aef273a72a125854309bb92d7308cba0786ffb88 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 5 Jun 2025 11:12:24 -0700 Subject: [PATCH 01/30] AppendBlobClient and PageBlobClient first draft --- .../src/clients/append_blob_client.rs | 101 +++++++++++++++++ .../src/clients/blob_client.rs | 24 +++- .../azure_storage_blob/src/clients/mod.rs | 7 +- .../src/clients/page_blob_client.rs | 106 ++++++++++++++++++ sdk/storage/azure_storage_blob/src/lib.rs | 9 +- .../tests/append_blob_client.rs | 51 +++++++++ .../tests/page_blob_client.rs | 51 +++++++++ 7 files changed, 343 insertions(+), 6 deletions(-) create mode 100644 sdk/storage/azure_storage_blob/src/clients/append_blob_client.rs create mode 100644 sdk/storage/azure_storage_blob/src/clients/page_blob_client.rs create mode 100644 sdk/storage/azure_storage_blob/tests/append_blob_client.rs create mode 100644 sdk/storage/azure_storage_blob/tests/page_blob_client.rs 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 new file mode 100644 index 0000000000..3986014862 --- /dev/null +++ b/sdk/storage/azure_storage_blob/src/clients/append_blob_client.rs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use crate::{ + generated::clients::AppendBlobClient as GeneratedAppendBlobClient, + models::{AppendBlobClientCreateOptions, AppendBlobClientCreateResult}, + pipeline::StorageHeadersPolicy, + AppendBlobClientOptions, BlobClientOptions, +}; +use azure_core::{ + credentials::TokenCredential, + http::{ + policies::{BearerTokenCredentialPolicy, Policy}, + RequestContent, Response, Url, + }, + Bytes, Result, +}; +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, +} + +impl AppendBlobClient { + /// Creates a new AppendBlobClient, using Entra ID authentication. + /// + /// # Arguments + /// + /// * `endpoint` - The full URL of the Azure storage account, for example `https://myaccount.blob.core.windows.net/` + /// * `container_name` - The name of the container containing this Append blob. + /// * `blob_name` - The name of the Append blob to interact with. + /// * `credential` - An implementation of [`TokenCredential`] that can provide an Entra ID token to use when authenticating. + /// * `options` - Optional configuration for the client. + pub fn new( + endpoint: &str, + container_name: String, + blob_name: String, + credential: Arc, + 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 oauth_token_policy = BearerTokenCredentialPolicy::new( + credential.clone(), + ["https://storage.azure.com/.default"], + ); + options + .client_options + .per_try_policies + .push(Arc::new(oauth_token_policy) as Arc); + + let client = GeneratedAppendBlobClient::new( + endpoint, + credential.clone(), + container_name.clone(), + blob_name.clone(), + Some(options), + )?; + Ok(Self { + endpoint: endpoint.parse()?, + client, + }) + } + + /// Gets the endpoint of the Storage account this client is connected to. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Gets the container name of the Storage account this client is connected to. + pub fn container_name(&self) -> &str { + &self.client.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 + } + + /// Creates a new Append blob. + /// + /// # Arguments + /// + /// * `content_length` - Total length of the blob data to be uploaded. + /// * `options` - Optional configuration for the request. + pub async fn create( + &self, + content_length: u64, + options: Option>, + ) -> Result> { + self.client.create(content_length, options).await + } +} 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 cf0a42c751..118e494ad9 100644 --- a/sdk/storage/azure_storage_blob/src/clients/blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/blob_client.rs @@ -16,7 +16,7 @@ use crate::{ BlockListType, BlockLookupList, }, pipeline::StorageHeadersPolicy, - BlobClientOptions, BlockBlobClient, + AppendBlobClient, BlobClientOptions, BlockBlobClient, PageBlobClient, }; use azure_core::{ credentials::TokenCredential, @@ -81,6 +81,17 @@ impl BlobClient { }) } + /// Returns a new instance of AppendBlobClient. + /// + /// # Arguments + /// + pub fn append_blob_client(&self) -> AppendBlobClient { + AppendBlobClient { + endpoint: self.client.endpoint.clone(), + client: self.client.get_append_blob_client(), + } + } + /// Returns a new instance of BlockBlobClient. /// /// # Arguments @@ -92,6 +103,17 @@ impl BlobClient { } } + /// Returns a new instance of PageBlobClient. + /// + /// # Arguments + /// + pub fn page_blob_client(&self) -> PageBlobClient { + PageBlobClient { + endpoint: self.client.endpoint.clone(), + client: self.client.get_page_blob_client(), + } + } + /// Gets the endpoint of the Storage account this client is connected to. pub fn endpoint(&self) -> &Url { &self.endpoint diff --git a/sdk/storage/azure_storage_blob/src/clients/mod.rs b/sdk/storage/azure_storage_blob/src/clients/mod.rs index 2b9367ae2e..4b310f4a63 100644 --- a/sdk/storage/azure_storage_blob/src/clients/mod.rs +++ b/sdk/storage/azure_storage_blob/src/clients/mod.rs @@ -3,16 +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. +mod append_blob_client; mod blob_client; mod blob_container_client; mod blob_service_client; mod block_blob_client; +mod page_blob_client; +pub use append_blob_client::AppendBlobClient; pub use blob_client::BlobClient; pub use blob_container_client::BlobContainerClient; pub use blob_service_client::BlobServiceClient; pub use block_blob_client::BlockBlobClient; +pub use page_blob_client::PageBlobClient; pub use crate::generated::clients::{ - BlobClientOptions, BlobContainerClientOptions, BlobServiceClientOptions, BlockBlobClientOptions, + AppendBlobClientOptions, BlobClientOptions, BlobContainerClientOptions, + BlobServiceClientOptions, BlockBlobClientOptions, PageBlobClientOptions, }; 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 new file mode 100644 index 0000000000..9a1a6133db --- /dev/null +++ b/sdk/storage/azure_storage_blob/src/clients/page_blob_client.rs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use crate::{ + generated::clients::PageBlobClient as GeneratedPageBlobClient, + models::{PageBlobClientCreateOptions, PageBlobClientCreateResult}, + pipeline::StorageHeadersPolicy, + BlobClientOptions, PageBlobClientOptions, +}; +use azure_core::{ + credentials::TokenCredential, + http::{ + policies::{BearerTokenCredentialPolicy, Policy}, + RequestContent, Response, Url, + }, + Bytes, Result, +}; +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, +} + +impl PageBlobClient { + /// Creates a new PageBlobClient, using Entra ID authentication. + /// + /// # Arguments + /// + /// * `endpoint` - The full URL of the Azure storage account, for example `https://myaccount.blob.core.windows.net/` + /// * `container_name` - The name of the container containing this Page blob. + /// * `blob_name` - The name of the Page blob to interact with. + /// * `credential` - An implementation of [`TokenCredential`] that can provide an Entra ID token to use when authenticating. + /// * `options` - Optional configuration for the client. + pub fn new( + endpoint: &str, + container_name: String, + blob_name: String, + credential: Arc, + 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 oauth_token_policy = BearerTokenCredentialPolicy::new( + credential.clone(), + ["https://storage.azure.com/.default"], + ); + options + .client_options + .per_try_policies + .push(Arc::new(oauth_token_policy) as Arc); + + let client = GeneratedPageBlobClient::new( + endpoint, + credential.clone(), + container_name.clone(), + blob_name.clone(), + Some(options), + )?; + Ok(Self { + endpoint: endpoint.parse()?, + client, + }) + } + + /// Gets the endpoint of the Storage account this client is connected to. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Gets the container name of the Storage account this client is connected to. + pub fn container_name(&self) -> &str { + &self.client.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 + } + + /// Creates a new Page blob. + /// + /// # Arguments + /// + /// * `content_length` - Total length of the blob data to be uploaded. + /// * `blob_content_length` - The maximum size for the Page blob, up to 1TB. The page blob size must + /// be aligned to a 512-byte boundary. + /// * `options` - Optional parameters for the request. + pub async fn create( + &self, + content_length: u64, + blob_content_length: u64, + options: Option>, + ) -> Result> { + self.client + .create(content_length, blob_content_length, options) + .await + } +} diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index 0e8fa822ae..3967e4cb47 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -15,8 +15,9 @@ pub use clients::*; pub mod models { pub use crate::generated::models::{ - AccessTier, ArchiveStatus, BlobClientDeleteOptions, BlobClientDownloadOptions, - BlobClientDownloadResult, BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, + AccessTier, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, ArchiveStatus, + BlobClientDeleteOptions, BlobClientDownloadOptions, BlobClientDownloadResult, + BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions, BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, @@ -28,7 +29,7 @@ pub mod models { BlockBlobClientGetBlockListOptions, BlockBlobClientStageBlockOptions, BlockBlobClientStageBlockResult, BlockBlobClientUploadOptions, BlockBlobClientUploadResult, BlockList, BlockListType, BlockLookupList, CopyStatus, LeaseState, LeaseStatus, - ListBlobsFlatSegmentResponse, PublicAccessType, RehydratePriority, - StorageServiceProperties, + ListBlobsFlatSegmentResponse, PageBlobClientCreateOptions, PageBlobClientCreateResult, + PublicAccessType, RehydratePriority, StorageServiceProperties, }; } diff --git a/sdk/storage/azure_storage_blob/tests/append_blob_client.rs b/sdk/storage/azure_storage_blob/tests/append_blob_client.rs new file mode 100644 index 0000000000..164530fe71 --- /dev/null +++ b/sdk/storage/azure_storage_blob/tests/append_blob_client.rs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use azure_core_test::{recorded, TestContext}; +use azure_storage_blob::models::{BlobClientGetPropertiesResultHeaders, BlobType}; +use azure_storage_blob_test::{get_blob_name, get_container_client}; +use std::error::Error; + +#[recorded::test] +async fn test_create_append_blob(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let append_blob_client = blob_client.append_blob_client(); + + append_blob_client.create(0, None).await?; + + // Assert + let blob_properties = blob_client.get_properties(None).await?; + let blob_type = blob_properties.blob_type()?; + let content_length = blob_properties.content_length()?; + + assert_eq!(0, content_length.unwrap()); + assert_eq!(BlobType::AppendBlob, blob_type.unwrap()); + + container_client.delete_container(None).await?; + Ok(()) +} + +#[recorded::test] +async fn test_create_append_blob2(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let append_blob_client = blob_client.append_blob_client(); + + append_blob_client.create(0, None).await?; + + // Assert + let blob_properties = blob_client.get_properties(None).await?; + let blob_type = blob_properties.blob_type()?; + let content_length = blob_properties.content_length()?; + + assert_eq!(0, content_length.unwrap()); + assert_eq!(BlobType::AppendBlob, blob_type.unwrap()); + + container_client.delete_container(None).await?; + Ok(()) +} diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs new file mode 100644 index 0000000000..1a2299e1ce --- /dev/null +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use azure_core_test::{recorded, TestContext}; +use azure_storage_blob::models::{BlobClientGetPropertiesResultHeaders, BlobType}; +use azure_storage_blob_test::{get_blob_name, get_container_client}; +use std::error::Error; + +#[recorded::test] +async fn test_create_page_blob(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let page_blob_client = blob_client.page_blob_client(); + + page_blob_client.create(0, 1024, None).await?; + + // Assert + let blob_properties = blob_client.get_properties(None).await?; + let blob_type = blob_properties.blob_type()?; + let content_length = blob_properties.content_length()?; + + assert_eq!(1024, content_length.unwrap()); + assert_eq!(BlobType::PageBlob, blob_type.unwrap()); + + container_client.delete_container(None).await?; + Ok(()) +} + +#[recorded::test] +async fn test_create_page_blob2(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let page_blob_client = blob_client.page_blob_client(); + + page_blob_client.create(0, 1024, None).await?; + + // Assert + let blob_properties = blob_client.get_properties(None).await?; + let blob_type = blob_properties.blob_type()?; + let content_length = blob_properties.content_length()?; + + assert_eq!(1024, content_length.unwrap()); + assert_eq!(BlobType::PageBlob, blob_type.unwrap()); + + container_client.delete_container(None).await?; + Ok(()) +} From 00859d5cfad35ede70f749e3d0cb2a05cdeed3fb Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 5 Jun 2025 11:12:45 -0700 Subject: [PATCH 02/30] nit --- .../tests/append_blob_client.rs | 22 ------------------- .../tests/page_blob_client.rs | 22 ------------------- 2 files changed, 44 deletions(-) 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 164530fe71..8920044303 100644 --- a/sdk/storage/azure_storage_blob/tests/append_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/append_blob_client.rs @@ -27,25 +27,3 @@ async fn test_create_append_blob(ctx: TestContext) -> Result<(), Box> container_client.delete_container(None).await?; Ok(()) } - -#[recorded::test] -async fn test_create_append_blob2(ctx: TestContext) -> Result<(), Box> { - // Recording Setup - let recording = ctx.recording(); - let container_client = get_container_client(recording, true).await?; - let blob_client = container_client.blob_client(get_blob_name(recording)); - let append_blob_client = blob_client.append_blob_client(); - - append_blob_client.create(0, None).await?; - - // Assert - let blob_properties = blob_client.get_properties(None).await?; - let blob_type = blob_properties.blob_type()?; - let content_length = blob_properties.content_length()?; - - assert_eq!(0, content_length.unwrap()); - assert_eq!(BlobType::AppendBlob, blob_type.unwrap()); - - container_client.delete_container(None).await?; - Ok(()) -} diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index 1a2299e1ce..e0182470bb 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -27,25 +27,3 @@ async fn test_create_page_blob(ctx: TestContext) -> Result<(), Box> { container_client.delete_container(None).await?; Ok(()) } - -#[recorded::test] -async fn test_create_page_blob2(ctx: TestContext) -> Result<(), Box> { - // Recording Setup - let recording = ctx.recording(); - let container_client = get_container_client(recording, true).await?; - let blob_client = container_client.blob_client(get_blob_name(recording)); - let page_blob_client = blob_client.page_blob_client(); - - page_blob_client.create(0, 1024, None).await?; - - // Assert - let blob_properties = blob_client.get_properties(None).await?; - let blob_type = blob_properties.blob_type()?; - let content_length = blob_properties.content_length()?; - - assert_eq!(1024, content_length.unwrap()); - assert_eq!(BlobType::PageBlob, blob_type.unwrap()); - - container_client.delete_container(None).await?; - Ok(()) -} From a9808ea3a7be60b9923adc2e6daa87f64afa6941 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 11 Jun 2025 13:22:01 -0700 Subject: [PATCH 03/30] Regenerate against latest version + removed response headers --- .../generated/clients/append_blob_client.rs | 19 +- .../src/generated/clients/blob_client.rs | 63 +- .../clients/blob_container_client.rs | 41 +- .../generated/clients/blob_service_client.rs | 13 +- .../generated/clients/block_blob_client.rs | 38 +- .../src/generated/clients/page_blob_client.rs | 27 +- .../src/generated/models/enums.rs | 7 + .../src/generated/models/header_traits.rs | 1125 ++++++++++++++++- .../src/generated/models/method_options.rs | 37 +- .../src/generated/models/pub_models.rs | 32 + .../azure_storage_blob/tsp-location.yaml | 2 +- 11 files changed, 1277 insertions(+), 127 deletions(-) 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 a9bfe32a7e..fcb6d893f9 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 @@ -116,7 +116,7 @@ impl AppendBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { request.insert_header("content-md5", base64::encode(transactional_content_md5)); @@ -216,7 +216,7 @@ impl AppendBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { request.insert_header("content-md5", base64::encode(transactional_content_md5)); @@ -265,6 +265,9 @@ impl AppendBlobClient { if let Some(encryption_scope) = options.encryption_scope { request.insert_header("x-ms-encryption-scope", encryption_scope); } + if let Some(file_request_intent) = options.file_request_intent { + request.insert_header("x-ms-file-request-intent", file_request_intent.to_string()); + } if let Some(if_tags) = options.if_tags { request.insert_header("x-ms-if-tags", if_tags); } @@ -312,11 +315,9 @@ impl AppendBlobClient { /// /// # Arguments /// - /// * `content_length` - The length of the request. /// * `options` - Optional parameters for the request. pub async fn create( &self, - content_length: u64, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); @@ -326,15 +327,13 @@ impl AppendBlobClient { 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("AppendBlob"); if let Some(timeout) = options.timeout { url.query_pairs_mut() .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); - request.insert_header("content-length", content_length.to_string()); - request.insert_header("content-type", "application/xml"); + request.insert_header("accept", "application/xml"); + request.insert_header("content-length", "0"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } @@ -443,7 +442,7 @@ impl AppendBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -478,7 +477,7 @@ impl Default for AppendBlobClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2025-11-05"), } } } 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 974e609213..e1e7a55689 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 @@ -11,7 +11,7 @@ use crate::generated::{ BlobClientBreakLeaseResult, BlobClientChangeLeaseOptions, BlobClientChangeLeaseResult, BlobClientCopyFromUrlOptions, BlobClientCopyFromUrlResult, BlobClientCreateSnapshotOptions, BlobClientCreateSnapshotResult, BlobClientDeleteImmutabilityPolicyOptions, - BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteOptions, + BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteOptions, BlobClientDeleteResult, BlobClientDownloadOptions, BlobClientDownloadResult, BlobClientGetAccountInfoOptions, BlobClientGetAccountInfoResult, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, BlobClientGetTagsOptions, BlobClientReleaseLeaseOptions, @@ -19,8 +19,9 @@ use crate::generated::{ BlobClientSetExpiryOptions, BlobClientSetExpiryResult, BlobClientSetImmutabilityPolicyOptions, BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldOptions, BlobClientSetLegalHoldResult, BlobClientSetMetadataOptions, - BlobClientSetPropertiesOptions, BlobClientSetTagsOptions, BlobClientSetTagsResult, - BlobClientSetTierOptions, BlobClientStartCopyFromUrlOptions, + BlobClientSetMetadataResult, BlobClientSetPropertiesOptions, BlobClientSetPropertiesResult, + BlobClientSetTagsOptions, BlobClientSetTagsResult, BlobClientSetTierOptions, + BlobClientSetTierResult, BlobClientStartCopyFromUrlOptions, BlobClientStartCopyFromUrlResult, BlobClientUndeleteOptions, BlobClientUndeleteResult, BlobExpiryOptions, BlobTags, }, @@ -134,7 +135,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -171,7 +172,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -229,7 +230,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -288,7 +289,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -346,7 +347,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -379,6 +380,9 @@ impl BlobClient { if let Some(encryption_scope) = options.encryption_scope { request.insert_header("x-ms-encryption-scope", encryption_scope); } + if let Some(file_request_intent) = options.file_request_intent { + request.insert_header("x-ms-file-request-intent", file_request_intent.to_string()); + } if let Some(if_tags) = options.if_tags { request.insert_header("x-ms-if-tags", if_tags); } @@ -458,7 +462,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -524,7 +528,7 @@ impl BlobClient { pub async fn delete( &self, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -547,7 +551,7 @@ impl BlobClient { url.query_pairs_mut().append_pair("versionid", &version_id); } let mut request = Request::new(url, Method::Delete); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -609,7 +613,7 @@ impl BlobClient { url.query_pairs_mut().append_pair("versionid", &version_id); } let mut request = Request::new(url, Method::Delete); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -730,7 +734,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -800,8 +804,7 @@ impl BlobClient { url.query_pairs_mut().append_pair("versionid", &version_id); } let mut request = Request::new(url, Method::Head); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", ""); + request.insert_header("accept", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } @@ -913,7 +916,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -968,7 +971,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -1020,7 +1023,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -1062,7 +1065,7 @@ impl BlobClient { url.query_pairs_mut().append_pair("versionid", &version_id); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_unmodified_since) = options.if_unmodified_since { request.insert_header( @@ -1119,7 +1122,7 @@ impl BlobClient { url.query_pairs_mut().append_pair("versionid", &version_id); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -1137,7 +1140,7 @@ impl BlobClient { pub async fn set_metadata( &self, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -1151,7 +1154,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -1209,7 +1212,7 @@ impl BlobClient { pub async fn set_properties( &self, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -1225,7 +1228,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -1300,7 +1303,7 @@ impl BlobClient { url.query_pairs_mut().append_pair("versionid", &version_id); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); if let Some(transactional_content_md5) = options.transactional_content_md5 { request.insert_header("content-md5", base64::encode(transactional_content_md5)); } @@ -1337,7 +1340,7 @@ impl BlobClient { &self, tier: AccessTier, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -1357,7 +1360,7 @@ impl BlobClient { url.query_pairs_mut().append_pair("versionid", &version_id); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-access-tier", tier.to_string()); if let Some(client_request_id) = options.client_request_id { @@ -1401,7 +1404,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -1507,7 +1510,7 @@ impl BlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -1521,7 +1524,7 @@ impl Default for BlobClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2025-11-05"), } } } diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs index 36895fc8b0..c47712d880 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs @@ -9,7 +9,8 @@ use crate::generated::{ BlobContainerClientAcquireLeaseOptions, BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseOptions, BlobContainerClientBreakLeaseResult, BlobContainerClientChangeLeaseOptions, BlobContainerClientChangeLeaseResult, - BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, + BlobContainerClientCreateOptions, BlobContainerClientCreateResult, + BlobContainerClientDeleteOptions, BlobContainerClientDeleteResult, BlobContainerClientFilterBlobsOptions, BlobContainerClientGetAccessPolicyOptions, BlobContainerClientGetAccountInfoOptions, BlobContainerClientGetAccountInfoResult, BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, @@ -20,8 +21,8 @@ use crate::generated::{ BlobContainerClientRenewLeaseResult, BlobContainerClientRestoreOptions, BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyOptions, BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetMetadataOptions, - FilterBlobSegment, ListBlobsFlatSegmentResponse, ListBlobsHierarchySegmentResponse, - SignedIdentifier, + BlobContainerClientSetMetadataResult, FilterBlobSegment, ListBlobsFlatSegmentResponse, + ListBlobsHierarchySegmentResponse, SignedIdentifier, }, }; use azure_core::{ @@ -124,7 +125,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", date::to_rfc7231(&if_modified_since)); @@ -171,7 +172,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", date::to_rfc7231(&if_modified_since)); @@ -219,7 +220,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", date::to_rfc7231(&if_modified_since)); @@ -248,7 +249,7 @@ impl BlobContainerClient { pub async fn create( &self, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -259,7 +260,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(access) = options.access { request.insert_header("x-ms-blob-public-access", access.to_string()); @@ -294,7 +295,7 @@ impl BlobContainerClient { pub async fn delete( &self, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -305,7 +306,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Delete); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", date::to_rfc7231(&if_modified_since)); @@ -431,7 +432,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -475,7 +476,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -695,7 +696,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", date::to_rfc7231(&if_modified_since)); @@ -737,7 +738,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -775,7 +776,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", date::to_rfc7231(&if_modified_since)); @@ -815,7 +816,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -854,7 +855,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", date::to_rfc7231(&if_modified_since)); @@ -887,7 +888,7 @@ impl BlobContainerClient { pub async fn set_metadata( &self, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -900,7 +901,7 @@ impl BlobContainerClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", date::to_rfc7231(&if_modified_since)); @@ -925,7 +926,7 @@ impl Default for BlobContainerClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2025-11-05"), } } } diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs index a39ffc5f5d..2ec145cce6 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs @@ -10,8 +10,9 @@ use crate::generated::{ BlobServiceClientGetAccountInfoResult, BlobServiceClientGetPropertiesOptions, BlobServiceClientGetStatisticsOptions, BlobServiceClientGetUserDelegationKeyOptions, BlobServiceClientListContainersSegmentOptions, BlobServiceClientSetPropertiesOptions, - FilterBlobSegment, KeyInfo, ListContainersSegmentResponse, StorageServiceProperties, - StorageServiceStats, UserDelegationKey, + BlobServiceClientSetPropertiesResult, FilterBlobSegment, KeyInfo, + ListContainersSegmentResponse, StorageServiceProperties, StorageServiceStats, + UserDelegationKey, }, }; use azure_core::{ @@ -153,7 +154,7 @@ impl BlobServiceClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -361,7 +362,7 @@ impl BlobServiceClient { &self, storage_service_properties: RequestContent, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -373,7 +374,7 @@ impl BlobServiceClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -388,7 +389,7 @@ impl Default for BlobServiceClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2025-11-05"), } } } 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 4c3380885c..bd8f16ccea 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 @@ -122,7 +122,7 @@ impl BlockBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); if let Some(transactional_content_md5) = options.transactional_content_md5 { request.insert_header("content-md5", base64::encode(transactional_content_md5)); } @@ -299,12 +299,11 @@ impl BlockBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { request.insert_header("content-md5", base64::encode(transactional_content_md5)); } - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } @@ -373,6 +372,9 @@ impl BlockBlobClient { if let Some(encryption_scope) = options.encryption_scope { request.insert_header("x-ms-encryption-scope", encryption_scope); } + if let Some(file_request_intent) = options.file_request_intent { + request.insert_header("x-ms-file-request-intent", file_request_intent.to_string()); + } if let Some(if_tags) = options.if_tags { request.insert_header("x-ms-if-tags", if_tags); } @@ -520,7 +522,7 @@ impl BlockBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { request.insert_header("content-md5", base64::encode(transactional_content_md5)); @@ -553,6 +555,15 @@ impl BlockBlobClient { if let Some(lease_id) = options.lease_id { request.insert_header("x-ms-lease-id", lease_id); } + if let Some(structured_body_type) = options.structured_body_type { + request.insert_header("x-ms-structured-body", structured_body_type); + } + if let Some(structured_content_length) = options.structured_content_length { + request.insert_header( + "x-ms-structured-content-length", + structured_content_length.to_string(), + ); + } request.insert_header("x-ms-version", &self.version); request.set_body(body); self.pipeline.send(&ctx, &mut request).await @@ -593,7 +604,7 @@ impl BlockBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { @@ -618,6 +629,9 @@ impl BlockBlobClient { if let Some(encryption_scope) = options.encryption_scope { request.insert_header("x-ms-encryption-scope", encryption_scope); } + if let Some(file_request_intent) = options.file_request_intent { + request.insert_header("x-ms-file-request-intent", file_request_intent.to_string()); + } if let Some(lease_id) = options.lease_id { request.insert_header("x-ms-lease-id", lease_id); } @@ -681,13 +695,12 @@ impl BlockBlobClient { 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"); if let Some(timeout) = options.timeout { url.query_pairs_mut() .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { request.insert_header("content-md5", base64::encode(transactional_content_md5)); @@ -780,6 +793,15 @@ impl BlockBlobClient { request.insert_header(format!("x-ms-meta-{}", k), v); } } + if let Some(structured_body_type) = options.structured_body_type { + request.insert_header("x-ms-structured-body", structured_body_type); + } + if let Some(structured_content_length) = options.structured_content_length { + request.insert_header( + "x-ms-structured-content-length", + structured_content_length.to_string(), + ); + } if let Some(blob_tags_string) = options.blob_tags_string { request.insert_header("x-ms-tags", blob_tags_string); } @@ -793,7 +815,7 @@ impl Default for BlockBlobClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2025-11-05"), } } } 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 5e2ffc6ba9..a7ead730e5 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 @@ -121,9 +121,8 @@ impl PageBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } @@ -219,7 +218,7 @@ impl PageBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -251,13 +250,11 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `content_length` - The length of the request. /// * `blob_content_length` - This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must /// be aligned to a 512-byte boundary. /// * `options` - Optional parameters for the request. pub async fn create( &self, - content_length: u64, blob_content_length: u64, options: Option>, ) -> Result> { @@ -268,15 +265,13 @@ impl PageBlobClient { 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("PageBlob"); if let Some(timeout) = options.timeout { url.query_pairs_mut() .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); - request.insert_header("content-length", content_length.to_string()); - request.insert_header("content-type", ""); + request.insert_header("accept", "application/xml"); + request.insert_header("content-length", "0"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } @@ -538,7 +533,7 @@ impl PageBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -612,7 +607,7 @@ impl PageBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); @@ -680,7 +675,7 @@ impl PageBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { request.insert_header("content-md5", base64::encode(transactional_content_md5)); @@ -803,9 +798,8 @@ impl PageBlobClient { .append_pair("timeout", &timeout.to_string()); } let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); + request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } @@ -843,6 +837,9 @@ impl PageBlobClient { if let Some(encryption_scope) = options.encryption_scope { request.insert_header("x-ms-encryption-scope", encryption_scope); } + if let Some(file_request_intent) = options.file_request_intent { + request.insert_header("x-ms-file-request-intent", file_request_intent.to_string()); + } if let Some(if_sequence_number_equal_to) = options.if_sequence_number_equal_to { request.insert_header( "x-ms-if-sequence-number-eq", @@ -910,7 +907,7 @@ impl Default for PageBlobClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2025-11-05"), } } } diff --git a/sdk/storage/azure_storage_blob/src/generated/models/enums.rs b/sdk/storage/azure_storage_blob/src/generated/models/enums.rs index e9245214c8..e38b41e502 100644 --- a/sdk/storage/azure_storage_blob/src/generated/models/enums.rs +++ b/sdk/storage/azure_storage_blob/src/generated/models/enums.rs @@ -151,6 +151,13 @@ create_extensible_enum!( (AES256, "AES256") ); +create_extensible_enum!( + #[doc = r#"/// The file share token intent types."#] + FileShareTokenIntent, + #[doc = r#"/// The file share token intent is backup."#] + (Backup, "backup") +); + create_extensible_enum!( #[doc = r#"/// The filter blobs includes."#] FilterBlobsIncludeItem, 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 cb132ce3a1..9074d5d182 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 @@ -9,25 +9,29 @@ use super::{ ArchiveStatus, BlobClientAbortCopyFromUrlResult, BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, BlobClientCopyFromUrlResult, BlobClientCreateSnapshotResult, BlobClientDeleteImmutabilityPolicyResult, - BlobClientDownloadResult, BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, - BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, BlobClientSetExpiryResult, - BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldResult, BlobClientSetTagsResult, - BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, + BlobClientDeleteResult, BlobClientDownloadResult, BlobClientGetAccountInfoResult, + BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, + BlobClientSetExpiryResult, BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldResult, + BlobClientSetMetadataResult, BlobClientSetPropertiesResult, BlobClientSetTagsResult, + BlobClientSetTierResult, BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult, - BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult, + BlobContainerClientChangeLeaseResult, BlobContainerClientCreateResult, + BlobContainerClientDeleteResult, BlobContainerClientGetAccountInfoResult, BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult, BlobContainerClientRenameResult, BlobContainerClientRenewLeaseResult, BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyResult, - BlobImmutabilityPolicyMode, BlobServiceClientGetAccountInfoResult, BlobTags, BlobType, - BlockBlobClientCommitBlockListResult, BlockBlobClientPutBlobFromUrlResult, + BlobContainerClientSetMetadataResult, BlobImmutabilityPolicyMode, + BlobServiceClientGetAccountInfoResult, BlobServiceClientSetPropertiesResult, BlobTags, + BlobType, BlockBlobClientCommitBlockListResult, BlockBlobClientPutBlobFromUrlResult, BlockBlobClientQueryResult, BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult, BlockBlobClientUploadResult, BlockList, CopyStatus, FilterBlobSegment, LeaseDuration, LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse, - ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult, - PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult, PageBlobClientResizeResult, + ListBlobsHierarchySegmentResponse, ListContainersSegmentResponse, + PageBlobClientClearPagesResult, PageBlobClientCopyIncrementalResult, + PageBlobClientCreateResult, PageBlobClientResizeResult, PageBlobClientUpdateSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList, PublicAccessType, RehydratePriority, - SignedIdentifier, SkuName, StorageServiceStats, UserDelegationKey, + SignedIdentifier, SkuName, StorageServiceProperties, StorageServiceStats, UserDelegationKey, }; use azure_core::{ base64, date, @@ -56,6 +60,7 @@ const BLOB_SEALED: HeaderName = HeaderName::from_static("x-ms-blob-sealed"); const BLOB_SEQUENCE_NUMBER: HeaderName = HeaderName::from_static("x-ms-blob-sequence-number"); const BLOB_TYPE: HeaderName = HeaderName::from_static("x-ms-blob-type"); const CACHE_CONTROL: HeaderName = HeaderName::from_static("cache-control"); +const CLIENT_REQUEST_ID: HeaderName = HeaderName::from_static("x-ms-client-request-id"); const CONTENT_CRC64: HeaderName = HeaderName::from_static("x-ms-content-crc64"); const CONTENT_DISPOSITION: HeaderName = HeaderName::from_static("content-disposition"); const CONTENT_ENCODING: HeaderName = HeaderName::from_static("content-encoding"); @@ -69,6 +74,8 @@ const COPY_DESTINATION_SNAPSHOT: HeaderName = const COPY_ID: HeaderName = HeaderName::from_static("x-ms-copy-id"); const COPY_PROGRESS: HeaderName = HeaderName::from_static("x-ms-copy-progress"); const COPY_SOURCE: HeaderName = HeaderName::from_static("x-ms-copy-source"); +const COPY_SOURCE_ERROR_CODE: HeaderName = HeaderName::from_static("x-ms-copy-source-error-code"); +const COPY_SOURCE_STATUS_CODE: HeaderName = HeaderName::from_static("x-ms-copy-source-status-code"); const COPY_STATUS: HeaderName = HeaderName::from_static("x-ms-copy-status"); const COPY_STATUS_DESCRIPTION: HeaderName = HeaderName::from_static("x-ms-copy-status-description"); const CREATION_TIME: HeaderName = HeaderName::from_static("x-ms-creation-time"); @@ -104,11 +111,15 @@ const META: &str = "x-ms-meta-"; const OR: &str = "x-ms-or-"; const OR_POLICY_ID: HeaderName = HeaderName::from_static("x-ms-or-policy-id"); const REHYDRATE_PRIORITY: HeaderName = HeaderName::from_static("x-ms-rehydrate-priority"); +const REQUEST_ID: HeaderName = HeaderName::from_static("x-ms-request-id"); const REQUEST_SERVER_ENCRYPTED: HeaderName = HeaderName::from_static("x-ms-request-server-encrypted"); +const SERVER_ENCRYPTED: HeaderName = HeaderName::from_static("x-ms-server-encrypted"); const SKU_NAME: HeaderName = HeaderName::from_static("x-ms-sku-name"); const SNAPSHOT: HeaderName = HeaderName::from_static("x-ms-snapshot"); const STRUCTURED_BODY: HeaderName = HeaderName::from_static("x-ms-structured-body"); +const STRUCTURED_CONTENT_LENGTH: HeaderName = + HeaderName::from_static("x-ms-structured-content-length"); const TAG_COUNT: HeaderName = HeaderName::from_static("x-ms-tag-count"); const VERSION_ID: HeaderName = HeaderName::from_static("x-ms-version-id"); @@ -120,9 +131,13 @@ pub trait AppendBlobClientAppendBlockFromUrlResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn blob_append_offset(&self) -> Result>; fn blob_committed_block_count(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; + fn copy_source_error_code(&self) -> Result>; + fn copy_source_status_code(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; } @@ -163,6 +178,11 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -170,6 +190,16 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders }) } + /// The error code for the copy source. + fn copy_source_error_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) + } + + /// The status code for the copy source. + fn copy_source_status_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) + } + /// 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> { @@ -183,6 +213,11 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -198,9 +233,11 @@ pub trait AppendBlobClientAppendBlockResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn blob_append_offset(&self) -> Result>; fn blob_committed_block_count(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; fn structured_body_type(&self) -> Result>; } @@ -240,6 +277,11 @@ impl AppendBlobClientAppendBlockResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -260,6 +302,11 @@ impl AppendBlobClientAppendBlockResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -275,7 +322,6 @@ impl AppendBlobClientAppendBlockResultHeaders for Response Result>>; - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; @@ -291,11 +337,6 @@ impl AppendBlobClientCreateResultHeaders for Response Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| date::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| { @@ -340,6 +381,8 @@ pub trait AppendBlobClientSealResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn is_sealed(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl AppendBlobClientSealResultHeaders for Response { @@ -364,11 +407,23 @@ impl AppendBlobClientSealResultHeaders for Response fn is_sealed(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_SEALED) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::abort_copy_from_url()` pub trait BlobClientAbortCopyFromUrlResultHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientAbortCopyFromUrlResultHeaders for Response { @@ -376,6 +431,16 @@ impl BlobClientAbortCopyFromUrlResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::acquire_lease()` @@ -383,7 +448,9 @@ pub trait BlobClientAcquireLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientAcquireLeaseResultHeaders for Response { @@ -404,10 +471,20 @@ impl BlobClientAcquireLeaseResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::break_lease()` @@ -415,7 +492,9 @@ pub trait BlobClientBreakLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn lease_time(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientBreakLeaseResultHeaders for Response { @@ -436,10 +515,20 @@ impl BlobClientBreakLeaseResultHeaders for Response Headers::get_optional_as(self.headers(), &ETAG) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Approximate time remaining in the lease period, in seconds. fn lease_time(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_TIME) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::change_lease()` @@ -447,7 +536,9 @@ pub trait BlobClientChangeLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientChangeLeaseResultHeaders for Response { @@ -468,10 +559,20 @@ impl BlobClientChangeLeaseResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::copy_from_url()` @@ -480,10 +581,14 @@ pub trait BlobClientCopyFromUrlResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn copy_id(&self) -> Result>; + fn copy_source_error_code(&self) -> Result>; + fn copy_source_status_code(&self) -> Result>; fn copy_status(&self) -> Result>; fn encryption_scope(&self) -> Result>; + fn request_id(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -511,6 +616,11 @@ impl BlobClientCopyFromUrlResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -524,6 +634,16 @@ impl BlobClientCopyFromUrlResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) + } + + /// The status code for the copy source. + fn copy_source_status_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) + } + /// State of the copy operation identified by x-ms-copy-id. fn copy_status(&self) -> Result> { Headers::get_optional_as(self.headers(), ©_STATUS) @@ -536,6 +656,11 @@ impl BlobClientCopyFromUrlResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } + /// 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> { @@ -548,6 +673,8 @@ pub trait BlobClientCreateSnapshotResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; fn snapshot(&self) -> Result>; fn version_id(&self) -> Result>; @@ -571,6 +698,16 @@ impl BlobClientCreateSnapshotResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -593,6 +730,8 @@ impl BlobClientCreateSnapshotResultHeaders for Response Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientDeleteImmutabilityPolicyResultHeaders @@ -602,6 +741,40 @@ impl BlobClientDeleteImmutabilityPolicyResultHeaders fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } +} + +/// Provides access to typed response headers for `BlobClient::delete()` +pub trait BlobClientDeleteResultHeaders: private::Sealed { + fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; +} + +impl BlobClientDeleteResultHeaders 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| date::parse_rfc7231(h.as_str())) + } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::download()` @@ -614,6 +787,7 @@ pub trait BlobClientDownloadResultHeaders: private::Sealed { 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 blob_committed_block_count(&self) -> Result>; @@ -621,6 +795,7 @@ pub trait BlobClientDownloadResultHeaders: private::Sealed { fn is_sealed(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; fn blob_type(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn copy_completion_time(&self) -> Result>; fn copy_id(&self) -> Result>; @@ -642,7 +817,10 @@ pub trait BlobClientDownloadResultHeaders: private::Sealed { fn metadata(&self) -> Result>; fn object_replication_rules(&self) -> Result>; fn object_replication_policy_id(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; + fn structured_body_type(&self) -> Result>; + fn structured_content_length(&self) -> Result>; fn tag_count(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -693,6 +871,11 @@ impl BlobClientDownloadResultHeaders for Response { 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| date::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| { @@ -734,6 +917,11 @@ impl BlobClientDownloadResultHeaders for Response { Headers::get_optional_as(self.headers(), &BLOB_TYPE) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -881,10 +1069,26 @@ impl BlobClientDownloadResultHeaders for Response { Headers::get_optional_as(self.headers(), &OR_POLICY_ID) } + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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) + Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED) + } + + /// Indicates the response body contains a structured message and specifies the message schema version and properties. + fn structured_body_type(&self) -> Result> { + Headers::get_optional_as(self.headers(), &STRUCTURED_BODY) + } + + /// The length of the blob/file content inside the message body when the response body is returned as a structured message. + /// Will always be smaller than Content-Length. + fn structured_content_length(&self) -> Result> { + Headers::get_optional_as(self.headers(), &STRUCTURED_CONTENT_LENGTH) } /// The number of tags associated with the blob @@ -903,7 +1107,9 @@ impl BlobClientDownloadResultHeaders for Response { pub trait BlobClientGetAccountInfoResultHeaders: private::Sealed { fn date(&self) -> Result>; fn account_kind(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn is_hierarchical_namespace_enabled(&self) -> Result>; + fn request_id(&self) -> Result>; fn sku_name(&self) -> Result>; } @@ -918,11 +1124,21 @@ impl BlobClientGetAccountInfoResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// 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) } + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } + /// Identifies the sku name of the account fn sku_name(&self) -> Result> { Headers::get_optional_as(self.headers(), &SKU_NAME) @@ -931,12 +1147,14 @@ impl BlobClientGetAccountInfoResultHeaders for Response 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 date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn tier(&self) -> Result>; @@ -977,6 +1195,11 @@ pub trait BlobClientGetPropertiesResultHeaders: private::Sealed { } impl BlobClientGetPropertiesResultHeaders for Response { + /// 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) @@ -1011,6 +1234,11 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| date::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| { @@ -1235,7 +1463,7 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) + Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED) } /// The number of tags associated with the blob @@ -1255,6 +1483,8 @@ pub trait BlobClientReleaseLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientReleaseLeaseResultHeaders for Response { @@ -1274,6 +1504,16 @@ impl BlobClientReleaseLeaseResultHeaders for Response Result> { Headers::get_optional_as(self.headers(), &ETAG) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::renew_lease()` @@ -1281,7 +1521,9 @@ pub trait BlobClientRenewLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientRenewLeaseResultHeaders for Response { @@ -1302,10 +1544,20 @@ impl BlobClientRenewLeaseResultHeaders for Response Headers::get_optional_as(self.headers(), &ETAG) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::set_expiry()` @@ -1313,6 +1565,8 @@ pub trait BlobClientSetExpiryResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientSetExpiryResultHeaders for Response { @@ -1332,13 +1586,25 @@ impl BlobClientSetExpiryResultHeaders for Response { fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::set_immutability_policy()` pub trait BlobClientSetImmutabilityPolicyResultHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn immutability_policy_mode(&self) -> Result>; fn immutability_policy_expires_on(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientSetImmutabilityPolicyResultHeaders @@ -1349,6 +1615,11 @@ impl BlobClientSetImmutabilityPolicyResultHeaders Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Indicates the immutability policy mode of the blob. fn immutability_policy_mode(&self) -> Result> { Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE) @@ -1360,12 +1631,19 @@ impl BlobClientSetImmutabilityPolicyResultHeaders date::parse_rfc7231(h.as_str()) }) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::set_legal_hold()` pub trait BlobClientSetLegalHoldResultHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn legal_hold(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientSetLegalHoldResultHeaders for Response { @@ -1374,15 +1652,138 @@ impl BlobClientSetLegalHoldResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Specifies the legal hold status to set on the blob. fn legal_hold(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEGAL_HOLD) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } +} + +/// Provides access to typed response headers for `BlobClient::set_metadata()` +pub trait BlobClientSetMetadataResultHeaders: private::Sealed { + fn date(&self) -> Result>; + fn last_modified(&self) -> Result>; + fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn encryption_key_sha256(&self) -> Result>; + fn encryption_scope(&self) -> Result>; + fn request_id(&self) -> Result>; + fn is_server_encrypted(&self) -> Result>; + fn version_id(&self) -> Result>; +} + +impl BlobClientSetMetadataResultHeaders 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| date::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| { + date::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) + } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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) + } + + /// 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) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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) + } + + /// 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 `BlobClient::set_properties()` +pub trait BlobClientSetPropertiesResultHeaders: private::Sealed { + fn date(&self) -> Result>; + fn last_modified(&self) -> Result>; + fn etag(&self) -> Result>; + fn blob_sequence_number(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; +} + +impl BlobClientSetPropertiesResultHeaders 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| date::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| { + date::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 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) + } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::set_tags()` pub trait BlobClientSetTagsResultHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientSetTagsResultHeaders for Response { @@ -1390,6 +1791,34 @@ impl BlobClientSetTagsResultHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } +} + +/// Provides access to typed response headers for `BlobClient::set_tier()` +pub trait BlobClientSetTierResultHeaders: private::Sealed { + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; +} + +impl BlobClientSetTierResultHeaders for Response { + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobClient::start_copy_from_url()` @@ -1397,8 +1826,12 @@ pub trait BlobClientStartCopyFromUrlResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn copy_id(&self) -> Result>; + fn copy_source_error_code(&self) -> Result>; + fn copy_source_status_code(&self) -> Result>; fn copy_status(&self) -> Result>; + fn request_id(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -1420,17 +1853,37 @@ impl BlobClientStartCopyFromUrlResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// 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) } + /// The error code for the copy source. + fn copy_source_error_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) + } + + /// The status code for the copy source. + fn copy_source_status_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) + } + /// State of the copy operation identified by x-ms-copy-id. fn copy_status(&self) -> Result> { Headers::get_optional_as(self.headers(), ©_STATUS) } + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } + /// 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> { @@ -1441,6 +1894,8 @@ impl BlobClientStartCopyFromUrlResultHeaders for Response Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobClientUndeleteResultHeaders for Response { @@ -1448,6 +1903,16 @@ impl BlobClientUndeleteResultHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::acquire_lease()` @@ -1455,7 +1920,9 @@ pub trait BlobContainerClientAcquireLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobContainerClientAcquireLeaseResultHeaders @@ -1478,10 +1945,20 @@ impl BlobContainerClientAcquireLeaseResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::break_lease()` @@ -1489,8 +1966,10 @@ pub trait BlobContainerClientBreakLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; fn lease_time(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobContainerClientBreakLeaseResultHeaders for Response { @@ -1511,6 +1990,11 @@ impl BlobContainerClientBreakLeaseResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) @@ -1520,6 +2004,11 @@ impl BlobContainerClientBreakLeaseResultHeaders for Response Result> { Headers::get_optional_as(self.headers(), &LEASE_TIME) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::change_lease()` @@ -1527,7 +2016,9 @@ pub trait BlobContainerClientChangeLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobContainerClientChangeLeaseResultHeaders @@ -1550,17 +2041,91 @@ impl BlobContainerClientChangeLeaseResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } +} + +/// Provides access to typed response headers for `BlobContainerClient::create()` +pub trait BlobContainerClientCreateResultHeaders: private::Sealed { + fn date(&self) -> Result>; + fn last_modified(&self) -> Result>; + fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; +} + +impl BlobContainerClientCreateResultHeaders 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| date::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| { + date::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) + } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } +} + +/// Provides access to typed response headers for `BlobContainerClient::delete()` +pub trait BlobContainerClientDeleteResultHeaders: private::Sealed { + fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; +} + +impl BlobContainerClientDeleteResultHeaders 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| date::parse_rfc7231(h.as_str())) + } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::get_account_info()` pub trait BlobContainerClientGetAccountInfoResultHeaders: private::Sealed { fn date(&self) -> Result>; fn account_kind(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn is_hierarchical_namespace_enabled(&self) -> Result>; + fn request_id(&self) -> Result>; fn sku_name(&self) -> Result>; } @@ -1577,11 +2142,21 @@ impl BlobContainerClientGetAccountInfoResultHeaders Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// 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) } + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } + /// Identifies the sku name of the account fn sku_name(&self) -> Result> { Headers::get_optional_as(self.headers(), &SKU_NAME) @@ -1590,9 +2165,11 @@ impl BlobContainerClientGetAccountInfoResultHeaders /// Provides access to typed response headers for `BlobContainerClient::get_properties()` pub trait BlobContainerClientGetPropertiesResultHeaders: private::Sealed { + fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn access(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn default_encryption_scope(&self) -> Result>; fn prevent_encryption_scope_override(&self) -> Result>; fn has_immutability_policy(&self) -> Result>; @@ -1602,11 +2179,17 @@ pub trait BlobContainerClientGetPropertiesResultHeaders: private::Sealed { fn lease_state(&self) -> Result>; fn lease_status(&self) -> Result>; fn metadata(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobContainerClientGetPropertiesResultHeaders 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| date::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| { @@ -1624,6 +2207,11 @@ impl BlobContainerClientGetPropertiesResultHeaders Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// The default encryption scope for the container. fn default_encryption_scope(&self) -> Result> { Headers::get_optional_as(self.headers(), &DEFAULT_ENCRYPTION_SCOPE) @@ -1677,6 +2265,11 @@ impl BlobContainerClientGetPropertiesResultHeaders } Ok(values) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::release_lease()` @@ -1684,6 +2277,8 @@ pub trait BlobContainerClientReleaseLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobContainerClientReleaseLeaseResultHeaders @@ -1705,11 +2300,23 @@ impl BlobContainerClientReleaseLeaseResultHeaders fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::rename()` pub trait BlobContainerClientRenameResultHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobContainerClientRenameResultHeaders for Response { @@ -1717,6 +2324,16 @@ impl BlobContainerClientRenameResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::renew_lease()` @@ -1724,7 +2341,9 @@ pub trait BlobContainerClientRenewLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobContainerClientRenewLeaseResultHeaders for Response { @@ -1745,15 +2364,27 @@ impl BlobContainerClientRenewLeaseResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::restore()` pub trait BlobContainerClientRestoreResultHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobContainerClientRestoreResultHeaders for Response { @@ -1761,6 +2392,16 @@ impl BlobContainerClientRestoreResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::set_access_policy()` @@ -1768,6 +2409,8 @@ pub trait BlobContainerClientSetAccessPolicyResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobContainerClientSetAccessPolicyResultHeaders @@ -1789,13 +2432,65 @@ impl BlobContainerClientSetAccessPolicyResultHeaders fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } +} + +/// Provides access to typed response headers for `BlobContainerClient::set_metadata()` +pub trait BlobContainerClientSetMetadataResultHeaders: private::Sealed { + fn date(&self) -> Result>; + fn last_modified(&self) -> Result>; + fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; +} + +impl BlobContainerClientSetMetadataResultHeaders + 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| date::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| { + date::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) + } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobServiceClient::get_account_info()` pub trait BlobServiceClientGetAccountInfoResultHeaders: private::Sealed { fn date(&self) -> Result>; fn account_kind(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn is_hierarchical_namespace_enabled(&self) -> Result>; + fn request_id(&self) -> Result>; fn sku_name(&self) -> Result>; } @@ -1812,20 +2507,52 @@ impl BlobServiceClientGetAccountInfoResultHeaders Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// 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) } + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } + /// 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 `BlobServiceClient::set_properties()` +pub trait BlobServiceClientSetPropertiesResultHeaders: private::Sealed { + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; +} + +impl BlobServiceClientSetPropertiesResultHeaders + for Response +{ + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } +} + /// Provides access to typed response headers for `BlobClient::get_tags()` pub trait BlobTagsHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlobTagsHeaders for Response { @@ -1833,16 +2560,29 @@ impl BlobTagsHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlockBlobClient::commit_block_list()` pub trait BlockBlobClientCommitBlockListResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; + fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -1856,6 +2596,11 @@ impl BlockBlobClientCommitBlockListResultHeaders Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::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| date::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| { @@ -1868,6 +2613,11 @@ impl BlockBlobClientCommitBlockListResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -1888,6 +2638,11 @@ impl BlockBlobClientCommitBlockListResultHeaders Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -1907,6 +2662,8 @@ pub trait BlockBlobClientPutBlobFromUrlResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn copy_source_error_code(&self) -> Result>; + fn copy_source_status_code(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; @@ -1937,6 +2694,16 @@ impl BlockBlobClientPutBlobFromUrlResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) + } + + /// The status code for the copy source. + fn copy_source_status_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) + } + /// 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> { @@ -1980,6 +2747,7 @@ pub trait BlockBlobClientQueryResultHeaders: private::Sealed { fn blob_content_md5(&self) -> Result>>; fn blob_sequence_number(&self) -> Result>; fn blob_type(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn copy_completion_time(&self) -> Result>; fn copy_id(&self) -> Result>; @@ -1993,6 +2761,7 @@ pub trait BlockBlobClientQueryResultHeaders: private::Sealed { fn lease_state(&self) -> Result>; fn lease_status(&self) -> Result>; fn metadata(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; } @@ -2083,6 +2852,11 @@ impl BlockBlobClientQueryResultHeaders for Response Headers::get_optional_as(self.headers(), &BLOB_TYPE) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -2175,10 +2949,15 @@ impl BlockBlobClientQueryResultHeaders for Response Ok(values) } + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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) + Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED) } } @@ -2186,9 +2965,13 @@ impl BlockBlobClientQueryResultHeaders for Response pub trait BlockBlobClientStageBlockFromUrlResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; + fn copy_source_error_code(&self) -> Result>; + fn copy_source_status_code(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; } @@ -2206,6 +2989,11 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -2213,6 +3001,16 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders }) } + /// The error code for the copy source. + fn copy_source_error_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) + } + + /// The status code for the copy source. + fn copy_source_status_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) + } + /// 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> { @@ -2226,6 +3024,11 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -2236,10 +3039,14 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders /// Provides access to typed response headers for `BlockBlobClient::stage_block()` pub trait BlockBlobClientStageBlockResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; + fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; + fn structured_body_type(&self) -> Result>; } impl BlockBlobClientStageBlockResultHeaders for Response { @@ -2249,6 +3056,16 @@ impl BlockBlobClientStageBlockResultHeaders for Response Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) + } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -2269,21 +3086,35 @@ impl BlockBlobClientStageBlockResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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) } + + /// Indicates the response body contains a structured message and specifies the message schema version and properties. + fn structured_body_type(&self) -> Result> { + Headers::get_optional_as(self.headers(), &STRUCTURED_BODY) + } } /// Provides access to typed response headers for `BlockBlobClient::upload()` pub trait BlockBlobClientUploadResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; + fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; + fn structured_body_type(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -2294,6 +3125,11 @@ impl BlockBlobClientUploadResultHeaders for Response Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| date::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| { @@ -2306,6 +3142,11 @@ impl BlockBlobClientUploadResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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> { @@ -2319,12 +3160,22 @@ impl BlockBlobClientUploadResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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) } + /// Indicates the response body contains a structured message and specifies the message schema version and properties. + fn structured_body_type(&self) -> Result> { + Headers::get_optional_as(self.headers(), &STRUCTURED_BODY) + } + /// 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> { @@ -2334,12 +3185,20 @@ impl BlockBlobClientUploadResultHeaders for Response Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_content_length(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl BlockListHeaders 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| date::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| { @@ -2357,6 +3216,16 @@ impl BlockListHeaders for Response { fn blob_content_length(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for the following methods: @@ -2364,6 +3233,8 @@ impl BlockListHeaders for Response { /// * `BlobServiceClient::filter_blobs()` pub trait FilterBlobSegmentHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl FilterBlobSegmentHeaders for Response { @@ -2371,11 +3242,23 @@ impl FilterBlobSegmentHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::list_blob_flat_segment()` pub trait ListBlobsFlatSegmentResponseHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl ListBlobsFlatSegmentResponseHeaders for Response { @@ -2383,11 +3266,23 @@ impl ListBlobsFlatSegmentResponseHeaders for Response Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::list_blob_hierarchy_segment()` pub trait ListBlobsHierarchySegmentResponseHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl ListBlobsHierarchySegmentResponseHeaders for Response { @@ -2395,6 +3290,34 @@ impl ListBlobsHierarchySegmentResponseHeaders for Response Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } +} + +/// Provides access to typed response headers for `BlobServiceClient::list_containers_segment()` +pub trait ListContainersSegmentResponseHeaders: private::Sealed { + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; +} + +impl ListContainersSegmentResponseHeaders for Response { + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `PageBlobClient::clear_pages()` @@ -2449,8 +3372,10 @@ pub trait PageBlobClientCopyIncrementalResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn copy_id(&self) -> Result>; fn copy_status(&self) -> Result>; + fn request_id(&self) -> Result>; } impl PageBlobClientCopyIncrementalResultHeaders for Response { @@ -2471,6 +3396,11 @@ impl PageBlobClientCopyIncrementalResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + /// 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> { @@ -2481,12 +3411,16 @@ impl PageBlobClientCopyIncrementalResultHeaders for Response Result> { Headers::get_optional_as(self.headers(), ©_STATUS) } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `PageBlobClient::create()` pub trait PageBlobClientCreateResultHeaders: 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>; @@ -2502,11 +3436,6 @@ impl PageBlobClientCreateResultHeaders for Response Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::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| date::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| { @@ -2551,6 +3480,8 @@ pub trait PageBlobClientResizeResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl PageBlobClientResizeResultHeaders for Response { @@ -2575,6 +3506,16 @@ impl PageBlobClientResizeResultHeaders for Response fn blob_sequence_number(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `PageBlobClient::update_sequence_number()` @@ -2583,6 +3524,8 @@ pub trait PageBlobClientUpdateSequenceNumberResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl PageBlobClientUpdateSequenceNumberResultHeaders @@ -2609,6 +3552,16 @@ impl PageBlobClientUpdateSequenceNumberResultHeaders fn blob_sequence_number(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `PageBlobClient::upload_pages_from_url()` @@ -2619,6 +3572,8 @@ pub trait PageBlobClientUploadPagesFromUrlResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; fn content_crc64(&self) -> Result>>; + fn copy_source_error_code(&self) -> Result>; + fn copy_source_status_code(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; @@ -2662,6 +3617,16 @@ impl PageBlobClientUploadPagesFromUrlResultHeaders }) } + /// The error code for the copy source. + fn copy_source_error_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) + } + + /// The status code for the copy source. + fn copy_source_status_code(&self) -> Result> { + Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) + } + /// 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> { @@ -2689,9 +3654,11 @@ pub trait PageBlobClientUploadPagesResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; + fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; + fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; fn structured_body_type(&self) -> Result>; } @@ -2725,6 +3692,11 @@ impl PageBlobClientUploadPagesResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -2745,6 +3717,11 @@ impl PageBlobClientUploadPagesResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -2765,6 +3742,8 @@ pub trait PageListHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_content_length(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl PageListHeaders for Response { @@ -2790,11 +3769,41 @@ impl PageListHeaders for Response { fn blob_content_length(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } +} + +/// Provides access to typed response headers for `BlobServiceClient::get_properties()` +pub trait StorageServicePropertiesHeaders: private::Sealed { + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; +} + +impl StorageServicePropertiesHeaders for Response { + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobServiceClient::get_statistics()` pub trait StorageServiceStatsHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl StorageServiceStatsHeaders for Response { @@ -2802,11 +3811,23 @@ impl StorageServiceStatsHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobServiceClient::get_user_delegation_key()` pub trait UserDelegationKeyHeaders: private::Sealed { fn date(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl UserDelegationKeyHeaders for Response { @@ -2814,6 +3835,16 @@ impl UserDelegationKeyHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } /// Provides access to typed response headers for `BlobContainerClient::get_access_policy()` @@ -2822,6 +3853,8 @@ pub trait VecSignedIdentifierHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn access(&self) -> Result>; + fn client_request_id(&self) -> Result>; + fn request_id(&self) -> Result>; } impl VecSignedIdentifierHeaders for Response> { @@ -2846,6 +3879,16 @@ impl VecSignedIdentifierHeaders for Response> { fn access(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS) } + + /// An opaque, globally-unique, client-generated string identifier for the request. + fn client_request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) + } + + /// An opaque, globally-unique, server-generated string identifier for the request. + fn request_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &REQUEST_ID) + } } mod private { @@ -2854,25 +3897,29 @@ mod private { AppendBlobClientCreateResult, AppendBlobClientSealResult, BlobClientAbortCopyFromUrlResult, BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, BlobClientCopyFromUrlResult, BlobClientCreateSnapshotResult, - BlobClientDeleteImmutabilityPolicyResult, BlobClientDownloadResult, + BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteResult, BlobClientDownloadResult, BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, BlobClientSetExpiryResult, BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldResult, - BlobClientSetTagsResult, BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, + BlobClientSetMetadataResult, BlobClientSetPropertiesResult, BlobClientSetTagsResult, + BlobClientSetTierResult, BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult, - BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult, + BlobContainerClientChangeLeaseResult, BlobContainerClientCreateResult, + BlobContainerClientDeleteResult, BlobContainerClientGetAccountInfoResult, BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult, BlobContainerClientRenameResult, BlobContainerClientRenewLeaseResult, BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyResult, - BlobServiceClientGetAccountInfoResult, BlobTags, BlockBlobClientCommitBlockListResult, + BlobContainerClientSetMetadataResult, BlobServiceClientGetAccountInfoResult, + BlobServiceClientSetPropertiesResult, BlobTags, BlockBlobClientCommitBlockListResult, BlockBlobClientPutBlobFromUrlResult, BlockBlobClientQueryResult, BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult, BlockBlobClientUploadResult, BlockList, FilterBlobSegment, ListBlobsFlatSegmentResponse, - ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult, - PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult, - PageBlobClientResizeResult, PageBlobClientUpdateSequenceNumberResult, - PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList, - SignedIdentifier, StorageServiceStats, UserDelegationKey, + ListBlobsHierarchySegmentResponse, ListContainersSegmentResponse, + PageBlobClientClearPagesResult, PageBlobClientCopyIncrementalResult, + PageBlobClientCreateResult, PageBlobClientResizeResult, + PageBlobClientUpdateSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult, + PageBlobClientUploadPagesResult, PageList, SignedIdentifier, StorageServiceProperties, + StorageServiceStats, UserDelegationKey, }; use azure_core::http::Response; @@ -2889,6 +3936,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 {} @@ -2897,12 +3945,17 @@ 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 {} @@ -2910,7 +3963,9 @@ 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 {} @@ -2922,6 +3977,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 {} @@ -2930,6 +3986,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> {} 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 2a52a8bd63..721bc294a2 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 @@ -5,8 +5,9 @@ use super::{ AccessTier, BlobDeleteType, BlobImmutabilityPolicyMode, DeleteSnapshotsOptionType, - EncryptionAlgorithmType, FilterBlobsIncludeItem, LeaseDuration, ListBlobsIncludeItem, - ListContainersIncludeType, PremiumPageBlobAccessTier, PublicAccessType, RehydratePriority, + EncryptionAlgorithmType, FileShareTokenIntent, FilterBlobsIncludeItem, LeaseDuration, + ListBlobsIncludeItem, ListContainersIncludeType, PremiumPageBlobAccessTier, PublicAccessType, + RehydratePriority, }; use azure_core::{fmt::SafeDebug, http::ClientMethodOptions}; use std::collections::HashMap; @@ -115,6 +116,9 @@ pub struct AppendBlobClientAppendBlockFromUrlOptions<'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, + /// The request should only proceed if an entity matches this string. pub if_match: Option, @@ -422,6 +426,9 @@ pub struct BlobClientCopyFromUrlOptions<'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, + /// The request should only proceed if an entity matches this string. pub if_match: Option, @@ -650,7 +657,8 @@ pub struct BlobClientDownloadOptions<'a> { /// 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, - /// Required if the request body is a structured message. Specifies the message schema version and properties. + /// Specifies the response content should be returned as a structured message and specifies the message schema version and + /// properties. pub structured_body_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) @@ -1846,6 +1854,9 @@ pub struct BlockBlobClientPutBlobFromUrlOptions<'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, + /// The request should only proceed if an entity matches this string. pub if_match: Option, @@ -1976,6 +1987,13 @@ 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, @@ -2013,6 +2031,9 @@ pub struct BlockBlobClientStageBlockFromUrlOptions<'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, + /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -2126,6 +2147,13 @@ pub struct BlockBlobClientUploadOptions<'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 tier to be set on the blob. pub tier: Option, @@ -2610,6 +2638,9 @@ pub struct PageBlobClientUploadPagesFromUrlOptions<'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, + /// The request should only proceed if an entity matches this string. pub if_match: 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 221c9f984e..1a45087a44 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 @@ -127,6 +127,10 @@ pub struct BlobClientCreateSnapshotResult; #[derive(SafeDebug)] pub struct BlobClientDeleteImmutabilityPolicyResult; +/// Contains results for `BlobClient::delete()` +#[derive(SafeDebug)] +pub struct BlobClientDeleteResult; + /// Contains results for `BlobClient::download()` #[derive(SafeDebug)] pub struct BlobClientDownloadResult; @@ -159,10 +163,22 @@ pub struct BlobClientSetImmutabilityPolicyResult; #[derive(SafeDebug)] pub struct BlobClientSetLegalHoldResult; +/// Contains results for `BlobClient::set_metadata()` +#[derive(SafeDebug)] +pub struct BlobClientSetMetadataResult; + +/// Contains results for `BlobClient::set_properties()` +#[derive(SafeDebug)] +pub struct BlobClientSetPropertiesResult; + /// Contains results for `BlobClient::set_tags()` #[derive(SafeDebug)] pub struct BlobClientSetTagsResult; +/// Contains results for `BlobClient::set_tier()` +#[derive(SafeDebug)] +pub struct BlobClientSetTierResult; + /// Contains results for `BlobClient::start_copy_from_url()` #[derive(SafeDebug)] pub struct BlobClientStartCopyFromUrlResult; @@ -183,6 +199,14 @@ pub struct BlobContainerClientBreakLeaseResult; #[derive(SafeDebug)] pub struct BlobContainerClientChangeLeaseResult; +/// Contains results for `BlobContainerClient::create()` +#[derive(SafeDebug)] +pub struct BlobContainerClientCreateResult; + +/// Contains results for `BlobContainerClient::delete()` +#[derive(SafeDebug)] +pub struct BlobContainerClientDeleteResult; + /// Contains results for `BlobContainerClient::get_account_info()` #[derive(SafeDebug)] pub struct BlobContainerClientGetAccountInfoResult; @@ -211,6 +235,10 @@ pub struct BlobContainerClientRestoreResult; #[derive(SafeDebug)] pub struct BlobContainerClientSetAccessPolicyResult; +/// Contains results for `BlobContainerClient::set_metadata()` +#[derive(SafeDebug)] +pub struct BlobContainerClientSetMetadataResult; + /// The blob flat list segment. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::http::Model)] #[non_exhaustive] @@ -557,6 +585,10 @@ pub struct BlobPropertiesInternal { #[derive(SafeDebug)] pub struct BlobServiceClientGetAccountInfoResult; +/// Contains results for `BlobServiceClient::set_properties()` +#[derive(SafeDebug)] +pub struct BlobServiceClientSetPropertiesResult; + /// The blob tags. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::http::Model)] #[serde(rename = "Tag")] diff --git a/sdk/storage/azure_storage_blob/tsp-location.yaml b/sdk/storage/azure_storage_blob/tsp-location.yaml index 630396183b..f20e0bf106 100644 --- a/sdk/storage/azure_storage_blob/tsp-location.yaml +++ b/sdk/storage/azure_storage_blob/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/storage/Microsoft.BlobStorage -commit: a0463864e021c00771eb01510e2eecd800ad05e2 +commit: 768d3540db4230cfa416dc26ea1843ee8716399b repo: Azure/azure-rest-api-specs additionalDirectories: From 074d6f4d527b97589ef8103b1c9248b4dc28b91e Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 11 Jun 2025 13:27:58 -0700 Subject: [PATCH 04/30] Refactor handwritten layer to match generated code changes --- .../azure_storage_blob/src/clients/append_blob_client.rs | 3 +-- .../azure_storage_blob/src/clients/page_blob_client.rs | 5 +---- sdk/storage/azure_storage_blob/tests/append_blob_client.rs | 2 +- sdk/storage/azure_storage_blob/tests/page_blob_client.rs | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) 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 3986014862..c9b6070526 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 @@ -93,9 +93,8 @@ impl AppendBlobClient { /// * `options` - Optional configuration for the request. pub async fn create( &self, - content_length: u64, options: Option>, ) -> Result> { - self.client.create(content_length, options).await + self.client.create(options).await } } 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 9a1a6133db..1818e58b77 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 @@ -95,12 +95,9 @@ impl PageBlobClient { /// * `options` - Optional parameters for the request. pub async fn create( &self, - content_length: u64, blob_content_length: u64, options: Option>, ) -> Result> { - self.client - .create(content_length, blob_content_length, options) - .await + self.client.create(blob_content_length, options).await } } 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 8920044303..f98dd5d247 100644 --- a/sdk/storage/azure_storage_blob/tests/append_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/append_blob_client.rs @@ -14,7 +14,7 @@ async fn test_create_append_blob(ctx: TestContext) -> Result<(), Box> let blob_client = container_client.blob_client(get_blob_name(recording)); let append_blob_client = blob_client.append_blob_client(); - append_blob_client.create(0, None).await?; + append_blob_client.create(None).await?; // Assert let blob_properties = blob_client.get_properties(None).await?; diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index e0182470bb..6d3a53c23b 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -14,7 +14,7 @@ async fn test_create_page_blob(ctx: TestContext) -> Result<(), Box> { let blob_client = container_client.blob_client(get_blob_name(recording)); let page_blob_client = blob_client.page_blob_client(); - page_blob_client.create(0, 1024, None).await?; + page_blob_client.create(1024, None).await?; // Assert let blob_properties = blob_client.get_properties(None).await?; From 1b6655e515c9ee637ef058b633802aecf0cc539b Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 18 Jun 2025 14:01:15 -0700 Subject: [PATCH 05/30] Regen feature/blob-tsp --- .../src/clients/append_blob_client.rs | 4 +- .../src/clients/page_blob_client.rs | 4 +- .../src/generated/clients/blob_client.rs | 7 +- .../clients/blob_container_client.rs | 7 +- .../generated/clients/blob_service_client.rs | 5 +- .../src/generated/models/header_traits.rs | 1077 +---------------- .../src/generated/models/pub_models.rs | 32 - sdk/storage/azure_storage_blob/src/lib.rs | 3 +- .../azure_storage_blob/tsp-location.yaml | 4 +- 9 files changed, 47 insertions(+), 1096 deletions(-) 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 c9b6070526..9a4df6c5e0 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 @@ -11,7 +11,7 @@ use azure_core::{ credentials::TokenCredential, http::{ policies::{BearerTokenCredentialPolicy, Policy}, - RequestContent, Response, Url, + NoFormat, RequestContent, Response, Url, }, Bytes, Result, }; @@ -94,7 +94,7 @@ impl AppendBlobClient { pub async fn create( &self, options: Option>, - ) -> Result> { + ) -> Result> { self.client.create(options).await } } 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 1818e58b77..80bb55c594 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 @@ -11,7 +11,7 @@ use azure_core::{ credentials::TokenCredential, http::{ policies::{BearerTokenCredentialPolicy, Policy}, - RequestContent, Response, Url, + NoFormat, RequestContent, Response, Url, }, Bytes, Result, }; @@ -97,7 +97,7 @@ impl PageBlobClient { &self, blob_content_length: u64, options: Option>, - ) -> Result> { + ) -> Result> { self.client.create(blob_content_length, options).await } } 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 4886789efc..69d08dc344 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 @@ -11,7 +11,7 @@ use crate::generated::{ BlobClientBreakLeaseResult, BlobClientChangeLeaseOptions, BlobClientChangeLeaseResult, BlobClientCopyFromUrlOptions, BlobClientCopyFromUrlResult, BlobClientCreateSnapshotOptions, BlobClientCreateSnapshotResult, BlobClientDeleteImmutabilityPolicyOptions, - BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteOptions, BlobClientDeleteResult, + BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteOptions, BlobClientDownloadOptions, BlobClientDownloadResult, BlobClientGetAccountInfoOptions, BlobClientGetAccountInfoResult, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, BlobClientGetTagsOptions, BlobClientReleaseLeaseOptions, @@ -19,9 +19,8 @@ use crate::generated::{ BlobClientSetExpiryOptions, BlobClientSetExpiryResult, BlobClientSetImmutabilityPolicyOptions, BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldOptions, BlobClientSetLegalHoldResult, BlobClientSetMetadataOptions, - BlobClientSetMetadataResult, BlobClientSetPropertiesOptions, BlobClientSetPropertiesResult, - BlobClientSetTagsOptions, BlobClientSetTagsResult, BlobClientSetTierOptions, - BlobClientSetTierResult, BlobClientStartCopyFromUrlOptions, + BlobClientSetPropertiesOptions, BlobClientSetTagsOptions, BlobClientSetTagsResult, + BlobClientSetTierOptions, BlobClientStartCopyFromUrlOptions, BlobClientStartCopyFromUrlResult, BlobClientUndeleteOptions, BlobClientUndeleteResult, BlobExpiryOptions, BlobTags, }, diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs index dc017b7ba0..1a18d5cb51 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs @@ -9,8 +9,7 @@ use crate::generated::{ BlobContainerClientAcquireLeaseOptions, BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseOptions, BlobContainerClientBreakLeaseResult, BlobContainerClientChangeLeaseOptions, BlobContainerClientChangeLeaseResult, - BlobContainerClientCreateOptions, BlobContainerClientCreateResult, - BlobContainerClientDeleteOptions, BlobContainerClientDeleteResult, + BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, BlobContainerClientFilterBlobsOptions, BlobContainerClientGetAccessPolicyOptions, BlobContainerClientGetAccountInfoOptions, BlobContainerClientGetAccountInfoResult, BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, @@ -21,8 +20,8 @@ use crate::generated::{ BlobContainerClientRenewLeaseResult, BlobContainerClientRestoreOptions, BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyOptions, BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetMetadataOptions, - BlobContainerClientSetMetadataResult, FilterBlobSegment, ListBlobsFlatSegmentResponse, - ListBlobsHierarchySegmentResponse, SignedIdentifier, + FilterBlobSegment, ListBlobsFlatSegmentResponse, ListBlobsHierarchySegmentResponse, + SignedIdentifier, }, }; use azure_core::{ diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs index 2daf1cf791..de2175cb81 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/blob_service_client.rs @@ -10,9 +10,8 @@ use crate::generated::{ BlobServiceClientGetAccountInfoResult, BlobServiceClientGetPropertiesOptions, BlobServiceClientGetStatisticsOptions, BlobServiceClientGetUserDelegationKeyOptions, BlobServiceClientListContainersSegmentOptions, BlobServiceClientSetPropertiesOptions, - BlobServiceClientSetPropertiesResult, FilterBlobSegment, KeyInfo, - ListContainersSegmentResponse, StorageServiceProperties, StorageServiceStats, - UserDelegationKey, + FilterBlobSegment, KeyInfo, ListContainersSegmentResponse, StorageServiceProperties, + StorageServiceStats, UserDelegationKey, }, }; use azure_core::{ 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 2f481ce6b8..792064b59a 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 @@ -23,12 +23,11 @@ use super::{ BlockBlobClientQueryResult, BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult, BlockBlobClientUploadResult, BlockList, CopyStatus, FilterBlobSegment, LeaseDuration, LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse, - ListBlobsHierarchySegmentResponse, ListContainersSegmentResponse, - PageBlobClientClearPagesResult, PageBlobClientCopyIncrementalResult, - PageBlobClientCreateResult, PageBlobClientResizeResult, + ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult, + PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult, PageBlobClientResizeResult, PageBlobClientUpdateSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList, PublicAccessType, RehydratePriority, - SignedIdentifier, SkuName, StorageServiceProperties, StorageServiceStats, UserDelegationKey, + SignedIdentifier, SkuName, StorageServiceStats, UserDelegationKey, }; use azure_core::{ base64, date, @@ -57,7 +56,6 @@ const BLOB_SEALED: HeaderName = HeaderName::from_static("x-ms-blob-sealed"); const BLOB_SEQUENCE_NUMBER: HeaderName = HeaderName::from_static("x-ms-blob-sequence-number"); const BLOB_TYPE: HeaderName = HeaderName::from_static("x-ms-blob-type"); const CACHE_CONTROL: HeaderName = HeaderName::from_static("cache-control"); -const CLIENT_REQUEST_ID: HeaderName = HeaderName::from_static("x-ms-client-request-id"); const CONTENT_CRC64: HeaderName = HeaderName::from_static("x-ms-content-crc64"); const CONTENT_DISPOSITION: HeaderName = HeaderName::from_static("content-disposition"); const CONTENT_ENCODING: HeaderName = HeaderName::from_static("content-encoding"); @@ -71,8 +69,6 @@ const COPY_DESTINATION_SNAPSHOT: HeaderName = const COPY_ID: HeaderName = HeaderName::from_static("x-ms-copy-id"); const COPY_PROGRESS: HeaderName = HeaderName::from_static("x-ms-copy-progress"); const COPY_SOURCE: HeaderName = HeaderName::from_static("x-ms-copy-source"); -const COPY_SOURCE_ERROR_CODE: HeaderName = HeaderName::from_static("x-ms-copy-source-error-code"); -const COPY_SOURCE_STATUS_CODE: HeaderName = HeaderName::from_static("x-ms-copy-source-status-code"); const COPY_STATUS: HeaderName = HeaderName::from_static("x-ms-copy-status"); const COPY_STATUS_DESCRIPTION: HeaderName = HeaderName::from_static("x-ms-copy-status-description"); const CREATION_TIME: HeaderName = HeaderName::from_static("x-ms-creation-time"); @@ -108,7 +104,6 @@ const META: &str = "x-ms-meta-"; const OR: &str = "x-ms-or-"; const OR_POLICY_ID: HeaderName = HeaderName::from_static("x-ms-or-policy-id"); const REHYDRATE_PRIORITY: HeaderName = HeaderName::from_static("x-ms-rehydrate-priority"); -const REQUEST_ID: HeaderName = HeaderName::from_static("x-ms-request-id"); const REQUEST_SERVER_ENCRYPTED: HeaderName = HeaderName::from_static("x-ms-request-server-encrypted"); const SERVER_ENCRYPTED: HeaderName = HeaderName::from_static("x-ms-server-encrypted"); @@ -125,13 +120,9 @@ pub trait AppendBlobClientAppendBlockFromUrlResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn blob_append_offset(&self) -> Result>; fn blob_committed_block_count(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; - fn copy_source_error_code(&self) -> Result>; - fn copy_source_status_code(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; } @@ -172,11 +163,6 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -184,16 +170,6 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders }) } - /// The error code for the copy source. - fn copy_source_error_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) - } - - /// The status code for the copy source. - fn copy_source_status_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) - } - /// 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> { @@ -207,11 +183,6 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -227,11 +198,9 @@ pub trait AppendBlobClientAppendBlockResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn blob_append_offset(&self) -> Result>; fn blob_committed_block_count(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; } @@ -272,11 +241,6 @@ impl AppendBlobClientAppendBlockResultHeaders Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -297,11 +261,6 @@ impl AppendBlobClientAppendBlockResultHeaders Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -312,6 +271,7 @@ impl AppendBlobClientAppendBlockResultHeaders /// Provides access to typed response headers for `AppendBlobClient::create()` pub trait AppendBlobClientCreateResultHeaders: 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>; @@ -327,6 +287,11 @@ impl AppendBlobClientCreateResultHeaders for Response Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| date::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| { @@ -371,8 +336,6 @@ pub trait AppendBlobClientSealResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn is_sealed(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl AppendBlobClientSealResultHeaders for Response { @@ -397,23 +360,11 @@ impl AppendBlobClientSealResultHeaders for Response Result> { Headers::get_optional_as(self.headers(), &BLOB_SEALED) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::abort_copy_from_url()` pub trait BlobClientAbortCopyFromUrlResultHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientAbortCopyFromUrlResultHeaders @@ -423,16 +374,6 @@ impl BlobClientAbortCopyFromUrlResultHeaders fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::acquire_lease()` @@ -440,9 +381,7 @@ pub trait BlobClientAcquireLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientAcquireLeaseResultHeaders for Response { @@ -463,20 +402,10 @@ impl BlobClientAcquireLeaseResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::break_lease()` @@ -484,9 +413,7 @@ pub trait BlobClientBreakLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn lease_time(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientBreakLeaseResultHeaders for Response { @@ -507,20 +434,10 @@ impl BlobClientBreakLeaseResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Approximate time remaining in the lease period, in seconds. fn lease_time(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_TIME) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::change_lease()` @@ -528,9 +445,7 @@ pub trait BlobClientChangeLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientChangeLeaseResultHeaders for Response { @@ -551,20 +466,10 @@ impl BlobClientChangeLeaseResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::copy_from_url()` @@ -573,11 +478,9 @@ pub trait BlobClientCopyFromUrlResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn copy_id(&self) -> Result>; fn encryption_scope(&self) -> Result>; - fn request_id(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -605,11 +508,6 @@ impl BlobClientCopyFromUrlResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -630,11 +528,6 @@ impl BlobClientCopyFromUrlResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } - /// 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> { @@ -647,8 +540,6 @@ pub trait BlobClientCreateSnapshotResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; fn snapshot(&self) -> Result>; fn version_id(&self) -> Result>; @@ -672,16 +563,6 @@ impl BlobClientCreateSnapshotResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -704,8 +585,6 @@ impl BlobClientCreateSnapshotResultHeaders for Response Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientDeleteImmutabilityPolicyResultHeaders @@ -715,40 +594,6 @@ impl BlobClientDeleteImmutabilityPolicyResultHeaders fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } -} - -/// Provides access to typed response headers for `BlobClient::delete()` -pub trait BlobClientDeleteResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; -} - -impl BlobClientDeleteResultHeaders 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| date::parse_rfc7231(h.as_str())) - } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::download()` @@ -760,7 +605,6 @@ pub trait BlobClientDownloadResultHeaders: private::Sealed { 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 blob_committed_block_count(&self) -> Result>; @@ -768,7 +612,6 @@ pub trait BlobClientDownloadResultHeaders: private::Sealed { fn is_sealed(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; fn blob_type(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn copy_completion_time(&self) -> Result>; fn copy_id(&self) -> Result>; @@ -790,10 +633,7 @@ pub trait BlobClientDownloadResultHeaders: private::Sealed { fn metadata(&self) -> Result>; fn object_replication_rules(&self) -> Result>; fn object_replication_policy_id(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; - fn structured_body_type(&self) -> Result>; - fn structured_content_length(&self) -> Result>; fn tag_count(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -839,11 +679,6 @@ impl BlobClientDownloadResultHeaders for Response Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| date::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| { @@ -885,11 +720,6 @@ impl BlobClientDownloadResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -1037,11 +867,6 @@ impl BlobClientDownloadResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -1064,9 +889,7 @@ impl BlobClientDownloadResultHeaders for Response Result>; fn account_kind(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn is_hierarchical_namespace_enabled(&self) -> Result>; - fn request_id(&self) -> Result>; fn sku_name(&self) -> Result>; } @@ -1081,21 +904,11 @@ impl BlobClientGetAccountInfoResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// 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) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } - /// Identifies the sku name of the account fn sku_name(&self) -> Result> { Headers::get_optional_as(self.headers(), &SKU_NAME) @@ -1104,14 +917,12 @@ impl BlobClientGetAccountInfoResultHeaders for Response 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 date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn access_tier(&self) -> Result>; @@ -1186,11 +997,6 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| date::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| { @@ -1437,8 +1243,6 @@ pub trait BlobClientReleaseLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientReleaseLeaseResultHeaders for Response { @@ -1458,16 +1262,6 @@ impl BlobClientReleaseLeaseResultHeaders for Response Result> { Headers::get_optional_as(self.headers(), &ETAG) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::renew_lease()` @@ -1475,9 +1269,7 @@ pub trait BlobClientRenewLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientRenewLeaseResultHeaders for Response { @@ -1498,20 +1290,10 @@ impl BlobClientRenewLeaseResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::set_expiry()` @@ -1519,8 +1301,6 @@ pub trait BlobClientSetExpiryResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientSetExpiryResultHeaders for Response { @@ -1540,25 +1320,13 @@ impl BlobClientSetExpiryResultHeaders for Response Result> { Headers::get_optional_as(self.headers(), &ETAG) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::set_immutability_policy()` pub trait BlobClientSetImmutabilityPolicyResultHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn immutability_policy_mode(&self) -> Result>; fn immutability_policy_expires_on(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientSetImmutabilityPolicyResultHeaders @@ -1569,11 +1337,6 @@ impl BlobClientSetImmutabilityPolicyResultHeaders Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Indicates the immutability policy mode of the blob. fn immutability_policy_mode(&self) -> Result> { Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE) @@ -1585,19 +1348,12 @@ impl BlobClientSetImmutabilityPolicyResultHeaders date::parse_rfc7231(h.as_str()) }) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::set_legal_hold()` pub trait BlobClientSetLegalHoldResultHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn legal_hold(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientSetLegalHoldResultHeaders for Response { @@ -1606,138 +1362,15 @@ impl BlobClientSetLegalHoldResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Specifies the legal hold status to set on the blob. fn legal_hold(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEGAL_HOLD) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } -} - -/// Provides access to typed response headers for `BlobClient::set_metadata()` -pub trait BlobClientSetMetadataResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn encryption_key_sha256(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn request_id(&self) -> Result>; - fn is_server_encrypted(&self) -> Result>; - fn version_id(&self) -> Result>; -} - -impl BlobClientSetMetadataResultHeaders 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| date::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| { - date::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) - } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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) - } - - /// 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) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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) - } - - /// 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 `BlobClient::set_properties()` -pub trait BlobClientSetPropertiesResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn etag(&self) -> Result>; - fn blob_sequence_number(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; -} - -impl BlobClientSetPropertiesResultHeaders 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| date::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| { - date::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 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) - } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::set_tags()` pub trait BlobClientSetTagsResultHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientSetTagsResultHeaders for Response { @@ -1745,34 +1378,6 @@ impl BlobClientSetTagsResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } -} - -/// Provides access to typed response headers for `BlobClient::set_tier()` -pub trait BlobClientSetTierResultHeaders: private::Sealed { - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; -} - -impl BlobClientSetTierResultHeaders for Response { - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobClient::start_copy_from_url()` @@ -1780,12 +1385,8 @@ pub trait BlobClientStartCopyFromUrlResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn copy_id(&self) -> Result>; - fn copy_source_error_code(&self) -> Result>; - fn copy_source_status_code(&self) -> Result>; fn copy_status(&self) -> Result>; - fn request_id(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -1809,37 +1410,17 @@ impl BlobClientStartCopyFromUrlResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// 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) } - /// The error code for the copy source. - fn copy_source_error_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) - } - - /// The status code for the copy source. - fn copy_source_status_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) - } - /// State of the copy operation identified by x-ms-copy-id. fn copy_status(&self) -> Result> { Headers::get_optional_as(self.headers(), ©_STATUS) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } - /// 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> { @@ -1850,8 +1431,6 @@ impl BlobClientStartCopyFromUrlResultHeaders /// Provides access to typed response headers for `BlobClient::undelete()` pub trait BlobClientUndeleteResultHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobClientUndeleteResultHeaders for Response { @@ -1859,16 +1438,6 @@ impl BlobClientUndeleteResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::acquire_lease()` @@ -1876,9 +1445,7 @@ pub trait BlobContainerClientAcquireLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobContainerClientAcquireLeaseResultHeaders @@ -1901,20 +1468,10 @@ impl BlobContainerClientAcquireLeaseResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::break_lease()` @@ -1922,10 +1479,8 @@ pub trait BlobContainerClientBreakLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; fn lease_time(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobContainerClientBreakLeaseResultHeaders @@ -1948,11 +1503,6 @@ impl BlobContainerClientBreakLeaseResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) @@ -1962,11 +1512,6 @@ impl BlobContainerClientBreakLeaseResultHeaders fn lease_time(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_TIME) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::change_lease()` @@ -1974,9 +1519,7 @@ pub trait BlobContainerClientChangeLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobContainerClientChangeLeaseResultHeaders @@ -1999,91 +1542,17 @@ impl BlobContainerClientChangeLeaseResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } -} - -/// Provides access to typed response headers for `BlobContainerClient::create()` -pub trait BlobContainerClientCreateResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; -} - -impl BlobContainerClientCreateResultHeaders 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| date::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| { - date::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) - } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } -} - -/// Provides access to typed response headers for `BlobContainerClient::delete()` -pub trait BlobContainerClientDeleteResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; -} - -impl BlobContainerClientDeleteResultHeaders 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| date::parse_rfc7231(h.as_str())) - } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::get_account_info()` pub trait BlobContainerClientGetAccountInfoResultHeaders: private::Sealed { fn date(&self) -> Result>; fn account_kind(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn is_hierarchical_namespace_enabled(&self) -> Result>; - fn request_id(&self) -> Result>; fn sku_name(&self) -> Result>; } @@ -2100,21 +1569,11 @@ impl BlobContainerClientGetAccountInfoResultHeaders Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// 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) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } - /// Identifies the sku name of the account fn sku_name(&self) -> Result> { Headers::get_optional_as(self.headers(), &SKU_NAME) @@ -2123,11 +1582,9 @@ impl BlobContainerClientGetAccountInfoResultHeaders /// Provides access to typed response headers for `BlobContainerClient::get_properties()` pub trait BlobContainerClientGetPropertiesResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn access(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn default_encryption_scope(&self) -> Result>; fn prevent_encryption_scope_override(&self) -> Result>; fn has_immutability_policy(&self) -> Result>; @@ -2137,17 +1594,11 @@ pub trait BlobContainerClientGetPropertiesResultHeaders: private::Sealed { fn lease_state(&self) -> Result>; fn lease_status(&self) -> Result>; fn metadata(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobContainerClientGetPropertiesResultHeaders 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| date::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| { @@ -2165,11 +1616,6 @@ impl BlobContainerClientGetPropertiesResultHeaders Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// The default encryption scope for the container. fn default_encryption_scope(&self) -> Result> { Headers::get_optional_as(self.headers(), &DEFAULT_ENCRYPTION_SCOPE) @@ -2223,11 +1669,6 @@ impl BlobContainerClientGetPropertiesResultHeaders } Ok(values) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::release_lease()` @@ -2235,8 +1676,6 @@ pub trait BlobContainerClientReleaseLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobContainerClientReleaseLeaseResultHeaders @@ -2258,23 +1697,11 @@ impl BlobContainerClientReleaseLeaseResultHeaders fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::rename()` pub trait BlobContainerClientRenameResultHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobContainerClientRenameResultHeaders @@ -2284,16 +1711,6 @@ impl BlobContainerClientRenameResultHeaders fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::renew_lease()` @@ -2301,9 +1718,7 @@ pub trait BlobContainerClientRenewLeaseResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn lease_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobContainerClientRenewLeaseResultHeaders @@ -2326,27 +1741,15 @@ impl BlobContainerClientRenewLeaseResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// Uniquely identifies a blobs' lease fn lease_id(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_ID) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::restore()` pub trait BlobContainerClientRestoreResultHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobContainerClientRestoreResultHeaders @@ -2356,16 +1759,6 @@ impl BlobContainerClientRestoreResultHeaders fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::set_access_policy()` @@ -2373,8 +1766,6 @@ pub trait BlobContainerClientSetAccessPolicyResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobContainerClientSetAccessPolicyResultHeaders @@ -2396,65 +1787,13 @@ impl BlobContainerClientSetAccessPolicyResultHeaders fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } -} - -/// Provides access to typed response headers for `BlobContainerClient::set_metadata()` -pub trait BlobContainerClientSetMetadataResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; -} - -impl BlobContainerClientSetMetadataResultHeaders - 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| date::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| { - date::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) - } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobServiceClient::get_account_info()` pub trait BlobServiceClientGetAccountInfoResultHeaders: private::Sealed { fn date(&self) -> Result>; fn account_kind(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn is_hierarchical_namespace_enabled(&self) -> Result>; - fn request_id(&self) -> Result>; fn sku_name(&self) -> Result>; } @@ -2471,52 +1810,20 @@ impl BlobServiceClientGetAccountInfoResultHeaders Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// 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) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } - /// 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 `BlobServiceClient::set_properties()` -pub trait BlobServiceClientSetPropertiesResultHeaders: private::Sealed { - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; -} - -impl BlobServiceClientSetPropertiesResultHeaders - for Response -{ - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } -} - /// Provides access to typed response headers for `BlobClient::get_tags()` pub trait BlobTagsHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl BlobTagsHeaders for Response { @@ -2524,29 +1831,16 @@ impl BlobTagsHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlockBlobClient::commit_block_list()` pub trait BlockBlobClientCommitBlockListResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -2560,11 +1854,6 @@ impl BlockBlobClientCommitBlockListResultHeaders Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::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| date::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| { @@ -2577,11 +1866,6 @@ impl BlockBlobClientCommitBlockListResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -2602,11 +1886,6 @@ impl BlockBlobClientCommitBlockListResultHeaders Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -2626,8 +1905,6 @@ pub trait BlockBlobClientPutBlobFromUrlResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn copy_source_error_code(&self) -> Result>; - fn copy_source_status_code(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; @@ -2660,16 +1937,6 @@ impl BlockBlobClientPutBlobFromUrlResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// The error code for the copy source. - fn copy_source_error_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) - } - - /// The status code for the copy source. - fn copy_source_status_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) - } - /// 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> { @@ -2713,7 +1980,6 @@ pub trait BlockBlobClientQueryResultHeaders: private::Sealed { fn blob_content_md5(&self) -> Result>>; fn blob_sequence_number(&self) -> Result>; fn blob_type(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn copy_completion_time(&self) -> Result>; fn copy_id(&self) -> Result>; @@ -2727,7 +1993,6 @@ pub trait BlockBlobClientQueryResultHeaders: private::Sealed { fn lease_state(&self) -> Result>; fn lease_status(&self) -> Result>; fn metadata(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; } @@ -2818,11 +2083,6 @@ impl BlockBlobClientQueryResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -2915,11 +2175,6 @@ impl BlockBlobClientQueryResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -2931,13 +2186,9 @@ impl BlockBlobClientQueryResultHeaders for Response Result>>; fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; - fn copy_source_error_code(&self) -> Result>; - fn copy_source_status_code(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; } @@ -2955,11 +2206,6 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -2967,16 +2213,6 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders }) } - /// The error code for the copy source. - fn copy_source_error_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) - } - - /// The status code for the copy source. - fn copy_source_status_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) - } - /// 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> { @@ -2990,11 +2226,6 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -3005,14 +2236,10 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders /// Provides access to typed response headers for `BlockBlobClient::stage_block()` pub trait BlockBlobClientStageBlockResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; - fn structured_body_type(&self) -> Result>; } impl BlockBlobClientStageBlockResultHeaders @@ -3024,16 +2251,6 @@ impl BlockBlobClientStageBlockResultHeaders Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::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| date::parse_rfc7231(h.as_str())) - } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -3054,35 +2271,21 @@ impl BlockBlobClientStageBlockResultHeaders Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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) } - - /// Indicates the response body contains a structured message and specifies the message schema version and properties. - fn structured_body_type(&self) -> Result> { - Headers::get_optional_as(self.headers(), &STRUCTURED_BODY) - } } /// Provides access to typed response headers for `BlockBlobClient::upload()` pub trait BlockBlobClientUploadResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; - fn structured_body_type(&self) -> Result>; fn version_id(&self) -> Result>; } @@ -3093,11 +2296,6 @@ impl BlockBlobClientUploadResultHeaders for Response Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| date::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| { @@ -3110,11 +2308,6 @@ impl BlockBlobClientUploadResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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> { @@ -3128,22 +2321,12 @@ impl BlockBlobClientUploadResultHeaders for Response Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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) } - /// Indicates the response body contains a structured message and specifies the message schema version and properties. - fn structured_body_type(&self) -> Result> { - Headers::get_optional_as(self.headers(), &STRUCTURED_BODY) - } - /// 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> { @@ -3153,20 +2336,12 @@ impl BlockBlobClientUploadResultHeaders for Response Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn blob_content_length(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; + fn blob_content_length(&self) -> Result>; } -impl BlockListHeaders 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| date::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| { @@ -3179,21 +2354,10 @@ impl BlockListHeaders for Response { Headers::get_optional_as(self.headers(), &ETAG) } - /// This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte - /// boundary. - fn blob_content_length(&self) -> Result> { + /// The size of the blob in bytes. + fn blob_content_length(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for the following methods: @@ -3201,8 +2365,6 @@ impl BlockListHeaders for Response { /// * `BlobServiceClient::filter_blobs()` pub trait FilterBlobSegmentHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl FilterBlobSegmentHeaders for Response { @@ -3210,23 +2372,11 @@ impl FilterBlobSegmentHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::list_blob_flat_segment()` pub trait ListBlobsFlatSegmentResponseHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl ListBlobsFlatSegmentResponseHeaders for Response { @@ -3234,23 +2384,11 @@ impl ListBlobsFlatSegmentResponseHeaders for Response Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::list_blob_hierarchy_segment()` pub trait ListBlobsHierarchySegmentResponseHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl ListBlobsHierarchySegmentResponseHeaders @@ -3260,34 +2398,6 @@ impl ListBlobsHierarchySegmentResponseHeaders fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } -} - -/// Provides access to typed response headers for `BlobServiceClient::list_containers_segment()` -pub trait ListContainersSegmentResponseHeaders: private::Sealed { - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; -} - -impl ListContainersSegmentResponseHeaders for Response { - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `PageBlobClient::clear_pages()` @@ -3342,10 +2452,8 @@ pub trait PageBlobClientCopyIncrementalResultHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn copy_id(&self) -> Result>; fn copy_status(&self) -> Result>; - fn request_id(&self) -> Result>; } impl PageBlobClientCopyIncrementalResultHeaders @@ -3368,11 +2476,6 @@ impl PageBlobClientCopyIncrementalResultHeaders Headers::get_optional_as(self.headers(), &ETAG) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - /// 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> { @@ -3383,16 +2486,12 @@ impl PageBlobClientCopyIncrementalResultHeaders fn copy_status(&self) -> Result> { Headers::get_optional_as(self.headers(), ©_STATUS) } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `PageBlobClient::create()` pub trait PageBlobClientCreateResultHeaders: 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>; @@ -3408,6 +2507,11 @@ impl PageBlobClientCreateResultHeaders for Response Result> { + Headers::get_optional_with(self.headers(), &DATE, |h| date::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| { @@ -3452,8 +2556,6 @@ pub trait PageBlobClientResizeResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl PageBlobClientResizeResultHeaders for Response { @@ -3478,16 +2580,6 @@ impl PageBlobClientResizeResultHeaders for Response Result> { Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `PageBlobClient::update_sequence_number()` @@ -3496,8 +2588,6 @@ pub trait PageBlobClientUpdateSequenceNumberResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl PageBlobClientUpdateSequenceNumberResultHeaders @@ -3524,16 +2614,6 @@ impl PageBlobClientUpdateSequenceNumberResultHeaders fn blob_sequence_number(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `PageBlobClient::upload_pages_from_url()` @@ -3544,8 +2624,6 @@ pub trait PageBlobClientUploadPagesFromUrlResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; fn content_crc64(&self) -> Result>>; - fn copy_source_error_code(&self) -> Result>; - fn copy_source_status_code(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; @@ -3589,16 +2667,6 @@ impl PageBlobClientUploadPagesFromUrlResultHeaders }) } - /// The error code for the copy source. - fn copy_source_error_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_ERROR_CODE) - } - - /// The status code for the copy source. - fn copy_source_status_code(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE_STATUS_CODE) - } - /// 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> { @@ -3626,11 +2694,9 @@ pub trait PageBlobClientUploadPagesResultHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; - fn client_request_id(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; - fn request_id(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; } @@ -3665,11 +2731,6 @@ impl PageBlobClientUploadPagesResultHeaders Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER) } - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_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| { @@ -3690,11 +2751,6 @@ impl PageBlobClientUploadPagesResultHeaders Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_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> { @@ -3709,9 +2765,7 @@ pub trait PageListHeaders: private::Sealed { fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn blob_content_length(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; + fn blob_content_length(&self) -> Result>; } impl PageListHeaders for Response { @@ -3732,46 +2786,15 @@ impl PageListHeaders for Response { Headers::get_optional_as(self.headers(), &ETAG) } - /// This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte - /// boundary. - fn blob_content_length(&self) -> Result> { + /// The size of the blob in bytes. + fn blob_content_length(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } -} - -/// Provides access to typed response headers for `BlobServiceClient::get_properties()` -pub trait StorageServicePropertiesHeaders: private::Sealed { - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; -} - -impl StorageServicePropertiesHeaders for Response { - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobServiceClient::get_statistics()` pub trait StorageServiceStatsHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl StorageServiceStatsHeaders for Response { @@ -3779,23 +2802,11 @@ impl StorageServiceStatsHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobServiceClient::get_user_delegation_key()` pub trait UserDelegationKeyHeaders: private::Sealed { fn date(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl UserDelegationKeyHeaders for Response { @@ -3803,16 +2814,6 @@ impl UserDelegationKeyHeaders for Response { fn date(&self) -> Result> { Headers::get_optional_with(self.headers(), &DATE, |h| date::parse_rfc7231(h.as_str())) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } /// Provides access to typed response headers for `BlobContainerClient::get_access_policy()` @@ -3821,8 +2822,6 @@ pub trait VecSignedIdentifierHeaders: private::Sealed { fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn access(&self) -> Result>; - fn client_request_id(&self) -> Result>; - fn request_id(&self) -> Result>; } impl VecSignedIdentifierHeaders for Response, XmlFormat> { @@ -3847,16 +2846,6 @@ impl VecSignedIdentifierHeaders for Response, XmlFormat> { fn access(&self) -> Result> { Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS) } - - /// An opaque, globally-unique, client-generated string identifier for the request. - fn client_request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CLIENT_REQUEST_ID) - } - - /// An opaque, globally-unique, server-generated string identifier for the request. - fn request_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_ID) - } } mod private { @@ -3865,29 +2854,25 @@ mod private { AppendBlobClientCreateResult, AppendBlobClientSealResult, BlobClientAbortCopyFromUrlResult, BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, BlobClientCopyFromUrlResult, BlobClientCreateSnapshotResult, - BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteResult, BlobClientDownloadResult, + BlobClientDeleteImmutabilityPolicyResult, BlobClientDownloadResult, BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, BlobClientSetExpiryResult, BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldResult, - BlobClientSetMetadataResult, BlobClientSetPropertiesResult, BlobClientSetTagsResult, - BlobClientSetTierResult, BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, + BlobClientSetTagsResult, BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult, - BlobContainerClientChangeLeaseResult, BlobContainerClientCreateResult, - BlobContainerClientDeleteResult, BlobContainerClientGetAccountInfoResult, + BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult, BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult, BlobContainerClientRenameResult, BlobContainerClientRenewLeaseResult, BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyResult, - BlobContainerClientSetMetadataResult, BlobServiceClientGetAccountInfoResult, - BlobServiceClientSetPropertiesResult, BlobTags, BlockBlobClientCommitBlockListResult, + BlobServiceClientGetAccountInfoResult, BlobTags, BlockBlobClientCommitBlockListResult, BlockBlobClientPutBlobFromUrlResult, BlockBlobClientQueryResult, BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult, BlockBlobClientUploadResult, BlockList, FilterBlobSegment, ListBlobsFlatSegmentResponse, - ListBlobsHierarchySegmentResponse, ListContainersSegmentResponse, - PageBlobClientClearPagesResult, PageBlobClientCopyIncrementalResult, - PageBlobClientCreateResult, PageBlobClientResizeResult, - PageBlobClientUpdateSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult, - PageBlobClientUploadPagesResult, PageList, SignedIdentifier, StorageServiceProperties, - StorageServiceStats, UserDelegationKey, + ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult, + PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult, + PageBlobClientResizeResult, PageBlobClientUpdateSequenceNumberResult, + PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList, + SignedIdentifier, StorageServiceStats, UserDelegationKey, }; use azure_core::http::{NoFormat, Response, XmlFormat}; 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 48739da20c..32c8a1577c 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 @@ -124,10 +124,6 @@ pub struct BlobClientCreateSnapshotResult; #[derive(SafeDebug)] pub struct BlobClientDeleteImmutabilityPolicyResult; -/// Contains results for `BlobClient::delete()` -#[derive(SafeDebug)] -pub struct BlobClientDeleteResult; - /// Contains results for `BlobClient::download()` #[derive(SafeDebug)] pub struct BlobClientDownloadResult; @@ -160,22 +156,10 @@ pub struct BlobClientSetImmutabilityPolicyResult; #[derive(SafeDebug)] pub struct BlobClientSetLegalHoldResult; -/// Contains results for `BlobClient::set_metadata()` -#[derive(SafeDebug)] -pub struct BlobClientSetMetadataResult; - -/// Contains results for `BlobClient::set_properties()` -#[derive(SafeDebug)] -pub struct BlobClientSetPropertiesResult; - /// Contains results for `BlobClient::set_tags()` #[derive(SafeDebug)] pub struct BlobClientSetTagsResult; -/// Contains results for `BlobClient::set_tier()` -#[derive(SafeDebug)] -pub struct BlobClientSetTierResult; - /// Contains results for `BlobClient::start_copy_from_url()` #[derive(SafeDebug)] pub struct BlobClientStartCopyFromUrlResult; @@ -196,14 +180,6 @@ pub struct BlobContainerClientBreakLeaseResult; #[derive(SafeDebug)] pub struct BlobContainerClientChangeLeaseResult; -/// Contains results for `BlobContainerClient::create()` -#[derive(SafeDebug)] -pub struct BlobContainerClientCreateResult; - -/// Contains results for `BlobContainerClient::delete()` -#[derive(SafeDebug)] -pub struct BlobContainerClientDeleteResult; - /// Contains results for `BlobContainerClient::get_account_info()` #[derive(SafeDebug)] pub struct BlobContainerClientGetAccountInfoResult; @@ -232,10 +208,6 @@ pub struct BlobContainerClientRestoreResult; #[derive(SafeDebug)] pub struct BlobContainerClientSetAccessPolicyResult; -/// Contains results for `BlobContainerClient::set_metadata()` -#[derive(SafeDebug)] -pub struct BlobContainerClientSetMetadataResult; - /// The blob flat list segment. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] @@ -575,10 +547,6 @@ pub struct BlobPropertiesInternal { #[derive(SafeDebug)] pub struct BlobServiceClientGetAccountInfoResult; -/// Contains results for `BlobServiceClient::set_properties()` -#[derive(SafeDebug)] -pub struct BlobServiceClientSetPropertiesResult; - /// The blob tags. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[serde(rename = "Tag")] diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index cca9767b0c..b39b6a07f1 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -15,7 +15,8 @@ pub use clients::*; pub mod models { pub use crate::generated::models::{ - AccessTierOptional, ArchiveStatus, BlobClientDeleteOptions, BlobClientDownloadOptions, + AccessTierOptional, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, + ArchiveStatus, BlobClientDeleteOptions, BlobClientDownloadOptions, BlobClientDownloadResult, BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions, diff --git a/sdk/storage/azure_storage_blob/tsp-location.yaml b/sdk/storage/azure_storage_blob/tsp-location.yaml index 4694efb612..58f49ae9e4 100644 --- a/sdk/storage/azure_storage_blob/tsp-location.yaml +++ b/sdk/storage/azure_storage_blob/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/storage/Microsoft.BlobStorage -commit: 37843c7f2116830dccd5883d6960bc05c66d30b1 +commit: 0fb24e5a13f2eaa86af724acef4b725d0b3d0ca7 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: From 0665a7b075dcd70c8431de4e5c3c1ca165629ddd Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 18 Jun 2025 15:49:18 -0700 Subject: [PATCH 06/30] Need generated code support --- .../src/clients/page_blob_client.rs | 63 +++++++++- .../src/generated/clients/page_blob_client.rs | 6 + sdk/storage/azure_storage_blob/src/lib.rs | 7 +- .../tests/page_blob_client.rs | 108 +++++++++++++++++- 4 files changed, 176 insertions(+), 8 deletions(-) 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 80bb55c594..a70268dc30 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 @@ -3,7 +3,12 @@ use crate::{ generated::clients::PageBlobClient as GeneratedPageBlobClient, - models::{PageBlobClientCreateOptions, PageBlobClientCreateResult}, + models::{ + PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, + PageBlobClientCreateOptions, PageBlobClientCreateResult, PageBlobClientResizeOptions, + PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, + PageBlobClientUploadPagesResult, + }, pipeline::StorageHeadersPolicy, BlobClientOptions, PageBlobClientOptions, }; @@ -89,15 +94,63 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `content_length` - Total length of the blob data to be uploaded. - /// * `blob_content_length` - The maximum size for the Page blob, up to 1TB. The page blob size must + /// * `content_length` - The maximum size for the Page blob, up to 1TB. The page blob size must /// be aligned to a 512-byte boundary. /// * `options` - Optional parameters for the request. pub async fn create( &self, - blob_content_length: u64, + content_length: u64, options: Option>, ) -> Result> { - self.client.create(blob_content_length, options).await + self.client.create(content_length, options).await + } + + /// Clears a range of pages. + /// + /// # Arguments + /// + /// * `length` - Number of bytes to clear. The length specified must be a modulus of 512. + /// * `options` - Optional parameters for the request. + pub async fn clear_page( + &self, + length: u64, + options: Option>, + ) -> Result> { + self.client.clear_pages(length, options).await + } + + /// Resizes a Page blob to the specified size. If the specified value is less than + /// the current size of the blob, then all pages above the specified value are cleared. + /// + /// # Arguments + /// + /// * `size` - Size used to resize the blob. Maximum size for a page Blob is up to 1TB. The + /// Page blob size must be aligned to a 512-byte boundary. + /// * `options` - Optional parameters for the request. + pub async fn resize_blob( + &self, + size: u64, + options: Option>, + ) -> Result> { + self.client.resize(size, options).await + } + + /// The Upload Pages operation writes a range of pages to a Page blob. + /// + /// # Arguments + /// + /// * `data` - The contents of the page. + /// * `content_length` - Number of bytes to use for writing to a section of the blob. The + /// content_length specified must be a modulus of 512. + /// * `options` - Optional parameters for the request. + pub async fn upload_page( + &self, + data: RequestContent, + content_length: u64, + options: Option>, + ) -> Result> { + self.client + .upload_pages(data, content_length, options) + .await } } 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 9fcb689b1b..20926b8898 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 @@ -187,6 +187,9 @@ impl PageBlobClient { if let Some(range) = options.range { request.insert_header("x-ms-range", range); } + // Generated code support + // request.insert_header("x-ms-range", "bytes=0-511"); + request.insert_header("x-ms-version", &self.version); self.pipeline.send(&ctx, &mut request).await.map(Into::into) } @@ -752,6 +755,9 @@ impl PageBlobClient { if let Some(range) = options.range { request.insert_header("x-ms-range", range); } + // Generated code support + // request.insert_header("x-ms-range", "bytes=0-511"); + if let Some(structured_body_type) = options.structured_body_type { request.insert_header("x-ms-structured-body", structured_body_type); } diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index b39b6a07f1..3e76cf718f 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -29,7 +29,10 @@ pub mod models { BlockBlobClientGetBlockListOptions, BlockBlobClientStageBlockOptions, BlockBlobClientStageBlockResult, BlockBlobClientUploadOptions, BlockBlobClientUploadResult, BlockList, BlockListType, BlockLookupList, CopyStatus, LeaseState, LeaseStatus, - ListBlobsFlatSegmentResponse, PageBlobClientCreateOptions, PageBlobClientCreateResult, - PublicAccessType, RehydratePriority, StorageServiceProperties, + ListBlobsFlatSegmentResponse, PageBlobClientClearPagesOptions, + PageBlobClientClearPagesResult, PageBlobClientCreateOptions, PageBlobClientCreateResult, + PageBlobClientResizeOptions, PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, + PageBlobClientUploadPagesResult, PublicAccessType, RehydratePriority, + StorageServiceProperties, }; } diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index 6d3a53c23b..c09070b0a6 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -1,8 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +use azure_core::http::{RequestContent, StatusCode}; use azure_core_test::{recorded, TestContext}; -use azure_storage_blob::models::{BlobClientGetPropertiesResultHeaders, BlobType}; +use azure_storage_blob::models::{ + BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, + PageBlobClientUploadPagesOptions, +}; use azure_storage_blob_test::{get_blob_name, get_container_client}; use std::error::Error; @@ -27,3 +31,105 @@ async fn test_create_page_blob(ctx: TestContext) -> Result<(), Box> { container_client.delete_container(None).await?; Ok(()) } + +#[recorded::test] +async fn test_upload_page(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let page_blob_client = blob_client.page_blob_client(); + page_blob_client.create(512, None).await?; + let data = vec![b'A'; 512]; + page_blob_client + .upload_page(RequestContent::from(data.clone()), 512, None) + .await?; + + // Assert + let response = blob_client.download(None).await?; + let content_length = response.content_length()?; + 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?); + + container_client.delete_container(None).await?; + Ok(()) +} + +#[recorded::test] +async fn test_clear_page(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let page_blob_client = blob_client.page_blob_client(); + page_blob_client.create(512, None).await?; + let data = vec![b'A'; 512]; + page_blob_client + .upload_page(RequestContent::from(data), 512, None) + .await?; + + page_blob_client.clear_page(512, None).await?; + + // Assert + let response = blob_client.download(None).await?; + let content_length = response.content_length()?; + 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?); + + container_client.delete_container(None).await?; + Ok(()) +} + +#[recorded::test] +async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let page_blob_client = blob_client.page_blob_client(); + + // Blob Too Small Scenario + page_blob_client.create(512, None).await?; + let data = vec![b'A'; 1024]; + // TODO: REMOVE, SHOULD BE REQUIRED PARAM + let upload_page_options = PageBlobClientUploadPagesOptions { + range: Some("bytes=0-1023".to_string()), + ..Default::default() + }; + let response = page_blob_client + .upload_page( + RequestContent::from(data.clone()), + 1024, + Some(upload_page_options.clone()), + ) + .await; + // Assert + let error = response.unwrap_err().http_status(); + assert_eq!(StatusCode::RequestedRangeNotSatisfiable, error.unwrap()); + + page_blob_client.resize_blob(1024, None).await?; + page_blob_client + .upload_page( + RequestContent::from(data.clone()), + 1024, + Some(upload_page_options), + ) + .await?; + + // Truncate Blob Scenario + page_blob_client.resize_blob(512, None).await?; + // Assert + let response = blob_client.download(None).await?; + let content_length = response.content_length()?; + 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?); + + container_client.delete_container(None).await?; + Ok(()) +} From e217cb3339297861be116f807ae0c45d0bd993c2 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Fri, 20 Jun 2025 14:04:11 -0700 Subject: [PATCH 07/30] PR feedback, regen against corrected .tsp --- .../src/clients/page_blob_client.rs | 10 +++--- .../src/generated/clients/blob_client.rs | 6 ++-- .../src/generated/clients/page_blob_client.rs | 34 +++++++------------ .../src/generated/models/method_options.rs | 6 ---- .../tests/page_blob_client.rs | 30 ++++++++++------ .../azure_storage_blob/tsp-location.yaml | 2 +- 6 files changed, 42 insertions(+), 46 deletions(-) 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 a70268dc30..e646038f37 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 @@ -109,14 +109,14 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `length` - Number of bytes to clear. The length specified must be a modulus of 512. + /// * `range` - The range of bytes to clear. /// * `options` - Optional parameters for the request. pub async fn clear_page( &self, - length: u64, + range: String, options: Option>, ) -> Result> { - self.client.clear_pages(length, options).await + self.client.clear_pages(range, options).await } /// Resizes a Page blob to the specified size. If the specified value is less than @@ -142,15 +142,17 @@ impl PageBlobClient { /// * `data` - The contents of the page. /// * `content_length` - Number of bytes to use for writing to a section of the blob. The /// content_length specified must be a modulus of 512. + /// * `range` - The range of bytes to write to. /// * `options` - Optional parameters for the request. pub async fn upload_page( &self, data: RequestContent, content_length: u64, + range: String, options: Option>, ) -> Result> { self.client - .upload_pages(data, content_length, options) + .upload_pages(data, content_length, range, options) .await } } 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 69d08dc344..350aa03886 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 @@ -670,6 +670,9 @@ impl BlobClient { date::to_rfc7231(&if_unmodified_since), ); } + if let Some(range) = options.range { + request.insert_header("range", range); + } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); } @@ -691,9 +694,6 @@ impl BlobClient { if let Some(lease_id) = options.lease_id { request.insert_header("x-ms-lease-id", lease_id); } - if let Some(range) = options.range { - request.insert_header("x-ms-range", range); - } if let Some(range_get_content_crc64) = options.range_get_content_crc64 { request.insert_header( "x-ms-range-get-content-crc64", 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 20926b8898..ebba919ced 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 @@ -100,11 +100,11 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `content_length` - The length of the request. + /// * `range` - Bytes of data in the specified range. /// * `options` - Optional parameters for the request. pub async fn clear_pages( &self, - content_length: u64, + range: String, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); @@ -123,7 +123,7 @@ impl PageBlobClient { } let mut request = Request::new(url, Method::Put); request.insert_header("accept", "application/xml"); - request.insert_header("content-length", content_length.to_string()); + request.insert_header("content-length", "0"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } @@ -139,6 +139,7 @@ impl PageBlobClient { date::to_rfc7231(&if_unmodified_since), ); } + request.insert_header("range", range); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); } @@ -184,12 +185,6 @@ impl PageBlobClient { request.insert_header("x-ms-lease-id", lease_id); } request.insert_header("x-ms-page-write", "clear"); - if let Some(range) = options.range { - request.insert_header("x-ms-range", range); - } - // Generated code support - // request.insert_header("x-ms-range", "bytes=0-511"); - request.insert_header("x-ms-version", &self.version); self.pipeline.send(&ctx, &mut request).await.map(Into::into) } @@ -421,6 +416,9 @@ impl PageBlobClient { date::to_rfc7231(&if_unmodified_since), ); } + if let Some(range) = options.range { + request.insert_header("range", range); + } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); } @@ -430,9 +428,6 @@ impl PageBlobClient { if let Some(lease_id) = options.lease_id { request.insert_header("x-ms-lease-id", lease_id); } - if let Some(range) = options.range { - request.insert_header("x-ms-range", range); - } request.insert_header("x-ms-version", &self.version); self.pipeline.send(&ctx, &mut request).await.map(Into::into) } @@ -492,6 +487,9 @@ impl PageBlobClient { date::to_rfc7231(&if_unmodified_since), ); } + if let Some(range) = options.range { + request.insert_header("range", range); + } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); } @@ -504,9 +502,6 @@ impl PageBlobClient { if let Some(prev_snapshot_url) = options.prev_snapshot_url { request.insert_header("x-ms-previous-snapshot-url", prev_snapshot_url); } - if let Some(range) = options.range { - request.insert_header("x-ms-range", range); - } request.insert_header("x-ms-version", &self.version); self.pipeline.send(&ctx, &mut request).await.map(Into::into) } @@ -658,11 +653,13 @@ impl PageBlobClient { /// /// * `body` - The body of the request. /// * `content_length` - The length of the request. + /// * `range` - Bytes of data in the specified range. /// * `options` - Optional parameters for the request. pub async fn upload_pages( &self, body: RequestContent, content_length: u64, + range: String, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); @@ -701,6 +698,7 @@ impl PageBlobClient { date::to_rfc7231(&if_unmodified_since), ); } + request.insert_header("range", range); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); } @@ -752,12 +750,6 @@ impl PageBlobClient { request.insert_header("x-ms-lease-id", lease_id); } request.insert_header("x-ms-page-write", "update"); - if let Some(range) = options.range { - request.insert_header("x-ms-range", range); - } - // Generated code support - // request.insert_header("x-ms-range", "bytes=0-511"); - if let Some(structured_body_type) = options.structured_body_type { request.insert_header("x-ms-structured-body", structured_body_type); } 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 402e665a92..2654792fb4 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 @@ -2221,9 +2221,6 @@ pub struct PageBlobClientClearPagesOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Return only the bytes of the blob in the specified range. - pub 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, } @@ -2591,9 +2588,6 @@ pub struct PageBlobClientUploadPagesOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Return only the bytes of the blob in the specified range. - pub range: Option, - /// Required if the request body is a structured message. Specifies the message schema version and properties. pub structured_body_type: Option, diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index c09070b0a6..a009a91db6 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -5,7 +5,6 @@ use azure_core::http::{RequestContent, StatusCode}; use azure_core_test::{recorded, TestContext}; use azure_storage_blob::models::{ BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, - PageBlobClientUploadPagesOptions, }; use azure_storage_blob_test::{get_blob_name, get_container_client}; use std::error::Error; @@ -42,7 +41,12 @@ async fn test_upload_page(ctx: TestContext) -> Result<(), Box> { page_blob_client.create(512, None).await?; let data = vec![b'A'; 512]; page_blob_client - .upload_page(RequestContent::from(data.clone()), 512, None) + .upload_page( + RequestContent::from(data.clone()), + 512, + "bytes=0-511".to_string(), + None, + ) .await?; // Assert @@ -67,10 +71,17 @@ async fn test_clear_page(ctx: TestContext) -> Result<(), Box> { page_blob_client.create(512, None).await?; let data = vec![b'A'; 512]; page_blob_client - .upload_page(RequestContent::from(data), 512, None) + .upload_page( + RequestContent::from(data), + 512, + "bytes=0-511".to_string(), + None, + ) .await?; - page_blob_client.clear_page(512, None).await?; + page_blob_client + .clear_page("bytes=0-511".to_string(), None) + .await?; // Assert let response = blob_client.download(None).await?; @@ -95,16 +106,12 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { // Blob Too Small Scenario page_blob_client.create(512, None).await?; let data = vec![b'A'; 1024]; - // TODO: REMOVE, SHOULD BE REQUIRED PARAM - let upload_page_options = PageBlobClientUploadPagesOptions { - range: Some("bytes=0-1023".to_string()), - ..Default::default() - }; let response = page_blob_client .upload_page( RequestContent::from(data.clone()), 1024, - Some(upload_page_options.clone()), + "bytes=0-1023".to_string(), + None, ) .await; // Assert @@ -116,7 +123,8 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 1024, - Some(upload_page_options), + "bytes=0-1023".to_string(), + None, ) .await?; diff --git a/sdk/storage/azure_storage_blob/tsp-location.yaml b/sdk/storage/azure_storage_blob/tsp-location.yaml index 58f49ae9e4..0008d188d0 100644 --- a/sdk/storage/azure_storage_blob/tsp-location.yaml +++ b/sdk/storage/azure_storage_blob/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/storage/Microsoft.BlobStorage -commit: 0fb24e5a13f2eaa86af724acef4b725d0b3d0ca7 +commit: 839ef44c12a0236b2b3b9359a92f5014f906f115 repo: Azure/azure-rest-api-specs additionalDirectories: From b6e9a0a2ffe7caa54d667d1b082ee6f8ae40d689 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Fri, 20 Jun 2025 15:24:47 -0700 Subject: [PATCH 08/30] Added create-if-not-exists scenario to create_page_blob test suite --- .../tests/page_blob_client.rs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index a009a91db6..359ef6f1b6 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -5,6 +5,7 @@ use azure_core::http::{RequestContent, StatusCode}; use azure_core_test::{recorded, TestContext}; use azure_storage_blob::models::{ BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, + PageBlobClientCreateOptions, }; use azure_storage_blob_test::{get_blob_name, get_container_client}; use std::error::Error; @@ -17,13 +18,33 @@ async fn test_create_page_blob(ctx: TestContext) -> Result<(), Box> { let blob_client = container_client.blob_client(get_blob_name(recording)); let page_blob_client = blob_client.page_blob_client(); + // Regular Create Scenario page_blob_client.create(1024, None).await?; - // Assert let blob_properties = blob_client.get_properties(None).await?; let blob_type = blob_properties.blob_type()?; let content_length = blob_properties.content_length()?; + assert_eq!(1024, content_length.unwrap()); + assert_eq!(BlobType::PageBlob, blob_type.unwrap()); + + // Create If Not Exists Scenario + let create_options = PageBlobClientCreateOptions { + if_none_match: Some("*".to_string()), + ..Default::default() + }; + let response = page_blob_client + .create(1024, Some(create_options.clone())) + .await; + // Assert + let error = response.unwrap_err().http_status(); + assert_eq!(StatusCode::Conflict, error.unwrap()); + blob_client.delete(None).await?; + page_blob_client.create(1024, Some(create_options)).await?; + // Assert + let blob_properties = blob_client.get_properties(None).await?; + let blob_type = blob_properties.blob_type()?; + let content_length = blob_properties.content_length()?; assert_eq!(1024, content_length.unwrap()); assert_eq!(BlobType::PageBlob, blob_type.unwrap()); From 72b825f87e1860812e37b4e51d43506c3f436c20 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Mon, 23 Jun 2025 15:01:01 -0700 Subject: [PATCH 09/30] Add helper concept, refactor after helper --- .../src/clients/page_blob_client.rs | 26 ++++++++----- sdk/storage/azure_storage_blob/src/lib.rs | 2 + .../azure_storage_blob/src/serialize.rs | 31 +++++++++++++++ .../tests/page_blob_client.rs | 38 ++++--------------- 4 files changed, 57 insertions(+), 40 deletions(-) create mode 100644 sdk/storage/azure_storage_blob/src/serialize.rs 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 e646038f37..37b401e839 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 @@ -10,6 +10,7 @@ use crate::{ PageBlobClientUploadPagesResult, }, pipeline::StorageHeadersPolicy, + serialize::format_http_range, BlobClientOptions, PageBlobClientOptions, }; use azure_core::{ @@ -109,14 +110,20 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `range` - The range of bytes to clear. + /// * `offset` - Start of the byte range to use for clearing a section of the blob. + /// The offset specified must be a modulus of 512. + /// * `length` - Number of bytes to use for clearing a section of the blob. + /// The length specified must be a modulus of 512. /// * `options` - Optional parameters for the request. pub async fn clear_page( &self, - range: String, + offset: u64, + length: u64, options: Option>, ) -> Result> { - self.client.clear_pages(range, options).await + self.client + .clear_pages(format_http_range(offset, length), options) + .await } /// Resizes a Page blob to the specified size. If the specified value is less than @@ -140,19 +147,20 @@ impl PageBlobClient { /// # Arguments /// /// * `data` - The contents of the page. - /// * `content_length` - Number of bytes to use for writing to a section of the blob. The - /// content_length specified must be a modulus of 512. - /// * `range` - The range of bytes to write to. + /// * `offset` - Start of the byte range to use for writing to a section of the blob. + /// The offset specified must be a modulus of 512. + /// * `length` - Number of bytes to use for writing to a section of the blob. + /// The length specified must be a modulus of 512. /// * `options` - Optional parameters for the request. pub async fn upload_page( &self, data: RequestContent, - content_length: u64, - range: String, + offset: u64, + length: u64, options: Option>, ) -> Result> { self.client - .upload_pages(data, content_length, range, options) + .upload_pages(data, length, format_http_range(offset, length), options) .await } } diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index dba66957ca..15b5e2d1f4 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -10,6 +10,7 @@ pub mod clients; mod generated; mod pipeline; +pub mod serialize; pub use clients::*; @@ -37,4 +38,5 @@ pub mod models { PageBlobClientUploadPagesResult, PublicAccessType, RehydratePriority, StorageServiceProperties, }; + pub use crate::serialize::*; } diff --git a/sdk/storage/azure_storage_blob/src/serialize.rs b/sdk/storage/azure_storage_blob/src/serialize.rs new file mode 100644 index 0000000000..ae27dcec60 --- /dev/null +++ b/sdk/storage/azure_storage_blob/src/serialize.rs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use crate::models::PageBlobClientCreateOptions; + +/// Takes in an offset and a length and returns the HTTP range in string format. +/// +/// # Arguments +/// +/// * `offset` - Start of the byte range to use for writing to a section of the blob. Must be aligned +/// to a 512-byte boundary. +/// * `length` - Number of bytes to use for writing to a section of the blob. Must be aligned +/// to a 512-byte boundary. +pub fn format_http_range(offset: u64, length: u64) -> String { + if offset % 512 != 0 { + panic!("offset must be aligned to a 512-byte boundary."); + } + if length % 512 != 0 { + panic!("length must be aligned to a 512-byte boundary."); + } + let end_range = offset + length - 1; + let content_range = format!("bytes={}-{}", offset, end_range); + content_range +} + +pub fn page_blob_create_if_not_exists( + mut options: PageBlobClientCreateOptions, +) -> PageBlobClientCreateOptions { + options.if_none_match = Some("*".to_string()); + options +} diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index 359ef6f1b6..7fdf1fcbff 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -7,6 +7,7 @@ use azure_storage_blob::models::{ BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, PageBlobClientCreateOptions, }; +use azure_storage_blob::serialize::page_blob_create_if_not_exists; use azure_storage_blob_test::{get_blob_name, get_container_client}; use std::error::Error; @@ -28,10 +29,7 @@ async fn test_create_page_blob(ctx: TestContext) -> Result<(), Box> { assert_eq!(BlobType::PageBlob, blob_type.unwrap()); // Create If Not Exists Scenario - let create_options = PageBlobClientCreateOptions { - if_none_match: Some("*".to_string()), - ..Default::default() - }; + let create_options = page_blob_create_if_not_exists(PageBlobClientCreateOptions::default()); let response = page_blob_client .create(1024, Some(create_options.clone())) .await; @@ -62,12 +60,7 @@ async fn test_upload_page(ctx: TestContext) -> Result<(), Box> { page_blob_client.create(512, None).await?; let data = vec![b'A'; 512]; page_blob_client - .upload_page( - RequestContent::from(data.clone()), - 512, - "bytes=0-511".to_string(), - None, - ) + .upload_page(RequestContent::from(data.clone()), 0, 512, None) .await?; // Assert @@ -92,17 +85,10 @@ async fn test_clear_page(ctx: TestContext) -> Result<(), Box> { page_blob_client.create(512, None).await?; let data = vec![b'A'; 512]; page_blob_client - .upload_page( - RequestContent::from(data), - 512, - "bytes=0-511".to_string(), - None, - ) + .upload_page(RequestContent::from(data), 0, 512, None) .await?; - page_blob_client - .clear_page("bytes=0-511".to_string(), None) - .await?; + page_blob_client.clear_page(0, 512, None).await?; // Assert let response = blob_client.download(None).await?; @@ -128,12 +114,7 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { page_blob_client.create(512, None).await?; let data = vec![b'A'; 1024]; let response = page_blob_client - .upload_page( - RequestContent::from(data.clone()), - 1024, - "bytes=0-1023".to_string(), - None, - ) + .upload_page(RequestContent::from(data.clone()), 0, 1024, None) .await; // Assert let error = response.unwrap_err().http_status(); @@ -141,12 +122,7 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { page_blob_client.resize_blob(1024, None).await?; page_blob_client - .upload_page( - RequestContent::from(data.clone()), - 1024, - "bytes=0-1023".to_string(), - None, - ) + .upload_page(RequestContent::from(data.clone()), 0, 1024, None) .await?; // Truncate Blob Scenario From df0cbce5ed769aa9a9bee77723b689c90aa8c52b Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Mon, 23 Jun 2025 17:04:10 -0700 Subject: [PATCH 10/30] Regen against v0.17 & tsp changes --- eng/emitter-package-lock.json | 26 +- eng/emitter-package.json | 4 +- .../generated/clients/append_blob_client.rs | 60 ++-- .../src/generated/clients/blob_client.rs | 131 +++----- .../clients/blob_container_client.rs | 54 +--- .../generated/clients/block_blob_client.rs | 93 ++---- .../src/generated/clients/page_blob_client.rs | 93 ++---- .../src/generated/models/header_traits.rs | 304 +++++++----------- .../src/generated/models/method_options.rs | 3 +- .../src/generated/models/models_serde.rs | 6 +- .../src/generated/models/pub_models.rs | 23 +- .../azure_storage_blob/tsp-location.yaml | 4 +- 12 files changed, 297 insertions(+), 504 deletions(-) diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index 1f0ed47868..089739532a 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,12 +5,12 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-rust": "0.16.0" + "@azure-tools/typespec-rust": "0.17.0" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.57.0", "@azure-tools/typespec-azure-rulesets": "0.57.0", - "@azure-tools/typespec-client-generator-core": "0.57.0", + "@azure-tools/typespec-client-generator-core": "0.57.1", "@typespec/compiler": "1.1.0", "@typespec/http": "1.1.0", "@typespec/openapi": "1.1.0", @@ -118,9 +118,9 @@ } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.57.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.57.0.tgz", - "integrity": "sha512-k8Z2BMKF5OtsjnAA3kJTT/5iK4ndhxcen1k5H8xKv8TSNlpAK0TX98Kvhpo5y1HJXBNNnW0VRcS2y3onDfsecw==", + "version": "0.57.1", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.57.1.tgz", + "integrity": "sha512-R91xwSVDQrAf7wk/u2aJDz/zthGjp+RpziVbFeg4+u4BdPP1+fY4WwXCb3wG4fF8GdlkvYZAE0q+HVPsu15gYg==", "license": "MIT", "dependencies": { "change-case": "~5.4.4", @@ -144,16 +144,16 @@ } }, "node_modules/@azure-tools/typespec-rust": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-rust/-/typespec-rust-0.16.0.tgz", - "integrity": "sha512-Whc0jAkbW75iXB6Uu5NJz7gGdcXo6jRb0A0W0fQ57AUUpPVBlo92oRpo2ga4bgvHGS+R4dQYJwfKl9KV5yENOg==", + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-rust/-/typespec-rust-0.17.0.tgz", + "integrity": "sha512-6BrPtpt849Kap/nFRa7tWCKn3fGmjP2sJBgdwLnc7nZVu9+XnYVggvEVs5yRWRHPj8xTj8LPrCWtL4FbCiejZw==", "license": "MIT", "dependencies": { "@azure-tools/codegen": "~2.10.0", "@azure-tools/linq": "~3.1.263", "@types/turndown": "^5.0.5", "linkifyjs": "^4.2.0", - "query-string": "9.2.0", + "query-string": "9.2.1", "source-map-support": "0.5.21", "turndown": "^7.2.0" }, @@ -161,7 +161,7 @@ "node": ">=20.0.0" }, "peerDependencies": { - "@azure-tools/typespec-client-generator-core": ">=0.57.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.57.1 <1.0.0", "@typespec/compiler": "^1.1.0", "@typespec/http": "^1.1.0" } @@ -1287,9 +1287,9 @@ } }, "node_modules/query-string": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-9.2.0.tgz", - "integrity": "sha512-YIRhrHujoQxhexwRLxfy3VSjOXmvZRd2nyw1PwL1UUqZ/ys1dEZd1+NSgXkne2l/4X/7OXkigEAuhTX0g/ivJQ==", + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-9.2.1.tgz", + "integrity": "sha512-3jTGGLRzlhu/1ws2zlr4Q+GVMLCQTLFOj8CMX5x44cdZG9FQE07x2mQhaNxaKVPNmIDu0mvJ/cEwtY7Pim7hqA==", "license": "MIT", "dependencies": { "decode-uri-component": "^0.4.1", diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 4ca9fc9439..650bb51e0b 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,12 +1,12 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-rust": "0.16.0" + "@azure-tools/typespec-rust": "0.17.0" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.57.0", "@azure-tools/typespec-azure-rulesets": "0.57.0", - "@azure-tools/typespec-client-generator-core": "0.57.0", + "@azure-tools/typespec-client-generator-core": "0.57.1", "@typespec/compiler": "1.1.0", "@typespec/http": "1.1.0", "@typespec/openapi": "1.1.0", 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 e4c4c39a3e..cd98ac262a 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 @@ -10,14 +10,15 @@ use crate::generated::models::{ AppendBlobClientSealResult, }; use azure_core::{ - base64, + base64::encode, credentials::TokenCredential, fmt::SafeDebug, http::{ policies::{BearerTokenCredentialPolicy, Policy}, ClientOptions, Context, Method, NoFormat, Pipeline, Request, RequestContent, Response, Url, }, - time, Bytes, Result, + time::to_rfc7231, + Bytes, Result, }; use std::sync::Arc; @@ -118,23 +119,20 @@ impl AppendBlobClient { request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { - request.insert_header("content-md5", base64::encode(transactional_content_md5)); + request.insert_header("content-md5", encode(transactional_content_md5)); } request.insert_header("content-type", "application/octet-stream"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(append_position) = options.append_position { request.insert_header("x-ms-blob-condition-appendpos", append_position.to_string()); @@ -146,10 +144,7 @@ impl AppendBlobClient { request.insert_header("x-ms-client-request-id", client_request_id); } if let Some(transactional_content_crc64) = options.transactional_content_crc64 { - request.insert_header( - "x-ms-content-crc64", - base64::encode(transactional_content_crc64), - ); + request.insert_header("x-ms-content-crc64", encode(transactional_content_crc64)); } if let Some(encryption_algorithm) = options.encryption_algorithm { request.insert_header( @@ -218,23 +213,20 @@ impl AppendBlobClient { request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { - request.insert_header("content-md5", base64::encode(transactional_content_md5)); + request.insert_header("content-md5", encode(transactional_content_md5)); } request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(append_position) = options.append_position { request.insert_header("x-ms-blob-condition-appendpos", append_position.to_string()); @@ -274,16 +266,10 @@ impl AppendBlobClient { request.insert_header("x-ms-lease-id", lease_id); } if let Some(source_content_crc64) = options.source_content_crc64 { - request.insert_header( - "x-ms-source-content-crc64", - base64::encode(source_content_crc64), - ); + request.insert_header("x-ms-source-content-crc64", encode(source_content_crc64)); } if let Some(source_content_md5) = options.source_content_md5 { - request.insert_header( - "x-ms-source-content-md5", - base64::encode(source_content_md5), - ); + request.insert_header("x-ms-source-content-md5", encode(source_content_md5)); } if let Some(source_if_match) = options.source_if_match { request.insert_header("x-ms-source-if-match", source_if_match); @@ -291,7 +277,7 @@ impl AppendBlobClient { if let Some(source_if_modified_since) = options.source_if_modified_since { request.insert_header( "x-ms-source-if-modified-since", - time::to_rfc7231(&source_if_modified_since), + to_rfc7231(&source_if_modified_since), ); } if let Some(source_if_none_match) = options.source_if_none_match { @@ -300,7 +286,7 @@ impl AppendBlobClient { if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { request.insert_header( "x-ms-source-if-unmodified-since", - time::to_rfc7231(&source_if_unmodified_since), + to_rfc7231(&source_if_unmodified_since), ); } if let Some(source_range) = options.source_range { @@ -337,16 +323,13 @@ impl AppendBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(blob_cache_control) = options.blob_cache_control { request.insert_header("x-ms-blob-cache-control", blob_cache_control); @@ -361,7 +344,7 @@ impl AppendBlobClient { request.insert_header("x-ms-blob-content-language", blob_content_language); } if let Some(blob_content_md5) = options.blob_content_md5 { - request.insert_header("x-ms-blob-content-md5", base64::encode(blob_content_md5)); + request.insert_header("x-ms-blob-content-md5", encode(blob_content_md5)); } if let Some(blob_content_type) = options.blob_content_type { request.insert_header("x-ms-blob-content-type", blob_content_type); @@ -397,7 +380,7 @@ impl AppendBlobClient { if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { request.insert_header( "x-ms-immutability-policy-until-date", - time::to_rfc7231(&immutability_policy_expiry), + to_rfc7231(&immutability_policy_expiry), ); } if let Some(lease_id) = options.lease_id { @@ -447,16 +430,13 @@ impl AppendBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(append_position) = options.append_position { request.insert_header("x-ms-blob-condition-appendpos", append_position.to_string()); 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 2262f2bca2..621ad3ceac 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 @@ -26,7 +26,7 @@ use crate::generated::{ }, }; use azure_core::{ - base64, + base64::encode, credentials::TokenCredential, fmt::SafeDebug, http::{ @@ -34,7 +34,8 @@ use azure_core::{ ClientOptions, Context, Method, NoFormat, Pipeline, Request, RequestContent, Response, Url, XmlFormat, }, - time, Result, + time::to_rfc7231, + Result, }; use std::sync::Arc; @@ -177,16 +178,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -236,16 +234,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -296,16 +291,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -355,16 +347,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(tier) = options.tier { request.insert_header("x-ms-access-tier", tier.to_string()); @@ -397,7 +386,7 @@ impl BlobClient { if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { request.insert_header( "x-ms-immutability-policy-until-date", - time::to_rfc7231(&immutability_policy_expiry), + to_rfc7231(&immutability_policy_expiry), ); } if let Some(lease_id) = options.lease_id { @@ -413,10 +402,7 @@ impl BlobClient { } request.insert_header("x-ms-requires-sync", "true"); if let Some(source_content_md5) = options.source_content_md5 { - request.insert_header( - "x-ms-source-content-md5", - base64::encode(source_content_md5), - ); + request.insert_header("x-ms-source-content-md5", encode(source_content_md5)); } if let Some(source_if_match) = options.source_if_match { request.insert_header("x-ms-source-if-match", source_if_match); @@ -424,7 +410,7 @@ impl BlobClient { if let Some(source_if_modified_since) = options.source_if_modified_since { request.insert_header( "x-ms-source-if-modified-since", - time::to_rfc7231(&source_if_modified_since), + to_rfc7231(&source_if_modified_since), ); } if let Some(source_if_none_match) = options.source_if_none_match { @@ -433,7 +419,7 @@ impl BlobClient { if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { request.insert_header( "x-ms-source-if-unmodified-since", - time::to_rfc7231(&source_if_unmodified_since), + to_rfc7231(&source_if_unmodified_since), ); } if let Some(blob_tags_string) = options.blob_tags_string { @@ -471,16 +457,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -560,16 +543,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -658,16 +638,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(range) = options.range { request.insert_header("range", range); @@ -812,16 +789,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -925,16 +899,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -981,16 +952,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -1035,7 +1003,7 @@ impl BlobClient { } request.insert_header("x-ms-expiry-option", expiry_options.to_string()); if let Some(expires_on) = options.expires_on { - request.insert_header("x-ms-expiry-time", time::to_rfc7231(&expires_on)); + request.insert_header("x-ms-expiry-time", to_rfc7231(&expires_on)); } request.insert_header("x-ms-version", &self.version); self.pipeline.send(&ctx, &mut request).await.map(Into::into) @@ -1073,10 +1041,7 @@ impl BlobClient { request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -1090,7 +1055,7 @@ impl BlobClient { if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { request.insert_header( "x-ms-immutability-policy-until-date", - time::to_rfc7231(&immutability_policy_expiry), + to_rfc7231(&immutability_policy_expiry), ); } request.insert_header("x-ms-version", &self.version); @@ -1165,16 +1130,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -1239,16 +1201,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(blob_cache_control) = options.blob_cache_control { request.insert_header("x-ms-blob-cache-control", blob_cache_control); @@ -1263,7 +1222,7 @@ impl BlobClient { request.insert_header("x-ms-blob-content-language", blob_content_language); } if let Some(blob_content_md5) = options.blob_content_md5 { - request.insert_header("x-ms-blob-content-md5", base64::encode(blob_content_md5)); + request.insert_header("x-ms-blob-content-md5", encode(blob_content_md5)); } if let Some(blob_content_type) = options.blob_content_type { request.insert_header("x-ms-blob-content-type", blob_content_type); @@ -1310,17 +1269,14 @@ impl BlobClient { let mut request = Request::new(url, Method::Put); request.insert_header("accept", "application/xml"); if let Some(transactional_content_md5) = options.transactional_content_md5 { - request.insert_header("content-md5", base64::encode(transactional_content_md5)); + request.insert_header("content-md5", encode(transactional_content_md5)); } request.insert_header("content-type", "application/xml"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); } if let Some(transactional_content_crc64) = options.transactional_content_crc64 { - request.insert_header( - "x-ms-content-crc64", - base64::encode(transactional_content_crc64), - ); + request.insert_header("x-ms-content-crc64", encode(transactional_content_crc64)); } if let Some(if_tags) = options.if_tags { request.insert_header("x-ms-if-tags", if_tags); @@ -1415,16 +1371,13 @@ impl BlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(tier) = options.tier { request.insert_header("x-ms-access-tier", tier.to_string()); @@ -1445,7 +1398,7 @@ impl BlobClient { if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { request.insert_header( "x-ms-immutability-policy-until-date", - time::to_rfc7231(&immutability_policy_expiry), + to_rfc7231(&immutability_policy_expiry), ); } if let Some(lease_id) = options.lease_id { @@ -1472,7 +1425,7 @@ impl BlobClient { if let Some(source_if_modified_since) = options.source_if_modified_since { request.insert_header( "x-ms-source-if-modified-since", - time::to_rfc7231(&source_if_modified_since), + to_rfc7231(&source_if_modified_since), ); } if let Some(source_if_none_match) = options.source_if_none_match { @@ -1484,7 +1437,7 @@ impl BlobClient { if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { request.insert_header( "x-ms-source-if-unmodified-since", - time::to_rfc7231(&source_if_unmodified_since), + to_rfc7231(&source_if_unmodified_since), ); } if let Some(blob_tags_string) = options.blob_tags_string { diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs index 7c197a64c4..84f27dcf78 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs @@ -32,7 +32,8 @@ use azure_core::{ ClientOptions, Context, Method, NoFormat, PageIterator, PagerResult, Pipeline, RawResponse, Request, RequestContent, Response, Url, XmlFormat, }, - time, xml, Result, + time::to_rfc7231, + xml, Result, }; use std::sync::Arc; @@ -125,13 +126,10 @@ impl BlobContainerClient { let mut request = Request::new(url, Method::Put); request.insert_header("accept", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -173,13 +171,10 @@ impl BlobContainerClient { request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -222,13 +217,10 @@ impl BlobContainerClient { request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -309,13 +301,10 @@ impl BlobContainerClient { request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -697,13 +686,10 @@ impl BlobContainerClient { request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -778,13 +764,10 @@ impl BlobContainerClient { request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -858,13 +841,10 @@ impl BlobContainerClient { request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(access) = options.access { request.insert_header("x-ms-blob-public-access", access.to_string()); @@ -904,7 +884,7 @@ impl BlobContainerClient { request.insert_header("accept", "application/xml"); request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); 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 6deecdc67f..240907456b 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 @@ -13,7 +13,7 @@ use crate::generated::models::{ BlockLookupList, QueryRequest, }; use azure_core::{ - base64, + base64::encode, credentials::TokenCredential, fmt::SafeDebug, http::{ @@ -21,7 +21,8 @@ use azure_core::{ ClientOptions, Context, Method, NoFormat, Pipeline, Request, RequestContent, Response, Url, XmlFormat, }, - time, Bytes, Result, + time::to_rfc7231, + Bytes, Result, }; use std::sync::Arc; @@ -124,23 +125,20 @@ impl BlockBlobClient { let mut request = Request::new(url, Method::Put); request.insert_header("accept", "application/xml"); if let Some(transactional_content_md5) = options.transactional_content_md5 { - request.insert_header("content-md5", base64::encode(transactional_content_md5)); + request.insert_header("content-md5", encode(transactional_content_md5)); } request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(tier) = options.tier { request.insert_header("x-ms-access-tier", tier.to_string()); @@ -158,7 +156,7 @@ impl BlockBlobClient { request.insert_header("x-ms-blob-content-language", blob_content_language); } if let Some(blob_content_md5) = options.blob_content_md5 { - request.insert_header("x-ms-blob-content-md5", base64::encode(blob_content_md5)); + request.insert_header("x-ms-blob-content-md5", encode(blob_content_md5)); } if let Some(blob_content_type) = options.blob_content_type { request.insert_header("x-ms-blob-content-type", blob_content_type); @@ -167,10 +165,7 @@ impl BlockBlobClient { request.insert_header("x-ms-client-request-id", client_request_id); } if let Some(transactional_content_crc64) = options.transactional_content_crc64 { - request.insert_header( - "x-ms-content-crc64", - base64::encode(transactional_content_crc64), - ); + request.insert_header("x-ms-content-crc64", encode(transactional_content_crc64)); } if let Some(encryption_algorithm) = options.encryption_algorithm { request.insert_header( @@ -199,7 +194,7 @@ impl BlockBlobClient { if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { request.insert_header( "x-ms-immutability-policy-until-date", - time::to_rfc7231(&immutability_policy_expiry), + to_rfc7231(&immutability_policy_expiry), ); } if let Some(lease_id) = options.lease_id { @@ -302,22 +297,19 @@ impl BlockBlobClient { request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { - request.insert_header("content-md5", base64::encode(transactional_content_md5)); + request.insert_header("content-md5", encode(transactional_content_md5)); } if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(tier) = options.tier { request.insert_header("x-ms-access-tier", tier.to_string()); @@ -335,7 +327,7 @@ impl BlockBlobClient { request.insert_header("x-ms-blob-content-language", blob_content_language); } if let Some(blob_content_md5) = options.blob_content_md5 { - request.insert_header("x-ms-blob-content-md5", base64::encode(blob_content_md5)); + request.insert_header("x-ms-blob-content-md5", encode(blob_content_md5)); } if let Some(blob_content_type) = options.blob_content_type { request.insert_header("x-ms-blob-content-type", blob_content_type); @@ -387,10 +379,7 @@ impl BlockBlobClient { } } if let Some(source_content_md5) = options.source_content_md5 { - request.insert_header( - "x-ms-source-content-md5", - base64::encode(source_content_md5), - ); + request.insert_header("x-ms-source-content-md5", encode(source_content_md5)); } if let Some(source_if_match) = options.source_if_match { request.insert_header("x-ms-source-if-match", source_if_match); @@ -398,7 +387,7 @@ impl BlockBlobClient { if let Some(source_if_modified_since) = options.source_if_modified_since { request.insert_header( "x-ms-source-if-modified-since", - time::to_rfc7231(&source_if_modified_since), + to_rfc7231(&source_if_modified_since), ); } if let Some(source_if_none_match) = options.source_if_none_match { @@ -410,7 +399,7 @@ impl BlockBlobClient { if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { request.insert_header( "x-ms-source-if-unmodified-since", - time::to_rfc7231(&source_if_unmodified_since), + to_rfc7231(&source_if_unmodified_since), ); } if let Some(blob_tags_string) = options.blob_tags_string { @@ -453,16 +442,13 @@ impl BlockBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -516,7 +502,7 @@ impl BlockBlobClient { url = url.join(&path)?; url.query_pairs_mut().append_pair("comp", "block"); url.query_pairs_mut() - .append_pair("blockid", &base64::encode(block_id)); + .append_pair("blockid", &encode(block_id)); if let Some(timeout) = options.timeout { url.query_pairs_mut() .append_pair("timeout", &timeout.to_string()); @@ -525,17 +511,14 @@ impl BlockBlobClient { request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { - request.insert_header("content-md5", base64::encode(transactional_content_md5)); + request.insert_header("content-md5", encode(transactional_content_md5)); } request.insert_header("content-type", "application/octet-stream"); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); } if let Some(transactional_content_crc64) = options.transactional_content_crc64 { - request.insert_header( - "x-ms-content-crc64", - base64::encode(transactional_content_crc64), - ); + request.insert_header("x-ms-content-crc64", encode(transactional_content_crc64)); } if let Some(encryption_algorithm) = options.encryption_algorithm { request.insert_header( @@ -598,7 +581,7 @@ impl BlockBlobClient { .append_pair("comp", "block") .append_key_only("fromURL"); url.query_pairs_mut() - .append_pair("blockid", &base64::encode(block_id)); + .append_pair("blockid", &encode(block_id)); if let Some(timeout) = options.timeout { url.query_pairs_mut() .append_pair("timeout", &timeout.to_string()); @@ -636,16 +619,10 @@ impl BlockBlobClient { request.insert_header("x-ms-lease-id", lease_id); } if let Some(source_content_crc64) = options.source_content_crc64 { - request.insert_header( - "x-ms-source-content-crc64", - base64::encode(source_content_crc64), - ); + request.insert_header("x-ms-source-content-crc64", encode(source_content_crc64)); } if let Some(source_content_md5) = options.source_content_md5 { - request.insert_header( - "x-ms-source-content-md5", - base64::encode(source_content_md5), - ); + request.insert_header("x-ms-source-content-md5", encode(source_content_md5)); } if let Some(source_if_match) = options.source_if_match { request.insert_header("x-ms-source-if-match", source_if_match); @@ -653,7 +630,7 @@ impl BlockBlobClient { if let Some(source_if_modified_since) = options.source_if_modified_since { request.insert_header( "x-ms-source-if-modified-since", - time::to_rfc7231(&source_if_modified_since), + to_rfc7231(&source_if_modified_since), ); } if let Some(source_if_none_match) = options.source_if_none_match { @@ -662,7 +639,7 @@ impl BlockBlobClient { if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { request.insert_header( "x-ms-source-if-unmodified-since", - time::to_rfc7231(&source_if_unmodified_since), + to_rfc7231(&source_if_unmodified_since), ); } if let Some(source_range) = options.source_range { @@ -703,23 +680,20 @@ impl BlockBlobClient { request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { - request.insert_header("content-md5", base64::encode(transactional_content_md5)); + request.insert_header("content-md5", encode(transactional_content_md5)); } request.insert_header("content-type", "application/octet-stream"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(tier) = options.tier { request.insert_header("x-ms-access-tier", tier.to_string()); @@ -737,7 +711,7 @@ impl BlockBlobClient { request.insert_header("x-ms-blob-content-language", blob_content_language); } if let Some(blob_content_md5) = options.blob_content_md5 { - request.insert_header("x-ms-blob-content-md5", base64::encode(blob_content_md5)); + request.insert_header("x-ms-blob-content-md5", encode(blob_content_md5)); } if let Some(blob_content_type) = options.blob_content_type { request.insert_header("x-ms-blob-content-type", blob_content_type); @@ -747,10 +721,7 @@ impl BlockBlobClient { request.insert_header("x-ms-client-request-id", client_request_id); } if let Some(transactional_content_crc64) = options.transactional_content_crc64 { - request.insert_header( - "x-ms-content-crc64", - base64::encode(transactional_content_crc64), - ); + request.insert_header("x-ms-content-crc64", encode(transactional_content_crc64)); } if let Some(encryption_algorithm) = options.encryption_algorithm { request.insert_header( @@ -779,7 +750,7 @@ impl BlockBlobClient { if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { request.insert_header( "x-ms-immutability-policy-until-date", - time::to_rfc7231(&immutability_policy_expiry), + to_rfc7231(&immutability_policy_expiry), ); } if let Some(lease_id) = options.lease_id { 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 98e8f257e3..5442724163 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 @@ -15,7 +15,7 @@ use crate::generated::models::{ SequenceNumberActionType, }; use azure_core::{ - base64, + base64::encode, credentials::TokenCredential, fmt::SafeDebug, http::{ @@ -23,7 +23,8 @@ use azure_core::{ ClientOptions, Context, Method, NoFormat, Pipeline, Request, RequestContent, Response, Url, XmlFormat, }, - time, Bytes, Result, + time::to_rfc7231, + Bytes, Result, }; use std::sync::Arc; @@ -127,16 +128,13 @@ impl PageBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } request.insert_header("range", range); if let Some(client_request_id) = options.client_request_id { @@ -223,16 +221,13 @@ impl PageBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -275,16 +270,13 @@ impl PageBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(tier) = options.tier { request.insert_header("x-ms-access-tier", tier.to_string()); @@ -303,7 +295,7 @@ impl PageBlobClient { } request.insert_header("x-ms-blob-content-length", blob_content_length.to_string()); if let Some(blob_content_md5) = options.blob_content_md5 { - request.insert_header("x-ms-blob-content-md5", base64::encode(blob_content_md5)); + request.insert_header("x-ms-blob-content-md5", encode(blob_content_md5)); } if let Some(blob_content_type) = options.blob_content_type { request.insert_header("x-ms-blob-content-type", blob_content_type); @@ -345,7 +337,7 @@ impl PageBlobClient { if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { request.insert_header( "x-ms-immutability-policy-until-date", - time::to_rfc7231(&immutability_policy_expiry), + to_rfc7231(&immutability_policy_expiry), ); } if let Some(lease_id) = options.lease_id { @@ -404,16 +396,13 @@ impl PageBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(range) = options.range { request.insert_header("range", range); @@ -475,16 +464,13 @@ impl PageBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(range) = options.range { request.insert_header("range", range); @@ -538,16 +524,13 @@ impl PageBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } request.insert_header("x-ms-blob-content-length", blob_content_length.to_string()); if let Some(client_request_id) = options.client_request_id { @@ -612,16 +595,13 @@ impl PageBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(blob_sequence_number) = options.blob_sequence_number { request.insert_header( @@ -679,33 +659,27 @@ impl PageBlobClient { request.insert_header("accept", "application/xml"); request.insert_header("content-length", content_length.to_string()); if let Some(transactional_content_md5) = options.transactional_content_md5 { - request.insert_header("content-md5", base64::encode(transactional_content_md5)); + request.insert_header("content-md5", encode(transactional_content_md5)); } request.insert_header("content-type", "application/octet-stream"); if let Some(if_match) = options.if_match { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } request.insert_header("range", range); if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); } if let Some(transactional_content_crc64) = options.transactional_content_crc64 { - request.insert_header( - "x-ms-content-crc64", - base64::encode(transactional_content_crc64), - ); + request.insert_header("x-ms-content-crc64", encode(transactional_content_crc64)); } if let Some(encryption_algorithm) = options.encryption_algorithm { request.insert_header( @@ -804,16 +778,13 @@ impl PageBlobClient { request.insert_header("if-match", if_match); } if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", time::to_rfc7231(&if_modified_since)); + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(if_none_match) = options.if_none_match { request.insert_header("if-none-match", if_none_match); } if let Some(if_unmodified_since) = options.if_unmodified_since { - request.insert_header( - "if-unmodified-since", - time::to_rfc7231(&if_unmodified_since), - ); + request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } if let Some(client_request_id) = options.client_request_id { request.insert_header("x-ms-client-request-id", client_request_id); @@ -869,16 +840,10 @@ impl PageBlobClient { request.insert_header("x-ms-page-write", "update"); request.insert_header("x-ms-range", range); if let Some(source_content_crc64) = options.source_content_crc64 { - request.insert_header( - "x-ms-source-content-crc64", - base64::encode(source_content_crc64), - ); + request.insert_header("x-ms-source-content-crc64", encode(source_content_crc64)); } if let Some(source_content_md5) = options.source_content_md5 { - request.insert_header( - "x-ms-source-content-md5", - base64::encode(source_content_md5), - ); + request.insert_header("x-ms-source-content-md5", encode(source_content_md5)); } if let Some(source_if_match) = options.source_if_match { request.insert_header("x-ms-source-if-match", source_if_match); @@ -886,7 +851,7 @@ impl PageBlobClient { if let Some(source_if_modified_since) = options.source_if_modified_since { request.insert_header( "x-ms-source-if-modified-since", - time::to_rfc7231(&source_if_modified_since), + to_rfc7231(&source_if_modified_since), ); } if let Some(source_if_none_match) = options.source_if_none_match { @@ -895,7 +860,7 @@ impl PageBlobClient { if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { request.insert_header( "x-ms-source-if-unmodified-since", - time::to_rfc7231(&source_if_unmodified_since), + to_rfc7231(&source_if_unmodified_since), ); } request.insert_header("x-ms-source-range", source_range); 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 1b315af0d8..ba8ace8590 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 @@ -29,14 +29,14 @@ use super::{ PageBlobClientUploadPagesResult, PageList, PublicAccessType, RehydratePriority, SignedIdentifier, SkuName, StorageServiceStats, UserDelegationKey, }; -use azure_core::time::OffsetDateTime; use azure_core::{ - base64, + base64::decode, http::{ headers::{HeaderName, Headers}, NoFormat, Response, XmlFormat, }, - time, Result, + time::{parse_rfc7231, OffsetDateTime}, + Result, }; use std::collections::HashMap; @@ -132,18 +132,18 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders /// 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| base64::decode(h.as_str())) + 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -165,9 +165,7 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders /// 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| { - base64::decode(h.as_str()) - }) + 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 @@ -210,18 +208,18 @@ impl AppendBlobClientAppendBlockResultHeaders /// 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| base64::decode(h.as_str())) + 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -243,9 +241,7 @@ impl AppendBlobClientAppendBlockResultHeaders /// 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| { - base64::decode(h.as_str()) - }) + 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 @@ -271,7 +267,6 @@ impl AppendBlobClientAppendBlockResultHeaders /// Provides access to typed response headers for `AppendBlobClient::create()` pub trait AppendBlobClientCreateResultHeaders: 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>; @@ -284,18 +279,13 @@ impl AppendBlobClientCreateResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -341,13 +331,13 @@ pub trait AppendBlobClientSealResultHeaders: private::Sealed { impl AppendBlobClientSealResultHeaders 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -372,7 +362,7 @@ impl BlobClientAbortCopyFromUrlResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -387,13 +377,13 @@ pub trait BlobClientAcquireLeaseResultHeaders: private::Sealed { impl BlobClientAcquireLeaseResultHeaders 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -419,13 +409,13 @@ pub trait BlobClientBreakLeaseResultHeaders: private::Sealed { impl BlobClientBreakLeaseResultHeaders 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -451,13 +441,13 @@ pub trait BlobClientChangeLeaseResultHeaders: private::Sealed { impl BlobClientChangeLeaseResultHeaders 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -488,18 +478,18 @@ impl BlobClientCopyFromUrlResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str())) + 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -510,9 +500,7 @@ impl BlobClientCopyFromUrlResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| { - base64::decode(h.as_str()) - }) + Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) } /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or @@ -548,13 +536,13 @@ pub trait BlobClientCreateSnapshotResultHeaders: private::Sealed { impl BlobClientCreateSnapshotResultHeaders 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -592,7 +580,7 @@ impl BlobClientDeleteImmutabilityPolicyResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -670,7 +658,7 @@ impl BlobClientDownloadResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str())) + 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' @@ -682,7 +670,7 @@ impl BlobClientDownloadResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -700,9 +688,7 @@ impl BlobClientDownloadResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &BLOB_CONTENT_MD5, |h| { - base64::decode(h.as_str()) - }) + Headers::get_optional_with(self.headers(), &BLOB_CONTENT_MD5, |h| decode(h.as_str())) } /// If this blob has been sealed @@ -722,9 +708,7 @@ impl BlobClientDownloadResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| { - base64::decode(h.as_str()) - }) + 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 @@ -733,7 +717,7 @@ impl BlobClientDownloadResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), ©_COMPLETION_TIME, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -774,7 +758,7 @@ impl BlobClientDownloadResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &CREATION_TIME, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -799,7 +783,7 @@ impl BlobClientDownloadResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &IMMUTABILITY_POLICY_UNTIL_DATE, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -811,7 +795,7 @@ impl BlobClientDownloadResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &LAST_ACCESS_TIME, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -896,7 +880,7 @@ pub trait BlobClientGetAccountInfoResultHeaders: private::Sealed { 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } /// Identifies the account kind @@ -994,13 +978,13 @@ impl BlobClientGetPropertiesResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1019,7 +1003,7 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &ACCESS_TIER_CHANGE_TIME, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1062,7 +1046,7 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), ©_COMPLETION_TIME, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1109,7 +1093,7 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &CREATION_TIME, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1128,9 +1112,7 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { - Headers::get_optional_with(self.headers(), &EXPIRY_TIME, |h| { - time::parse_rfc7231(h.as_str()) - }) + Headers::get_optional_with(self.headers(), &EXPIRY_TIME, |h| parse_rfc7231(h.as_str())) } /// Indicates the immutability policy mode of the blob. @@ -1141,7 +1123,7 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &IMMUTABILITY_POLICY_UNTIL_DATE, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1158,7 +1140,7 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), &LAST_ACCESS_TIME, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1248,13 +1230,13 @@ pub trait BlobClientReleaseLeaseResultHeaders: private::Sealed { impl BlobClientReleaseLeaseResultHeaders 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1275,13 +1257,13 @@ pub trait BlobClientRenewLeaseResultHeaders: private::Sealed { impl BlobClientRenewLeaseResultHeaders 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1306,13 +1288,13 @@ pub trait BlobClientSetExpiryResultHeaders: private::Sealed { impl BlobClientSetExpiryResultHeaders 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1334,7 +1316,7 @@ impl BlobClientSetImmutabilityPolicyResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } /// Indicates the immutability policy mode of the blob. @@ -1345,7 +1327,7 @@ impl BlobClientSetImmutabilityPolicyResultHeaders /// UTC date/time value generated by the service that indicates the time at which the blob immutability policy will expire. fn immutability_policy_expires_on(&self) -> Result> { Headers::get_optional_with(self.headers(), &IMMUTABILITY_POLICY_UNTIL_DATE, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } } @@ -1359,7 +1341,7 @@ pub trait BlobClientSetLegalHoldResultHeaders: private::Sealed { impl BlobClientSetLegalHoldResultHeaders 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } /// Specifies the legal hold status to set on the blob. @@ -1376,7 +1358,7 @@ pub trait BlobClientSetTagsResultHeaders: private::Sealed { impl BlobClientSetTagsResultHeaders 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -1395,13 +1377,13 @@ impl BlobClientStartCopyFromUrlResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1436,7 +1418,7 @@ pub trait BlobClientUndeleteResultHeaders: private::Sealed { impl BlobClientUndeleteResultHeaders 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -1453,13 +1435,13 @@ impl BlobContainerClientAcquireLeaseResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1488,13 +1470,13 @@ impl BlobContainerClientBreakLeaseResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1527,13 +1509,13 @@ impl BlobContainerClientChangeLeaseResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1561,7 +1543,7 @@ impl BlobContainerClientGetAccountInfoResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } /// Identifies the account kind @@ -1602,7 +1584,7 @@ impl BlobContainerClientGetPropertiesResultHeaders /// The date/time that the container was last modified. fn last_modified(&self) -> Result> { Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1683,13 +1665,13 @@ impl BlobContainerClientReleaseLeaseResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1709,7 +1691,7 @@ impl BlobContainerClientRenameResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -1726,13 +1708,13 @@ impl BlobContainerClientRenewLeaseResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1757,7 +1739,7 @@ impl BlobContainerClientRestoreResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -1773,13 +1755,13 @@ impl BlobContainerClientSetAccessPolicyResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1802,7 +1784,7 @@ impl BlobServiceClientGetAccountInfoResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } /// Identifies the account kind @@ -1829,7 +1811,7 @@ pub trait BlobTagsHeaders: private::Sealed { 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -1851,13 +1833,13 @@ impl BlockBlobClientCommitBlockListResultHeaders /// 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| base64::decode(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -1868,9 +1850,7 @@ impl BlockBlobClientCommitBlockListResultHeaders /// 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| { - base64::decode(h.as_str()) - }) + 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 @@ -1917,18 +1897,18 @@ impl BlockBlobClientPutBlobFromUrlResultHeaders /// 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| base64::decode(h.as_str())) + 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2033,7 +2013,7 @@ impl BlockBlobClientQueryResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str())) + 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' @@ -2044,13 +2024,13 @@ impl BlockBlobClientQueryResultHeaders for Response Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2068,9 +2048,7 @@ impl BlockBlobClientQueryResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &BLOB_CONTENT_MD5, |h| { - base64::decode(h.as_str()) - }) + 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. @@ -2085,9 +2063,7 @@ impl BlockBlobClientQueryResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| { - base64::decode(h.as_str()) - }) + 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 @@ -2096,7 +2072,7 @@ impl BlockBlobClientQueryResultHeaders for Response Result> { Headers::get_optional_with(self.headers(), ©_COMPLETION_TIME, |h| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2198,19 +2174,17 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders /// 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| base64::decode(h.as_str())) + 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| time::parse_rfc7231(h.as_str())) + 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| { - base64::decode(h.as_str()) - }) + 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 @@ -2248,14 +2222,12 @@ impl BlockBlobClientStageBlockResultHeaders /// 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| base64::decode(h.as_str())) + Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(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| { - base64::decode(h.as_str()) - }) + 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 @@ -2293,13 +2265,13 @@ impl BlockBlobClientUploadResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2345,7 +2317,7 @@ 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2370,7 +2342,7 @@ pub trait FilterBlobSegmentHeaders: private::Sealed { impl FilterBlobSegmentHeaders 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -2382,7 +2354,7 @@ pub trait ListBlobsFlatSegmentResponseHeaders: private::Sealed { impl ListBlobsFlatSegmentResponseHeaders 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -2396,14 +2368,13 @@ impl ListBlobsHierarchySegmentResponseHeaders { /// 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } /// Provides access to typed response headers for `PageBlobClient::clear_pages()` pub trait PageBlobClientClearPagesResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; @@ -2414,18 +2385,13 @@ impl PageBlobClientClearPagesResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2441,9 +2407,7 @@ impl PageBlobClientClearPagesResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| { - base64::decode(h.as_str()) - }) + Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str())) } } @@ -2461,13 +2425,13 @@ impl PageBlobClientCopyIncrementalResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2491,7 +2455,6 @@ impl PageBlobClientCopyIncrementalResultHeaders /// Provides access to typed response headers for `PageBlobClient::create()` pub trait PageBlobClientCreateResultHeaders: 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>; @@ -2504,18 +2467,13 @@ impl PageBlobClientCreateResultHeaders for Response Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2552,22 +2510,16 @@ impl PageBlobClientCreateResultHeaders for Response Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; } impl PageBlobClientResizeResultHeaders 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| time::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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2595,13 +2547,13 @@ impl PageBlobClientUpdateSequenceNumberResultHeaders { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2635,18 +2587,18 @@ impl PageBlobClientUploadPagesFromUrlResultHeaders /// 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| base64::decode(h.as_str())) + 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2662,9 +2614,7 @@ impl PageBlobClientUploadPagesFromUrlResultHeaders /// 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| { - base64::decode(h.as_str()) - }) + 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 @@ -2690,7 +2640,6 @@ impl PageBlobClientUploadPagesFromUrlResultHeaders /// Provides access to typed response headers for `PageBlobClient::upload_pages()` pub trait PageBlobClientUploadPagesResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; @@ -2706,18 +2655,13 @@ impl PageBlobClientUploadPagesResultHeaders /// 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| base64::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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2733,9 +2677,7 @@ impl PageBlobClientUploadPagesResultHeaders /// 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| { - base64::decode(h.as_str()) - }) + 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 @@ -2771,13 +2713,13 @@ pub trait PageListHeaders: private::Sealed { impl PageListHeaders 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } @@ -2800,7 +2742,7 @@ pub trait StorageServiceStatsHeaders: private::Sealed { impl StorageServiceStatsHeaders 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -2812,7 +2754,7 @@ pub trait UserDelegationKeyHeaders: private::Sealed { impl UserDelegationKeyHeaders 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| time::parse_rfc7231(h.as_str())) + Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) } } @@ -2827,13 +2769,13 @@ pub trait VecSignedIdentifierHeaders: private::Sealed { impl VecSignedIdentifierHeaders for Response, XmlFormat> { /// 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| time::parse_rfc7231(h.as_str())) + 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| { - time::parse_rfc7231(h.as_str()) + parse_rfc7231(h.as_str()) }) } 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 6b73973249..faac0279ab 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 @@ -9,8 +9,7 @@ use super::{ ListBlobsIncludeItem, ListContainersIncludeType, PremiumPageBlobAccessTier, PublicAccessType, RehydratePriority, }; -use azure_core::time::OffsetDateTime; -use azure_core::{fmt::SafeDebug, http::ClientMethodOptions}; +use azure_core::{fmt::SafeDebug, http::ClientMethodOptions, time::OffsetDateTime}; use std::collections::HashMap; /// Options to be passed to `AppendBlobClient::append_block()` diff --git a/sdk/storage/azure_storage_blob/src/generated/models/models_serde.rs b/sdk/storage/azure_storage_blob/src/generated/models/models_serde.rs index 55a937a49e..516c8c2284 100644 --- a/sdk/storage/azure_storage_blob/src/generated/models/models_serde.rs +++ b/sdk/storage/azure_storage_blob/src/generated/models/models_serde.rs @@ -5,7 +5,7 @@ pub mod option_vec_encoded_bytes_std { #![allow(clippy::type_complexity)] - use azure_core::base64; + use azure_core::base64::{decode, encode}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::result::Result; @@ -18,7 +18,7 @@ pub mod option_vec_encoded_bytes_std { Some(to_deserialize) => { let mut decoded0 = >>::new(); for v in to_deserialize { - decoded0.push(base64::decode(v).map_err(serde::de::Error::custom)?); + decoded0.push(decode(v).map_err(serde::de::Error::custom)?); } Ok(Some(decoded0)) } @@ -34,7 +34,7 @@ pub mod option_vec_encoded_bytes_std { S: Serializer, { if let Some(to_serialize) = to_serialize { - let encoded0 = to_serialize.iter().map(base64::encode).collect(); + let encoded0 = to_serialize.iter().map(encode).collect(); >>::serialize(&Some(encoded0), serializer) } else { serializer.serialize_none() 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 977a0f39f9..c53356b7a9 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 @@ -14,8 +14,11 @@ use super::{ GeoReplicationStatusType, LeaseDuration, LeaseState, LeaseStatus, PublicAccessType, QueryRequestType, QueryType, RehydratePriority, }; -use azure_core::time::OffsetDateTime; -use azure_core::{base64, fmt::SafeDebug}; +use azure_core::{ + base64::{deserialize, serialize}, + fmt::SafeDebug, + time::OffsetDateTime, +}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -27,7 +30,7 @@ pub struct AccessPolicy { default, rename = "Expiry", skip_serializing_if = "Option::is_none", - with = "azure_core::time::rfc3339::option" + with = "azure_core::time::rfc7231::option" )] pub expiry: Option, @@ -40,7 +43,7 @@ pub struct AccessPolicy { default, rename = "Start", skip_serializing_if = "Option::is_none", - with = "azure_core::time::rfc3339::option" + with = "azure_core::time::rfc7231::option" )] pub start: Option, } @@ -373,9 +376,9 @@ pub struct BlobPropertiesInternal { /// The content MD5 of the blob. #[serde( default, - deserialize_with = "base64::deserialize", + deserialize_with = "deserialize", rename = "Content-MD5", - serialize_with = "base64::serialize", + serialize_with = "serialize", skip_serializing_if = "Option::is_none" )] pub content_md5: Option>, @@ -582,9 +585,9 @@ pub struct Block { /// The base64 encoded block ID. #[serde( default, - deserialize_with = "base64::deserialize", + deserialize_with = "deserialize", rename = "Name", - serialize_with = "base64::serialize", + serialize_with = "serialize", skip_serializing_if = "Option::is_none" )] pub name: Option>, @@ -1376,9 +1379,9 @@ pub struct UserDelegationKey { /// The key as a base64 string. #[serde( default, - deserialize_with = "base64::deserialize", + deserialize_with = "deserialize", rename = "Value", - serialize_with = "base64::serialize", + serialize_with = "serialize", skip_serializing_if = "Option::is_none" )] pub value: Option>, diff --git a/sdk/storage/azure_storage_blob/tsp-location.yaml b/sdk/storage/azure_storage_blob/tsp-location.yaml index f1831c8c24..6049879ea9 100644 --- a/sdk/storage/azure_storage_blob/tsp-location.yaml +++ b/sdk/storage/azure_storage_blob/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/storage/Microsoft.BlobStorage -commit: 0fb24e5a13f2eaa86af724acef4b725d0b3d0ca7 +commit: 552cf9b5591fc74384eca9d32917ca912b4ea317 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: From 8cf475798894a198bfd3aef7de6bdb03c47d857c Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Mon, 23 Jun 2025 17:24:02 -0700 Subject: [PATCH 11/30] PR feedback --- .../src/clients/page_blob_client.rs | 27 +++++-------- .../azure_storage_blob/src/serialize.rs | 8 ++-- .../tests/page_blob_client.rs | 38 +++++++++++++++---- 3 files changed, 44 insertions(+), 29 deletions(-) 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 37b401e839..1cb1436950 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 @@ -110,20 +110,14 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `offset` - Start of the byte range to use for clearing a section of the blob. - /// The offset specified must be a modulus of 512. - /// * `length` - Number of bytes to use for clearing a section of the blob. - /// The length specified must be a modulus of 512. + /// * `range` - The range of bytes to clear. See [`azure_storage_blob::serialize::format_http_range()`](crate::serialize::format_http_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn clear_page( &self, - offset: u64, - length: u64, + range: String, options: Option>, ) -> Result> { - self.client - .clear_pages(format_http_range(offset, length), options) - .await + self.client.clear_pages(range, options).await } /// Resizes a Page blob to the specified size. If the specified value is less than @@ -134,7 +128,7 @@ impl PageBlobClient { /// * `size` - Size used to resize the blob. Maximum size for a page Blob is up to 1TB. The /// Page blob size must be aligned to a 512-byte boundary. /// * `options` - Optional parameters for the request. - pub async fn resize_blob( + pub async fn resize( &self, size: u64, options: Option>, @@ -147,20 +141,19 @@ impl PageBlobClient { /// # Arguments /// /// * `data` - The contents of the page. - /// * `offset` - Start of the byte range to use for writing to a section of the blob. - /// The offset specified must be a modulus of 512. - /// * `length` - Number of bytes to use for writing to a section of the blob. - /// The length specified must be a modulus of 512. + /// * `content_length` - Number of bytes to use for writing to a section of the blob. The + /// content_length specified must be a modulus of 512. + /// * `range` - The range of the bytes to write. See [`azure_storage_blob::serialize::format_http_range()`](crate::serialize::format_http_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn upload_page( &self, data: RequestContent, - offset: u64, - length: u64, + content_length: u64, + range: String, options: Option>, ) -> Result> { self.client - .upload_pages(data, length, format_http_range(offset, length), options) + .upload_pages(data, content_length, range, options) .await } } diff --git a/sdk/storage/azure_storage_blob/src/serialize.rs b/sdk/storage/azure_storage_blob/src/serialize.rs index ae27dcec60..8534941e9e 100644 --- a/sdk/storage/azure_storage_blob/src/serialize.rs +++ b/sdk/storage/azure_storage_blob/src/serialize.rs @@ -7,10 +7,10 @@ use crate::models::PageBlobClientCreateOptions; /// /// # Arguments /// -/// * `offset` - Start of the byte range to use for writing to a section of the blob. Must be aligned -/// to a 512-byte boundary. -/// * `length` - Number of bytes to use for writing to a section of the blob. Must be aligned -/// to a 512-byte boundary. +/// * `offset` - Start of the byte range to use for writing to a section of the blob. +/// The offset specified must be a modulus of 512. +/// * `length` - Number of bytes to use for writing to a section of the blob. +/// The length specified must be a modulus of 512. pub fn format_http_range(offset: u64, length: u64) -> String { if offset % 512 != 0 { panic!("offset must be aligned to a 512-byte boundary."); diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index 7fdf1fcbff..9afdf42c7c 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -7,7 +7,7 @@ use azure_storage_blob::models::{ BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, PageBlobClientCreateOptions, }; -use azure_storage_blob::serialize::page_blob_create_if_not_exists; +use azure_storage_blob::serialize::{format_http_range, page_blob_create_if_not_exists}; use azure_storage_blob_test::{get_blob_name, get_container_client}; use std::error::Error; @@ -60,7 +60,12 @@ async fn test_upload_page(ctx: TestContext) -> Result<(), Box> { page_blob_client.create(512, None).await?; let data = vec![b'A'; 512]; page_blob_client - .upload_page(RequestContent::from(data.clone()), 0, 512, None) + .upload_page( + RequestContent::from(data.clone()), + 512, + format_http_range(0, 512), + None, + ) .await?; // Assert @@ -85,10 +90,17 @@ async fn test_clear_page(ctx: TestContext) -> Result<(), Box> { page_blob_client.create(512, None).await?; let data = vec![b'A'; 512]; page_blob_client - .upload_page(RequestContent::from(data), 0, 512, None) + .upload_page( + RequestContent::from(data), + 512, + format_http_range(0, 512), + None, + ) .await?; - page_blob_client.clear_page(0, 512, None).await?; + page_blob_client + .clear_page(format_http_range(0, 512), None) + .await?; // Assert let response = blob_client.download(None).await?; @@ -114,19 +126,29 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { page_blob_client.create(512, None).await?; let data = vec![b'A'; 1024]; let response = page_blob_client - .upload_page(RequestContent::from(data.clone()), 0, 1024, None) + .upload_page( + RequestContent::from(data.clone()), + 1024, + format_http_range(0, 1024), + None, + ) .await; // Assert let error = response.unwrap_err().http_status(); assert_eq!(StatusCode::RequestedRangeNotSatisfiable, error.unwrap()); - page_blob_client.resize_blob(1024, None).await?; + page_blob_client.resize(1024, None).await?; page_blob_client - .upload_page(RequestContent::from(data.clone()), 0, 1024, None) + .upload_page( + RequestContent::from(data.clone()), + 1024, + format_http_range(0, 1024), + None, + ) .await?; // Truncate Blob Scenario - page_blob_client.resize_blob(512, None).await?; + page_blob_client.resize(512, None).await?; // Assert let response = blob_client.download(None).await?; let content_length = response.content_length()?; From 99272e92bcf5e0ab81452e83cc2a2f2ddb165625 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Mon, 23 Jun 2025 17:34:55 -0700 Subject: [PATCH 12/30] Fix test recordings for CI --- sdk/storage/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/assets.json b/sdk/storage/assets.json index f1df7b7e17..38706fd454 100644 --- a/sdk/storage/assets.json +++ b/sdk/storage/assets.json @@ -1,6 +1,6 @@ { "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "rust", - "Tag": "rust/azure_storage_blob_a55c38eec2", + "Tag": "rust/azure_storage_blob_83b2698a78", "TagPrefix": "rust/azure_storage_blob" } \ No newline at end of file From 3f77c8a7a50e3a86a59a0a187900d77005252658 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 24 Jun 2025 16:10:04 -0700 Subject: [PATCH 13/30] initial impl, blobs --- .../src/clients/blob_client.rs | 55 +++++++++++++++++-- sdk/storage/azure_storage_blob/src/lib.rs | 10 +++- 2 files changed, 56 insertions(+), 9 deletions(-) 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 a8fda105c3..80ddba27a5 100644 --- a/sdk/storage/azure_storage_blob/src/clients/blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/blob_client.rs @@ -4,14 +4,16 @@ use crate::{ generated::clients::BlobClient as GeneratedBlobClient, generated::models::{ - BlobClientDownloadResult, BlobClientGetPropertiesResult, - BlockBlobClientCommitBlockListResult, BlockBlobClientStageBlockResult, - BlockBlobClientUploadResult, + BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, + BlobClientDownloadResult, BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult, + BlobClientRenewLeaseResult, BlockBlobClientCommitBlockListResult, + BlockBlobClientStageBlockResult, BlockBlobClientUploadResult, }, models::{ - AccessTierOptional, BlobClientDeleteOptions, BlobClientDownloadOptions, - BlobClientGetPropertiesOptions, BlobClientSetMetadataOptions, - BlobClientSetPropertiesOptions, BlobClientSetTierOptions, + AccessTierOptional, BlobClientAcquireLeaseOptions, BlobClientBreakLeaseOptions, + BlobClientChangeLeaseOptions, BlobClientDeleteOptions, BlobClientDownloadOptions, + BlobClientGetPropertiesOptions, BlobClientReleaseLeaseOptions, BlobClientRenewLeaseOptions, + BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions, BlockBlobClientCommitBlockListOptions, BlockBlobClientUploadOptions, BlockList, BlockListType, BlockLookupList, }, @@ -211,4 +213,45 @@ impl BlobClient { ) -> Result> { self.client.set_tier(tier, options).await } + + pub async fn acquire_lease( + &self, + options: Option>, + ) -> Result> { + self.client.acquire_lease(options).await + } + + pub async fn break_lease( + &self, + options: Option>, + ) -> Result> { + self.client.break_lease(options).await + } + + pub async fn change_lease( + &self, + lease_id: String, + proposed_lease_id: String, + options: Option>, + ) -> Result> { + self.client + .change_lease(lease_id, proposed_lease_id, options) + .await + } + + pub async fn release_lease( + &self, + lease_id: String, + options: Option>, + ) -> Result> { + self.client.release_lease(lease_id, options).await + } + + pub async fn renew_lease( + &self, + lease_id: String, + options: Option>, + ) -> Result> { + self.client.renew_lease(lease_id, options).await + } } diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index 3b87ac4bf8..1a6bbc57a3 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -15,9 +15,13 @@ pub use clients::*; pub mod models { pub use crate::generated::models::{ - AccessTierOptional, ArchiveStatus, BlobClientDeleteOptions, BlobClientDownloadOptions, - BlobClientDownloadResult, BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, - BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders, + AccessTierOptional, ArchiveStatus, BlobClientAcquireLeaseOptions, + BlobClientAcquireLeaseResult, BlobClientBreakLeaseOptions, BlobClientBreakLeaseResult, + BlobClientChangeLeaseOptions, BlobClientChangeLeaseResult, BlobClientDeleteOptions, + BlobClientDownloadOptions, BlobClientDownloadResult, BlobClientDownloadResultHeaders, + BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, + BlobClientGetPropertiesResultHeaders, BlobClientReleaseLeaseOptions, + BlobClientReleaseLeaseResult, BlobClientRenewLeaseOptions, BlobClientRenewLeaseResult, BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions, BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, From f92d168993e9b6643915f9ea389358f086f2cb6d Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 24 Jun 2025 17:13:42 -0700 Subject: [PATCH 14/30] Refactor on PR feedback, move to extension traits, still wip helper --- .../src/clients/page_blob_client.rs | 5 +- sdk/storage/azure_storage_blob/src/lib.rs | 30 +----------- .../azure_storage_blob/src/models/mod.rs | 26 ++++++++++ .../storage_traits.rs} | 16 +++++-- .../tests/page_blob_client.rs | 47 +++++++++++++++++-- 5 files changed, 83 insertions(+), 41 deletions(-) create mode 100644 sdk/storage/azure_storage_blob/src/models/mod.rs rename sdk/storage/azure_storage_blob/src/{serialize.rs => models/storage_traits.rs} (75%) 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 1cb1436950..29096b3a99 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 @@ -4,13 +4,12 @@ use crate::{ generated::clients::PageBlobClient as GeneratedPageBlobClient, models::{ - PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, + format_http_range, PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, PageBlobClientCreateOptions, PageBlobClientCreateResult, PageBlobClientResizeOptions, PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, PageBlobClientUploadPagesResult, }, pipeline::StorageHeadersPolicy, - serialize::format_http_range, BlobClientOptions, PageBlobClientOptions, }; use azure_core::{ @@ -110,7 +109,7 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `range` - The range of bytes to clear. See [`azure_storage_blob::serialize::format_http_range()`](crate::serialize::format_http_range) for help with the expected String format. + /// * `range` - The range of bytes to clear. See [`azure_storage_blob::models::format_http_range()`](crate::models::format_http_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn clear_page( &self, diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index 15b5e2d1f4..6387c05db1 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -9,34 +9,6 @@ pub mod clients; mod generated; +pub mod models; mod pipeline; -pub mod serialize; - pub use clients::*; - -pub mod models { - pub use crate::generated::models::{ - AccessTierOptional, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, - ArchiveStatus, BlobClientDeleteOptions, BlobClientDownloadOptions, - BlobClientDownloadResult, BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, - BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders, - BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions, - BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, - BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, - BlobContainerClientGetPropertiesResultHeaders, - BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientSetMetadataOptions, - BlobImmutabilityPolicyMode, BlobServiceClientGetPropertiesOptions, - BlobServiceClientListContainersSegmentOptions, BlobType, - BlockBlobClientCommitBlockListOptions, BlockBlobClientCommitBlockListResult, - BlockBlobClientGetBlockListOptions, BlockBlobClientStageBlockOptions, - BlockBlobClientStageBlockResult, BlockBlobClientUploadOptions, BlockBlobClientUploadResult, - BlockList, BlockListType, BlockLookupList, CopyStatus, LeaseState, LeaseStatus, - ListBlobsFlatSegmentResponse, ListContainersSegmentResponse, - PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, - PageBlobClientCreateOptions, PageBlobClientCreateResult, PageBlobClientResizeOptions, - PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, - PageBlobClientUploadPagesResult, PublicAccessType, RehydratePriority, - StorageServiceProperties, - }; - pub use crate::serialize::*; -} diff --git a/sdk/storage/azure_storage_blob/src/models/mod.rs b/sdk/storage/azure_storage_blob/src/models/mod.rs new file mode 100644 index 0000000000..0ed05c0b7b --- /dev/null +++ b/sdk/storage/azure_storage_blob/src/models/mod.rs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +mod storage_traits; + +pub use crate::generated::models::{ + AccessTierOptional, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, ArchiveStatus, + BlobClientDeleteOptions, BlobClientDownloadOptions, BlobClientDownloadResult, + BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, + BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, + BlobClientSetPropertiesOptions, BlobClientSetTierOptions, BlobContainerClientCreateOptions, + BlobContainerClientDeleteOptions, BlobContainerClientGetPropertiesOptions, + BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders, + BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientSetMetadataOptions, + BlobImmutabilityPolicyMode, BlobServiceClientGetPropertiesOptions, + BlobServiceClientListContainersSegmentOptions, BlobType, BlockBlobClientCommitBlockListOptions, + BlockBlobClientCommitBlockListResult, BlockBlobClientGetBlockListOptions, + BlockBlobClientStageBlockOptions, BlockBlobClientStageBlockResult, + BlockBlobClientUploadOptions, BlockBlobClientUploadResult, BlockList, BlockListType, + BlockLookupList, CopyStatus, LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse, + ListContainersSegmentResponse, PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, + PageBlobClientCreateOptions, PageBlobClientCreateResult, PageBlobClientResizeOptions, + PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, PageBlobClientUploadPagesResult, + PublicAccessType, RehydratePriority, StorageServiceProperties, +}; +pub use storage_traits::*; diff --git a/sdk/storage/azure_storage_blob/src/serialize.rs b/sdk/storage/azure_storage_blob/src/models/storage_traits.rs similarity index 75% rename from sdk/storage/azure_storage_blob/src/serialize.rs rename to sdk/storage/azure_storage_blob/src/models/storage_traits.rs index 8534941e9e..738793aa19 100644 --- a/sdk/storage/azure_storage_blob/src/serialize.rs +++ b/sdk/storage/azure_storage_blob/src/models/storage_traits.rs @@ -23,9 +23,15 @@ pub fn format_http_range(offset: u64, length: u64) -> String { content_range } -pub fn page_blob_create_if_not_exists( - mut options: PageBlobClientCreateOptions, -) -> PageBlobClientCreateOptions { - options.if_none_match = Some("*".to_string()); - options +pub trait PageBlobClientCreateOptionsExt { + fn with_if_not_exists(self) -> Self; +} + +impl PageBlobClientCreateOptionsExt for PageBlobClientCreateOptions<'_> { + fn with_if_not_exists(self) -> Self { + Self { + if_none_match: Some("*".into()), + ..self + } + } } diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index 9afdf42c7c..71c4552d10 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -4,10 +4,9 @@ use azure_core::http::{RequestContent, StatusCode}; use azure_core_test::{recorded, TestContext}; use azure_storage_blob::models::{ - BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, - PageBlobClientCreateOptions, + format_http_range, BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, + BlobType, PageBlobClientCreateOptions, PageBlobClientCreateOptionsExt, }; -use azure_storage_blob::serialize::{format_http_range, page_blob_create_if_not_exists}; use azure_storage_blob_test::{get_blob_name, get_container_client}; use std::error::Error; @@ -29,7 +28,47 @@ async fn test_create_page_blob(ctx: TestContext) -> Result<(), Box> { assert_eq!(BlobType::PageBlob, blob_type.unwrap()); // Create If Not Exists Scenario - let create_options = page_blob_create_if_not_exists(PageBlobClientCreateOptions::default()); + let create_options = PageBlobClientCreateOptions::default().with_if_not_exists(); + let response = page_blob_client + .create(1024, Some(create_options.clone())) + .await; + // Assert + let error = response.unwrap_err().http_status(); + assert_eq!(StatusCode::Conflict, error.unwrap()); + + blob_client.delete(None).await?; + page_blob_client.create(1024, Some(create_options)).await?; + // Assert + let blob_properties = blob_client.get_properties(None).await?; + let blob_type = blob_properties.blob_type()?; + let content_length = blob_properties.content_length()?; + assert_eq!(1024, content_length.unwrap()); + assert_eq!(BlobType::PageBlob, blob_type.unwrap()); + + container_client.delete_container(None).await?; + Ok(()) +} + +#[recorded::test] +async fn test_create_page_blob2(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let page_blob_client = blob_client.page_blob_client(); + + // Regular Create Scenario + page_blob_client.create(1024, None).await?; + // Assert + let blob_properties = blob_client.get_properties(None).await?; + let blob_type = blob_properties.blob_type()?; + let content_length = blob_properties.content_length()?; + assert_eq!(1024, content_length.unwrap()); + assert_eq!(BlobType::PageBlob, blob_type.unwrap()); + + // Create If Not Exists Scenario + // let create_options = page_blob_create_if_not_exists(PageBlobClientCreateOptions::default()); + let create_options = PageBlobClientCreateOptions::default().with_overwrite(); let response = page_blob_client .create(1024, Some(create_options.clone())) .await; From 8f68359aa17f194d7f014dc06fd145aa6c399680 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 24 Jun 2025 17:20:23 -0700 Subject: [PATCH 15/30] nit --- .../tests/page_blob_client.rs | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index 71c4552d10..07c819e1cf 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -49,46 +49,6 @@ async fn test_create_page_blob(ctx: TestContext) -> Result<(), Box> { Ok(()) } -#[recorded::test] -async fn test_create_page_blob2(ctx: TestContext) -> Result<(), Box> { - // Recording Setup - let recording = ctx.recording(); - let container_client = get_container_client(recording, true).await?; - let blob_client = container_client.blob_client(get_blob_name(recording)); - let page_blob_client = blob_client.page_blob_client(); - - // Regular Create Scenario - page_blob_client.create(1024, None).await?; - // Assert - let blob_properties = blob_client.get_properties(None).await?; - let blob_type = blob_properties.blob_type()?; - let content_length = blob_properties.content_length()?; - assert_eq!(1024, content_length.unwrap()); - assert_eq!(BlobType::PageBlob, blob_type.unwrap()); - - // Create If Not Exists Scenario - // let create_options = page_blob_create_if_not_exists(PageBlobClientCreateOptions::default()); - let create_options = PageBlobClientCreateOptions::default().with_overwrite(); - let response = page_blob_client - .create(1024, Some(create_options.clone())) - .await; - // Assert - let error = response.unwrap_err().http_status(); - assert_eq!(StatusCode::Conflict, error.unwrap()); - - blob_client.delete(None).await?; - page_blob_client.create(1024, Some(create_options)).await?; - // Assert - let blob_properties = blob_client.get_properties(None).await?; - let blob_type = blob_properties.blob_type()?; - let content_length = blob_properties.content_length()?; - assert_eq!(1024, content_length.unwrap()); - assert_eq!(BlobType::PageBlob, blob_type.unwrap()); - - container_client.delete_container(None).await?; - Ok(()) -} - #[recorded::test] async fn test_upload_page(ctx: TestContext) -> Result<(), Box> { // Recording Setup From d5be6ee7932e7c27acdf101a8d2950aba91d0eee Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 24 Jun 2025 17:38:26 -0700 Subject: [PATCH 16/30] Refactor both to be extension traits --- .../src/clients/page_blob_client.rs | 4 +-- sdk/storage/azure_storage_blob/src/lib.rs | 29 ++++++++++++++++++- .../azure_storage_blob/src/models/mod.rs | 26 ----------------- .../src/{models => }/storage_traits.rs | 24 +++++++++------ .../tests/page_blob_client.rs | 20 ++++++++----- 5 files changed, 57 insertions(+), 46 deletions(-) delete mode 100644 sdk/storage/azure_storage_blob/src/models/mod.rs rename sdk/storage/azure_storage_blob/src/{models => }/storage_traits.rs (58%) 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 29096b3a99..0eda885c1a 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 @@ -4,7 +4,7 @@ use crate::{ generated::clients::PageBlobClient as GeneratedPageBlobClient, models::{ - format_http_range, PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, + PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, PageBlobClientCreateOptions, PageBlobClientCreateResult, PageBlobClientResizeOptions, PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, PageBlobClientUploadPagesResult, @@ -109,7 +109,7 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `range` - The range of bytes to clear. See [`azure_storage_blob::models::format_http_range()`](crate::models::format_http_range) for help with the expected String format. + /// * `range` - The range of bytes to clear. See [`azure_storage_blob::format_http_range()`](crate::PageBlobClientExt::format_http_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn clear_page( &self, diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index 6387c05db1..74417fd771 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -9,6 +9,33 @@ pub mod clients; mod generated; -pub mod models; mod pipeline; +mod storage_traits; pub use clients::*; +pub use storage_traits::*; + +pub mod models { + pub use crate::generated::models::{ + AccessTierOptional, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, + ArchiveStatus, BlobClientDeleteOptions, BlobClientDownloadOptions, + BlobClientDownloadResult, BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, + BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders, + BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions, + BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, + BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, + BlobContainerClientGetPropertiesResultHeaders, + BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientSetMetadataOptions, + BlobImmutabilityPolicyMode, BlobServiceClientGetPropertiesOptions, + BlobServiceClientListContainersSegmentOptions, BlobType, + BlockBlobClientCommitBlockListOptions, BlockBlobClientCommitBlockListResult, + BlockBlobClientGetBlockListOptions, BlockBlobClientStageBlockOptions, + BlockBlobClientStageBlockResult, BlockBlobClientUploadOptions, BlockBlobClientUploadResult, + BlockList, BlockListType, BlockLookupList, CopyStatus, LeaseState, LeaseStatus, + ListBlobsFlatSegmentResponse, ListContainersSegmentResponse, + PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, + PageBlobClientCreateOptions, PageBlobClientCreateResult, PageBlobClientResizeOptions, + PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, + PageBlobClientUploadPagesResult, PublicAccessType, RehydratePriority, + StorageServiceProperties, + }; +} diff --git a/sdk/storage/azure_storage_blob/src/models/mod.rs b/sdk/storage/azure_storage_blob/src/models/mod.rs deleted file mode 100644 index 0ed05c0b7b..0000000000 --- a/sdk/storage/azure_storage_blob/src/models/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -mod storage_traits; - -pub use crate::generated::models::{ - AccessTierOptional, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, ArchiveStatus, - BlobClientDeleteOptions, BlobClientDownloadOptions, BlobClientDownloadResult, - BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, - BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, - BlobClientSetPropertiesOptions, BlobClientSetTierOptions, BlobContainerClientCreateOptions, - BlobContainerClientDeleteOptions, BlobContainerClientGetPropertiesOptions, - BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders, - BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientSetMetadataOptions, - BlobImmutabilityPolicyMode, BlobServiceClientGetPropertiesOptions, - BlobServiceClientListContainersSegmentOptions, BlobType, BlockBlobClientCommitBlockListOptions, - BlockBlobClientCommitBlockListResult, BlockBlobClientGetBlockListOptions, - BlockBlobClientStageBlockOptions, BlockBlobClientStageBlockResult, - BlockBlobClientUploadOptions, BlockBlobClientUploadResult, BlockList, BlockListType, - BlockLookupList, CopyStatus, LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse, - ListContainersSegmentResponse, PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, - PageBlobClientCreateOptions, PageBlobClientCreateResult, PageBlobClientResizeOptions, - PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, PageBlobClientUploadPagesResult, - PublicAccessType, RehydratePriority, StorageServiceProperties, -}; -pub use storage_traits::*; diff --git a/sdk/storage/azure_storage_blob/src/models/storage_traits.rs b/sdk/storage/azure_storage_blob/src/storage_traits.rs similarity index 58% rename from sdk/storage/azure_storage_blob/src/models/storage_traits.rs rename to sdk/storage/azure_storage_blob/src/storage_traits.rs index 738793aa19..be8efaa793 100644 --- a/sdk/storage/azure_storage_blob/src/models/storage_traits.rs +++ b/sdk/storage/azure_storage_blob/src/storage_traits.rs @@ -2,7 +2,11 @@ // Licensed under the MIT License. use crate::models::PageBlobClientCreateOptions; +use crate::PageBlobClient; +pub trait PageBlobClientExt { + fn format_http_range(offset: u64, length: u64) -> String; +} /// Takes in an offset and a length and returns the HTTP range in string format. /// /// # Arguments @@ -11,16 +15,18 @@ use crate::models::PageBlobClientCreateOptions; /// The offset specified must be a modulus of 512. /// * `length` - Number of bytes to use for writing to a section of the blob. /// The length specified must be a modulus of 512. -pub fn format_http_range(offset: u64, length: u64) -> String { - if offset % 512 != 0 { - panic!("offset must be aligned to a 512-byte boundary."); - } - if length % 512 != 0 { - panic!("length must be aligned to a 512-byte boundary."); +impl PageBlobClientExt for PageBlobClient { + fn format_http_range(offset: u64, length: u64) -> String { + if offset % 512 != 0 { + panic!("offset must be aligned to a 512-byte boundary."); + } + if length % 512 != 0 { + panic!("length must be aligned to a 512-byte boundary."); + } + let end_range = offset + length - 1; + let content_range = format!("bytes={}-{}", offset, end_range); + content_range } - let end_range = offset + length - 1; - let content_range = format!("bytes={}-{}", offset, end_range); - content_range } pub trait PageBlobClientCreateOptionsExt { diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index 07c819e1cf..7319eff45b 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -3,9 +3,12 @@ use azure_core::http::{RequestContent, StatusCode}; use azure_core_test::{recorded, TestContext}; -use azure_storage_blob::models::{ - format_http_range, BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, - BlobType, PageBlobClientCreateOptions, PageBlobClientCreateOptionsExt, +use azure_storage_blob::{ + models::{ + BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, + PageBlobClientCreateOptions, + }, + PageBlobClient, PageBlobClientCreateOptionsExt, PageBlobClientExt, }; use azure_storage_blob_test::{get_blob_name, get_container_client}; use std::error::Error; @@ -13,6 +16,7 @@ use std::error::Error; #[recorded::test] async fn test_create_page_blob(ctx: TestContext) -> Result<(), Box> { // Recording Setup + let recording = ctx.recording(); let container_client = get_container_client(recording, true).await?; let blob_client = container_client.blob_client(get_blob_name(recording)); @@ -62,7 +66,7 @@ async fn test_upload_page(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 512, - format_http_range(0, 512), + PageBlobClient::format_http_range(0, 512), None, ) .await?; @@ -92,13 +96,13 @@ async fn test_clear_page(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data), 512, - format_http_range(0, 512), + PageBlobClient::format_http_range(0, 512), None, ) .await?; page_blob_client - .clear_page(format_http_range(0, 512), None) + .clear_page(PageBlobClient::format_http_range(0, 512), None) .await?; // Assert @@ -128,7 +132,7 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 1024, - format_http_range(0, 1024), + PageBlobClient::format_http_range(0, 1024), None, ) .await; @@ -141,7 +145,7 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 1024, - format_http_range(0, 1024), + PageBlobClient::format_http_range(0, 1024), None, ) .await?; From c3fb77017b53ac596aec4f5dca4ffe39a5d6ad8a Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 24 Jun 2025 17:44:20 -0700 Subject: [PATCH 17/30] nit docs --- sdk/storage/azure_storage_blob/src/clients/page_blob_client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0eda885c1a..73c77fc69e 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 @@ -142,7 +142,7 @@ impl PageBlobClient { /// * `data` - The contents of the page. /// * `content_length` - Number of bytes to use for writing to a section of the blob. The /// content_length specified must be a modulus of 512. - /// * `range` - The range of the bytes to write. See [`azure_storage_blob::serialize::format_http_range()`](crate::serialize::format_http_range) for help with the expected String format. + /// * `range` - The range of the bytes to write. See [`azure_storage_blob::format_http_range()`](crate::PageBlobClientExt::format_http_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn upload_page( &self, From d8786ea369db111e851dbea6e34f8c8ee55ac9d0 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 25 Jun 2025 13:46:05 -0700 Subject: [PATCH 18/30] Refactor, storage_utils for common helpers, storage_traits for options bag extension methods --- .../src/clients/page_blob_client.rs | 6 ++-- sdk/storage/azure_storage_blob/src/lib.rs | 5 ++-- .../azure_storage_blob/src/storage_traits.rs | 30 +++---------------- .../azure_storage_blob/src/storage_utils.rs | 26 ++++++++++++++++ .../tests/page_blob_client.rs | 13 ++++---- 5 files changed, 43 insertions(+), 37 deletions(-) create mode 100644 sdk/storage/azure_storage_blob/src/storage_utils.rs 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 73c77fc69e..3c9a44436d 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 @@ -96,7 +96,7 @@ impl PageBlobClient { /// /// * `content_length` - The maximum size for the Page blob, up to 1TB. The page blob size must /// be aligned to a 512-byte boundary. - /// * `options` - Optional parameters for the request. + /// * `options` - Optional parameters for the request. See [`azure_storage_blob::storage_traits::PageBlobClientCreateOptionsExt`](crate::storage_traits::PageBlobClientCreateOptionsExt) for additional usage helpers. pub async fn create( &self, content_length: u64, @@ -109,7 +109,7 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `range` - The range of bytes to clear. See [`azure_storage_blob::format_http_range()`](crate::PageBlobClientExt::format_http_range) for help with the expected String format. + /// * `range` - The range of bytes to clear. See [`azure_storage_blob::StorageUtils::format_http_range()`](crate::StorageUtils::format_http_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn clear_page( &self, @@ -142,7 +142,7 @@ impl PageBlobClient { /// * `data` - The contents of the page. /// * `content_length` - Number of bytes to use for writing to a section of the blob. The /// content_length specified must be a modulus of 512. - /// * `range` - The range of the bytes to write. See [`azure_storage_blob::format_http_range()`](crate::PageBlobClientExt::format_http_range) for help with the expected String format. + /// * `range` - The range of the bytes to write. See [`azure_storage_blob::StorageUtils::format_http_range()`](crate::StorageUtils::format_http_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn upload_page( &self, diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index 74417fd771..265ac9ec9b 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -10,9 +10,10 @@ pub mod clients; mod generated; mod pipeline; -mod storage_traits; +pub mod storage_traits; +pub mod storage_utils; pub use clients::*; -pub use storage_traits::*; +pub use storage_utils::*; pub mod models { pub use crate::generated::models::{ diff --git a/sdk/storage/azure_storage_blob/src/storage_traits.rs b/sdk/storage/azure_storage_blob/src/storage_traits.rs index be8efaa793..356e6634a0 100644 --- a/sdk/storage/azure_storage_blob/src/storage_traits.rs +++ b/sdk/storage/azure_storage_blob/src/storage_traits.rs @@ -2,34 +2,12 @@ // Licensed under the MIT License. use crate::models::PageBlobClientCreateOptions; -use crate::PageBlobClient; - -pub trait PageBlobClientExt { - fn format_http_range(offset: u64, length: u64) -> String; -} -/// Takes in an offset and a length and returns the HTTP range in string format. -/// -/// # Arguments -/// -/// * `offset` - Start of the byte range to use for writing to a section of the blob. -/// The offset specified must be a modulus of 512. -/// * `length` - Number of bytes to use for writing to a section of the blob. -/// The length specified must be a modulus of 512. -impl PageBlobClientExt for PageBlobClient { - fn format_http_range(offset: u64, length: u64) -> String { - if offset % 512 != 0 { - panic!("offset must be aligned to a 512-byte boundary."); - } - if length % 512 != 0 { - panic!("length must be aligned to a 512-byte boundary."); - } - let end_range = offset + length - 1; - let content_range = format!("bytes={}-{}", offset, end_range); - content_range - } -} pub trait PageBlobClientCreateOptionsExt { + /// Augments the current options bag to only create if the page blob does not already exists. + /// # Arguments + /// + /// * `self` - The options bag to be modified. fn with_if_not_exists(self) -> Self; } diff --git a/sdk/storage/azure_storage_blob/src/storage_utils.rs b/sdk/storage/azure_storage_blob/src/storage_utils.rs new file mode 100644 index 0000000000..c144332168 --- /dev/null +++ b/sdk/storage/azure_storage_blob/src/storage_utils.rs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +pub struct StorageUtils; + +impl StorageUtils { + /// Takes in an offset and a length and returns the HTTP range in string format. + /// + /// # Arguments + /// + /// * `offset` - Start of the byte range to use for writing to a section of the blob. + /// The offset specified must be a modulus of 512. + /// * `length` - Number of bytes to use for writing to a section of the blob. + /// The length specified must be a modulus of 512. + pub fn format_http_range(offset: u64, length: u64) -> String { + if offset % 512 != 0 { + panic!("offset must be aligned to a 512-byte boundary."); + } + if length % 512 != 0 { + panic!("length must be aligned to a 512-byte boundary."); + } + let end_range = offset + length - 1; + let content_range = format!("bytes={}-{}", offset, end_range); + content_range + } +} diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index 7319eff45b..53aca48d2d 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -8,7 +8,8 @@ use azure_storage_blob::{ BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, PageBlobClientCreateOptions, }, - PageBlobClient, PageBlobClientCreateOptionsExt, PageBlobClientExt, + storage_traits::PageBlobClientCreateOptionsExt, + StorageUtils, }; use azure_storage_blob_test::{get_blob_name, get_container_client}; use std::error::Error; @@ -66,7 +67,7 @@ async fn test_upload_page(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 512, - PageBlobClient::format_http_range(0, 512), + StorageUtils::format_http_range(0, 512), None, ) .await?; @@ -96,13 +97,13 @@ async fn test_clear_page(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data), 512, - PageBlobClient::format_http_range(0, 512), + StorageUtils::format_http_range(0, 512), None, ) .await?; page_blob_client - .clear_page(PageBlobClient::format_http_range(0, 512), None) + .clear_page(StorageUtils::format_http_range(0, 512), None) .await?; // Assert @@ -132,7 +133,7 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 1024, - PageBlobClient::format_http_range(0, 1024), + StorageUtils::format_http_range(0, 1024), None, ) .await; @@ -145,7 +146,7 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 1024, - PageBlobClient::format_http_range(0, 1024), + StorageUtils::format_http_range(0, 1024), None, ) .await?; From 186cc1ae4b2b8ac1ec3c11d112b034027d6835d0 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 25 Jun 2025 17:29:57 -0700 Subject: [PATCH 19/30] First draft, full testcases for Blobs --- .../src/clients/blob_client.rs | 34 ++++++++ sdk/storage/azure_storage_blob/src/lib.rs | 5 +- .../azure_storage_blob/tests/blob_client.rs | 80 ++++++++++++++++++- 3 files changed, 113 insertions(+), 6 deletions(-) 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 80ddba27a5..ea08d650b4 100644 --- a/sdk/storage/azure_storage_blob/src/clients/blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/blob_client.rs @@ -214,6 +214,11 @@ impl BlobClient { self.client.set_tier(tier, options).await } + /// Requests a new lease on a blob. The lease lock duration can be 15 to 60 seconds, or can be infinite. + /// + /// # Arguments + /// + /// * `options` - Optional configuration for the request. pub async fn acquire_lease( &self, options: Option>, @@ -221,6 +226,12 @@ impl BlobClient { self.client.acquire_lease(options).await } + /// Ends a lease and ensures that another client can't acquire a new lease until the current lease + /// period has expired. + /// + /// # Arguments + /// + /// * `options` - Optional configuration for the request. pub async fn break_lease( &self, options: Option>, @@ -228,6 +239,14 @@ impl BlobClient { self.client.break_lease(options).await } + /// Changes the ID of an existing lease to the proposed lease ID. + /// + /// # Arguments + /// + /// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the + /// lease ID must match. + /// * `proposed_lease_id` - The proposed lease ID for the blob. + /// * `options` - Optional configuration for the request. pub async fn change_lease( &self, lease_id: String, @@ -239,6 +258,14 @@ impl BlobClient { .await } + /// Frees the lease so that another client can immediately acquire a lease + /// against the blob as soon as the release is complete. + /// + /// # Arguments + /// + /// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the + /// lease ID must match. + /// * `options` - Optional configuration for the request. pub async fn release_lease( &self, lease_id: String, @@ -247,6 +274,13 @@ impl BlobClient { self.client.release_lease(lease_id, options).await } + /// Renews the lease on a blob. + /// + /// # Arguments + /// + /// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the + /// lease ID must match. + /// * `options` - Optional configuration for the request. pub async fn renew_lease( &self, lease_id: String, diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index 1a6bbc57a3..11e9935cea 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -16,8 +16,9 @@ pub use clients::*; pub mod models { pub use crate::generated::models::{ AccessTierOptional, ArchiveStatus, BlobClientAcquireLeaseOptions, - BlobClientAcquireLeaseResult, BlobClientBreakLeaseOptions, BlobClientBreakLeaseResult, - BlobClientChangeLeaseOptions, BlobClientChangeLeaseResult, BlobClientDeleteOptions, + BlobClientAcquireLeaseResult, BlobClientAcquireLeaseResultHeaders, + BlobClientBreakLeaseOptions, BlobClientBreakLeaseResult, BlobClientChangeLeaseOptions, + BlobClientChangeLeaseResult, BlobClientChangeLeaseResultHeaders, BlobClientDeleteOptions, BlobClientDownloadOptions, BlobClientDownloadResult, BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders, BlobClientReleaseLeaseOptions, diff --git a/sdk/storage/azure_storage_blob/tests/blob_client.rs b/sdk/storage/azure_storage_blob/tests/blob_client.rs index ef95fbbb0b..bcd6c0e70c 100644 --- a/sdk/storage/azure_storage_blob/tests/blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/blob_client.rs @@ -7,12 +7,14 @@ use azure_core::{ }; use azure_core_test::{recorded, TestContext}; use azure_storage_blob::models::{ - AccessTierOptional, BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, - BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlockBlobClientUploadOptions, - LeaseState, + AccessTierOptional, BlobClientAcquireLeaseOptions, BlobClientAcquireLeaseResultHeaders, + BlobClientChangeLeaseResultHeaders, BlobClientDownloadResultHeaders, + BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, + BlobClientSetPropertiesOptions, BlockBlobClientUploadOptions, LeaseState, }; use azure_storage_blob_test::{create_test_blob, get_blob_name, get_container_client}; -use std::{collections::HashMap, error::Error}; +use std::{collections::HashMap, error::Error, time::Duration}; +use tokio::time; #[recorded::test] async fn test_get_blob_properties(ctx: TestContext) -> Result<(), Box> { @@ -276,3 +278,73 @@ async fn test_set_access_tier(ctx: TestContext) -> Result<(), Box> { container_client.delete_container(None).await?; Ok(()) } + +#[recorded::test] +async fn test_blob_lease_operations(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_name = get_blob_name(recording); + let blob_client = container_client.blob_client(blob_name.clone()); + let other_blob_client = container_client.blob_client(blob_name); + create_test_blob(&blob_client).await?; + + // Acquire Lease + let acquire_lease_options = BlobClientAcquireLeaseOptions { + duration: Some(15), + ..Default::default() + }; + let acquire_response = blob_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await?; + let lease_id = acquire_response.lease_id()?.unwrap(); + let other_acquire_response = other_blob_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await; + // Assert + let error = other_acquire_response.unwrap_err().http_status(); + assert_eq!(StatusCode::Conflict, error.unwrap()); + + // Change Lease + let proposed_lease_id = "00000000-1111-2222-3333-444444444444".to_string(); + let change_lease_response = blob_client + .change_lease(lease_id, proposed_lease_id.clone(), None) + .await?; + // Assert + let lease_id = change_lease_response.lease_id()?.unwrap(); + assert_eq!(proposed_lease_id.clone().to_string(), lease_id); + + // Sleep until lease expires + time::sleep(Duration::from_secs(15)).await; + + // Renew Lease + blob_client + .renew_lease(proposed_lease_id.clone(), None) + .await?; + let other_acquire_response = other_blob_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await; + // Assert + let error = other_acquire_response.unwrap_err().http_status(); + assert_eq!(StatusCode::Conflict, error.unwrap()); + + // Break Lease + blob_client.break_lease(None).await?; + let other_acquire_response = other_blob_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await; + // Assert + let error = other_acquire_response.unwrap_err().http_status(); + assert_eq!(StatusCode::Conflict, error.unwrap()); + + // Release Lease + blob_client + .release_lease(proposed_lease_id.clone(), None) + .await?; + other_blob_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await?; + + container_client.delete_container(None).await?; + Ok(()) +} From f3a017ea51a3b884520bc208193eebd6177219ed Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 25 Jun 2025 20:02:50 -0700 Subject: [PATCH 20/30] Finish BlobContainerClient impl and tests --- .../src/clients/blob_client.rs | 1 + .../src/clients/blob_container_client.rs | 91 ++++++++++++++++++- sdk/storage/azure_storage_blob/src/lib.rs | 8 +- .../tests/blob_container_client.rs | 87 +++++++++++++++++- 4 files changed, 178 insertions(+), 9 deletions(-) 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 ea08d650b4..c9d1ccf9f4 100644 --- a/sdk/storage/azure_storage_blob/src/clients/blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/blob_client.rs @@ -223,6 +223,7 @@ impl BlobClient { &self, options: Option>, ) -> Result> { + //TODO: Make duration a parameter self.client.acquire_lease(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 83a13f632c..55a90cd8a7 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 @@ -3,11 +3,18 @@ use crate::{ generated::clients::BlobContainerClient as GeneratedBlobContainerClient, - generated::models::BlobContainerClientGetPropertiesResult, + generated::models::{ + BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult, + BlobContainerClientChangeLeaseResult, BlobContainerClientGetPropertiesResult, + BlobContainerClientReleaseLeaseResult, BlobContainerClientRenewLeaseResult, + }, models::{ - BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, - BlobContainerClientGetPropertiesOptions, BlobContainerClientListBlobFlatSegmentOptions, - BlobContainerClientSetMetadataOptions, ListBlobsFlatSegmentResponse, + BlobContainerClientAcquireLeaseOptions, BlobContainerClientBreakLeaseOptions, + BlobContainerClientChangeLeaseOptions, BlobContainerClientCreateOptions, + BlobContainerClientDeleteOptions, BlobContainerClientGetPropertiesOptions, + BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientReleaseLeaseOptions, + BlobContainerClientRenewLeaseOptions, BlobContainerClientSetMetadataOptions, + ListBlobsFlatSegmentResponse, }, pipeline::StorageHeadersPolicy, BlobClient, BlobContainerClientOptions, @@ -157,4 +164,80 @@ impl BlobContainerClient { ) -> Result>> { self.client.list_blob_flat_segment(options) } + + /// Requests a new lease on a container. The lease lock duration can be 15 to 60 seconds, or can be infinite. + /// + /// # Arguments + /// + /// * `options` - Optional configuration for the request. + pub async fn acquire_lease( + &self, + options: Option>, + ) -> Result> { + //TODO: Make duration a parameter + self.client.acquire_lease(options).await + } + + /// Ends a lease and ensures that another client can't acquire a new lease until the current lease + /// period has expired. + /// + /// # Arguments + /// + /// * `options` - Optional configuration for the request. + pub async fn break_lease( + &self, + options: Option>, + ) -> Result> { + self.client.break_lease(options).await + } + + /// Changes the ID of an existing lease to the proposed lease ID. + /// + /// # Arguments + /// + /// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the + /// lease ID must match. + /// * `proposed_lease_id` - The proposed lease ID for the container. + /// * `options` - Optional configuration for the request. + pub async fn change_lease( + &self, + lease_id: String, + proposed_lease_id: String, + options: Option>, + ) -> Result> { + self.client + .change_lease(lease_id, proposed_lease_id, options) + .await + } + + /// Frees the lease so that another client can immediately acquire a lease + /// against the container as soon as the release is complete. + /// + /// # Arguments + /// + /// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the + /// lease ID must match. + /// * `options` - Optional configuration for the request. + pub async fn release_lease( + &self, + lease_id: String, + options: Option>, + ) -> Result> { + self.client.release_lease(lease_id, options).await + } + + /// Renews the lease on a container. + /// + /// # Arguments + /// + /// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the + /// lease ID must match. + /// * `options` - Optional configuration for the request. + pub async fn renew_lease( + &self, + lease_id: String, + options: Option>, + ) -> Result> { + self.client.renew_lease(lease_id, options).await + } } diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index 11e9935cea..508c3fbed8 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -24,10 +24,16 @@ pub mod models { BlobClientGetPropertiesResultHeaders, BlobClientReleaseLeaseOptions, BlobClientReleaseLeaseResult, BlobClientRenewLeaseOptions, BlobClientRenewLeaseResult, BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions, + BlobContainerClientAcquireLeaseOptions, BlobContainerClientAcquireLeaseResult, + BlobContainerClientAcquireLeaseResultHeaders, BlobContainerClientBreakLeaseOptions, + BlobContainerClientBreakLeaseResult, BlobContainerClientChangeLeaseOptions, + BlobContainerClientChangeLeaseResult, BlobContainerClientChangeLeaseResultHeaders, BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders, - BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientSetMetadataOptions, + BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientReleaseLeaseOptions, + BlobContainerClientReleaseLeaseResult, BlobContainerClientRenewLeaseOptions, + BlobContainerClientRenewLeaseResult, BlobContainerClientSetMetadataOptions, BlobImmutabilityPolicyMode, BlobServiceClientGetPropertiesOptions, BlobServiceClientListContainersSegmentOptions, BlobType, BlockBlobClientCommitBlockListOptions, BlockBlobClientCommitBlockListResult, 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 822ba98363..a1aee6b0a0 100644 --- a/sdk/storage/azure_storage_blob/tests/blob_container_client.rs +++ b/sdk/storage/azure_storage_blob/tests/blob_container_client.rs @@ -4,12 +4,17 @@ use azure_core::http::StatusCode; use azure_core_test::{recorded, TestContext}; use azure_storage_blob::models::{ - BlobContainerClientGetPropertiesResultHeaders, BlobContainerClientListBlobFlatSegmentOptions, - BlobContainerClientSetMetadataOptions, BlobType, LeaseState, + BlobContainerClientAcquireLeaseOptions, BlobContainerClientAcquireLeaseResultHeaders, + BlobContainerClientChangeLeaseResultHeaders, BlobContainerClientGetPropertiesResultHeaders, + BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientSetMetadataOptions, BlobType, + LeaseState, +}; +use azure_storage_blob_test::{ + create_test_blob, get_blob_service_client, get_container_client, get_container_name, }; -use azure_storage_blob_test::{create_test_blob, get_container_client}; use futures::{StreamExt, TryStreamExt}; -use std::{collections::HashMap, error::Error}; +use std::{collections::HashMap, error::Error, time::Duration}; +use tokio::time; #[recorded::test] async fn test_create_container(ctx: TestContext) -> Result<(), Box> { @@ -201,3 +206,77 @@ async fn test_list_blobs_with_continuation(ctx: TestContext) -> Result<(), Box Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let blob_service_client = get_blob_service_client(recording)?; + let container_name = get_container_name(recording); + let container_client = blob_service_client.blob_container_client(container_name.clone()); + let other_container_client = blob_service_client.blob_container_client(container_name); + container_client.create_container(None).await?; + + // Acquire Lease + let acquire_lease_options = BlobContainerClientAcquireLeaseOptions { + duration: Some(15), + ..Default::default() + }; + let acquire_response = container_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await?; + let lease_id = acquire_response.lease_id()?.unwrap(); + let other_acquire_response = other_container_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await; + // Assert + let error = other_acquire_response.unwrap_err().http_status(); + assert_eq!(StatusCode::Conflict, error.unwrap()); + + // Change Lease + let proposed_lease_id = "00000000-1111-2222-3333-444444444444".to_string(); + let change_lease_response = container_client + .change_lease(lease_id, proposed_lease_id.clone(), None) + .await?; + // Assert + let lease_id = change_lease_response.lease_id()?.unwrap(); + assert_eq!(proposed_lease_id.clone().to_string(), lease_id); + + // Sleep until lease expires + time::sleep(Duration::from_secs(15)).await; + + // Renew Lease + container_client + .renew_lease(proposed_lease_id.clone(), None) + .await?; + let other_acquire_response = other_container_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await; + // Assert + let error = other_acquire_response.unwrap_err().http_status(); + assert_eq!(StatusCode::Conflict, error.unwrap()); + + // Break Lease + container_client.break_lease(None).await?; + let other_acquire_response = other_container_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await; + // Assert + let error = other_acquire_response.unwrap_err().http_status(); + assert_eq!(StatusCode::Conflict, error.unwrap()); + + // Release Lease + container_client + .release_lease(proposed_lease_id.clone(), None) + .await?; + let other_acquire_response = other_container_client + .acquire_lease(Some(acquire_lease_options.clone())) + .await; + let lease_id = other_acquire_response?.lease_id().unwrap(); + other_container_client + .release_lease(lease_id.unwrap(), None) + .await?; + + container_client.delete_container(None).await?; + Ok(()) +} From 75abb342c42a2e77c69d89a06bb3965b5848b4d5 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 26 Jun 2025 18:30:15 -0700 Subject: [PATCH 21/30] Refactor to helpers, extension traits in models folder, add models folder --- .../src/clients/page_blob_client.rs | 6 +-- sdk/storage/azure_storage_blob/src/helpers.rs | 37 +++++++++++++++++++ sdk/storage/azure_storage_blob/src/lib.rs | 32 ++-------------- .../extensions.rs} | 19 +++++++++- .../azure_storage_blob/src/models/mod.rs | 26 +++++++++++++ .../azure_storage_blob/src/storage_utils.rs | 26 ------------- .../tests/page_blob_client.rs | 15 ++++---- 7 files changed, 94 insertions(+), 67 deletions(-) create mode 100644 sdk/storage/azure_storage_blob/src/helpers.rs rename sdk/storage/azure_storage_blob/src/{storage_traits.rs => models/extensions.rs} (50%) create mode 100644 sdk/storage/azure_storage_blob/src/models/mod.rs delete mode 100644 sdk/storage/azure_storage_blob/src/storage_utils.rs 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 3c9a44436d..1191fe15ff 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 @@ -96,7 +96,7 @@ impl PageBlobClient { /// /// * `content_length` - The maximum size for the Page blob, up to 1TB. The page blob size must /// be aligned to a 512-byte boundary. - /// * `options` - Optional parameters for the request. See [`azure_storage_blob::storage_traits::PageBlobClientCreateOptionsExt`](crate::storage_traits::PageBlobClientCreateOptionsExt) for additional usage helpers. + /// * `options` - Optional parameters for the request. See [`PageBlobClientCreateOptionsExt`](crate::storage_traits::PageBlobClientCreateOptionsExt) for additional usage helpers. pub async fn create( &self, content_length: u64, @@ -109,7 +109,7 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `range` - The range of bytes to clear. See [`azure_storage_blob::StorageUtils::format_http_range()`](crate::StorageUtils::format_http_range) for help with the expected String format. + /// * `range` - The range of bytes to clear. See [`StorageUtils::format_http_range()`](crate::StorageUtils::format_http_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn clear_page( &self, @@ -142,7 +142,7 @@ impl PageBlobClient { /// * `data` - The contents of the page. /// * `content_length` - Number of bytes to use for writing to a section of the blob. The /// content_length specified must be a modulus of 512. - /// * `range` - The range of the bytes to write. See [`azure_storage_blob::StorageUtils::format_http_range()`](crate::StorageUtils::format_http_range) for help with the expected String format. + /// * `range` - The range of the bytes to write. See [`StorageUtils::format_http_range()`](crate::StorageUtils::format_http_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn upload_page( &self, diff --git a/sdk/storage/azure_storage_blob/src/helpers.rs b/sdk/storage/azure_storage_blob/src/helpers.rs new file mode 100644 index 0000000000..e3c36c42d5 --- /dev/null +++ b/sdk/storage/azure_storage_blob/src/helpers.rs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use std::io::{Error, ErrorKind}; + +/// Takes in an offset and a length, verifies alignment to a 512-byte boundary, and +/// returns the HTTP range in String format. +/// +/// # Arguments +/// +/// * `offset` - Start of the byte range to use for writing to a section of the blob. +/// The offset specified must be a modulus of 512. +/// * `length` - Number of bytes to use for writing to a section of the blob. +/// The length specified must be a modulus of 512. +pub fn format_page_range(offset: u64, length: u64) -> Result { + if offset % 512 != 0 { + return Err(Error::new( + ErrorKind::InvalidInput, + format!( + "provided offset {} is not aligned to a 512-byte boundary.", + offset + ), + )); + } + if length % 512 != 0 { + return Err(Error::new( + ErrorKind::InvalidInput, + format!( + "provided length {} is not aligned to a 512-byte boundary.", + offset + ), + )); + } + let end_range = offset + length - 1; + let content_range = format!("bytes={}-{}", offset, end_range); + Ok(content_range) +} diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index 265ac9ec9b..988ef02746 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -9,34 +9,8 @@ pub mod clients; mod generated; +pub mod helpers; mod pipeline; -pub mod storage_traits; -pub mod storage_utils; pub use clients::*; -pub use storage_utils::*; - -pub mod models { - pub use crate::generated::models::{ - AccessTierOptional, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, - ArchiveStatus, BlobClientDeleteOptions, BlobClientDownloadOptions, - BlobClientDownloadResult, BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, - BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders, - BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions, - BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, - BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, - BlobContainerClientGetPropertiesResultHeaders, - BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientSetMetadataOptions, - BlobImmutabilityPolicyMode, BlobServiceClientGetPropertiesOptions, - BlobServiceClientListContainersSegmentOptions, BlobType, - BlockBlobClientCommitBlockListOptions, BlockBlobClientCommitBlockListResult, - BlockBlobClientGetBlockListOptions, BlockBlobClientStageBlockOptions, - BlockBlobClientStageBlockResult, BlockBlobClientUploadOptions, BlockBlobClientUploadResult, - BlockList, BlockListType, BlockLookupList, CopyStatus, LeaseState, LeaseStatus, - ListBlobsFlatSegmentResponse, ListContainersSegmentResponse, - PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, - PageBlobClientCreateOptions, PageBlobClientCreateResult, PageBlobClientResizeOptions, - PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, - PageBlobClientUploadPagesResult, PublicAccessType, RehydratePriority, - StorageServiceProperties, - }; -} +pub use helpers::*; +pub mod models; diff --git a/sdk/storage/azure_storage_blob/src/storage_traits.rs b/sdk/storage/azure_storage_blob/src/models/extensions.rs similarity index 50% rename from sdk/storage/azure_storage_blob/src/storage_traits.rs rename to sdk/storage/azure_storage_blob/src/models/extensions.rs index 356e6634a0..71ea4beccb 100644 --- a/sdk/storage/azure_storage_blob/src/storage_traits.rs +++ b/sdk/storage/azure_storage_blob/src/models/extensions.rs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -use crate::models::PageBlobClientCreateOptions; +use crate::models::{AppendBlobClientCreateOptions, PageBlobClientCreateOptions}; pub trait PageBlobClientCreateOptionsExt { /// Augments the current options bag to only create if the page blob does not already exists. @@ -19,3 +19,20 @@ impl PageBlobClientCreateOptionsExt for PageBlobClientCreateOptions<'_> { } } } + +pub trait AppendBlobClientCreateOptionsExt { + /// Augments the current options bag to only create if the append blob does not already exists. + /// # Arguments + /// + /// * `self` - The options bag to be modified. + fn with_if_not_exists(self) -> Self; +} + +impl AppendBlobClientCreateOptionsExt for AppendBlobClientCreateOptions<'_> { + fn with_if_not_exists(self) -> Self { + Self { + if_none_match: Some("*".into()), + ..self + } + } +} diff --git a/sdk/storage/azure_storage_blob/src/models/mod.rs b/sdk/storage/azure_storage_blob/src/models/mod.rs new file mode 100644 index 0000000000..7689d1235d --- /dev/null +++ b/sdk/storage/azure_storage_blob/src/models/mod.rs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +mod extensions; + +pub use crate::generated::models::{ + AccessTierOptional, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, ArchiveStatus, + BlobClientDeleteOptions, BlobClientDownloadOptions, BlobClientDownloadResult, + BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, + BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, + BlobClientSetPropertiesOptions, BlobClientSetTierOptions, BlobContainerClientCreateOptions, + BlobContainerClientDeleteOptions, BlobContainerClientGetPropertiesOptions, + BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders, + BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientSetMetadataOptions, + BlobImmutabilityPolicyMode, BlobServiceClientGetPropertiesOptions, + BlobServiceClientListContainersSegmentOptions, BlobType, BlockBlobClientCommitBlockListOptions, + BlockBlobClientCommitBlockListResult, BlockBlobClientGetBlockListOptions, + BlockBlobClientStageBlockOptions, BlockBlobClientStageBlockResult, + BlockBlobClientUploadOptions, BlockBlobClientUploadResult, BlockList, BlockListType, + BlockLookupList, CopyStatus, LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse, + ListContainersSegmentResponse, PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, + PageBlobClientCreateOptions, PageBlobClientCreateResult, PageBlobClientResizeOptions, + PageBlobClientResizeResult, PageBlobClientUploadPagesOptions, PageBlobClientUploadPagesResult, + PublicAccessType, RehydratePriority, StorageServiceProperties, +}; +pub use extensions::*; diff --git a/sdk/storage/azure_storage_blob/src/storage_utils.rs b/sdk/storage/azure_storage_blob/src/storage_utils.rs deleted file mode 100644 index c144332168..0000000000 --- a/sdk/storage/azure_storage_blob/src/storage_utils.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -pub struct StorageUtils; - -impl StorageUtils { - /// Takes in an offset and a length and returns the HTTP range in string format. - /// - /// # Arguments - /// - /// * `offset` - Start of the byte range to use for writing to a section of the blob. - /// The offset specified must be a modulus of 512. - /// * `length` - Number of bytes to use for writing to a section of the blob. - /// The length specified must be a modulus of 512. - pub fn format_http_range(offset: u64, length: u64) -> String { - if offset % 512 != 0 { - panic!("offset must be aligned to a 512-byte boundary."); - } - if length % 512 != 0 { - panic!("length must be aligned to a 512-byte boundary."); - } - let end_range = offset + length - 1; - let content_range = format!("bytes={}-{}", offset, end_range); - content_range - } -} diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index 53aca48d2d..fc013d33e3 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -4,12 +4,11 @@ use azure_core::http::{RequestContent, StatusCode}; use azure_core_test::{recorded, TestContext}; use azure_storage_blob::{ + helpers::format_page_range, models::{ BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, - PageBlobClientCreateOptions, + PageBlobClientCreateOptions, PageBlobClientCreateOptionsExt, }, - storage_traits::PageBlobClientCreateOptionsExt, - StorageUtils, }; use azure_storage_blob_test::{get_blob_name, get_container_client}; use std::error::Error; @@ -67,7 +66,7 @@ async fn test_upload_page(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 512, - StorageUtils::format_http_range(0, 512), + format_page_range(0, 512)?, None, ) .await?; @@ -97,13 +96,13 @@ async fn test_clear_page(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data), 512, - StorageUtils::format_http_range(0, 512), + format_page_range(0, 512)?, None, ) .await?; page_blob_client - .clear_page(StorageUtils::format_http_range(0, 512), None) + .clear_page(format_page_range(0, 512)?, None) .await?; // Assert @@ -133,7 +132,7 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 1024, - StorageUtils::format_http_range(0, 1024), + format_page_range(0, 1024)?, None, ) .await; @@ -146,7 +145,7 @@ async fn test_resize_blob(ctx: TestContext) -> Result<(), Box> { .upload_page( RequestContent::from(data.clone()), 1024, - StorageUtils::format_http_range(0, 1024), + format_page_range(0, 1024)?, None, ) .await?; From 0c9e84490d30deb4c6ea9f7e595f67b344a07b6e Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 26 Jun 2025 18:41:37 -0700 Subject: [PATCH 22/30] nit --- .../azure_storage_blob/src/clients/page_blob_client.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 1191fe15ff..4d3ff85a95 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 @@ -96,7 +96,7 @@ impl PageBlobClient { /// /// * `content_length` - The maximum size for the Page blob, up to 1TB. The page blob size must /// be aligned to a 512-byte boundary. - /// * `options` - Optional parameters for the request. See [`PageBlobClientCreateOptionsExt`](crate::storage_traits::PageBlobClientCreateOptionsExt) for additional usage helpers. + /// * `options` - Optional parameters for the request. See [`PageBlobClientCreateOptionsExt`](crate::models::PageBlobClientCreateOptionsExt) for additional usage helpers. pub async fn create( &self, content_length: u64, @@ -109,7 +109,7 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `range` - The range of bytes to clear. See [`StorageUtils::format_http_range()`](crate::StorageUtils::format_http_range) for help with the expected String format. + /// * `range` - The range of bytes to clear. See [`format_page_range()`](crate::helpers::format_page_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn clear_page( &self, @@ -142,7 +142,7 @@ impl PageBlobClient { /// * `data` - The contents of the page. /// * `content_length` - Number of bytes to use for writing to a section of the blob. The /// content_length specified must be a modulus of 512. - /// * `range` - The range of the bytes to write. See [`StorageUtils::format_http_range()`](crate::StorageUtils::format_http_range) for help with the expected String format. + /// * `range` - The range of the bytes to write. See [`format_page_range()`](crate::helpers::format_page_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn upload_page( &self, From 1d314ee4f3a83d48293aa904bc078c66a813c0f0 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Mon, 30 Jun 2025 13:42:08 -0700 Subject: [PATCH 23/30] Regenerate after making duration required param --- .../src/clients/blob_client.rs | 6 ++-- .../src/clients/blob_container_client.rs | 6 ++-- .../src/generated/clients/blob_client.rs | 7 +++-- .../clients/blob_container_client.rs | 7 +++-- .../src/generated/models/method_options.rs | 8 ----- .../azure_storage_blob/tests/blob_client.rs | 20 ++++-------- .../tests/blob_container_client.rs | 31 +++++-------------- .../azure_storage_blob/tsp-location.yaml | 2 +- 8 files changed, 31 insertions(+), 56 deletions(-) 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 c9d1ccf9f4..022573eaba 100644 --- a/sdk/storage/azure_storage_blob/src/clients/blob_client.rs +++ b/sdk/storage/azure_storage_blob/src/clients/blob_client.rs @@ -218,13 +218,15 @@ impl BlobClient { /// /// # Arguments /// + /// * `duration` - 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. /// * `options` - Optional configuration for the request. pub async fn acquire_lease( &self, + duration: i32, options: Option>, ) -> Result> { - //TODO: Make duration a parameter - self.client.acquire_lease(options).await + self.client.acquire_lease(duration, options).await } /// Ends a lease and ensures that another client can't acquire a new lease until the current lease 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 55a90cd8a7..01a785cb26 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 @@ -169,13 +169,15 @@ impl BlobContainerClient { /// /// # Arguments /// + /// * `duration` - 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. /// * `options` - Optional configuration for the request. pub async fn acquire_lease( &self, + duration: i32, options: Option>, ) -> Result> { - //TODO: Make duration a parameter - self.client.acquire_lease(options).await + self.client.acquire_lease(duration, options).await } /// Ends a lease and ensures that another client can't acquire a new lease until the current lease 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 fbe87708f3..1f8d9ea0ad 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 @@ -153,9 +153,12 @@ impl BlobClient { /// /// # Arguments /// + /// * `duration` - 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. /// * `options` - Optional parameters for the request. pub async fn acquire_lease( &self, + duration: i32, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); @@ -193,9 +196,7 @@ impl BlobClient { request.insert_header("x-ms-if-tags", if_tags); } request.insert_header("x-ms-lease-action", "acquire"); - if let Some(duration) = options.duration { - request.insert_header("x-ms-lease-duration", duration.to_string()); - } + request.insert_header("x-ms-lease-duration", duration.to_string()); if let Some(proposed_lease_id) = options.proposed_lease_id { request.insert_header("x-ms-proposed-lease-id", proposed_lease_id); } diff --git a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs b/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs index 84f27dcf78..844f8c1ed7 100644 --- a/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs +++ b/sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs @@ -106,9 +106,12 @@ impl BlobContainerClient { /// /// # Arguments /// + /// * `duration` - 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. /// * `options` - Optional parameters for the request. pub async fn acquire_lease( &self, + duration: i32, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); @@ -135,9 +138,7 @@ impl BlobContainerClient { request.insert_header("x-ms-client-request-id", client_request_id); } request.insert_header("x-ms-lease-action", "acquire"); - if let Some(duration) = options.duration { - request.insert_header("x-ms-lease-duration", duration.to_string()); - } + request.insert_header("x-ms-lease-duration", duration.to_string()); if let Some(proposed_lease_id) = options.proposed_lease_id { request.insert_header("x-ms-proposed-lease-id", proposed_lease_id); } 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 e1a142ca2e..58402fcab0 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 @@ -314,10 +314,6 @@ pub struct BlobClientAcquireLeaseOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// 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. - pub duration: Option, - /// A condition that must be met in order for the request to be processed. pub if_match: Option, @@ -1139,10 +1135,6 @@ pub struct BlobContainerClientAcquireLeaseOptions<'a> { /// An opaque, globally-unique, client-generated string identifier for the request. pub client_request_id: Option, - /// 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. - pub duration: 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, diff --git a/sdk/storage/azure_storage_blob/tests/blob_client.rs b/sdk/storage/azure_storage_blob/tests/blob_client.rs index bcd6c0e70c..294f0c0436 100644 --- a/sdk/storage/azure_storage_blob/tests/blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/blob_client.rs @@ -7,7 +7,7 @@ use azure_core::{ }; use azure_core_test::{recorded, TestContext}; use azure_storage_blob::models::{ - AccessTierOptional, BlobClientAcquireLeaseOptions, BlobClientAcquireLeaseResultHeaders, + AccessTierOptional, BlobClientAcquireLeaseResultHeaders, BlobClientChangeLeaseResultHeaders, BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlockBlobClientUploadOptions, LeaseState, @@ -290,17 +290,9 @@ async fn test_blob_lease_operations(ctx: TestContext) -> Result<(), Box Result<(), Box Result<(), Box Result<(), Box Result<(), Box Result<(), Box Result<(), Box Date: Mon, 30 Jun 2025 14:26:30 -0700 Subject: [PATCH 24/30] Added testcase for using non-lease APIs with active lease --- .../azure_storage_blob/tests/blob_client.rs | 105 ++++++++++++++++-- .../tests/blob_container_client.rs | 10 ++ 2 files changed, 104 insertions(+), 11 deletions(-) diff --git a/sdk/storage/azure_storage_blob/tests/blob_client.rs b/sdk/storage/azure_storage_blob/tests/blob_client.rs index 294f0c0436..3155564720 100644 --- a/sdk/storage/azure_storage_blob/tests/blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/blob_client.rs @@ -7,10 +7,11 @@ use azure_core::{ }; use azure_core_test::{recorded, TestContext}; use azure_storage_blob::models::{ - AccessTierOptional, BlobClientAcquireLeaseResultHeaders, - BlobClientChangeLeaseResultHeaders, BlobClientDownloadResultHeaders, + AccessTierOptional, BlobClientAcquireLeaseResultHeaders, BlobClientChangeLeaseResultHeaders, + BlobClientDownloadOptions, BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, - BlobClientSetPropertiesOptions, BlockBlobClientUploadOptions, LeaseState, + BlobClientSetPropertiesOptions, BlobClientSetTierOptions, BlockBlobClientUploadOptions, + LeaseState, }; use azure_storage_blob_test::{create_test_blob, get_blob_name, get_container_client}; use std::{collections::HashMap, error::Error, time::Duration}; @@ -313,18 +314,14 @@ async fn test_blob_lease_operations(ctx: TestContext) -> Result<(), Box Result<(), Box Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_name = get_blob_name(recording); + let blob_client = container_client.blob_client(blob_name.clone()); + create_test_blob(&blob_client).await?; + let acquire_response = blob_client.acquire_lease(-1, None).await?; + let lease_id = acquire_response.lease_id()?.unwrap(); + + // Set Properties, Set Metadata, Set Access Tier + let set_properties_options = BlobClientSetPropertiesOptions { + blob_content_language: Some("spanish".to_string()), + blob_content_disposition: Some("inline".to_string()), + lease_id: Some(lease_id.clone()), + ..Default::default() + }; + blob_client + .set_properties(Some(set_properties_options)) + .await?; + + let update_metadata = HashMap::from([("updated".to_string(), "values".to_string())]); + let set_metadata_options = BlobClientSetMetadataOptions { + metadata: Some(update_metadata.clone()), + lease_id: Some(lease_id.clone()), + ..Default::default() + }; + blob_client.set_metadata(Some(set_metadata_options)).await?; + + let set_tier_options = BlobClientSetTierOptions { + lease_id: Some(lease_id.clone()), + ..Default::default() + }; + blob_client + .set_tier(AccessTierOptional::Cold, Some(set_tier_options)) + .await?; + + // Assert + let get_properties_options = BlobClientGetPropertiesOptions { + lease_id: Some(lease_id.clone()), + ..Default::default() + }; + let response = blob_client + .get_properties(Some(get_properties_options)) .await?; + let content_language = response.content_language()?; + let content_disposition = response.content_disposition()?; + let response_metadata = response.metadata()?; + let access_tier = response.access_tier()?; + assert_eq!("spanish".to_string(), content_language.unwrap()); + assert_eq!("inline".to_string(), content_disposition.unwrap()); + assert_eq!(update_metadata, response_metadata); + assert_eq!(AccessTierOptional::Cold.to_string(), access_tier.unwrap()); + + // Overwrite Upload + let data = b"overruled!"; + let upload_options = BlockBlobClientUploadOptions { + lease_id: Some(lease_id.clone()), + ..Default::default() + }; + blob_client + .upload( + RequestContent::from(data.to_vec()), + true, + u64::try_from(data.len())?, + Some(upload_options), + ) + .await?; + + // Assert + let download_options = BlobClientDownloadOptions { + lease_id: Some(lease_id.clone()), + ..Default::default() + }; + let response = blob_client.download(Some(download_options)).await?; + let content_length = response.content_length()?; + let (status_code, _, response_body) = response.deconstruct(); + assert!(status_code.is_success()); + assert_eq!(10, content_length.unwrap()); + assert_eq!(data.to_vec(), response_body.collect().await?); + + blob_client.break_lease(None).await?; container_client.delete_container(None).await?; 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 af89f95dfe..65420e18fb 100644 --- a/sdk/storage/azure_storage_blob/tests/blob_container_client.rs +++ b/sdk/storage/azure_storage_blob/tests/blob_container_client.rs @@ -224,6 +224,16 @@ async fn test_container_lease_operations(ctx: TestContext) -> Result<(), Box Date: Mon, 7 Jul 2025 15:24:44 -0700 Subject: [PATCH 25/30] Rename to parsers, regen against feature/blob-tsp --- .../azure_storage_blob/src/clients/page_blob_client.rs | 4 ++-- sdk/storage/azure_storage_blob/src/lib.rs | 4 ++-- sdk/storage/azure_storage_blob/src/{helpers.rs => parsers.rs} | 0 sdk/storage/azure_storage_blob/tests/page_blob_client.rs | 2 +- sdk/storage/azure_storage_blob/tsp-location.yaml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename sdk/storage/azure_storage_blob/src/{helpers.rs => parsers.rs} (100%) 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 4d3ff85a95..af48eefeb3 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 @@ -109,7 +109,7 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `range` - The range of bytes to clear. See [`format_page_range()`](crate::helpers::format_page_range) for help with the expected String format. + /// * `range` - The range of bytes to clear. See [`format_page_range()`](crate::format_page_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn clear_page( &self, @@ -142,7 +142,7 @@ impl PageBlobClient { /// * `data` - The contents of the page. /// * `content_length` - Number of bytes to use for writing to a section of the blob. The /// content_length specified must be a modulus of 512. - /// * `range` - The range of the bytes to write. See [`format_page_range()`](crate::helpers::format_page_range) for help with the expected String format. + /// * `range` - The range of the bytes to write. See [`format_page_range()`](crate::format_page_range) for help with the expected String format. /// * `options` - Optional parameters for the request. pub async fn upload_page( &self, diff --git a/sdk/storage/azure_storage_blob/src/lib.rs b/sdk/storage/azure_storage_blob/src/lib.rs index 988ef02746..49ae35a0f3 100644 --- a/sdk/storage/azure_storage_blob/src/lib.rs +++ b/sdk/storage/azure_storage_blob/src/lib.rs @@ -9,8 +9,8 @@ pub mod clients; mod generated; -pub mod helpers; +mod parsers; mod pipeline; pub use clients::*; -pub use helpers::*; +pub use parsers::*; pub mod models; diff --git a/sdk/storage/azure_storage_blob/src/helpers.rs b/sdk/storage/azure_storage_blob/src/parsers.rs similarity index 100% rename from sdk/storage/azure_storage_blob/src/helpers.rs rename to sdk/storage/azure_storage_blob/src/parsers.rs diff --git a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs index fc013d33e3..49948ca5fe 100644 --- a/sdk/storage/azure_storage_blob/tests/page_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/page_blob_client.rs @@ -4,7 +4,7 @@ use azure_core::http::{RequestContent, StatusCode}; use azure_core_test::{recorded, TestContext}; use azure_storage_blob::{ - helpers::format_page_range, + format_page_range, models::{ BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, PageBlobClientCreateOptions, PageBlobClientCreateOptionsExt, diff --git a/sdk/storage/azure_storage_blob/tsp-location.yaml b/sdk/storage/azure_storage_blob/tsp-location.yaml index 6049879ea9..558ee24519 100644 --- a/sdk/storage/azure_storage_blob/tsp-location.yaml +++ b/sdk/storage/azure_storage_blob/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/storage/Microsoft.BlobStorage -commit: 552cf9b5591fc74384eca9d32917ca912b4ea317 +commit: ee1ab3f8db24317d6903867f016b88f13190d877 repo: Azure/azure-rest-api-specs additionalDirectories: From 97cfd3ae66785dbbc159e3f47d1985e27cbee76d Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 8 Jul 2025 15:29:11 -0700 Subject: [PATCH 26/30] append_block, append_block_from_url, seal for AppendBlob --- .../src/clients/append_blob_client.rs | 56 +++++++- .../azure_storage_blob/src/models/mod.rs | 5 +- .../tests/append_blob_client.rs | 123 +++++++++++++++++- 3 files changed, 180 insertions(+), 4 deletions(-) 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 9a4df6c5e0..24ebc6753d 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 @@ -3,7 +3,12 @@ use crate::{ generated::clients::AppendBlobClient as GeneratedAppendBlobClient, - models::{AppendBlobClientCreateOptions, AppendBlobClientCreateResult}, + models::{ + AppendBlobClientAppendBlockFromUrlOptions, AppendBlobClientAppendBlockFromUrlResult, + AppendBlobClientAppendBlockOptions, AppendBlobClientAppendBlockResult, + AppendBlobClientCreateOptions, AppendBlobClientCreateResult, AppendBlobClientSealOptions, + AppendBlobClientSealResult, + }, pipeline::StorageHeadersPolicy, AppendBlobClientOptions, BlobClientOptions, }; @@ -97,4 +102,53 @@ impl AppendBlobClient { ) -> Result> { self.client.create(options).await } + + /// Commits a new block of data to the end of an Append blob. + /// + /// # Arguments + /// + /// * `data` - The blob data to append. + /// * `content_length` - Total length of the blob data to be appended. + /// * `options` - Optional configuration for the request. + pub async fn append_block( + &self, + data: RequestContent, + content_length: u64, + options: Option>, + ) -> Result> { + self.client + .append_block(data, content_length, options) + .await + } + + /// Creates a new block to be committed as part of an Append blob where the contents are + /// read from a URL. + /// + /// # Arguments + /// + /// * `source_url` - The URL of the copy source. + /// * `content_length` - Total length of the blob data to be appended. + /// * `options` - Optional configuration for the request. + pub async fn append_block_from_url( + &self, + source_url: String, + content_length: u64, + options: Option>, + ) -> Result> { + self.client + .append_block_from_url(source_url, content_length, options) + .await + } + + /// Seals the Append blob to make it read-only. Seal is supported only on version 2019-12-12 or later. + /// + /// # Arguments + /// + /// * `options` - Optional parameters for the request. + pub async fn seal( + &self, + options: Option>, + ) -> Result> { + self.client.seal(options).await + } } diff --git a/sdk/storage/azure_storage_blob/src/models/mod.rs b/sdk/storage/azure_storage_blob/src/models/mod.rs index 7689d1235d..70326eb1f8 100644 --- a/sdk/storage/azure_storage_blob/src/models/mod.rs +++ b/sdk/storage/azure_storage_blob/src/models/mod.rs @@ -4,7 +4,10 @@ mod extensions; pub use crate::generated::models::{ - AccessTierOptional, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, ArchiveStatus, + AccessTierOptional, AppendBlobClientAppendBlockFromUrlOptions, + AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockOptions, + AppendBlobClientAppendBlockResult, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, + AppendBlobClientSealOptions, AppendBlobClientSealResult, ArchiveStatus, BlobClientDeleteOptions, BlobClientDownloadOptions, BlobClientDownloadResult, BlobClientDownloadResultHeaders, BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders, BlobClientSetMetadataOptions, 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 f98dd5d247..2c047c1c4e 100644 --- a/sdk/storage/azure_storage_blob/tests/append_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/append_blob_client.rs @@ -1,9 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +use azure_core::http::{RequestContent, StatusCode}; use azure_core_test::{recorded, TestContext}; -use azure_storage_blob::models::{BlobClientGetPropertiesResultHeaders, BlobType}; -use azure_storage_blob_test::{get_blob_name, get_container_client}; +use azure_storage_blob::models::{ + BlobClientDownloadResultHeaders, BlobClientGetPropertiesResultHeaders, BlobType, +}; +use azure_storage_blob_test::{create_test_blob, get_blob_name, get_container_client}; use std::error::Error; #[recorded::test] @@ -27,3 +30,119 @@ async fn test_create_append_blob(ctx: TestContext) -> Result<(), Box> container_client.delete_container(None).await?; Ok(()) } + +#[recorded::test] +async fn test_append_block(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let append_blob_client = blob_client.append_blob_client(); + append_blob_client.create(None).await?; + let mut block_1 = b"hello".to_vec(); + let block_2 = b" rusty world".to_vec(); + + // Act + append_blob_client + .append_block( + RequestContent::from(block_1.clone()), + u64::try_from(block_1.len())?, + None, + ) + .await?; + append_blob_client + .append_block( + RequestContent::from(block_2.clone()), + u64::try_from(block_2.len())?, + None, + ) + .await?; + + // Assert + let response = blob_client.download(None).await?; + let content_length = response.content_length()?; + let (status_code, _, response_body) = response.deconstruct(); + assert!(status_code.is_success()); + assert_eq!(17, content_length.unwrap()); + block_1.extend(&block_2); + assert_eq!(block_1, response_body.collect().await?); + + container_client.delete_container(None).await?; + Ok(()) +} + +#[recorded::test] +async fn test_append_block_from_url(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let blob_client_2 = container_client.blob_client(get_blob_name(recording)); + create_test_blob(&blob_client_2).await?; + let source_url = format!( + "{}{}/{}", + blob_client_2.endpoint(), + blob_client_2.container_name(), + blob_client_2.blob_name() + ); + println!("{}", source_url); + let append_blob_client = blob_client.append_blob_client(); + append_blob_client.create(None).await?; + + // Act + append_blob_client + .append_block_from_url(source_url, 17, None) + .await?; + + // Assert + let response = blob_client.download(None).await?; + let content_length = response.content_length()?; + let (status_code, _, response_body) = response.deconstruct(); + assert!(status_code.is_success()); + assert_eq!(17, content_length.unwrap()); + assert_eq!( + b"hello rusty world".to_vec(), + response_body.collect().await? + ); + + container_client.delete_container(None).await?; + Ok(()) +} + +#[recorded::test] +async fn test_seal_append_blob(ctx: TestContext) -> Result<(), Box> { + // Recording Setup + let recording = ctx.recording(); + let container_client = get_container_client(recording, true).await?; + let blob_client = container_client.blob_client(get_blob_name(recording)); + let append_blob_client = blob_client.append_blob_client(); + append_blob_client.create(None).await?; + let test_block = b"test".to_vec(); + + // Act + append_blob_client.seal(None).await?; + let response = append_blob_client + .append_block( + RequestContent::from(test_block.clone()), + u64::try_from(test_block.len())?, + None, + ) + .await; + + // Assert + let error = response.unwrap_err().http_status(); + assert_eq!(StatusCode::Conflict, error.unwrap()); + + // Check Read-Only + let response = blob_client.download(None).await?; + let content_length = response.content_length()?; + let (status_code, _, response_body) = response.deconstruct(); + + // Assert + assert!(status_code.is_success()); + assert_eq!(0, content_length.unwrap()); + assert_eq!(b"".to_vec(), response_body.collect().await?); + + container_client.delete_container(None).await?; + Ok(()) +} From 2ff96c42152f0096e5d0ede028618702f2236ce7 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 9 Jul 2025 12:00:20 -0700 Subject: [PATCH 27/30] nit --- sdk/storage/azure_storage_blob/tests/append_blob_client.rs | 1 - 1 file changed, 1 deletion(-) 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 2c047c1c4e..70116192d8 100644 --- a/sdk/storage/azure_storage_blob/tests/append_blob_client.rs +++ b/sdk/storage/azure_storage_blob/tests/append_blob_client.rs @@ -85,7 +85,6 @@ async fn test_append_block_from_url(ctx: TestContext) -> Result<(), Box Date: Thu, 10 Jul 2025 11:46:25 -0700 Subject: [PATCH 28/30] Test recordings --- sdk/storage/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/assets.json b/sdk/storage/assets.json index 38706fd454..20cba4eaa9 100644 --- a/sdk/storage/assets.json +++ b/sdk/storage/assets.json @@ -1,6 +1,6 @@ { "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "rust", - "Tag": "rust/azure_storage_blob_83b2698a78", + "Tag": "rust/azure_storage_blob_f12afa9550", "TagPrefix": "rust/azure_storage_blob" } \ No newline at end of file From 93c66d66d90adbd7cba6aa1bf7b8a99f6a1f3a73 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 10 Jul 2025 12:10:12 -0700 Subject: [PATCH 29/30] Regenerate against TypeSpec --- .../src/generated/models/header_traits.rs | 84 ------------------- .../azure_storage_blob/tsp-location.yaml | 4 +- 2 files changed, 2 insertions(+), 86 deletions(-) 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 ba8ace8590..7a09d50746 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 @@ -115,7 +115,6 @@ const VERSION_ID: HeaderName = HeaderName::from_static("x-ms-version-id"); /// Provides access to typed response headers for `AppendBlobClient::append_block_from_url()` pub trait AppendBlobClientAppendBlockFromUrlResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_append_offset(&self) -> Result>; @@ -135,11 +134,6 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders 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())) - } - /// The date/time that the container was last modified. fn last_modified(&self) -> Result> { Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { @@ -191,7 +185,6 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders /// Provides access to typed response headers for `AppendBlobClient::append_block()` pub trait AppendBlobClientAppendBlockResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn blob_append_offset(&self) -> Result>; @@ -211,11 +204,6 @@ impl AppendBlobClientAppendBlockResultHeaders 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())) - } - /// The date/time that the container was last modified. fn last_modified(&self) -> Result> { Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { @@ -322,18 +310,12 @@ impl AppendBlobClientCreateResultHeaders for Response Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn is_sealed(&self) -> Result>; } impl AppendBlobClientSealResultHeaders 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| { @@ -368,18 +350,12 @@ impl BlobClientAbortCopyFromUrlResultHeaders /// Provides access to typed response headers for `BlobClient::acquire_lease()` pub trait BlobClientAcquireLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn lease_id(&self) -> Result>; } impl BlobClientAcquireLeaseResultHeaders 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| { @@ -400,18 +376,12 @@ impl BlobClientAcquireLeaseResultHeaders for Response Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn lease_time(&self) -> Result>; } impl BlobClientBreakLeaseResultHeaders 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| { @@ -432,18 +402,12 @@ impl BlobClientBreakLeaseResultHeaders for Response Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn lease_id(&self) -> Result>; } impl BlobClientChangeLeaseResultHeaders 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| { @@ -1222,17 +1186,11 @@ impl BlobClientGetPropertiesResultHeaders for Response Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; } impl BlobClientReleaseLeaseResultHeaders 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| { @@ -1248,18 +1206,12 @@ impl BlobClientReleaseLeaseResultHeaders for Response Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn lease_id(&self) -> Result>; } impl BlobClientRenewLeaseResultHeaders 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| { @@ -1424,7 +1376,6 @@ impl BlobClientUndeleteResultHeaders for Response Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn lease_id(&self) -> Result>; @@ -1433,11 +1384,6 @@ pub trait BlobContainerClientAcquireLeaseResultHeaders: private::Sealed { impl BlobContainerClientAcquireLeaseResultHeaders 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| { @@ -1458,21 +1404,14 @@ impl BlobContainerClientAcquireLeaseResultHeaders /// Provides access to typed response headers for `BlobContainerClient::break_lease()` pub trait BlobContainerClientBreakLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; - fn lease_id(&self) -> Result>; fn lease_time(&self) -> Result>; } impl BlobContainerClientBreakLeaseResultHeaders 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| { @@ -1485,11 +1424,6 @@ impl BlobContainerClientBreakLeaseResultHeaders 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) - } - /// Approximate time remaining in the lease period, in seconds. fn lease_time(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEASE_TIME) @@ -1498,7 +1432,6 @@ impl BlobContainerClientBreakLeaseResultHeaders /// Provides access to typed response headers for `BlobContainerClient::change_lease()` pub trait BlobContainerClientChangeLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn lease_id(&self) -> Result>; @@ -1507,11 +1440,6 @@ pub trait BlobContainerClientChangeLeaseResultHeaders: private::Sealed { impl BlobContainerClientChangeLeaseResultHeaders 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| { @@ -1655,7 +1583,6 @@ impl BlobContainerClientGetPropertiesResultHeaders /// Provides access to typed response headers for `BlobContainerClient::release_lease()` pub trait BlobContainerClientReleaseLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; } @@ -1663,11 +1590,6 @@ pub trait BlobContainerClientReleaseLeaseResultHeaders: private::Sealed { impl BlobContainerClientReleaseLeaseResultHeaders 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| { @@ -1697,7 +1619,6 @@ impl BlobContainerClientRenameResultHeaders /// Provides access to typed response headers for `BlobContainerClient::renew_lease()` pub trait BlobContainerClientRenewLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn last_modified(&self) -> Result>; fn etag(&self) -> Result>; fn lease_id(&self) -> Result>; @@ -1706,11 +1627,6 @@ pub trait BlobContainerClientRenewLeaseResultHeaders: private::Sealed { impl BlobContainerClientRenewLeaseResultHeaders 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| { diff --git a/sdk/storage/azure_storage_blob/tsp-location.yaml b/sdk/storage/azure_storage_blob/tsp-location.yaml index 57108a8551..f925b4d548 100644 --- a/sdk/storage/azure_storage_blob/tsp-location.yaml +++ b/sdk/storage/azure_storage_blob/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/storage/Microsoft.BlobStorage -commit: 9f9436192da990f15c7bcce33374a8f04b91a462 +commit: 726258443214caac296d42bf9def946037c83a70 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: From 2a9a9df39dacf23398a44aaf9c1ee9ac958bef71 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 10 Jul 2025 18:35:11 -0700 Subject: [PATCH 30/30] Regen against feature/blob-tsp --- sdk/storage/azure_storage_blob/tsp-location.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/azure_storage_blob/tsp-location.yaml b/sdk/storage/azure_storage_blob/tsp-location.yaml index f925b4d548..545a4d0bf1 100644 --- a/sdk/storage/azure_storage_blob/tsp-location.yaml +++ b/sdk/storage/azure_storage_blob/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/storage/Microsoft.BlobStorage -commit: 726258443214caac296d42bf9def946037c83a70 +commit: 41532d82bfae3ea0f933e10279a5fa3d27ae4b03 repo: Azure/azure-rest-api-specs additionalDirectories: