From 0b8da284638f8dad71359e151118a2e13676882b Mon Sep 17 00:00:00 2001 From: Joel Hendrix Date: Tue, 24 Feb 2026 16:01:52 -0800 Subject: [PATCH 1/2] Update storage to latest tsp Removed test for pub(crate) items as we now have dedicated tests for that scenario. --- .../generated/clients/append_blob_client.rs | 139 +- .../src/generated/clients/blob_client.rs | 1140 +---- .../clients/blob_container_client.rs | 612 +-- .../generated/clients/blob_service_client.rs | 231 +- .../generated/clients/block_blob_client.rs | 670 +-- .../src/generated/clients/page_blob_client.rs | 477 +- .../src/generated/models/enums.rs | 519 +- .../src/generated/models/enums_impl.rs | 1364 ++++-- .../src/generated/models/enums_serde.rs | 92 +- .../src/generated/models/header_traits.rs | 2063 ++------ .../src/generated/models/method_options.rs | 946 ++-- .../src/generated/models/models.rs | 472 +- .../src/generated/models/models_impl.rs | 46 +- .../src/generated/models/models_serde.rs | 55 +- .../src/generated/models/xml_helpers.rs | 82 +- .../test/sdk/blob_storage/src/lib.rs | 37 - .../test/sdk/blob_storage/tests/testing.rs | 18 +- .../test/tsp/Microsoft.BlobStorage/client.tsp | 162 +- .../test/tsp/Microsoft.BlobStorage/main.tsp | 10 +- .../test/tsp/Microsoft.BlobStorage/models.tsp | 866 +++- .../test/tsp/Microsoft.BlobStorage/routes.tsp | 4254 +++++++++-------- 21 files changed, 5916 insertions(+), 8339 deletions(-) diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/append_blob_client.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/append_blob_client.rs index 6644c48a4..c26ad5350 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/append_blob_client.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/append_blob_client.rs @@ -7,27 +7,22 @@ use crate::generated::models::{ AppendBlobClientAppendBlockFromUrlOptions, AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockOptions, AppendBlobClientAppendBlockResult, AppendBlobClientCreateOptions, AppendBlobClientCreateResult, AppendBlobClientSealOptions, - AppendBlobClientSealResult, BlobType, + AppendBlobClientSealResult, }; use azure_core::{ base64, - credentials::TokenCredential, error::CheckSuccessOptions, fmt::SafeDebug, http::{ - policies::{auth::BearerTokenAuthorizationPolicy, Policy}, ClientOptions, Method, NoFormat, Pipeline, PipelineSendOptions, Request, RequestContent, Response, Url, UrlExt, }, time::to_rfc7231, tracing, Bytes, Result, }; -use std::sync::Arc; #[tracing::client] pub struct AppendBlobClient { - pub(crate) blob_name: String, - pub(crate) container_name: String, pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, @@ -43,52 +38,6 @@ pub struct AppendBlobClientOptions { } impl AppendBlobClient { - /// Creates a new AppendBlobClient, using Entra ID authentication. - /// - /// # Arguments - /// - /// * `endpoint` - Service host - /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an - /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. - /// * `blob_name` - The name of the blob. - /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob.Container.Blob.AppendBlob")] - pub fn new( - endpoint: &str, - credential: Arc, - container_name: String, - blob_name: String, - options: Option, - ) -> Result { - let options = options.unwrap_or_default(); - let endpoint = Url::parse(endpoint)?; - if !endpoint.scheme().starts_with("http") { - return Err(azure_core::Error::with_message( - azure_core::error::ErrorKind::Other, - format!("{endpoint} must use http(s)"), - )); - } - let auth_policy: Arc = Arc::new(BearerTokenAuthorizationPolicy::new( - credential, - vec!["https://storage.azure.com/.default"], - )); - Ok(Self { - blob_name, - container_name, - endpoint, - version: options.version, - pipeline: Pipeline::new( - option_env!("CARGO_PKG_NAME"), - option_env!("CARGO_PKG_VERSION"), - options.client_options, - Vec::default(), - vec![auth_policy], - None, - ), - }) - } - /// Returns the Url associated with this client. pub fn endpoint(&self) -> &Url { &self.endpoint @@ -116,19 +65,18 @@ impl AppendBlobClient { /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } + /// if let Some(last_modified) = response.last_modified()? { + /// println!("last-modified: {:?}", last_modified); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers /// * [`content_md5`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::date) - date /// * [`etag`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::last_modified) - last-modified /// * [`blob_append_offset`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::blob_append_offset) - x-ms-blob-append-offset @@ -137,10 +85,9 @@ impl AppendBlobClient { /// * [`encryption_key_sha256`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 /// * [`encryption_scope`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::encryption_scope) - x-ms-encryption-scope /// * [`is_server_encrypted`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted - /// * [`structured_body_type`()](crate::generated::models::AppendBlobClientAppendBlockResultHeaders::structured_body_type) - x-ms-structured-body /// /// [`AppendBlobClientAppendBlockResultHeaders`]: crate::generated::models::AppendBlobClientAppendBlockResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.AppendBlob.appendBlock")] + #[tracing::function("Storage.Blob.AppendBlobClient.appendBlock")] pub async fn append_block( &self, body: RequestContent, @@ -150,10 +97,6 @@ impl AppendBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "appendblock"); if let Some(timeout) = options.timeout { @@ -261,19 +204,18 @@ impl AppendBlobClient { /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } + /// if let Some(last_modified) = response.last_modified()? { + /// println!("last-modified: {:?}", last_modified); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers /// * [`content_md5`()](crate::generated::models::AppendBlobClientAppendBlockFromUrlResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::AppendBlobClientAppendBlockFromUrlResultHeaders::date) - date /// * [`etag`()](crate::generated::models::AppendBlobClientAppendBlockFromUrlResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::AppendBlobClientAppendBlockFromUrlResultHeaders::last_modified) - last-modified /// * [`blob_append_offset`()](crate::generated::models::AppendBlobClientAppendBlockFromUrlResultHeaders::blob_append_offset) - x-ms-blob-append-offset @@ -284,7 +226,7 @@ impl AppendBlobClient { /// * [`is_server_encrypted`()](crate::generated::models::AppendBlobClientAppendBlockFromUrlResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// /// [`AppendBlobClientAppendBlockFromUrlResultHeaders`]: crate::generated::models::AppendBlobClientAppendBlockFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.AppendBlob.appendBlockFromUrl")] + #[tracing::function("Storage.Blob.AppendBlobClient.appendBlockFromUrl")] pub async fn append_block_from_url( &self, source_url: String, @@ -294,14 +236,8 @@ impl AppendBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "appendblock") - .append_key_only("fromUrl"); + query_builder.append_pair("comp", "appendblock"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } @@ -311,7 +247,6 @@ impl AppendBlobClient { 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.as_ref() { request.insert_header("if-match", if_match); } @@ -349,6 +284,9 @@ impl AppendBlobClient { if let Some(encryption_scope) = options.encryption_scope.as_ref() { request.insert_header("x-ms-encryption-scope", encryption_scope); } + if let Some(file_request_intent) = options.file_request_intent.as_ref() { + request.insert_header("x-ms-file-request-intent", file_request_intent.to_string()); + } if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); } @@ -367,6 +305,21 @@ impl AppendBlobClient { base64::encode(source_content_md5), ); } + if let Some(source_encryption_algorithm) = options.source_encryption_algorithm.as_ref() { + request.insert_header( + "x-ms-source-encryption-algorithm", + source_encryption_algorithm.to_string(), + ); + } + if let Some(source_encryption_key) = options.source_encryption_key.as_ref() { + request.insert_header("x-ms-source-encryption-key", source_encryption_key); + } + if let Some(source_encryption_key_sha256) = options.source_encryption_key_sha256.as_ref() { + request.insert_header( + "x-ms-source-encryption-key-sha256", + source_encryption_key_sha256, + ); + } if let Some(source_if_match) = options.source_if_match.as_ref() { request.insert_header("x-ms-source-if-match", source_if_match); } @@ -409,7 +362,6 @@ impl AppendBlobClient { /// /// # Arguments /// - /// * `content_length` - The length of the request. /// * `options` - Optional parameters for the request. /// /// ## Response Headers @@ -426,19 +378,18 @@ impl AppendBlobClient { /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } + /// if let Some(last_modified) = response.last_modified()? { + /// println!("last-modified: {:?}", last_modified); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers /// * [`content_md5`()](crate::generated::models::AppendBlobClientCreateResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::AppendBlobClientCreateResultHeaders::date) - date /// * [`etag`()](crate::generated::models::AppendBlobClientCreateResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::AppendBlobClientCreateResultHeaders::last_modified) - last-modified /// * [`encryption_key_sha256`()](crate::generated::models::AppendBlobClientCreateResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 @@ -447,27 +398,21 @@ impl AppendBlobClient { /// * [`version_id`()](crate::generated::models::AppendBlobClientCreateResultHeaders::version_id) - x-ms-version-id /// /// [`AppendBlobClientCreateResultHeaders`]: crate::generated::models::AppendBlobClientCreateResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.AppendBlob.create")] + #[tracing::function("Storage.Blob.AppendBlobClient.create")] pub async fn create( &self, - content_length: u64, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder.append_key_only("AppendBlob"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-length", content_length.to_string()); + request.insert_header("content-length", "0"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -498,7 +443,7 @@ impl AppendBlobClient { if let Some(blob_content_type) = options.blob_content_type.as_ref() { request.insert_header("x-ms-blob-content-type", blob_content_type); } - request.insert_header("x-ms-blob-type", BlobType::AppendBlob.to_string()); + request.insert_header("x-ms-blob-type", "AppendBlob"); if let Some(encryption_algorithm) = options.encryption_algorithm.as_ref() { request.insert_header( "x-ms-encryption-algorithm", @@ -578,27 +523,26 @@ impl AppendBlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(is_sealed) = response.is_sealed()? { + /// println!("x-ms-blob-sealed: {:?}", is_sealed); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::AppendBlobClientSealResultHeaders::date) - date /// * [`etag`()](crate::generated::models::AppendBlobClientSealResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::AppendBlobClientSealResultHeaders::last_modified) - last-modified /// * [`is_sealed`()](crate::generated::models::AppendBlobClientSealResultHeaders::is_sealed) - x-ms-blob-sealed /// /// [`AppendBlobClientSealResultHeaders`]: crate::generated::models::AppendBlobClientSealResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.AppendBlob.seal")] + #[tracing::function("Storage.Blob.AppendBlobClient.seal")] pub async fn seal( &self, options: Option>, @@ -606,10 +550,6 @@ impl AppendBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "seal"); if let Some(timeout) = options.timeout { @@ -617,7 +557,6 @@ impl AppendBlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -658,7 +597,7 @@ impl Default for AppendBlobClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2026-04-06"), } } } diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_client.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_client.rs index e2d4c61df..9f9d88a0f 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_client.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_client.rs @@ -3,47 +3,34 @@ // // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use crate::generated::{ - clients::{AppendBlobClient, BlockBlobClient, PageBlobClient}, - models::{ - AccessTier, BlobClientAbortCopyFromUrlOptions, BlobClientAbortCopyFromUrlResult, - BlobClientAcquireLeaseOptions, BlobClientAcquireLeaseResult, BlobClientBreakLeaseOptions, - BlobClientBreakLeaseResult, BlobClientChangeLeaseOptions, BlobClientChangeLeaseResult, - BlobClientCopyFromUrlOptions, BlobClientCopyFromUrlResult, BlobClientCreateSnapshotOptions, - BlobClientCreateSnapshotResult, BlobClientDeleteImmutabilityPolicyOptions, - BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteOptions, - BlobClientDownloadOptions, BlobClientDownloadResult, BlobClientGetAccountInfoOptions, - BlobClientGetAccountInfoResult, BlobClientGetPropertiesOptions, - BlobClientGetPropertiesResult, BlobClientGetTagsOptions, BlobClientReleaseLeaseOptions, - BlobClientReleaseLeaseResult, BlobClientRenewLeaseOptions, BlobClientRenewLeaseResult, - BlobClientSetExpiryOptions, BlobClientSetExpiryResult, - BlobClientSetImmutabilityPolicyOptions, BlobClientSetImmutabilityPolicyResult, - BlobClientSetLegalHoldOptions, BlobClientSetLegalHoldResult, BlobClientSetMetadataOptions, - BlobClientSetPropertiesOptions, BlobClientSetTagsOptions, BlobClientSetTagsResult, - BlobClientSetTierOptions, BlobClientStartCopyFromUrlOptions, - BlobClientStartCopyFromUrlResult, BlobClientUndeleteOptions, BlobClientUndeleteResult, - BlobExpiryOptions, BlobTags, - }, +use crate::generated::models::{ + AccessTier, BlobClientAcquireLeaseOptions, BlobClientAcquireLeaseResult, + BlobClientBreakLeaseOptions, BlobClientBreakLeaseResult, BlobClientChangeLeaseOptions, + BlobClientChangeLeaseResult, BlobClientCreateSnapshotOptions, BlobClientCreateSnapshotResult, + BlobClientDeleteImmutabilityPolicyOptions, BlobClientDeleteOptions, + BlobClientDownloadInternalOptions, BlobClientDownloadInternalResult, + BlobClientGetAccountInfoOptions, BlobClientGetAccountInfoResult, + BlobClientGetPropertiesOptions, BlobClientGetPropertiesResult, BlobClientGetTagsOptions, + BlobClientReleaseLeaseOptions, BlobClientReleaseLeaseResult, BlobClientRenewLeaseOptions, + BlobClientRenewLeaseResult, BlobClientSetImmutabilityPolicyOptions, + BlobClientSetLegalHoldOptions, BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, + BlobClientSetTagsOptions, BlobClientSetTierOptions, BlobClientUndeleteOptions, BlobTags, }; use azure_core::{ base64, - credentials::TokenCredential, error::CheckSuccessOptions, fmt::SafeDebug, http::{ - policies::{auth::BearerTokenAuthorizationPolicy, Policy}, AsyncResponse, ClientOptions, Method, NoFormat, Pipeline, PipelineSendOptions, PipelineStreamOptions, Request, RequestContent, Response, Url, UrlExt, XmlFormat, }, - time::to_rfc7231, + time::{to_rfc7231, OffsetDateTime}, tracing, Result, }; -use std::sync::Arc; +use std::collections::HashMap; #[tracing::client] pub struct BlobClient { - pub(crate) blob_name: String, - pub(crate) container_name: String, pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, @@ -59,136 +46,18 @@ pub struct BlobClientOptions { } impl BlobClient { - /// Creates a new BlobClient, using Entra ID authentication. - /// - /// # Arguments - /// - /// * `endpoint` - Service host - /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an - /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. - /// * `blob_name` - The name of the blob. - /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob.Container.Blob")] - pub fn new( - endpoint: &str, - credential: Arc, - container_name: String, - blob_name: String, - options: Option, - ) -> Result { - let options = options.unwrap_or_default(); - let endpoint = Url::parse(endpoint)?; - if !endpoint.scheme().starts_with("http") { - return Err(azure_core::Error::with_message( - azure_core::error::ErrorKind::Other, - format!("{endpoint} must use http(s)"), - )); - } - let auth_policy: Arc = Arc::new(BearerTokenAuthorizationPolicy::new( - credential, - vec!["https://storage.azure.com/.default"], - )); - Ok(Self { - blob_name, - container_name, - endpoint, - version: options.version, - pipeline: Pipeline::new( - option_env!("CARGO_PKG_NAME"), - option_env!("CARGO_PKG_VERSION"), - options.client_options, - Vec::default(), - vec![auth_policy], - None, - ), - }) - } - /// Returns the Url associated with this client. pub fn endpoint(&self) -> &Url { &self.endpoint } - /// The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length - /// and full metadata. - /// - /// # Arguments - /// - /// * `copy_id` - The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientAbortCopyFromUrlResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```ignore - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobClientAbortCopyFromUrlResult, BlobClientAbortCopyFromUrlResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientAbortCopyFromUrlResultHeaders::date) - date - /// - /// [`BlobClientAbortCopyFromUrlResultHeaders`]: crate::generated::models::BlobClientAbortCopyFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.abortCopyFromUrl")] - pub(crate) async fn abort_copy_from_url( - &self, - copy_id: &str, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); - let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "copy") - .append_key_only("copyid"); - query_builder.set_pair("copyid", copy_id); - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); - if let Some(lease_id) = options.lease_id.as_ref() { - request.insert_header("x-ms-lease-id", lease_id); - } - request.insert_header("x-ms-version", &self.version); - let rsp = self - .pipeline - .send( - &ctx, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[204], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - /// The Acquire Lease operation requests a new lease on a blob. The lease lock duration can be 15 to 60 seconds, or can be /// infinite. /// /// # 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. /// /// ## Response Headers @@ -202,48 +71,41 @@ impl BlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(lease_id) = response.lease_id()? { + /// println!("x-ms-lease-id: {:?}", lease_id); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientAcquireLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobClientAcquireLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobClientAcquireLeaseResultHeaders::last_modified) - last-modified /// * [`lease_id`()](crate::generated::models::BlobClientAcquireLeaseResultHeaders::lease_id) - x-ms-lease-id /// /// [`BlobClientAcquireLeaseResultHeaders`]: crate::generated::models::BlobClientAcquireLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.acquireLease")] + #[tracing::function("Storage.Blob.BlobClient.acquireLease")] pub async fn acquire_lease( &self, + duration: i32, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_key_only("acquire") - .append_pair("comp", "lease"); + query_builder.append_pair("comp", "lease"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -259,9 +121,8 @@ impl BlobClient { if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); } - if let Some(duration) = options.duration.as_ref() { - request.insert_header("x-ms-lease-duration", duration.to_string()); - } + request.insert_header("x-ms-lease-action", "acquire"); + request.insert_header("x-ms-lease-duration", duration.to_string()); if let Some(proposed_lease_id) = options.proposed_lease_id.as_ref() { request.insert_header("x-ms-proposed-lease-id", proposed_lease_id); } @@ -300,27 +161,26 @@ impl BlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(lease_time) = response.lease_time()? { + /// println!("x-ms-lease-time: {:?}", lease_time); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientBreakLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobClientBreakLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobClientBreakLeaseResultHeaders::last_modified) - last-modified /// * [`lease_time`()](crate::generated::models::BlobClientBreakLeaseResultHeaders::lease_time) - x-ms-lease-time /// /// [`BlobClientBreakLeaseResultHeaders`]: crate::generated::models::BlobClientBreakLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.breakLease")] + #[tracing::function("Storage.Blob.BlobClient.breakLease")] pub async fn break_lease( &self, options: Option>, @@ -328,20 +188,13 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_key_only("break") - .append_pair("comp", "lease"); + query_builder.append_pair("comp", "lease"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -357,6 +210,7 @@ impl BlobClient { if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); } + request.insert_header("x-ms-lease-action", "break"); if let Some(break_period) = options.break_period { request.insert_header("x-ms-lease-break-period", break_period.to_string()); } @@ -397,27 +251,26 @@ impl BlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(lease_id) = response.lease_id()? { + /// println!("x-ms-lease-id: {:?}", lease_id); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientChangeLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobClientChangeLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobClientChangeLeaseResultHeaders::last_modified) - last-modified /// * [`lease_id`()](crate::generated::models::BlobClientChangeLeaseResultHeaders::lease_id) - x-ms-lease-id /// /// [`BlobClientChangeLeaseResultHeaders`]: crate::generated::models::BlobClientChangeLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.changeLease")] + #[tracing::function("Storage.Blob.BlobClient.changeLease")] pub async fn change_lease( &self, lease_id: String, @@ -427,20 +280,13 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_key_only("change") - .append_pair("comp", "lease"); + query_builder.append_pair("comp", "lease"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -456,6 +302,7 @@ impl BlobClient { if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); } + request.insert_header("x-ms-lease-action", "change"); request.insert_header("x-ms-lease-id", lease_id); request.insert_header("x-ms-proposed-lease-id", proposed_lease_id); request.insert_header("x-ms-version", &self.version); @@ -475,170 +322,6 @@ impl BlobClient { Ok(rsp.into()) } - /// The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the - /// copy is complete. - /// - /// # Arguments - /// - /// * `copy_source` - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that - /// specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must - /// either be public or must be authenticated via a shared access signature. - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientCopyFromUrlResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobClientCopyFromUrlResult, BlobClientCopyFromUrlResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(content_md5) = response.content_md5()? { - /// println!("content-md5: {:?}", content_md5); - /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// if let Some(etag) = response.etag()? { - /// println!("etag: {:?}", etag); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`content_md5`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::date) - date - /// * [`etag`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::last_modified) - last-modified - /// * [`content_crc64`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::content_crc64) - x-ms-content-crc64 - /// * [`copy_id`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::copy_id) - x-ms-copy-id - /// * [`copy_status`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::copy_status) - x-ms-copy-status - /// * [`encryption_scope`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::encryption_scope) - x-ms-encryption-scope - /// * [`version_id`()](crate::generated::models::BlobClientCopyFromUrlResultHeaders::version_id) - x-ms-version-id - /// - /// [`BlobClientCopyFromUrlResultHeaders`]: crate::generated::models::BlobClientCopyFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.copyFromUrl")] - pub async fn copy_from_url( - &self, - copy_source: String, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); - let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "copy") - .append_key_only("sync"); - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); - if let Some(if_match) = options.if_match.as_ref() { - request.insert_header("if-match", if_match); - } - if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); - } - if let Some(if_none_match) = options.if_none_match.as_ref() { - 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", to_rfc7231(&if_unmodified_since)); - } - if let Some(tier) = options.tier.as_ref() { - request.insert_header("x-ms-access-tier", tier.to_string()); - } - request.insert_header("x-ms-copy-source", copy_source); - if let Some(copy_source_authorization) = options.copy_source_authorization.as_ref() { - request.insert_header("x-ms-copy-source-authorization", copy_source_authorization); - } - if let Some(copy_source_tags) = options.copy_source_tags.as_ref() { - request.insert_header("x-ms-copy-source-tag-option", copy_source_tags); - } - if let Some(encryption_scope) = options.encryption_scope.as_ref() { - request.insert_header("x-ms-encryption-scope", encryption_scope); - } - if let Some(if_tags) = options.if_tags.as_ref() { - request.insert_header("x-ms-if-tags", if_tags); - } - if let Some(immutability_policy_mode) = options.immutability_policy_mode.as_ref() { - request.insert_header( - "x-ms-immutability-policy-mode", - immutability_policy_mode.to_string(), - ); - } - if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { - request.insert_header( - "x-ms-immutability-policy-until-date", - to_rfc7231(&immutability_policy_expiry), - ); - } - if let Some(lease_id) = options.lease_id.as_ref() { - request.insert_header("x-ms-lease-id", lease_id); - } - if let Some(legal_hold) = options.legal_hold { - request.insert_header("x-ms-legal-hold", legal_hold.to_string()); - } - if let Some(metadata) = options.metadata.as_ref() { - for (k, v) in metadata { - request.insert_header(format!("x-ms-meta-{k}"), v); - } - } - if let Some(source_content_md5) = options.source_content_md5 { - request.insert_header( - "x-ms-source-content-md5", - base64::encode(source_content_md5), - ); - } - if let Some(source_if_match) = options.source_if_match.as_ref() { - request.insert_header("x-ms-source-if-match", source_if_match); - } - if let Some(source_if_modified_since) = options.source_if_modified_since { - request.insert_header( - "x-ms-source-if-modified-since", - to_rfc7231(&source_if_modified_since), - ); - } - if let Some(source_if_none_match) = options.source_if_none_match.as_ref() { - request.insert_header("x-ms-source-if-none-match", source_if_none_match); - } - if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { - request.insert_header( - "x-ms-source-if-unmodified-since", - to_rfc7231(&source_if_unmodified_since), - ); - } - if let Some(blob_tags_string) = options.blob_tags_string.as_ref() { - request.insert_header("x-ms-tags", blob_tags_string); - } - request.insert_header("x-ms-version", &self.version); - let rsp = self - .pipeline - .send( - &ctx, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[202], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - /// The Create Snapshot operation creates a read-only snapshot of a blob /// /// # Arguments @@ -656,21 +339,20 @@ impl BlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(is_server_encrypted) = response.is_server_encrypted()? { + /// println!("x-ms-request-server-encrypted: {:?}", is_server_encrypted); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientCreateSnapshotResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobClientCreateSnapshotResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobClientCreateSnapshotResultHeaders::last_modified) - last-modified /// * [`is_server_encrypted`()](crate::generated::models::BlobClientCreateSnapshotResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted @@ -678,7 +360,7 @@ impl BlobClient { /// * [`version_id`()](crate::generated::models::BlobClientCreateSnapshotResultHeaders::version_id) - x-ms-version-id /// /// [`BlobClientCreateSnapshotResultHeaders`]: crate::generated::models::BlobClientCreateSnapshotResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.createSnapshot")] + #[tracing::function("Storage.Blob.BlobClient.createSnapshot")] pub async fn create_snapshot( &self, options: Option>, @@ -686,10 +368,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "snapshot"); if let Some(timeout) = options.timeout { @@ -697,7 +375,6 @@ impl BlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -766,7 +443,7 @@ impl BlobClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.Blob.delete")] + #[tracing::function("Storage.Blob.BlobClient.delete")] pub async fn delete( &self, options: Option>, @@ -774,10 +451,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); if let Some(blob_delete_type) = options.blob_delete_type.as_ref() { query_builder.set_pair("deletetype", blob_delete_type.as_ref()); @@ -793,7 +466,6 @@ impl BlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Delete); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -806,6 +478,18 @@ impl BlobClient { if let Some(if_unmodified_since) = options.if_unmodified_since { request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } + if let Some(access_tier_if_modified_since) = options.access_tier_if_modified_since { + request.insert_header( + "x-ms-access-tier-if-modified-since", + to_rfc7231(&access_tier_if_modified_since), + ); + } + if let Some(access_tier_if_unmodified_since) = options.access_tier_if_unmodified_since { + request.insert_header( + "x-ms-access-tier-if-unmodified-since", + to_rfc7231(&access_tier_if_unmodified_since), + ); + } if let Some(delete_snapshots) = options.delete_snapshots.as_ref() { request.insert_header("x-ms-delete-snapshots", delete_snapshots.to_string()); } @@ -837,41 +521,14 @@ impl BlobClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientDeleteImmutabilityPolicyResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteImmutabilityPolicyResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientDeleteImmutabilityPolicyResultHeaders::date) - date - /// - /// [`BlobClientDeleteImmutabilityPolicyResultHeaders`]: crate::generated::models::BlobClientDeleteImmutabilityPolicyResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.deleteImmutabilityPolicy")] + #[tracing::function("Storage.Blob.BlobClient.deleteImmutabilityPolicy")] pub async fn delete_immutability_policy( &self, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "immutabilityPolicies"); if let Some(snapshot) = options.snapshot.as_ref() { @@ -885,7 +542,6 @@ impl BlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Delete); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -912,82 +568,77 @@ impl BlobClient { /// /// ## Response Headers /// - /// The returned [`AsyncResponse`](azure_core::http::AsyncResponse) implements the [`BlobClientDownloadResultHeaders`] trait, which provides + /// The returned [`AsyncResponse`](azure_core::http::AsyncResponse) implements the [`BlobClientDownloadInternalResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::AsyncResponse}; - /// use blob_storage::models::{BlobClientDownloadResult, BlobClientDownloadResultHeaders}; + /// use blob_storage::models::{BlobClientDownloadInternalResult, BlobClientDownloadInternalResultHeaders}; /// async fn example() -> Result<()> { - /// let response: AsyncResponse = unimplemented!(); + /// let response: AsyncResponse = unimplemented!(); /// // Access response headers - /// if let Some(accept_ranges) = response.accept_ranges()? { - /// println!("accept-ranges: {:?}", accept_ranges); - /// } /// if let Some(cache_control) = response.cache_control()? { /// println!("cache-control: {:?}", cache_control); /// } /// if let Some(content_disposition) = response.content_disposition()? { /// println!("content-disposition: {:?}", content_disposition); /// } + /// if let Some(content_encoding) = response.content_encoding()? { + /// println!("content-encoding: {:?}", content_encoding); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`accept_ranges`()](crate::generated::models::BlobClientDownloadResultHeaders::accept_ranges) - accept-ranges - /// * [`cache_control`()](crate::generated::models::BlobClientDownloadResultHeaders::cache_control) - cache-control - /// * [`content_disposition`()](crate::generated::models::BlobClientDownloadResultHeaders::content_disposition) - content-disposition - /// * [`content_encoding`()](crate::generated::models::BlobClientDownloadResultHeaders::content_encoding) - content-encoding - /// * [`content_language`()](crate::generated::models::BlobClientDownloadResultHeaders::content_language) - content-language - /// * [`content_length`()](crate::generated::models::BlobClientDownloadResultHeaders::content_length) - content-length - /// * [`content_md5`()](crate::generated::models::BlobClientDownloadResultHeaders::content_md5) - content-md5 - /// * [`content_range`()](crate::generated::models::BlobClientDownloadResultHeaders::content_range) - content-range - /// * [`etag`()](crate::generated::models::BlobClientDownloadResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::BlobClientDownloadResultHeaders::last_modified) - last-modified - /// * [`blob_committed_block_count`()](crate::generated::models::BlobClientDownloadResultHeaders::blob_committed_block_count) - x-ms-blob-committed-block-count - /// * [`blob_content_md5`()](crate::generated::models::BlobClientDownloadResultHeaders::blob_content_md5) - x-ms-blob-content-md5 - /// * [`is_sealed`()](crate::generated::models::BlobClientDownloadResultHeaders::is_sealed) - x-ms-blob-sealed - /// * [`blob_sequence_number`()](crate::generated::models::BlobClientDownloadResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number - /// * [`blob_type`()](crate::generated::models::BlobClientDownloadResultHeaders::blob_type) - x-ms-blob-type - /// * [`content_crc64`()](crate::generated::models::BlobClientDownloadResultHeaders::content_crc64) - x-ms-content-crc64 - /// * [`copy_completion_time`()](crate::generated::models::BlobClientDownloadResultHeaders::copy_completion_time) - x-ms-copy-completion-time - /// * [`copy_id`()](crate::generated::models::BlobClientDownloadResultHeaders::copy_id) - x-ms-copy-id - /// * [`copy_progress`()](crate::generated::models::BlobClientDownloadResultHeaders::copy_progress) - x-ms-copy-progress - /// * [`copy_source`()](crate::generated::models::BlobClientDownloadResultHeaders::copy_source) - x-ms-copy-source - /// * [`copy_status`()](crate::generated::models::BlobClientDownloadResultHeaders::copy_status) - x-ms-copy-status - /// * [`copy_status_description`()](crate::generated::models::BlobClientDownloadResultHeaders::copy_status_description) - x-ms-copy-status-description - /// * [`creation_time`()](crate::generated::models::BlobClientDownloadResultHeaders::creation_time) - x-ms-creation-time - /// * [`encryption_key_sha256`()](crate::generated::models::BlobClientDownloadResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 - /// * [`encryption_scope`()](crate::generated::models::BlobClientDownloadResultHeaders::encryption_scope) - x-ms-encryption-scope - /// * [`immutability_policy_mode`()](crate::generated::models::BlobClientDownloadResultHeaders::immutability_policy_mode) - x-ms-immutability-policy-mode - /// * [`immutability_policy_expires_on`()](crate::generated::models::BlobClientDownloadResultHeaders::immutability_policy_expires_on) - x-ms-immutability-policy-until-date - /// * [`is_current_version`()](crate::generated::models::BlobClientDownloadResultHeaders::is_current_version) - x-ms-is-current-version - /// * [`last_accessed`()](crate::generated::models::BlobClientDownloadResultHeaders::last_accessed) - x-ms-last-access-time - /// * [`duration`()](crate::generated::models::BlobClientDownloadResultHeaders::duration) - x-ms-lease-duration - /// * [`lease_state`()](crate::generated::models::BlobClientDownloadResultHeaders::lease_state) - x-ms-lease-state - /// * [`lease_status`()](crate::generated::models::BlobClientDownloadResultHeaders::lease_status) - x-ms-lease-status - /// * [`legal_hold`()](crate::generated::models::BlobClientDownloadResultHeaders::legal_hold) - x-ms-legal-hold - /// * [`metadata`()](crate::generated::models::BlobClientDownloadResultHeaders::metadata) - x-ms-meta - /// * [`object_replication_rules`()](crate::generated::models::BlobClientDownloadResultHeaders::object_replication_rules) - x-ms-or - /// * [`object_replication_policy_id`()](crate::generated::models::BlobClientDownloadResultHeaders::object_replication_policy_id) - x-ms-or-policy-id - /// * [`is_server_encrypted`()](crate::generated::models::BlobClientDownloadResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted - /// * [`tag_count`()](crate::generated::models::BlobClientDownloadResultHeaders::tag_count) - x-ms-tag-count - /// * [`version_id`()](crate::generated::models::BlobClientDownloadResultHeaders::version_id) - x-ms-version-id - /// - /// [`BlobClientDownloadResultHeaders`]: crate::generated::models::BlobClientDownloadResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.download")] - pub async fn download( + /// * [`cache_control`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::cache_control) - cache-control + /// * [`content_disposition`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::content_disposition) - content-disposition + /// * [`content_encoding`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::content_encoding) - content-encoding + /// * [`content_language`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::content_language) - content-language + /// * [`content_length`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::content_length) - content-length + /// * [`content_md5`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::content_md5) - content-md5 + /// * [`content_range`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::content_range) - content-range + /// * [`etag`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::etag) - etag + /// * [`last_modified`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::last_modified) - last-modified + /// * [`blob_committed_block_count`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::blob_committed_block_count) - x-ms-blob-committed-block-count + /// * [`blob_content_md5`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::blob_content_md5) - x-ms-blob-content-md5 + /// * [`is_sealed`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::is_sealed) - x-ms-blob-sealed + /// * [`blob_sequence_number`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number + /// * [`blob_type`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::blob_type) - x-ms-blob-type + /// * [`content_crc64`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::content_crc64) - x-ms-content-crc64 + /// * [`copy_completion_time`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::copy_completion_time) - x-ms-copy-completion-time + /// * [`copy_id`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::copy_id) - x-ms-copy-id + /// * [`copy_progress`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::copy_progress) - x-ms-copy-progress + /// * [`copy_source`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::copy_source) - x-ms-copy-source + /// * [`copy_status`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::copy_status) - x-ms-copy-status + /// * [`copy_status_description`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::copy_status_description) - x-ms-copy-status-description + /// * [`creation_time`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::creation_time) - x-ms-creation-time + /// * [`encryption_key_sha256`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 + /// * [`encryption_scope`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::encryption_scope) - x-ms-encryption-scope + /// * [`immutability_policy_mode`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::immutability_policy_mode) - x-ms-immutability-policy-mode + /// * [`immutability_policy_expires_on`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::immutability_policy_expires_on) - x-ms-immutability-policy-until-date + /// * [`is_current_version`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::is_current_version) - x-ms-is-current-version + /// * [`last_accessed`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::last_accessed) - x-ms-last-access-time + /// * [`duration`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::duration) - x-ms-lease-duration + /// * [`lease_state`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::lease_state) - x-ms-lease-state + /// * [`lease_status`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::lease_status) - x-ms-lease-status + /// * [`legal_hold`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::legal_hold) - x-ms-legal-hold + /// * [`metadata`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::metadata) - x-ms-meta + /// * [`object_replication_rules`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::object_replication_rules) - x-ms-or + /// * [`object_replication_policy_id`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::object_replication_policy_id) - x-ms-or-policy-id + /// * [`is_server_encrypted`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::is_server_encrypted) - x-ms-server-encrypted + /// * [`tag_count`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::tag_count) - x-ms-tag-count + /// * [`version_id`()](crate::generated::models::BlobClientDownloadInternalResultHeaders::version_id) - x-ms-version-id + /// + /// [`BlobClientDownloadInternalResultHeaders`]: crate::generated::models::BlobClientDownloadInternalResultHeaders + #[tracing::function("Storage.Blob.BlobClient.download")] + pub async fn download_internal( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); if let Some(snapshot) = options.snapshot.as_ref() { query_builder.set_pair("snapshot", snapshot); @@ -1013,6 +664,9 @@ impl BlobClient { if let Some(if_unmodified_since) = options.if_unmodified_since { request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } + if let Some(range) = options.range.as_ref() { + request.insert_header("range", range); + } if let Some(encryption_algorithm) = options.encryption_algorithm.as_ref() { request.insert_header( "x-ms-encryption-algorithm", @@ -1031,9 +685,6 @@ impl BlobClient { if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } - if let Some(range) = options.range.as_ref() { - 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", @@ -1083,27 +734,26 @@ impl BlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(account_kind) = response.account_kind()? { /// println!("x-ms-account-kind: {:?}", account_kind); /// } /// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? { /// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled); /// } + /// if let Some(sku_name) = response.sku_name()? { + /// println!("x-ms-sku-name: {:?}", sku_name); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientGetAccountInfoResultHeaders::date) - date /// * [`account_kind`()](crate::generated::models::BlobClientGetAccountInfoResultHeaders::account_kind) - x-ms-account-kind /// * [`is_hierarchical_namespace_enabled`()](crate::generated::models::BlobClientGetAccountInfoResultHeaders::is_hierarchical_namespace_enabled) - x-ms-is-hns-enabled /// * [`sku_name`()](crate::generated::models::BlobClientGetAccountInfoResultHeaders::sku_name) - x-ms-sku-name /// /// [`BlobClientGetAccountInfoResultHeaders`]: crate::generated::models::BlobClientGetAccountInfoResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.getAccountInfo")] + #[tracing::function("Storage.Blob.BlobClient.getAccountInfo")] pub async fn get_account_info( &self, options: Option>, @@ -1111,13 +761,8 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder - .append_key_only("blob") .append_pair("comp", "properties") .append_pair("restype", "account"); if let Some(timeout) = options.timeout { @@ -1125,7 +770,6 @@ impl BlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Get); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -1143,42 +787,6 @@ impl BlobClient { Ok(rsp.into()) } - /// Returns a new instance of AppendBlobClient. - #[tracing::subclient] - pub fn get_append_blob_client(&self) -> AppendBlobClient { - AppendBlobClient { - blob_name: self.blob_name.clone(), - container_name: self.container_name.clone(), - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - - /// Returns a new instance of BlockBlobClient. - #[tracing::subclient] - pub fn get_block_blob_client(&self) -> BlockBlobClient { - BlockBlobClient { - blob_name: self.blob_name.clone(), - container_name: self.container_name.clone(), - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - - /// Returns a new instance of PageBlobClient. - #[tracing::subclient] - pub fn get_page_blob_client(&self) -> PageBlobClient { - PageBlobClient { - blob_name: self.blob_name.clone(), - container_name: self.container_name.clone(), - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - /// The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the /// blob. It does not return the content of the blob. /// @@ -1219,7 +827,7 @@ impl BlobClient { /// * [`content_md5`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::content_md5) - content-md5 /// * [`etag`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::last_modified) - last-modified - /// * [`tier`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::tier) - x-ms-access-tier + /// * [`access_tier`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::access_tier) - x-ms-access-tier /// * [`access_tier_change_time`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::access_tier_change_time) - x-ms-access-tier-change-time /// * [`access_tier_inferred`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::access_tier_inferred) - x-ms-access-tier-inferred /// * [`archive_status`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::archive_status) - x-ms-archive-status @@ -1251,12 +859,12 @@ impl BlobClient { /// * [`object_replication_rules`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::object_replication_rules) - x-ms-or /// * [`object_replication_policy_id`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::object_replication_policy_id) - x-ms-or-policy-id /// * [`rehydrate_priority`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::rehydrate_priority) - x-ms-rehydrate-priority - /// * [`is_server_encrypted`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted + /// * [`is_server_encrypted`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::is_server_encrypted) - x-ms-server-encrypted /// * [`tag_count`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::tag_count) - x-ms-tag-count /// * [`version_id`()](crate::generated::models::BlobClientGetPropertiesResultHeaders::version_id) - x-ms-version-id /// /// [`BlobClientGetPropertiesResultHeaders`]: crate::generated::models::BlobClientGetPropertiesResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.getProperties")] + #[tracing::function("Storage.Blob.BlobClient.getProperties")] pub async fn get_properties( &self, options: Option>, @@ -1264,10 +872,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); if let Some(snapshot) = options.snapshot.as_ref() { query_builder.set_pair("snapshot", snapshot); @@ -1332,30 +936,7 @@ impl BlobClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobTagsHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, XmlFormat}}; - /// use blob_storage::models::{BlobTags, BlobTagsHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobTagsHeaders::date) - date - /// - /// [`BlobTagsHeaders`]: crate::generated::models::BlobTagsHeaders - #[tracing::function("Storage.Blob.Container.Blob.getTags")] + #[tracing::function("Storage.Blob.BlobClient.getTags")] pub async fn get_tags( &self, options: Option>, @@ -1363,10 +944,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "tags"); if let Some(snapshot) = options.snapshot.as_ref() { @@ -1381,7 +958,24 @@ impl BlobClient { query_builder.build(); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); + if let Some(if_match) = options.if_match.as_ref() { + request.insert_header("x-ms-blob-if-match", if_match); + } + if let Some(if_modified_since) = options.if_modified_since { + request.insert_header( + "x-ms-blob-if-modified-since", + to_rfc7231(&if_modified_since), + ); + } + if let Some(if_none_match) = options.if_none_match.as_ref() { + request.insert_header("x-ms-blob-if-none-match", if_none_match); + } + if let Some(if_unmodified_since) = options.if_unmodified_since { + request.insert_header( + "x-ms-blob-if-unmodified-since", + to_rfc7231(&if_unmodified_since), + ); + } if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); } @@ -1425,9 +1019,6 @@ impl BlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } @@ -1439,12 +1030,11 @@ impl BlobClient { /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientReleaseLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobClientReleaseLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobClientReleaseLeaseResultHeaders::last_modified) - last-modified /// /// [`BlobClientReleaseLeaseResultHeaders`]: crate::generated::models::BlobClientReleaseLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.releaseLease")] + #[tracing::function("Storage.Blob.BlobClient.releaseLease")] pub async fn release_lease( &self, lease_id: String, @@ -1453,20 +1043,13 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "lease") - .append_key_only("release"); + query_builder.append_pair("comp", "lease"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -1482,6 +1065,7 @@ impl BlobClient { if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); } + request.insert_header("x-ms-lease-action", "release"); request.insert_header("x-ms-lease-id", lease_id); request.insert_header("x-ms-version", &self.version); let rsp = self @@ -1519,27 +1103,26 @@ impl BlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(lease_id) = response.lease_id()? { + /// println!("x-ms-lease-id: {:?}", lease_id); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientRenewLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobClientRenewLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobClientRenewLeaseResultHeaders::last_modified) - last-modified /// * [`lease_id`()](crate::generated::models::BlobClientRenewLeaseResultHeaders::lease_id) - x-ms-lease-id /// /// [`BlobClientRenewLeaseResultHeaders`]: crate::generated::models::BlobClientRenewLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.renewLease")] + #[tracing::function("Storage.Blob.BlobClient.renewLease")] pub async fn renew_lease( &self, lease_id: String, @@ -1548,20 +1131,13 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "lease") - .append_key_only("renew"); + query_builder.append_pair("comp", "lease"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -1577,6 +1153,7 @@ impl BlobClient { if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); } + request.insert_header("x-ms-lease-action", "renew"); request.insert_header("x-ms-lease-id", lease_id); request.insert_header("x-ms-version", &self.version); let rsp = self @@ -1595,133 +1172,21 @@ impl BlobClient { Ok(rsp.into()) } - /// Set the expiration time of a blob - /// - /// # Arguments - /// - /// * `expiry_options` - Required. Indicates mode of the expiry time - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientSetExpiryResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobClientSetExpiryResult, BlobClientSetExpiryResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// if let Some(etag) = response.etag()? { - /// println!("etag: {:?}", etag); - /// } - /// if let Some(last_modified) = response.last_modified()? { - /// println!("last-modified: {:?}", last_modified); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientSetExpiryResultHeaders::date) - date - /// * [`etag`()](crate::generated::models::BlobClientSetExpiryResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::BlobClientSetExpiryResultHeaders::last_modified) - last-modified - /// - /// [`BlobClientSetExpiryResultHeaders`]: crate::generated::models::BlobClientSetExpiryResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.setExpiry")] - pub async fn set_expiry( - &self, - expiry_options: BlobExpiryOptions, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); - let mut query_builder = url.query_builder(); - query_builder.append_pair("comp", "expiry"); - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); - 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", to_rfc7231(&expires_on)); - } - request.insert_header("x-ms-version", &self.version); - let rsp = self - .pipeline - .send( - &ctx, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[200], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - /// Set the immutability policy of a blob /// /// # Arguments /// + /// * `expiry` - Specifies the date time when the blobs immutability policy is set to expire. /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientSetImmutabilityPolicyResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobClientSetImmutabilityPolicyResult, BlobClientSetImmutabilityPolicyResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// if let Some(immutability_policy_mode) = response.immutability_policy_mode()? { - /// println!("x-ms-immutability-policy-mode: {:?}", immutability_policy_mode); - /// } - /// if let Some(immutability_policy_expires_on) = response.immutability_policy_expires_on()? { - /// println!("x-ms-immutability-policy-until-date: {:?}", immutability_policy_expires_on); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientSetImmutabilityPolicyResultHeaders::date) - date - /// * [`immutability_policy_mode`()](crate::generated::models::BlobClientSetImmutabilityPolicyResultHeaders::immutability_policy_mode) - x-ms-immutability-policy-mode - /// * [`immutability_policy_expires_on`()](crate::generated::models::BlobClientSetImmutabilityPolicyResultHeaders::immutability_policy_expires_on) - x-ms-immutability-policy-until-date - /// - /// [`BlobClientSetImmutabilityPolicyResultHeaders`]: crate::generated::models::BlobClientSetImmutabilityPolicyResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.setImmutabilityPolicy")] + #[tracing::function("Storage.Blob.BlobClient.setImmutabilityPolicy")] pub async fn set_immutability_policy( &self, + expiry: &OffsetDateTime, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "immutabilityPolicies"); if let Some(snapshot) = options.snapshot.as_ref() { @@ -1735,7 +1200,6 @@ impl BlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_unmodified_since) = options.if_unmodified_since { request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } @@ -1745,12 +1209,7 @@ impl BlobClient { immutability_policy_mode.to_string(), ); } - if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { - request.insert_header( - "x-ms-immutability-policy-until-date", - to_rfc7231(&immutability_policy_expiry), - ); - } + request.insert_header("x-ms-immutability-policy-until-date", to_rfc7231(expiry)); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -1774,46 +1233,15 @@ impl BlobClient { /// /// * `legal_hold` - Required. Specifies the legal hold status to set on the blob. /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientSetLegalHoldResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobClientSetLegalHoldResult, BlobClientSetLegalHoldResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// if let Some(legal_hold) = response.legal_hold()? { - /// println!("x-ms-legal-hold: {:?}", legal_hold); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientSetLegalHoldResultHeaders::date) - date - /// * [`legal_hold`()](crate::generated::models::BlobClientSetLegalHoldResultHeaders::legal_hold) - x-ms-legal-hold - /// - /// [`BlobClientSetLegalHoldResultHeaders`]: crate::generated::models::BlobClientSetLegalHoldResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.setLegalHold")] + #[tracing::function("Storage.Blob.BlobClient.setLegalHold")] pub async fn set_legal_hold( &self, legal_hold: bool, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "legalhold"); if let Some(snapshot) = options.snapshot.as_ref() { @@ -1827,7 +1255,6 @@ impl BlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-legal-hold", legal_hold.to_string()); request.insert_header("x-ms-version", &self.version); let rsp = self @@ -1850,19 +1277,17 @@ impl BlobClient { /// /// # Arguments /// + /// * `metadata` - The metadata headers. /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.Blob.setMetadata")] + #[tracing::function("Storage.Blob.BlobClient.setMetadata")] pub async fn set_metadata( &self, + metadata: &HashMap, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "metadata"); if let Some(timeout) = options.timeout { @@ -1870,7 +1295,6 @@ impl BlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -1904,10 +1328,8 @@ impl BlobClient { if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } - if let Some(metadata) = options.metadata.as_ref() { - for (k, v) in metadata { - request.insert_header(format!("x-ms-meta-{k}"), v); - } + for (k, v) in metadata { + request.insert_header(format!("x-ms-meta-{k}"), v); } request.insert_header("x-ms-version", &self.version); let rsp = self @@ -1931,7 +1353,7 @@ impl BlobClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.Blob.setHttpHeaders")] + #[tracing::function("Storage.Blob.BlobClient.setProperties")] pub async fn set_properties( &self, options: Option>, @@ -1939,20 +1361,13 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_key_only("SetHTTPHeaders") - .append_pair("comp", "properties"); + query_builder.append_pair("comp", "properties"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -2012,42 +1427,15 @@ impl BlobClient { /// /// * `tags` - The blob tags. /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientSetTagsResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobClientSetTagsResult, BlobClientSetTagsResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientSetTagsResultHeaders::date) - date - /// - /// [`BlobClientSetTagsResultHeaders`]: crate::generated::models::BlobClientSetTagsResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.setTags")] + #[tracing::function("Storage.Blob.BlobClient.setTags")] pub async fn set_tags( &self, tags: RequestContent, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "tags"); if let Some(timeout) = options.timeout { @@ -2062,6 +1450,24 @@ impl BlobClient { 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.as_ref() { + request.insert_header("x-ms-blob-if-match", if_match); + } + if let Some(if_modified_since) = options.if_modified_since { + request.insert_header( + "x-ms-blob-if-modified-since", + to_rfc7231(&if_modified_since), + ); + } + if let Some(if_none_match) = options.if_none_match.as_ref() { + request.insert_header("x-ms-blob-if-none-match", if_none_match); + } + if let Some(if_unmodified_since) = options.if_unmodified_since { + request.insert_header( + "x-ms-blob-if-unmodified-since", + to_rfc7231(&if_unmodified_since), + ); + } if let Some(transactional_content_crc64) = options.transactional_content_crc64 { request.insert_header( "x-ms-content-crc64", @@ -2100,7 +1506,7 @@ impl BlobClient { /// /// * `tier` - Indicates the tier to be set on the blob. /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.Blob.setTier")] + #[tracing::function("Storage.Blob.BlobClient.setTier")] pub async fn set_tier( &self, tier: AccessTier, @@ -2109,10 +1515,6 @@ impl BlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "tier"); if let Some(snapshot) = options.snapshot.as_ref() { @@ -2126,7 +1528,6 @@ impl BlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-access-tier", tier.to_string()); if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); @@ -2154,197 +1555,19 @@ impl BlobClient { Ok(rsp.into()) } - /// The Start Copy From URL operation copies a blob or an internet resource to a new blob. - /// - /// # Arguments - /// - /// * `copy_source` - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that - /// specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must - /// either be public or must be authenticated via a shared access signature. - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientStartCopyFromUrlResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobClientStartCopyFromUrlResult, BlobClientStartCopyFromUrlResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// if let Some(etag) = response.etag()? { - /// println!("etag: {:?}", etag); - /// } - /// if let Some(last_modified) = response.last_modified()? { - /// println!("last-modified: {:?}", last_modified); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientStartCopyFromUrlResultHeaders::date) - date - /// * [`etag`()](crate::generated::models::BlobClientStartCopyFromUrlResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::BlobClientStartCopyFromUrlResultHeaders::last_modified) - last-modified - /// * [`copy_id`()](crate::generated::models::BlobClientStartCopyFromUrlResultHeaders::copy_id) - x-ms-copy-id - /// * [`copy_status`()](crate::generated::models::BlobClientStartCopyFromUrlResultHeaders::copy_status) - x-ms-copy-status - /// * [`version_id`()](crate::generated::models::BlobClientStartCopyFromUrlResultHeaders::version_id) - x-ms-version-id - /// - /// [`BlobClientStartCopyFromUrlResultHeaders`]: crate::generated::models::BlobClientStartCopyFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.startCopyFromUrl")] - pub async fn start_copy_from_url( - &self, - copy_source: String, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); - let mut query_builder = url.query_builder(); - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); - if let Some(if_match) = options.if_match.as_ref() { - request.insert_header("if-match", if_match); - } - if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); - } - if let Some(if_none_match) = options.if_none_match.as_ref() { - 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", to_rfc7231(&if_unmodified_since)); - } - if let Some(tier) = options.tier.as_ref() { - request.insert_header("x-ms-access-tier", tier.to_string()); - } - request.insert_header("x-ms-copy-source", copy_source); - if let Some(if_tags) = options.if_tags.as_ref() { - request.insert_header("x-ms-if-tags", if_tags); - } - if let Some(immutability_policy_mode) = options.immutability_policy_mode.as_ref() { - request.insert_header( - "x-ms-immutability-policy-mode", - immutability_policy_mode.to_string(), - ); - } - if let Some(immutability_policy_expiry) = options.immutability_policy_expiry { - request.insert_header( - "x-ms-immutability-policy-until-date", - to_rfc7231(&immutability_policy_expiry), - ); - } - if let Some(lease_id) = options.lease_id.as_ref() { - request.insert_header("x-ms-lease-id", lease_id); - } - if let Some(legal_hold) = options.legal_hold { - request.insert_header("x-ms-legal-hold", legal_hold.to_string()); - } - if let Some(metadata) = options.metadata.as_ref() { - for (k, v) in metadata { - request.insert_header(format!("x-ms-meta-{k}"), v); - } - } - if let Some(rehydrate_priority) = options.rehydrate_priority.as_ref() { - request.insert_header("x-ms-rehydrate-priority", rehydrate_priority.to_string()); - } - if let Some(seal_blob) = options.seal_blob { - request.insert_header("x-ms-seal-blob", seal_blob.to_string()); - } - if let Some(source_if_match) = options.source_if_match.as_ref() { - request.insert_header("x-ms-source-if-match", source_if_match); - } - if let Some(source_if_modified_since) = options.source_if_modified_since { - request.insert_header( - "x-ms-source-if-modified-since", - to_rfc7231(&source_if_modified_since), - ); - } - if let Some(source_if_none_match) = options.source_if_none_match.as_ref() { - request.insert_header("x-ms-source-if-none-match", source_if_none_match); - } - if let Some(source_if_tags) = options.source_if_tags.as_ref() { - request.insert_header("x-ms-source-if-tags", source_if_tags); - } - if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { - request.insert_header( - "x-ms-source-if-unmodified-since", - to_rfc7231(&source_if_unmodified_since), - ); - } - if let Some(blob_tags_string) = options.blob_tags_string.as_ref() { - request.insert_header("x-ms-tags", blob_tags_string); - } - request.insert_header("x-ms-version", &self.version); - let rsp = self - .pipeline - .send( - &ctx, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[202], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - /// Undelete a blob that was previously soft deleted /// /// # Arguments /// /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobClientUndeleteResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobClientUndeleteResult, BlobClientUndeleteResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobClientUndeleteResultHeaders::date) - date - /// - /// [`BlobClientUndeleteResultHeaders`]: crate::generated::models::BlobClientUndeleteResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.undelete")] + #[tracing::function("Storage.Blob.BlobClient.undelete")] pub async fn undelete( &self, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "undelete"); if let Some(timeout) = options.timeout { @@ -2352,7 +1575,6 @@ impl BlobClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -2375,7 +1597,7 @@ impl Default for BlobClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2026-04-06"), } } } diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_container_client.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_container_client.rs index dd974fb28..bd9c15b99 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_container_client.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_container_client.rs @@ -3,45 +3,34 @@ // // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use crate::generated::{ - clients::BlobClient, - models::{ - BlobContainerClientAcquireLeaseOptions, BlobContainerClientAcquireLeaseResult, - BlobContainerClientBreakLeaseOptions, BlobContainerClientBreakLeaseResult, - BlobContainerClientChangeLeaseOptions, BlobContainerClientChangeLeaseResult, - BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, - BlobContainerClientFilterBlobsOptions, BlobContainerClientGetAccessPolicyOptions, - BlobContainerClientGetAccountInfoOptions, BlobContainerClientGetAccountInfoResult, - BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, - BlobContainerClientListBlobFlatSegmentOptions, - BlobContainerClientListBlobHierarchySegmentOptions, BlobContainerClientReleaseLeaseOptions, - BlobContainerClientReleaseLeaseResult, BlobContainerClientRenameOptions, - BlobContainerClientRenameResult, BlobContainerClientRenewLeaseOptions, - BlobContainerClientRenewLeaseResult, BlobContainerClientRestoreOptions, - BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyOptions, - BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetMetadataOptions, - FilterBlobSegment, ListBlobsFlatSegmentResponse, ListBlobsHierarchySegmentResponse, - SignedIdentifiers, - }, +use crate::generated::models::{ + BlobContainerClientAcquireLeaseOptions, BlobContainerClientAcquireLeaseResult, + BlobContainerClientBreakLeaseOptions, BlobContainerClientBreakLeaseResult, + BlobContainerClientChangeLeaseOptions, BlobContainerClientChangeLeaseResult, + BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions, + BlobContainerClientFindBlobsByTagsOptions, BlobContainerClientGetAccessPolicyOptions, + BlobContainerClientGetAccountInfoOptions, BlobContainerClientGetAccountInfoResult, + BlobContainerClientGetPropertiesOptions, BlobContainerClientGetPropertiesResult, + BlobContainerClientListBlobsOptions, BlobContainerClientReleaseLeaseOptions, + BlobContainerClientReleaseLeaseResult, BlobContainerClientRenewLeaseOptions, + BlobContainerClientRenewLeaseResult, BlobContainerClientSetAccessPolicyOptions, + BlobContainerClientSetMetadataOptions, FilterBlobSegment, ListBlobsResponse, SignedIdentifiers, }; use azure_core::{ - credentials::TokenCredential, error::CheckSuccessOptions, fmt::SafeDebug, http::{ pager::{PagerContinuation, PagerResult, PagerState}, - policies::{auth::BearerTokenAuthorizationPolicy, Policy}, ClientOptions, Method, NoFormat, Pager, Pipeline, PipelineSendOptions, RawResponse, Request, RequestContent, Response, Url, UrlExt, XmlFormat, }, time::to_rfc7231, tracing, xml, Result, }; -use std::sync::Arc; +use std::collections::HashMap; #[tracing::client] pub struct BlobContainerClient { - pub(crate) container_name: String, pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, @@ -57,49 +46,6 @@ pub struct BlobContainerClientOptions { } impl BlobContainerClient { - /// Creates a new BlobContainerClient, using Entra ID authentication. - /// - /// # Arguments - /// - /// * `endpoint` - Service host - /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an - /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. - /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob.Container")] - pub fn new( - endpoint: &str, - credential: Arc, - container_name: String, - options: Option, - ) -> Result { - let options = options.unwrap_or_default(); - let endpoint = Url::parse(endpoint)?; - if !endpoint.scheme().starts_with("http") { - return Err(azure_core::Error::with_message( - azure_core::error::ErrorKind::Other, - format!("{endpoint} must use http(s)"), - )); - } - let auth_policy: Arc = Arc::new(BearerTokenAuthorizationPolicy::new( - credential, - vec!["https://storage.azure.com/.default"], - )); - Ok(Self { - container_name, - endpoint, - version: options.version, - pipeline: Pipeline::new( - option_env!("CARGO_PKG_NAME"), - option_env!("CARGO_PKG_VERSION"), - options.client_options, - Vec::default(), - vec![auth_policy], - None, - ), - }) - } - /// Returns the Url associated with this client. pub fn endpoint(&self) -> &Url { &self.endpoint @@ -110,6 +56,8 @@ 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. /// /// ## Response Headers @@ -123,40 +71,36 @@ impl BlobContainerClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(lease_id) = response.lease_id()? { + /// println!("x-ms-lease-id: {:?}", lease_id); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientAcquireLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobContainerClientAcquireLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobContainerClientAcquireLeaseResultHeaders::last_modified) - last-modified /// * [`lease_id`()](crate::generated::models::BlobContainerClientAcquireLeaseResultHeaders::lease_id) - x-ms-lease-id /// /// [`BlobContainerClientAcquireLeaseResultHeaders`]: crate::generated::models::BlobContainerClientAcquireLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.acquireLease")] + #[tracing::function("Storage.Blob.BlobContainerClient.acquireLease")] pub async fn acquire_lease( &self, + duration: i32, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder - .append_key_only("acquire") .append_pair("comp", "lease") .append_pair("restype", "container"); if let Some(timeout) = options.timeout { @@ -164,16 +108,14 @@ impl BlobContainerClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.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", to_rfc7231(&if_unmodified_since)); } - if let Some(duration) = options.duration.as_ref() { - request.insert_header("x-ms-lease-duration", duration.to_string()); - } + request.insert_header("x-ms-lease-action", "acquire"); + request.insert_header("x-ms-lease-duration", duration.to_string()); if let Some(proposed_lease_id) = options.proposed_lease_id.as_ref() { request.insert_header("x-ms-proposed-lease-id", proposed_lease_id); } @@ -212,28 +154,26 @@ impl BlobContainerClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(lease_time) = response.lease_time()? { + /// println!("x-ms-lease-time: {:?}", lease_time); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientBreakLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobContainerClientBreakLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobContainerClientBreakLeaseResultHeaders::last_modified) - last-modified - /// * [`lease_id`()](crate::generated::models::BlobContainerClientBreakLeaseResultHeaders::lease_id) - x-ms-lease-id /// * [`lease_time`()](crate::generated::models::BlobContainerClientBreakLeaseResultHeaders::lease_time) - x-ms-lease-time /// /// [`BlobContainerClientBreakLeaseResultHeaders`]: crate::generated::models::BlobContainerClientBreakLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.breakLease")] + #[tracing::function("Storage.Blob.BlobContainerClient.breakLease")] pub async fn break_lease( &self, options: Option>, @@ -241,12 +181,8 @@ impl BlobContainerClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder - .append_key_only("break") .append_pair("comp", "lease") .append_pair("restype", "container"); if let Some(timeout) = options.timeout { @@ -254,13 +190,13 @@ impl BlobContainerClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.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", to_rfc7231(&if_unmodified_since)); } + request.insert_header("x-ms-lease-action", "break"); if let Some(break_period) = options.break_period { request.insert_header("x-ms-lease-break-period", break_period.to_string()); } @@ -301,27 +237,26 @@ impl BlobContainerClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(lease_id) = response.lease_id()? { + /// println!("x-ms-lease-id: {:?}", lease_id); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientChangeLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobContainerClientChangeLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobContainerClientChangeLeaseResultHeaders::last_modified) - last-modified /// * [`lease_id`()](crate::generated::models::BlobContainerClientChangeLeaseResultHeaders::lease_id) - x-ms-lease-id /// /// [`BlobContainerClientChangeLeaseResultHeaders`]: crate::generated::models::BlobContainerClientChangeLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.changeLease")] + #[tracing::function("Storage.Blob.BlobContainerClient.changeLease")] pub async fn change_lease( &self, lease_id: String, @@ -331,12 +266,8 @@ impl BlobContainerClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder - .append_key_only("change") .append_pair("comp", "lease") .append_pair("restype", "container"); if let Some(timeout) = options.timeout { @@ -344,13 +275,13 @@ impl BlobContainerClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.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", to_rfc7231(&if_unmodified_since)); } + request.insert_header("x-ms-lease-action", "change"); request.insert_header("x-ms-lease-id", lease_id); request.insert_header("x-ms-proposed-lease-id", proposed_lease_id); request.insert_header("x-ms-version", &self.version); @@ -376,7 +307,7 @@ impl BlobContainerClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.create")] + #[tracing::function("Storage.Blob.BlobContainerClient.create")] pub async fn create( &self, options: Option>, @@ -384,9 +315,6 @@ impl BlobContainerClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("restype", "container"); if let Some(timeout) = options.timeout { @@ -394,7 +322,6 @@ impl BlobContainerClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(access) = options.access.as_ref() { request.insert_header("x-ms-blob-public-access", access.to_string()); } @@ -435,7 +362,7 @@ impl BlobContainerClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.delete")] + #[tracing::function("Storage.Blob.BlobContainerClient.delete")] pub async fn delete( &self, options: Option>, @@ -443,9 +370,6 @@ impl BlobContainerClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("restype", "container"); if let Some(timeout) = options.timeout { @@ -453,7 +377,6 @@ impl BlobContainerClient { } query_builder.build(); let mut request = Request::new(url, Method::Delete); - request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } @@ -485,41 +408,17 @@ impl BlobContainerClient { /// /// # Arguments /// + /// * `filter_expression` - Filters the results to return only to return only blobs whose tags match the specified expression. /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`FilterBlobSegmentHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, XmlFormat}}; - /// use blob_storage::models::{FilterBlobSegment, FilterBlobSegmentHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::FilterBlobSegmentHeaders::date) - date - /// - /// [`FilterBlobSegmentHeaders`]: crate::generated::models::FilterBlobSegmentHeaders - #[tracing::function("Storage.Blob.Container.filterBlobs")] - pub async fn filter_blobs( + #[tracing::function("Storage.Blob.BlobContainerClient.findBlobsByTags")] + pub async fn find_blobs_by_tags( &self, - options: Option>, + filter_expression: &str, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder .append_pair("comp", "blobs") @@ -543,13 +442,10 @@ impl BlobContainerClient { if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } - if let Some(where_param) = options.where_param.as_ref() { - query_builder.set_pair("where", where_param); - } + query_builder.set_pair("where", filter_expression); query_builder.build(); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -584,27 +480,26 @@ impl BlobContainerClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(access) = response.access()? { + /// println!("x-ms-blob-public-access: {:?}", access); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::SignedIdentifiersHeaders::date) - date /// * [`etag`()](crate::generated::models::SignedIdentifiersHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::SignedIdentifiersHeaders::last_modified) - last-modified /// * [`access`()](crate::generated::models::SignedIdentifiersHeaders::access) - x-ms-blob-public-access /// /// [`SignedIdentifiersHeaders`]: crate::generated::models::SignedIdentifiersHeaders - #[tracing::function("Storage.Blob.Container.getAccessPolicy")] + #[tracing::function("Storage.Blob.BlobContainerClient.getAccessPolicy")] pub async fn get_access_policy( &self, options: Option>, @@ -612,9 +507,6 @@ impl BlobContainerClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder .append_pair("comp", "acl") @@ -625,7 +517,6 @@ impl BlobContainerClient { query_builder.build(); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } @@ -663,27 +554,26 @@ impl BlobContainerClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(account_kind) = response.account_kind()? { /// println!("x-ms-account-kind: {:?}", account_kind); /// } /// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? { /// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled); /// } + /// if let Some(sku_name) = response.sku_name()? { + /// println!("x-ms-sku-name: {:?}", sku_name); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientGetAccountInfoResultHeaders::date) - date /// * [`account_kind`()](crate::generated::models::BlobContainerClientGetAccountInfoResultHeaders::account_kind) - x-ms-account-kind /// * [`is_hierarchical_namespace_enabled`()](crate::generated::models::BlobContainerClientGetAccountInfoResultHeaders::is_hierarchical_namespace_enabled) - x-ms-is-hns-enabled /// * [`sku_name`()](crate::generated::models::BlobContainerClientGetAccountInfoResultHeaders::sku_name) - x-ms-sku-name /// /// [`BlobContainerClientGetAccountInfoResultHeaders`]: crate::generated::models::BlobContainerClientGetAccountInfoResultHeaders - #[tracing::function("Storage.Blob.Container.getAccountInfo")] + #[tracing::function("Storage.Blob.BlobContainerClient.getAccountInfo")] pub async fn get_account_info( &self, options: Option>, @@ -691,9 +581,6 @@ impl BlobContainerClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder .append_pair("comp", "properties") @@ -703,7 +590,6 @@ impl BlobContainerClient { } query_builder.build(); let mut request = Request::new(url, Method::Get); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -721,22 +607,6 @@ impl BlobContainerClient { Ok(rsp.into()) } - /// Returns a new instance of BlobClient. - /// - /// # Arguments - /// - /// * `blob_name` - The name of the blob. - #[tracing::subclient] - pub fn get_blob_client(&self, blob_name: String) -> BlobClient { - BlobClient { - blob_name, - container_name: self.container_name.clone(), - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - /// returns all user-defined metadata and system properties for the specified container. The data returned does not include /// the container's list of blobs /// @@ -783,7 +653,7 @@ impl BlobContainerClient { /// * [`metadata`()](crate::generated::models::BlobContainerClientGetPropertiesResultHeaders::metadata) - x-ms-meta /// /// [`BlobContainerClientGetPropertiesResultHeaders`]: crate::generated::models::BlobContainerClientGetPropertiesResultHeaders - #[tracing::function("Storage.Blob.Container.getProperties")] + #[tracing::function("Storage.Blob.BlobContainerClient.getProperties")] pub async fn get_properties( &self, options: Option>, @@ -791,9 +661,6 @@ impl BlobContainerClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("restype", "container"); if let Some(timeout) = options.timeout { @@ -801,7 +668,6 @@ impl BlobContainerClient { } query_builder.build(); let mut request = Request::new(url, Method::Get); - request.insert_header("content-type", "application/xml"); if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } @@ -827,44 +693,17 @@ impl BlobContainerClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`ListBlobsFlatSegmentResponseHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, XmlFormat}}; - /// use blob_storage::models::{ListBlobsFlatSegmentResponse, ListBlobsFlatSegmentResponseHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::ListBlobsFlatSegmentResponseHeaders::date) - date - /// - /// [`ListBlobsFlatSegmentResponseHeaders`]: crate::generated::models::ListBlobsFlatSegmentResponseHeaders - #[tracing::function("Storage.Blob.Container.listBlobFlatSegment")] - pub fn list_blob_flat_segment( + #[tracing::function("Storage.Blob.BlobContainerClient.listBlobs")] + pub fn list_blobs( &self, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default().into_owned(); let pipeline = self.pipeline.clone(); let mut first_url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - first_url.append_path(&path); let mut query_builder = first_url.query_builder(); query_builder .append_pair("comp", "list") - .append_key_only("flat") .append_pair("restype", "container"); if let Some(include) = options.include.as_ref() { query_builder.set_pair( @@ -885,121 +724,8 @@ impl BlobContainerClient { if let Some(prefix) = options.prefix.as_ref() { query_builder.set_pair("prefix", prefix); } - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let version = self.version.clone(); - Ok(Pager::new( - move |marker: PagerState, pager_options| { - let mut url = first_url.clone(); - if let PagerState::More(marker) = marker { - let mut query_builder = url.query_builder(); - query_builder.set_pair("marker", marker.as_ref()); - query_builder.build(); - } - let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); - request.insert_header("x-ms-version", &version); - let pipeline = pipeline.clone(); - Box::pin(async move { - let rsp = pipeline - .send( - &pager_options.context, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[200], - }, - ..Default::default() - }), - ) - .await?; - let (status, headers, body) = rsp.deconstruct(); - let res: ListBlobsFlatSegmentResponse = xml::from_xml(&body)?; - let rsp = RawResponse::from_bytes(status, headers, body).into(); - Ok(match res.next_marker { - Some(next_marker) if !next_marker.is_empty() => PagerResult::More { - response: rsp, - continuation: PagerContinuation::Token(next_marker), - }, - _ => PagerResult::Done { response: rsp }, - }) - }) - }, - Some(options.method_options), - )) - } - - /// The List Blobs operation returns a list of the blobs under the specified container. A delimiter can be used to traverse - /// a virtual hierarchy of blobs as though it were a file system. - /// - /// # Arguments - /// - /// * `delimiter` - When the request includes this parameter, the operation returns a BlobPrefix element in the response body - /// that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter - /// character. The delimiter may be a single character or a string. - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`ListBlobsHierarchySegmentResponseHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, XmlFormat}}; - /// use blob_storage::models::{ListBlobsHierarchySegmentResponse, ListBlobsHierarchySegmentResponseHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::ListBlobsHierarchySegmentResponseHeaders::date) - date - /// - /// [`ListBlobsHierarchySegmentResponseHeaders`]: crate::generated::models::ListBlobsHierarchySegmentResponseHeaders - #[tracing::function("Storage.Blob.Container.listBlobHierarchySegment")] - pub fn list_blob_hierarchy_segment( - &self, - delimiter: &str, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default().into_owned(); - let pipeline = self.pipeline.clone(); - let mut first_url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - first_url.append_path(&path); - let mut query_builder = first_url.query_builder(); - query_builder - .append_pair("comp", "list") - .append_key_only("hierarchy") - .append_pair("restype", "container"); - query_builder.set_pair("delimiter", delimiter); - if let Some(include) = options.include.as_ref() { - query_builder.set_pair( - "include", - include - .iter() - .map(|i| i.to_string()) - .collect::>() - .join(","), - ); - } - if let Some(marker) = options.marker.as_ref() { - query_builder.set_pair("marker", marker); - } - if let Some(maxresults) = options.maxresults { - query_builder.set_pair("maxresults", maxresults.to_string()); - } - if let Some(prefix) = options.prefix.as_ref() { - query_builder.set_pair("prefix", prefix); + if let Some(start_from) = options.start_from.as_ref() { + query_builder.set_pair("startFrom", start_from); } if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); @@ -1016,7 +742,6 @@ impl BlobContainerClient { } let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &version); let pipeline = pipeline.clone(); Box::pin(async move { @@ -1033,7 +758,7 @@ impl BlobContainerClient { ) .await?; let (status, headers, body) = rsp.deconstruct(); - let res: ListBlobsHierarchySegmentResponse = xml::from_xml(&body)?; + let res: ListBlobsResponse = xml::from_xml(&body)?; let rsp = RawResponse::from_bytes(status, headers, body).into(); Ok(match res.next_marker { Some(next_marker) if !next_marker.is_empty() => PagerResult::More { @@ -1068,9 +793,6 @@ impl BlobContainerClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } @@ -1082,12 +804,11 @@ impl BlobContainerClient { /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientReleaseLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobContainerClientReleaseLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobContainerClientReleaseLeaseResultHeaders::last_modified) - last-modified /// /// [`BlobContainerClientReleaseLeaseResultHeaders`]: crate::generated::models::BlobContainerClientReleaseLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.releaseLease")] + #[tracing::function("Storage.Blob.BlobContainerClient.releaseLease")] pub async fn release_lease( &self, lease_id: String, @@ -1096,26 +817,22 @@ impl BlobContainerClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder .append_pair("comp", "lease") - .append_key_only("release") .append_pair("restype", "container"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.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", to_rfc7231(&if_unmodified_since)); } + request.insert_header("x-ms-lease-action", "release"); request.insert_header("x-ms-lease-id", lease_id); request.insert_header("x-ms-version", &self.version); let rsp = self @@ -1134,78 +851,6 @@ impl BlobContainerClient { Ok(rsp.into()) } - /// Renames an existing container. - /// - /// # Arguments - /// - /// * `source_container_name` - Required. Specifies the name of the container to rename. - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientRenameResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobContainerClientRenameResult, BlobContainerClientRenameResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientRenameResultHeaders::date) - date - /// - /// [`BlobContainerClientRenameResultHeaders`]: crate::generated::models::BlobContainerClientRenameResultHeaders - #[tracing::function("Storage.Blob.Container.rename")] - pub async fn rename( - &self, - source_container_name: String, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); - let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "rename") - .append_pair("restype", "container"); - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); - request.insert_header("x-ms-source-container-name", source_container_name); - if let Some(source_lease_id) = options.source_lease_id.as_ref() { - request.insert_header("x-ms-source-lease-id", source_lease_id); - } - request.insert_header("x-ms-version", &self.version); - let rsp = self - .pipeline - .send( - &ctx, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[200], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - /// The Renew Lease operation renews an existing lease. /// /// # Arguments @@ -1225,27 +870,26 @@ impl BlobContainerClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(lease_id) = response.lease_id()? { + /// println!("x-ms-lease-id: {:?}", lease_id); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientRenewLeaseResultHeaders::date) - date /// * [`etag`()](crate::generated::models::BlobContainerClientRenewLeaseResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::BlobContainerClientRenewLeaseResultHeaders::last_modified) - last-modified /// * [`lease_id`()](crate::generated::models::BlobContainerClientRenewLeaseResultHeaders::lease_id) - x-ms-lease-id /// /// [`BlobContainerClientRenewLeaseResultHeaders`]: crate::generated::models::BlobContainerClientRenewLeaseResultHeaders - #[tracing::function("Storage.Blob.Container.renewLease")] + #[tracing::function("Storage.Blob.BlobContainerClient.renewLease")] pub async fn renew_lease( &self, lease_id: String, @@ -1254,26 +898,22 @@ impl BlobContainerClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder .append_pair("comp", "lease") - .append_key_only("renew") .append_pair("restype", "container"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.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", to_rfc7231(&if_unmodified_since)); } + request.insert_header("x-ms-lease-action", "renew"); request.insert_header("x-ms-lease-id", lease_id); request.insert_header("x-ms-version", &self.version); let rsp = self @@ -1292,78 +932,6 @@ impl BlobContainerClient { Ok(rsp.into()) } - /// Restores a previously-deleted container. - /// - /// # Arguments - /// - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientRestoreResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobContainerClientRestoreResult, BlobContainerClientRestoreResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientRestoreResultHeaders::date) - date - /// - /// [`BlobContainerClientRestoreResultHeaders`]: crate::generated::models::BlobContainerClientRestoreResultHeaders - #[tracing::function("Storage.Blob.Container.restore")] - pub async fn restore( - &self, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); - let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "undelete") - .append_pair("restype", "container"); - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); - if let Some(deleted_container_name) = options.deleted_container_name.as_ref() { - request.insert_header("x-ms-deleted-container-name", deleted_container_name); - } - if let Some(deleted_container_version) = options.deleted_container_version.as_ref() { - request.insert_header("x-ms-deleted-container-version", deleted_container_version); - } - request.insert_header("x-ms-version", &self.version); - let rsp = self - .pipeline - .send( - &ctx, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[201], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - /// sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed /// publicly. /// @@ -1371,49 +939,15 @@ impl BlobContainerClient { /// /// * `container_acl` - The access control list for the container. /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlobContainerClientSetAccessPolicyResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetAccessPolicyResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// if let Some(etag) = response.etag()? { - /// println!("etag: {:?}", etag); - /// } - /// if let Some(last_modified) = response.last_modified()? { - /// println!("last-modified: {:?}", last_modified); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::BlobContainerClientSetAccessPolicyResultHeaders::date) - date - /// * [`etag`()](crate::generated::models::BlobContainerClientSetAccessPolicyResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::BlobContainerClientSetAccessPolicyResultHeaders::last_modified) - last-modified - /// - /// [`BlobContainerClientSetAccessPolicyResultHeaders`]: crate::generated::models::BlobContainerClientSetAccessPolicyResultHeaders - #[tracing::function("Storage.Blob.Container.setAccessPolicy")] + #[tracing::function("Storage.Blob.BlobContainerClient.setAccessPolicy")] pub async fn set_access_policy( &self, container_acl: RequestContent, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder .append_pair("comp", "acl") @@ -1458,18 +992,17 @@ impl BlobContainerClient { /// /// # Arguments /// + /// * `metadata` - The metadata headers. /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.Container.setMetadata")] + #[tracing::function("Storage.Blob.BlobContainerClient.setMetadata")] pub async fn set_metadata( &self, + metadata: &HashMap, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}"); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder .append_pair("comp", "metadata") @@ -1479,17 +1012,14 @@ impl BlobContainerClient { } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_modified_since) = options.if_modified_since { request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); } if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } - if let Some(metadata) = options.metadata.as_ref() { - for (k, v) in metadata { - request.insert_header(format!("x-ms-meta-{k}"), v); - } + for (k, v) in metadata { + request.insert_header(format!("x-ms-meta-{k}"), v); } request.insert_header("x-ms-version", &self.version); let rsp = self @@ -1513,7 +1043,7 @@ impl Default for BlobContainerClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2026-04-06"), } } } diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_service_client.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_service_client.rs index d8d754488..70e2a80a8 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_service_client.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/blob_service_client.rs @@ -3,30 +3,23 @@ // // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use crate::generated::{ - clients::BlobContainerClient, - models::{ - BlobServiceClientFilterBlobsOptions, BlobServiceClientGetAccountInfoOptions, - BlobServiceClientGetAccountInfoResult, BlobServiceClientGetPropertiesOptions, - BlobServiceClientGetStatisticsOptions, BlobServiceClientGetUserDelegationKeyOptions, - BlobServiceClientListContainersSegmentOptions, BlobServiceClientSetPropertiesOptions, - FilterBlobSegment, KeyInfo, ListContainersSegmentResponse, StorageServiceProperties, - StorageServiceStats, UserDelegationKey, - }, +use crate::generated::models::{ + BlobServiceClientFindBlobsByTagsOptions, BlobServiceClientGetAccountInfoOptions, + BlobServiceClientGetAccountInfoResult, BlobServiceClientGetPropertiesOptions, + BlobServiceClientGetStatisticsOptions, BlobServiceClientListContainersOptions, + BlobServiceClientSetPropertiesOptions, BlobServiceProperties, FilterBlobSegment, + ListContainersSegmentResponse, StorageServiceStats, }; use azure_core::{ - credentials::TokenCredential, error::CheckSuccessOptions, fmt::SafeDebug, http::{ pager::{PagerContinuation, PagerResult, PagerState}, - policies::{auth::BearerTokenAuthorizationPolicy, Policy}, ClientOptions, Method, NoFormat, Pager, Pipeline, PipelineSendOptions, RawResponse, Request, RequestContent, Response, Url, UrlExt, XmlFormat, }, tracing, xml, Result, }; -use std::sync::Arc; #[tracing::client] pub struct BlobServiceClient { @@ -45,46 +38,6 @@ pub struct BlobServiceClientOptions { } impl BlobServiceClient { - /// Creates a new BlobServiceClient, using Entra ID authentication. - /// - /// # Arguments - /// - /// * `endpoint` - Service host - /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an - /// Entra ID token to use when authenticating. - /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob")] - pub fn new( - endpoint: &str, - credential: Arc, - options: Option, - ) -> Result { - let options = options.unwrap_or_default(); - let endpoint = Url::parse(endpoint)?; - if !endpoint.scheme().starts_with("http") { - return Err(azure_core::Error::with_message( - azure_core::error::ErrorKind::Other, - format!("{endpoint} must use http(s)"), - )); - } - let auth_policy: Arc = Arc::new(BearerTokenAuthorizationPolicy::new( - credential, - vec!["https://storage.azure.com/.default"], - )); - Ok(Self { - endpoint, - version: options.version, - pipeline: Pipeline::new( - option_env!("CARGO_PKG_NAME"), - option_env!("CARGO_PKG_VERSION"), - options.client_options, - Vec::default(), - vec![auth_policy], - None, - ), - }) - } - /// Returns the Url associated with this client. pub fn endpoint(&self) -> &Url { &self.endpoint @@ -94,34 +47,13 @@ impl BlobServiceClient { /// /// # Arguments /// + /// * `filter_expression` - Filters the results to return only to return only blobs whose tags match the specified expression. /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`FilterBlobSegmentHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, XmlFormat}}; - /// use blob_storage::models::{FilterBlobSegment, FilterBlobSegmentHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::FilterBlobSegmentHeaders::date) - date - /// - /// [`FilterBlobSegmentHeaders`]: crate::generated::models::FilterBlobSegmentHeaders - #[tracing::function("Storage.Blob.filterBlobs")] - pub async fn filter_blobs( + #[tracing::function("Storage.Blob.BlobServiceClient.findBlobsByTags")] + pub async fn find_blobs_by_tags( &self, - options: Option>, + filter_expression: &str, + options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); @@ -147,13 +79,10 @@ impl BlobServiceClient { if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } - if let Some(where_param) = options.where_param.as_ref() { - query_builder.set_pair("where", where_param); - } + query_builder.set_pair("where", filter_expression); query_builder.build(); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -188,27 +117,26 @@ impl BlobServiceClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(account_kind) = response.account_kind()? { /// println!("x-ms-account-kind: {:?}", account_kind); /// } /// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? { /// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled); /// } + /// if let Some(sku_name) = response.sku_name()? { + /// println!("x-ms-sku-name: {:?}", sku_name); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::BlobServiceClientGetAccountInfoResultHeaders::date) - date /// * [`account_kind`()](crate::generated::models::BlobServiceClientGetAccountInfoResultHeaders::account_kind) - x-ms-account-kind /// * [`is_hierarchical_namespace_enabled`()](crate::generated::models::BlobServiceClientGetAccountInfoResultHeaders::is_hierarchical_namespace_enabled) - x-ms-is-hns-enabled /// * [`sku_name`()](crate::generated::models::BlobServiceClientGetAccountInfoResultHeaders::sku_name) - x-ms-sku-name /// /// [`BlobServiceClientGetAccountInfoResultHeaders`]: crate::generated::models::BlobServiceClientGetAccountInfoResultHeaders - #[tracing::function("Storage.Blob.getAccountInfo")] + #[tracing::function("Storage.Blob.BlobServiceClient.getAccountInfo")] pub async fn get_account_info( &self, options: Option>, @@ -225,7 +153,6 @@ impl BlobServiceClient { } query_builder.build(); let mut request = Request::new(url, Method::Get); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -243,32 +170,17 @@ impl BlobServiceClient { Ok(rsp.into()) } - /// Returns a new instance of BlobContainerClient. - /// - /// # Arguments - /// - /// * `container_name` - The name of the container. - #[tracing::subclient] - pub fn get_blob_container_client(&self, container_name: String) -> BlobContainerClient { - BlobContainerClient { - container_name, - endpoint: self.endpoint.clone(), - pipeline: self.pipeline.clone(), - version: self.version.clone(), - } - } - /// Retrieves properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin /// Resource Sharing) rules. /// /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.getProperties")] + #[tracing::function("Storage.Blob.BlobServiceClient.getProperties")] pub async fn get_properties( &self, options: Option>, - ) -> Result> { + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); @@ -282,7 +194,6 @@ impl BlobServiceClient { query_builder.build(); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -306,30 +217,7 @@ impl BlobServiceClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`StorageServiceStatsHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, XmlFormat}}; - /// use blob_storage::models::{StorageServiceStats, StorageServiceStatsHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::StorageServiceStatsHeaders::date) - date - /// - /// [`StorageServiceStatsHeaders`]: crate::generated::models::StorageServiceStatsHeaders - #[tracing::function("Storage.Blob.getStatistics")] + #[tracing::function("Storage.Blob.BlobServiceClient.getStatistics")] pub async fn get_statistics( &self, options: Option>, @@ -347,75 +235,7 @@ impl BlobServiceClient { query_builder.build(); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); - request.insert_header("x-ms-version", &self.version); - let rsp = self - .pipeline - .send( - &ctx, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[200], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - - /// Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication. - /// - /// # Arguments - /// - /// * `key_info` - Key information provided in the request - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`UserDelegationKeyHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```ignore - /// use azure_core::{Result, http::{Response, XmlFormat}}; - /// use blob_storage::models::{UserDelegationKey, UserDelegationKeyHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::UserDelegationKeyHeaders::date) - date - /// - /// [`UserDelegationKeyHeaders`]: crate::generated::models::UserDelegationKeyHeaders - #[tracing::function("Storage.Blob.getUserDelegationKey")] - pub(crate) async fn get_user_delegation_key( - &self, - key_info: RequestContent, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "userdelegationkey") - .append_pair("restype", "service"); - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &self.version); - request.set_body(key_info); let rsp = self .pipeline .send( @@ -437,10 +257,10 @@ impl BlobServiceClient { /// # Arguments /// /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.listContainersSegment")] - pub fn list_containers_segment( + #[tracing::function("Storage.Blob.BlobServiceClient.listContainers")] + pub fn list_containers( &self, - options: Option>, + options: Option>, ) -> Result> { let options = options.unwrap_or_default().into_owned(); let pipeline = self.pipeline.clone(); @@ -481,7 +301,6 @@ impl BlobServiceClient { } let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); request.insert_header("x-ms-version", &version); let pipeline = pipeline.clone(); Box::pin(async move { @@ -520,10 +339,10 @@ impl BlobServiceClient { /// /// * `storage_service_properties` - The storage service properties to set. /// * `options` - Optional parameters for the request. - #[tracing::function("Storage.Blob.setProperties")] + #[tracing::function("Storage.Blob.BlobServiceClient.setProperties")] pub async fn set_properties( &self, - storage_service_properties: RequestContent, + storage_service_properties: RequestContent, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); @@ -562,7 +381,7 @@ impl Default for BlobServiceClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2026-04-06"), } } } diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/block_blob_client.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/block_blob_client.rs index b9f31aee9..8cec5154d 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/block_blob_client.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/block_blob_client.rs @@ -4,33 +4,27 @@ // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. use crate::generated::models::{ - BlobType, BlockBlobClientCommitBlockListOptions, BlockBlobClientCommitBlockListResult, - BlockBlobClientGetBlockListOptions, BlockBlobClientPutBlobFromUrlOptions, - BlockBlobClientPutBlobFromUrlResult, BlockBlobClientQueryOptions, BlockBlobClientQueryResult, - BlockBlobClientStageBlockFromUrlOptions, BlockBlobClientStageBlockFromUrlResult, - BlockBlobClientStageBlockOptions, BlockBlobClientStageBlockResult, - BlockBlobClientUploadOptions, BlockBlobClientUploadResult, BlockList, BlockListType, - BlockLookupList, QueryRequest, + BlockBlobClientCommitBlockListOptions, BlockBlobClientCommitBlockListResult, + BlockBlobClientGetBlockListOptions, BlockBlobClientStageBlockFromUrlOptions, + BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockOptions, + BlockBlobClientStageBlockResult, BlockBlobClientUploadBlobFromUrlOptions, + BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadInternalOptions, + BlockBlobClientUploadInternalResult, BlockList, BlockListType, BlockLookupList, }; use azure_core::{ base64, - credentials::TokenCredential, error::CheckSuccessOptions, fmt::SafeDebug, http::{ - policies::{auth::BearerTokenAuthorizationPolicy, Policy}, - AsyncResponse, ClientOptions, Method, NoFormat, Pipeline, PipelineSendOptions, - PipelineStreamOptions, Request, RequestContent, Response, Url, UrlExt, XmlFormat, + ClientOptions, Method, NoFormat, Pipeline, PipelineSendOptions, Request, RequestContent, + Response, Url, UrlExt, XmlFormat, }, time::to_rfc7231, tracing, Bytes, Result, }; -use std::sync::Arc; #[tracing::client] pub struct BlockBlobClient { - pub(crate) blob_name: String, - pub(crate) container_name: String, pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, @@ -46,52 +40,6 @@ pub struct BlockBlobClientOptions { } impl BlockBlobClient { - /// Creates a new BlockBlobClient, using Entra ID authentication. - /// - /// # Arguments - /// - /// * `endpoint` - Service host - /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an - /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. - /// * `blob_name` - The name of the blob. - /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob.Container.Blob.BlockBlob")] - pub fn new( - endpoint: &str, - credential: Arc, - container_name: String, - blob_name: String, - options: Option, - ) -> Result { - let options = options.unwrap_or_default(); - let endpoint = Url::parse(endpoint)?; - if !endpoint.scheme().starts_with("http") { - return Err(azure_core::Error::with_message( - azure_core::error::ErrorKind::Other, - format!("{endpoint} must use http(s)"), - )); - } - let auth_policy: Arc = Arc::new(BearerTokenAuthorizationPolicy::new( - credential, - vec!["https://storage.azure.com/.default"], - )); - Ok(Self { - blob_name, - container_name, - endpoint, - version: options.version, - pipeline: Pipeline::new( - option_env!("CARGO_PKG_NAME"), - option_env!("CARGO_PKG_VERSION"), - options.client_options, - Vec::default(), - vec![auth_policy], - None, - ), - }) - } - /// Returns the Url associated with this client. pub fn endpoint(&self) -> &Url { &self.endpoint @@ -144,7 +92,7 @@ impl BlockBlobClient { /// * [`version_id`()](crate::generated::models::BlockBlobClientCommitBlockListResultHeaders::version_id) - x-ms-version-id /// /// [`BlockBlobClientCommitBlockListResultHeaders`]: crate::generated::models::BlockBlobClientCommitBlockListResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.commitBlockList")] + #[tracing::function("Storage.Blob.BlockBlobClient.commitBlockList")] pub async fn commit_block_list( &self, blocks: RequestContent, @@ -153,10 +101,6 @@ impl BlockBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "blocklist"); if let Some(timeout) = options.timeout { @@ -307,7 +251,7 @@ impl BlockBlobClient { /// * [`blob_content_length`()](crate::generated::models::BlockListHeaders::blob_content_length) - x-ms-blob-content-length /// /// [`BlockListHeaders`]: crate::generated::models::BlockListHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.getBlockList")] + #[tracing::function("Storage.Blob.BlockBlobClient.getBlockList")] pub async fn get_block_list( &self, list_type: BlockListType, @@ -316,10 +260,6 @@ impl BlockBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "blocklist"); query_builder.set_pair("blocklisttype", list_type.as_ref()); @@ -332,7 +272,6 @@ impl BlockBlobClient { query_builder.build(); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); } @@ -356,72 +295,63 @@ impl BlockBlobClient { Ok(rsp.into()) } - /// The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given URL. This - /// API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob from URL; the - /// content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blob’s - /// contents using a source URL, use the Put Block from URL API in conjunction with Put Block List. + /// The Stage Block operation creates a new block to be committed as part of a blob /// /// # Arguments /// + /// * `block_id` - A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than + /// or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the + /// same size for each block. /// * `content_length` - The length of the request. - /// * `copy_source` - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that - /// specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must - /// either be public or must be authenticated via a shared access signature. + /// * `body` - The body of the request. /// * `options` - Optional parameters for the request. /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlockBlobClientPutBlobFromUrlResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`BlockBlobClientStageBlockResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlockBlobClientPutBlobFromUrlResult, BlockBlobClientPutBlobFromUrlResultHeaders}; + /// use blob_storage::models::{BlockBlobClientStageBlockResult, BlockBlobClientStageBlockResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); + /// if let Some(content_crc64) = response.content_crc64()? { + /// println!("x-ms-content-crc64: {:?}", content_crc64); /// } - /// if let Some(etag) = response.etag()? { - /// println!("etag: {:?}", etag); + /// if let Some(encryption_key_sha256) = response.encryption_key_sha256()? { + /// println!("x-ms-encryption-key-sha256: {:?}", encryption_key_sha256); /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`content_md5`()](crate::generated::models::BlockBlobClientPutBlobFromUrlResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::BlockBlobClientPutBlobFromUrlResultHeaders::date) - date - /// * [`etag`()](crate::generated::models::BlockBlobClientPutBlobFromUrlResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::BlockBlobClientPutBlobFromUrlResultHeaders::last_modified) - last-modified - /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientPutBlobFromUrlResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 - /// * [`encryption_scope`()](crate::generated::models::BlockBlobClientPutBlobFromUrlResultHeaders::encryption_scope) - x-ms-encryption-scope - /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientPutBlobFromUrlResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted - /// * [`version_id`()](crate::generated::models::BlockBlobClientPutBlobFromUrlResultHeaders::version_id) - x-ms-version-id + /// * [`content_md5`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::content_md5) - content-md5 + /// * [`content_crc64`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::content_crc64) - x-ms-content-crc64 + /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 + /// * [`encryption_scope`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::encryption_scope) - x-ms-encryption-scope + /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// - /// [`BlockBlobClientPutBlobFromUrlResultHeaders`]: crate::generated::models::BlockBlobClientPutBlobFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.putBlobFromUrl")] - pub async fn put_blob_from_url( + /// [`BlockBlobClientStageBlockResultHeaders`]: crate::generated::models::BlockBlobClientStageBlockResultHeaders + #[tracing::function("Storage.Blob.BlockBlobClient.stageBlock")] + pub async fn stage_block( &self, + block_id: &[u8], content_length: u64, - copy_source: String, - options: Option>, - ) -> Result> { + body: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_key_only("BlockBlob") - .append_key_only("fromUrl"); + query_builder.append_pair("comp", "block"); + query_builder.set_pair("blockid", base64::encode(block_id)); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } @@ -431,53 +361,13 @@ impl BlockBlobClient { if let Some(transactional_content_md5) = options.transactional_content_md5 { request.insert_header("content-md5", base64::encode(transactional_content_md5)); } - if let Some(if_match) = options.if_match.as_ref() { - request.insert_header("if-match", if_match); - } - if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); - } - if let Some(if_none_match) = options.if_none_match.as_ref() { - 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", to_rfc7231(&if_unmodified_since)); - } - if let Some(tier) = options.tier.as_ref() { - request.insert_header("x-ms-access-tier", tier.to_string()); - } - if let Some(blob_cache_control) = options.blob_cache_control.as_ref() { - request.insert_header("x-ms-blob-cache-control", blob_cache_control); - } - if let Some(blob_content_disposition) = options.blob_content_disposition.as_ref() { - request.insert_header("x-ms-blob-content-disposition", blob_content_disposition); - } - if let Some(blob_content_encoding) = options.blob_content_encoding.as_ref() { - request.insert_header("x-ms-blob-content-encoding", blob_content_encoding); - } - if let Some(blob_content_language) = options.blob_content_language.as_ref() { - 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)); - } - if let Some(blob_content_type) = options.blob_content_type.as_ref() { - request.insert_header("x-ms-blob-content-type", blob_content_type); - } - request.insert_header("x-ms-blob-type", BlobType::BlockBlob.to_string()); - request.insert_header("x-ms-copy-source", copy_source); - if let Some(copy_source_authorization) = options.copy_source_authorization.as_ref() { - request.insert_header("x-ms-copy-source-authorization", copy_source_authorization); - } - if let Some(copy_source_blob_properties) = options.copy_source_blob_properties { + request.insert_header("content-type", "application/octet-stream"); + if let Some(transactional_content_crc64) = options.transactional_content_crc64 { request.insert_header( - "x-ms-copy-source-blob-properties", - copy_source_blob_properties.to_string(), + "x-ms-content-crc64", + base64::encode(transactional_content_crc64), ); } - if let Some(copy_source_tags) = options.copy_source_tags.as_ref() { - request.insert_header("x-ms-copy-source-tag-option", copy_source_tags); - } if let Some(encryption_algorithm) = options.encryption_algorithm.as_ref() { request.insert_header( "x-ms-encryption-algorithm", @@ -493,48 +383,20 @@ impl BlockBlobClient { if let Some(encryption_scope) = options.encryption_scope.as_ref() { request.insert_header("x-ms-encryption-scope", encryption_scope); } - if let Some(if_tags) = options.if_tags.as_ref() { - request.insert_header("x-ms-if-tags", if_tags); - } if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } - if let Some(metadata) = options.metadata.as_ref() { - for (k, v) in metadata { - request.insert_header(format!("x-ms-meta-{k}"), v); - } - } - if let Some(source_content_md5) = options.source_content_md5 { - request.insert_header( - "x-ms-source-content-md5", - base64::encode(source_content_md5), - ); - } - if let Some(source_if_match) = options.source_if_match.as_ref() { - request.insert_header("x-ms-source-if-match", source_if_match); - } - if let Some(source_if_modified_since) = options.source_if_modified_since { - request.insert_header( - "x-ms-source-if-modified-since", - to_rfc7231(&source_if_modified_since), - ); - } - if let Some(source_if_none_match) = options.source_if_none_match.as_ref() { - request.insert_header("x-ms-source-if-none-match", source_if_none_match); - } - if let Some(source_if_tags) = options.source_if_tags.as_ref() { - request.insert_header("x-ms-source-if-tags", source_if_tags); + if let Some(structured_body_type) = options.structured_body_type.as_ref() { + request.insert_header("x-ms-structured-body", structured_body_type); } - if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { + if let Some(structured_content_length) = options.structured_content_length { request.insert_header( - "x-ms-source-if-unmodified-since", - to_rfc7231(&source_if_unmodified_since), + "x-ms-structured-content-length", + structured_content_length.to_string(), ); } - if let Some(blob_tags_string) = options.blob_tags_string.as_ref() { - request.insert_header("x-ms-tags", blob_tags_string); - } request.insert_header("x-ms-version", &self.version); + request.set_body(body); let rsp = self .pipeline .send( @@ -551,143 +413,8 @@ impl BlockBlobClient { Ok(rsp.into()) } - /// The Query operation enables users to select/project on blob data by providing simple query expressions. - /// - /// # Arguments - /// - /// * `query_request` - The query request - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`AsyncResponse`](azure_core::http::AsyncResponse) implements the [`BlockBlobClientQueryResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::AsyncResponse}; - /// use blob_storage::models::{BlockBlobClientQueryResult, BlockBlobClientQueryResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: AsyncResponse = unimplemented!(); - /// // Access response headers - /// if let Some(accept_ranges) = response.accept_ranges()? { - /// println!("accept-ranges: {:?}", accept_ranges); - /// } - /// if let Some(cache_control) = response.cache_control()? { - /// println!("cache-control: {:?}", cache_control); - /// } - /// if let Some(content_disposition) = response.content_disposition()? { - /// println!("content-disposition: {:?}", content_disposition); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`accept_ranges`()](crate::generated::models::BlockBlobClientQueryResultHeaders::accept_ranges) - accept-ranges - /// * [`cache_control`()](crate::generated::models::BlockBlobClientQueryResultHeaders::cache_control) - cache-control - /// * [`content_disposition`()](crate::generated::models::BlockBlobClientQueryResultHeaders::content_disposition) - content-disposition - /// * [`content_encoding`()](crate::generated::models::BlockBlobClientQueryResultHeaders::content_encoding) - content-encoding - /// * [`content_language`()](crate::generated::models::BlockBlobClientQueryResultHeaders::content_language) - content-language - /// * [`content_length`()](crate::generated::models::BlockBlobClientQueryResultHeaders::content_length) - content-length - /// * [`content_md5`()](crate::generated::models::BlockBlobClientQueryResultHeaders::content_md5) - content-md5 - /// * [`content_range`()](crate::generated::models::BlockBlobClientQueryResultHeaders::content_range) - content-range - /// * [`date`()](crate::generated::models::BlockBlobClientQueryResultHeaders::date) - date - /// * [`etag`()](crate::generated::models::BlockBlobClientQueryResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::BlockBlobClientQueryResultHeaders::last_modified) - last-modified - /// * [`blob_committed_block_count`()](crate::generated::models::BlockBlobClientQueryResultHeaders::blob_committed_block_count) - x-ms-blob-committed-block-count - /// * [`blob_content_md5`()](crate::generated::models::BlockBlobClientQueryResultHeaders::blob_content_md5) - x-ms-blob-content-md5 - /// * [`blob_sequence_number`()](crate::generated::models::BlockBlobClientQueryResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number - /// * [`blob_type`()](crate::generated::models::BlockBlobClientQueryResultHeaders::blob_type) - x-ms-blob-type - /// * [`content_crc64`()](crate::generated::models::BlockBlobClientQueryResultHeaders::content_crc64) - x-ms-content-crc64 - /// * [`copy_completion_time`()](crate::generated::models::BlockBlobClientQueryResultHeaders::copy_completion_time) - x-ms-copy-completion-time - /// * [`copy_id`()](crate::generated::models::BlockBlobClientQueryResultHeaders::copy_id) - x-ms-copy-id - /// * [`copy_progress`()](crate::generated::models::BlockBlobClientQueryResultHeaders::copy_progress) - x-ms-copy-progress - /// * [`copy_source`()](crate::generated::models::BlockBlobClientQueryResultHeaders::copy_source) - x-ms-copy-source - /// * [`copy_status`()](crate::generated::models::BlockBlobClientQueryResultHeaders::copy_status) - x-ms-copy-status - /// * [`copy_status_description`()](crate::generated::models::BlockBlobClientQueryResultHeaders::copy_status_description) - x-ms-copy-status-description - /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientQueryResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 - /// * [`encryption_scope`()](crate::generated::models::BlockBlobClientQueryResultHeaders::encryption_scope) - x-ms-encryption-scope - /// * [`duration`()](crate::generated::models::BlockBlobClientQueryResultHeaders::duration) - x-ms-lease-duration - /// * [`lease_state`()](crate::generated::models::BlockBlobClientQueryResultHeaders::lease_state) - x-ms-lease-state - /// * [`lease_status`()](crate::generated::models::BlockBlobClientQueryResultHeaders::lease_status) - x-ms-lease-status - /// * [`metadata`()](crate::generated::models::BlockBlobClientQueryResultHeaders::metadata) - x-ms-meta - /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientQueryResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted - /// - /// [`BlockBlobClientQueryResultHeaders`]: crate::generated::models::BlockBlobClientQueryResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.query")] - pub async fn query( - &self, - query_request: RequestContent, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); - let mut query_builder = url.query_builder(); - query_builder.append_pair("comp", "query"); - if let Some(snapshot) = options.snapshot.as_ref() { - query_builder.set_pair("snapshot", snapshot); - } - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/octet-stream"); - request.insert_header("content-type", "application/xml"); - if let Some(if_match) = options.if_match.as_ref() { - request.insert_header("if-match", if_match); - } - if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); - } - if let Some(if_none_match) = options.if_none_match.as_ref() { - 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", to_rfc7231(&if_unmodified_since)); - } - if let Some(encryption_algorithm) = options.encryption_algorithm.as_ref() { - request.insert_header( - "x-ms-encryption-algorithm", - encryption_algorithm.to_string(), - ); - } - if let Some(encryption_key) = options.encryption_key.as_ref() { - request.insert_header("x-ms-encryption-key", encryption_key); - } - if let Some(encryption_key_sha256) = options.encryption_key_sha256.as_ref() { - request.insert_header("x-ms-encryption-key-sha256", encryption_key_sha256); - } - if let Some(if_tags) = options.if_tags.as_ref() { - request.insert_header("x-ms-if-tags", if_tags); - } - if let Some(lease_id) = options.lease_id.as_ref() { - request.insert_header("x-ms-lease-id", lease_id); - } - request.insert_header("x-ms-version", &self.version); - request.set_body(query_request); - let rsp = self - .pipeline - .stream( - &ctx, - &mut request, - Some(PipelineStreamOptions { - check_success: CheckSuccessOptions { - success_codes: &[200, 206], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - - /// The Stage Block operation creates a new block to be committed as part of a blob + /// The Stage Block From URL operation creates a new block to be committed as part of a blob where the contents are read from + /// a URL. /// /// # Arguments /// @@ -695,19 +422,19 @@ impl BlockBlobClient { /// or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the /// same size for each block. /// * `content_length` - The length of the request. - /// * `body` - The body of the request. + /// * `source_url` - Specify a URL to the copy source. /// * `options` - Optional parameters for the request. /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlockBlobClientStageBlockResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`BlockBlobClientStageBlockFromUrlResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlockBlobClientStageBlockResult, BlockBlobClientStageBlockResultHeaders}; + /// use blob_storage::models::{BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockFromUrlResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); @@ -723,28 +450,24 @@ impl BlockBlobClient { /// ``` /// /// ### Available headers - /// * [`content_md5`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::content_md5) - content-md5 - /// * [`content_crc64`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::content_crc64) - x-ms-content-crc64 - /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 - /// * [`encryption_scope`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::encryption_scope) - x-ms-encryption-scope - /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientStageBlockResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted + /// * [`content_md5`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::content_md5) - content-md5 + /// * [`content_crc64`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::content_crc64) - x-ms-content-crc64 + /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 + /// * [`encryption_scope`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::encryption_scope) - x-ms-encryption-scope + /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// - /// [`BlockBlobClientStageBlockResultHeaders`]: crate::generated::models::BlockBlobClientStageBlockResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.stageBlock")] - pub async fn stage_block( + /// [`BlockBlobClientStageBlockFromUrlResultHeaders`]: crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders + #[tracing::function("Storage.Blob.BlockBlobClient.stageBlockFromUrl")] + pub async fn stage_block_from_url( &self, block_id: &[u8], content_length: u64, - body: RequestContent, - options: Option>, - ) -> Result> { + source_url: String, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "block"); query_builder.set_pair("blockid", base64::encode(block_id)); @@ -754,15 +477,9 @@ impl BlockBlobClient { query_builder.build(); let mut request = Request::new(url, Method::Put); 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/octet-stream"); - 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-copy-source", source_url); + if let Some(copy_source_authorization) = options.copy_source_authorization.as_ref() { + request.insert_header("x-ms-copy-source-authorization", copy_source_authorization); } if let Some(encryption_algorithm) = options.encryption_algorithm.as_ref() { request.insert_header( @@ -779,11 +496,61 @@ impl BlockBlobClient { if let Some(encryption_scope) = options.encryption_scope.as_ref() { request.insert_header("x-ms-encryption-scope", encryption_scope); } + if let Some(file_request_intent) = options.file_request_intent.as_ref() { + request.insert_header("x-ms-file-request-intent", file_request_intent.to_string()); + } if let Some(lease_id) = options.lease_id.as_ref() { 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), + ); + } + if let Some(source_content_md5) = options.source_content_md5 { + request.insert_header( + "x-ms-source-content-md5", + base64::encode(source_content_md5), + ); + } + if let Some(source_encryption_algorithm) = options.source_encryption_algorithm.as_ref() { + request.insert_header( + "x-ms-source-encryption-algorithm", + source_encryption_algorithm.to_string(), + ); + } + if let Some(source_encryption_key) = options.source_encryption_key.as_ref() { + request.insert_header("x-ms-source-encryption-key", source_encryption_key); + } + if let Some(source_encryption_key_sha256) = options.source_encryption_key_sha256.as_ref() { + request.insert_header( + "x-ms-source-encryption-key-sha256", + source_encryption_key_sha256, + ); + } + if let Some(source_if_match) = options.source_if_match.as_ref() { + request.insert_header("x-ms-source-if-match", source_if_match); + } + if let Some(source_if_modified_since) = options.source_if_modified_since { + request.insert_header( + "x-ms-source-if-modified-since", + to_rfc7231(&source_if_modified_since), + ); + } + if let Some(source_if_none_match) = options.source_if_none_match.as_ref() { + request.insert_header("x-ms-source-if-none-match", source_if_none_match); + } + if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { + request.insert_header( + "x-ms-source-if-unmodified-since", + to_rfc7231(&source_if_unmodified_since), + ); + } + if let Some(source_range) = options.source_range.as_ref() { + request.insert_header("x-ms-source-range", source_range); + } request.insert_header("x-ms-version", &self.version); - request.set_body(body); let rsp = self .pipeline .send( @@ -800,82 +567,118 @@ impl BlockBlobClient { Ok(rsp.into()) } - /// The Stage Block From URL operation creates a new block to be committed as part of a blob where the contents are read from - /// a URL. + /// The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given URL. This + /// API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob from URL; the + /// content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blob’s + /// contents using a source URL, use the Put Block from URL API in conjunction with Put Block List. /// /// # Arguments /// - /// * `block_id` - A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than - /// or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the - /// same size for each block. - /// * `content_length` - The length of the request. - /// * `source_url` - Specify a URL to the copy source. + /// * `copy_source` - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that + /// specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must + /// either be public or must be authenticated via a shared access signature. /// * `options` - Optional parameters for the request. /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlockBlobClientStageBlockFromUrlResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`BlockBlobClientUploadBlobFromUrlResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockFromUrlResultHeaders}; + /// use blob_storage::models::{BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadBlobFromUrlResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); + /// if let Some(etag) = response.etag()? { + /// println!("etag: {:?}", etag); /// } - /// if let Some(content_crc64) = response.content_crc64()? { - /// println!("x-ms-content-crc64: {:?}", content_crc64); + /// if let Some(last_modified) = response.last_modified()? { + /// println!("last-modified: {:?}", last_modified); /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`content_md5`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::date) - date - /// * [`content_crc64`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::content_crc64) - x-ms-content-crc64 - /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 - /// * [`encryption_scope`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::encryption_scope) - x-ms-encryption-scope - /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted - /// - /// [`BlockBlobClientStageBlockFromUrlResultHeaders`]: crate::generated::models::BlockBlobClientStageBlockFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.stageBlockFromUrl")] - pub async fn stage_block_from_url( + /// * [`content_md5`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::content_md5) - content-md5 + /// * [`etag`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::etag) - etag + /// * [`last_modified`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::last_modified) - last-modified + /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 + /// * [`encryption_scope`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::encryption_scope) - x-ms-encryption-scope + /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted + /// * [`version_id`()](crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders::version_id) - x-ms-version-id + /// + /// [`BlockBlobClientUploadBlobFromUrlResultHeaders`]: crate::generated::models::BlockBlobClientUploadBlobFromUrlResultHeaders + #[tracing::function("Storage.Blob.BlockBlobClient.uploadBlobFromUrl")] + pub async fn upload_blob_from_url( &self, - block_id: &[u8], - content_length: u64, - source_url: String, - options: Option>, - ) -> Result> { + copy_source: String, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "block") - .append_key_only("fromURL"); - query_builder.set_pair("blockid", base64::encode(block_id)); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-length", content_length.to_string()); - request.insert_header("content-type", "application/xml"); - request.insert_header("x-ms-copy-source", source_url); + request.insert_header("content-length", "0"); + if let Some(transactional_content_md5) = options.transactional_content_md5 { + request.insert_header("content-md5", base64::encode(transactional_content_md5)); + } + if let Some(if_match) = options.if_match.as_ref() { + request.insert_header("if-match", if_match); + } + if let Some(if_modified_since) = options.if_modified_since { + request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); + } + if let Some(if_none_match) = options.if_none_match.as_ref() { + 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", to_rfc7231(&if_unmodified_since)); + } + if let Some(tier) = options.tier.as_ref() { + request.insert_header("x-ms-access-tier", tier.to_string()); + } + if let Some(blob_cache_control) = options.blob_cache_control.as_ref() { + request.insert_header("x-ms-blob-cache-control", blob_cache_control); + } + if let Some(blob_content_disposition) = options.blob_content_disposition.as_ref() { + request.insert_header("x-ms-blob-content-disposition", blob_content_disposition); + } + if let Some(blob_content_encoding) = options.blob_content_encoding.as_ref() { + request.insert_header("x-ms-blob-content-encoding", blob_content_encoding); + } + if let Some(blob_content_language) = options.blob_content_language.as_ref() { + 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)); + } + if let Some(blob_content_type) = options.blob_content_type.as_ref() { + request.insert_header("x-ms-blob-content-type", blob_content_type); + } + request.insert_header("x-ms-blob-type", "BlockBlob"); + request.insert_header("x-ms-copy-source", copy_source); if let Some(copy_source_authorization) = options.copy_source_authorization.as_ref() { request.insert_header("x-ms-copy-source-authorization", copy_source_authorization); } + if let Some(copy_source_blob_properties) = options.copy_source_blob_properties { + request.insert_header( + "x-ms-copy-source-blob-properties", + copy_source_blob_properties.to_string(), + ); + } + if let Some(copy_source_tags) = options.copy_source_tags.as_ref() { + request.insert_header("x-ms-copy-source-tag-option", copy_source_tags.to_string()); + } if let Some(encryption_algorithm) = options.encryption_algorithm.as_ref() { request.insert_header( "x-ms-encryption-algorithm", @@ -891,14 +694,19 @@ impl BlockBlobClient { if let Some(encryption_scope) = options.encryption_scope.as_ref() { request.insert_header("x-ms-encryption-scope", encryption_scope); } + if let Some(file_request_intent) = options.file_request_intent.as_ref() { + request.insert_header("x-ms-file-request-intent", file_request_intent.to_string()); + } + if let Some(if_tags) = options.if_tags.as_ref() { + request.insert_header("x-ms-if-tags", if_tags); + } if let Some(lease_id) = options.lease_id.as_ref() { 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), - ); + if let Some(metadata) = options.metadata.as_ref() { + for (k, v) in metadata { + request.insert_header(format!("x-ms-meta-{k}"), v); + } } if let Some(source_content_md5) = options.source_content_md5 { request.insert_header( @@ -906,6 +714,21 @@ impl BlockBlobClient { base64::encode(source_content_md5), ); } + if let Some(source_encryption_algorithm) = options.source_encryption_algorithm.as_ref() { + request.insert_header( + "x-ms-source-encryption-algorithm", + source_encryption_algorithm.to_string(), + ); + } + if let Some(source_encryption_key) = options.source_encryption_key.as_ref() { + request.insert_header("x-ms-source-encryption-key", source_encryption_key); + } + if let Some(source_encryption_key_sha256) = options.source_encryption_key_sha256.as_ref() { + request.insert_header( + "x-ms-source-encryption-key-sha256", + source_encryption_key_sha256, + ); + } if let Some(source_if_match) = options.source_if_match.as_ref() { request.insert_header("x-ms-source-if-match", source_if_match); } @@ -918,14 +741,17 @@ impl BlockBlobClient { if let Some(source_if_none_match) = options.source_if_none_match.as_ref() { request.insert_header("x-ms-source-if-none-match", source_if_none_match); } + if let Some(source_if_tags) = options.source_if_tags.as_ref() { + request.insert_header("x-ms-source-if-tags", source_if_tags); + } if let Some(source_if_unmodified_since) = options.source_if_unmodified_since { request.insert_header( "x-ms-source-if-unmodified-since", to_rfc7231(&source_if_unmodified_since), ); } - if let Some(source_range) = options.source_range.as_ref() { - request.insert_header("x-ms-source-range", source_range); + if let Some(blob_tags_string) = options.blob_tags_string.as_ref() { + request.insert_header("x-ms-tags", blob_tags_string); } request.insert_header("x-ms-version", &self.version); let rsp = self @@ -957,14 +783,14 @@ impl BlockBlobClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`BlockBlobClientUploadResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`BlockBlobClientUploadInternalResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{BlockBlobClientUploadResult, BlockBlobClientUploadResultHeaders}; + /// use blob_storage::models::{BlockBlobClientUploadInternalResult, BlockBlobClientUploadInternalResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); @@ -980,31 +806,26 @@ impl BlockBlobClient { /// ``` /// /// ### Available headers - /// * [`content_md5`()](crate::generated::models::BlockBlobClientUploadResultHeaders::content_md5) - content-md5 - /// * [`etag`()](crate::generated::models::BlockBlobClientUploadResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::BlockBlobClientUploadResultHeaders::last_modified) - last-modified - /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientUploadResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 - /// * [`encryption_scope`()](crate::generated::models::BlockBlobClientUploadResultHeaders::encryption_scope) - x-ms-encryption-scope - /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientUploadResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted - /// * [`version_id`()](crate::generated::models::BlockBlobClientUploadResultHeaders::version_id) - x-ms-version-id - /// - /// [`BlockBlobClientUploadResultHeaders`]: crate::generated::models::BlockBlobClientUploadResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.BlockBlob.upload")] - pub async fn upload( + /// * [`content_md5`()](crate::generated::models::BlockBlobClientUploadInternalResultHeaders::content_md5) - content-md5 + /// * [`etag`()](crate::generated::models::BlockBlobClientUploadInternalResultHeaders::etag) - etag + /// * [`last_modified`()](crate::generated::models::BlockBlobClientUploadInternalResultHeaders::last_modified) - last-modified + /// * [`encryption_key_sha256`()](crate::generated::models::BlockBlobClientUploadInternalResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 + /// * [`encryption_scope`()](crate::generated::models::BlockBlobClientUploadInternalResultHeaders::encryption_scope) - x-ms-encryption-scope + /// * [`is_server_encrypted`()](crate::generated::models::BlockBlobClientUploadInternalResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted + /// * [`version_id`()](crate::generated::models::BlockBlobClientUploadInternalResultHeaders::version_id) - x-ms-version-id + /// + /// [`BlockBlobClientUploadInternalResultHeaders`]: crate::generated::models::BlockBlobClientUploadInternalResultHeaders + #[tracing::function("Storage.Blob.BlockBlobClient.upload")] + pub async fn upload_internal( &self, body: RequestContent, content_length: u64, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder.append_key_only("BlockBlob"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } @@ -1048,7 +869,7 @@ impl BlockBlobClient { if let Some(blob_content_type) = options.blob_content_type.as_ref() { request.insert_header("x-ms-blob-content-type", blob_content_type); } - request.insert_header("x-ms-blob-type", BlobType::BlockBlob.to_string()); + request.insert_header("x-ms-blob-type", "BlockBlob"); if let Some(transactional_content_crc64) = options.transactional_content_crc64 { request.insert_header( "x-ms-content-crc64", @@ -1096,6 +917,15 @@ impl BlockBlobClient { request.insert_header(format!("x-ms-meta-{k}"), v); } } + if let Some(structured_body_type) = options.structured_body_type.as_ref() { + 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.as_ref() { request.insert_header("x-ms-tags", blob_tags_string); } @@ -1122,7 +952,7 @@ impl Default for BlockBlobClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2026-04-06"), } } } diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/page_blob_client.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/page_blob_client.rs index 40bb74d60..038e848be 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/page_blob_client.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/clients/page_blob_client.rs @@ -4,35 +4,27 @@ // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. use crate::generated::models::{ - BlobType, PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, - PageBlobClientCopyIncrementalOptions, PageBlobClientCopyIncrementalResult, - PageBlobClientCreateOptions, PageBlobClientCreateResult, - PageBlobClientGetPageRangesDiffOptions, PageBlobClientGetPageRangesOptions, - PageBlobClientResizeOptions, PageBlobClientResizeResult, - PageBlobClientUpdateSequenceNumberOptions, PageBlobClientUpdateSequenceNumberResult, - PageBlobClientUploadPagesFromUrlOptions, PageBlobClientUploadPagesFromUrlResult, - PageBlobClientUploadPagesOptions, PageBlobClientUploadPagesResult, PageList, - SequenceNumberActionType, + PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult, PageBlobClientCreateOptions, + PageBlobClientCreateResult, PageBlobClientGetPageRangesOptions, PageBlobClientResizeOptions, + PageBlobClientResizeResult, PageBlobClientSetSequenceNumberOptions, + PageBlobClientSetSequenceNumberResult, PageBlobClientUploadPagesFromUrlOptions, + PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesOptions, + PageBlobClientUploadPagesResult, PageList, SequenceNumberActionType, }; use azure_core::{ base64, - credentials::TokenCredential, error::CheckSuccessOptions, fmt::SafeDebug, http::{ - policies::{auth::BearerTokenAuthorizationPolicy, Policy}, ClientOptions, Method, NoFormat, Pipeline, PipelineSendOptions, Request, RequestContent, Response, Url, UrlExt, XmlFormat, }, time::to_rfc7231, tracing, Bytes, Result, }; -use std::sync::Arc; #[tracing::client] pub struct PageBlobClient { - pub(crate) blob_name: String, - pub(crate) container_name: String, pub(crate) endpoint: Url, pub(crate) pipeline: Pipeline, pub(crate) version: String, @@ -48,52 +40,6 @@ pub struct PageBlobClientOptions { } impl PageBlobClient { - /// Creates a new PageBlobClient, using Entra ID authentication. - /// - /// # Arguments - /// - /// * `endpoint` - Service host - /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an - /// Entra ID token to use when authenticating. - /// * `container_name` - The name of the container. - /// * `blob_name` - The name of the blob. - /// * `options` - Optional configuration for the client. - #[tracing::new("Storage.Blob.Container.Blob.PageBlob")] - pub fn new( - endpoint: &str, - credential: Arc, - container_name: String, - blob_name: String, - options: Option, - ) -> Result { - let options = options.unwrap_or_default(); - let endpoint = Url::parse(endpoint)?; - if !endpoint.scheme().starts_with("http") { - return Err(azure_core::Error::with_message( - azure_core::error::ErrorKind::Other, - format!("{endpoint} must use http(s)"), - )); - } - let auth_policy: Arc = Arc::new(BearerTokenAuthorizationPolicy::new( - credential, - vec!["https://storage.azure.com/.default"], - )); - Ok(Self { - blob_name, - container_name, - endpoint, - version: options.version, - pipeline: Pipeline::new( - option_env!("CARGO_PKG_NAME"), - option_env!("CARGO_PKG_VERSION"), - options.client_options, - Vec::default(), - vec![auth_policy], - None, - ), - }) - } - /// Returns the Url associated with this client. pub fn endpoint(&self) -> &Url { &self.endpoint @@ -103,7 +49,7 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `content_length` - The length of the request. + /// * `range` - Bytes of data in the specified range. /// * `options` - Optional parameters for the request. /// /// ## Response Headers @@ -120,48 +66,41 @@ impl PageBlobClient { /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } + /// if let Some(last_modified) = response.last_modified()? { + /// println!("last-modified: {:?}", last_modified); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers /// * [`content_md5`()](crate::generated::models::PageBlobClientClearPagesResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::PageBlobClientClearPagesResultHeaders::date) - date /// * [`etag`()](crate::generated::models::PageBlobClientClearPagesResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::PageBlobClientClearPagesResultHeaders::last_modified) - last-modified /// * [`blob_sequence_number`()](crate::generated::models::PageBlobClientClearPagesResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number /// * [`content_crc64`()](crate::generated::models::PageBlobClientClearPagesResultHeaders::content_crc64) - x-ms-content-crc64 /// /// [`PageBlobClientClearPagesResultHeaders`]: crate::generated::models::PageBlobClientClearPagesResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.clearPages")] + #[tracing::function("Storage.Blob.PageBlobClient.clearPages")] pub async fn clear_pages( &self, - content_length: u64, + range: String, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_key_only("clear") - .append_pair("comp", "page"); + query_builder.append_pair("comp", "page"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-length", content_length.to_string()); + request.insert_header("content-length", "0"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -174,6 +113,7 @@ impl PageBlobClient { if let Some(if_unmodified_since) = options.if_unmodified_since { request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } + request.insert_header("range", range); if let Some(encryption_algorithm) = options.encryption_algorithm.as_ref() { request.insert_header( "x-ms-encryption-algorithm", @@ -215,9 +155,7 @@ impl PageBlobClient { if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } - if let Some(range) = options.range.as_ref() { - request.insert_header("x-ms-range", range); - } + request.insert_header("x-ms-page-write", "clear"); request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -235,111 +173,12 @@ impl PageBlobClient { Ok(rsp.into()) } - /// The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot is copied - /// such that only the differential changes between the previously copied snapshot are transferred to the destination. The - /// copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. This API is supported - /// since REST version 2016-05-31. - /// - /// # Arguments - /// - /// * `copy_source` - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that - /// specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must - /// either be public or must be authenticated via a shared access signature. - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`PageBlobClientCopyIncrementalResultHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{PageBlobClientCopyIncrementalResult, PageBlobClientCopyIncrementalResultHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// if let Some(etag) = response.etag()? { - /// println!("etag: {:?}", etag); - /// } - /// if let Some(last_modified) = response.last_modified()? { - /// println!("last-modified: {:?}", last_modified); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::PageBlobClientCopyIncrementalResultHeaders::date) - date - /// * [`etag`()](crate::generated::models::PageBlobClientCopyIncrementalResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::PageBlobClientCopyIncrementalResultHeaders::last_modified) - last-modified - /// * [`copy_id`()](crate::generated::models::PageBlobClientCopyIncrementalResultHeaders::copy_id) - x-ms-copy-id - /// * [`copy_status`()](crate::generated::models::PageBlobClientCopyIncrementalResultHeaders::copy_status) - x-ms-copy-status - /// - /// [`PageBlobClientCopyIncrementalResultHeaders`]: crate::generated::models::PageBlobClientCopyIncrementalResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.copyIncremental")] - pub async fn copy_incremental( - &self, - copy_source: String, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); - let mut query_builder = url.query_builder(); - query_builder.append_pair("comp", "incrementalcopy"); - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); - if let Some(if_match) = options.if_match.as_ref() { - request.insert_header("if-match", if_match); - } - if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); - } - if let Some(if_none_match) = options.if_none_match.as_ref() { - 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", to_rfc7231(&if_unmodified_since)); - } - request.insert_header("x-ms-copy-source", copy_source); - if let Some(if_tags) = options.if_tags.as_ref() { - request.insert_header("x-ms-if-tags", if_tags); - } - request.insert_header("x-ms-version", &self.version); - let rsp = self - .pipeline - .send( - &ctx, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[202], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - /// The Create operation creates a new page blob. /// /// # 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. + /// * `size` - 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. /// /// ## Response Headers @@ -356,19 +195,18 @@ impl PageBlobClient { /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } + /// if let Some(last_modified) = response.last_modified()? { + /// println!("last-modified: {:?}", last_modified); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers /// * [`content_md5`()](crate::generated::models::PageBlobClientCreateResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::PageBlobClientCreateResultHeaders::date) - date /// * [`etag`()](crate::generated::models::PageBlobClientCreateResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::PageBlobClientCreateResultHeaders::last_modified) - last-modified /// * [`encryption_key_sha256`()](crate::generated::models::PageBlobClientCreateResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 @@ -377,28 +215,22 @@ impl PageBlobClient { /// * [`version_id`()](crate::generated::models::PageBlobClientCreateResultHeaders::version_id) - x-ms-version-id /// /// [`PageBlobClientCreateResultHeaders`]: crate::generated::models::PageBlobClientCreateResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.create")] + #[tracing::function("Storage.Blob.PageBlobClient.create")] pub async fn create( &self, - content_length: u64, - blob_content_length: u64, + size: u64, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder.append_key_only("PageBlob"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-length", content_length.to_string()); + request.insert_header("content-length", "0"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -426,7 +258,7 @@ impl PageBlobClient { if let Some(blob_content_language) = options.blob_content_language.as_ref() { request.insert_header("x-ms-blob-content-language", blob_content_language); } - request.insert_header("x-ms-blob-content-length", blob_content_length.to_string()); + request.insert_header("x-ms-blob-content-length", size.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)); } @@ -439,7 +271,7 @@ impl PageBlobClient { blob_sequence_number.to_string(), ); } - request.insert_header("x-ms-blob-type", BlobType::PageBlob.to_string()); + request.insert_header("x-ms-blob-type", "PageBlob"); if let Some(encryption_algorithm) = options.encryption_algorithm.as_ref() { request.insert_header( "x-ms-encryption-algorithm", @@ -518,27 +350,26 @@ impl PageBlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(blob_content_length) = response.blob_content_length()? { + /// println!("x-ms-blob-content-length: {:?}", blob_content_length); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::PageListHeaders::date) - date /// * [`etag`()](crate::generated::models::PageListHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::PageListHeaders::last_modified) - last-modified /// * [`blob_content_length`()](crate::generated::models::PageListHeaders::blob_content_length) - x-ms-blob-content-length /// /// [`PageListHeaders`]: crate::generated::models::PageListHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.getPageRanges")] + #[tracing::function("Storage.Blob.PageBlobClient.getPageRanges")] pub async fn get_page_ranges( &self, options: Option>, @@ -546,10 +377,6 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); query_builder.append_pair("comp", "pagelist"); if let Some(marker) = options.marker.as_ref() { @@ -567,7 +394,6 @@ impl PageBlobClient { query_builder.build(); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -580,115 +406,8 @@ impl PageBlobClient { if let Some(if_unmodified_since) = options.if_unmodified_since { request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } - if let Some(if_tags) = options.if_tags.as_ref() { - request.insert_header("x-ms-if-tags", if_tags); - } - if let Some(lease_id) = options.lease_id.as_ref() { - request.insert_header("x-ms-lease-id", lease_id); - } if let Some(range) = options.range.as_ref() { - request.insert_header("x-ms-range", range); - } - request.insert_header("x-ms-version", &self.version); - let rsp = self - .pipeline - .send( - &ctx, - &mut request, - Some(PipelineSendOptions { - check_success: CheckSuccessOptions { - success_codes: &[200], - }, - ..Default::default() - }), - ) - .await?; - Ok(rsp.into()) - } - - /// The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob or snapshot of a page blob. - /// - /// # Arguments - /// - /// * `options` - Optional parameters for the request. - /// - /// ## Response Headers - /// - /// The returned [`Response`](azure_core::http::Response) implements the [`PageListHeaders`] trait, which provides - /// access to response headers. For example: - /// - /// ```no_run - /// use azure_core::{Result, http::{Response, XmlFormat}}; - /// use blob_storage::models::{PageList, PageListHeaders}; - /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); - /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } - /// if let Some(etag) = response.etag()? { - /// println!("etag: {:?}", etag); - /// } - /// if let Some(last_modified) = response.last_modified()? { - /// println!("last-modified: {:?}", last_modified); - /// } - /// Ok(()) - /// } - /// ``` - /// - /// ### Available headers - /// * [`date`()](crate::generated::models::PageListHeaders::date) - date - /// * [`etag`()](crate::generated::models::PageListHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::PageListHeaders::last_modified) - last-modified - /// * [`blob_content_length`()](crate::generated::models::PageListHeaders::blob_content_length) - x-ms-blob-content-length - /// - /// [`PageListHeaders`]: crate::generated::models::PageListHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.getPageRangesDiff")] - pub async fn get_page_ranges_diff( - &self, - options: Option>, - ) -> Result> { - let options = options.unwrap_or_default(); - let ctx = options.method_options.context.to_borrowed(); - let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); - let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "pagelist") - .append_key_only("diff"); - if let Some(marker) = options.marker.as_ref() { - query_builder.set_pair("marker", marker); - } - if let Some(maxresults) = options.maxresults { - query_builder.set_pair("maxresults", maxresults.to_string()); - } - if let Some(prevsnapshot) = options.prevsnapshot.as_ref() { - query_builder.set_pair("prevsnapshot", prevsnapshot); - } - if let Some(snapshot) = options.snapshot.as_ref() { - query_builder.set_pair("snapshot", snapshot); - } - if let Some(timeout) = options.timeout { - query_builder.set_pair("timeout", timeout.to_string()); - } - query_builder.build(); - let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/xml"); - request.insert_header("content-type", "application/xml"); - if let Some(if_match) = options.if_match.as_ref() { - request.insert_header("if-match", if_match); - } - if let Some(if_modified_since) = options.if_modified_since { - request.insert_header("if-modified-since", to_rfc7231(&if_modified_since)); - } - if let Some(if_none_match) = options.if_none_match.as_ref() { - 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", to_rfc7231(&if_unmodified_since)); + request.insert_header("range", range); } if let Some(if_tags) = options.if_tags.as_ref() { request.insert_header("x-ms-if-tags", if_tags); @@ -696,12 +415,6 @@ impl PageBlobClient { if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } - if let Some(prev_snapshot_url) = options.prev_snapshot_url.as_ref() { - request.insert_header("x-ms-previous-snapshot-url", prev_snapshot_url); - } - if let Some(range) = options.range.as_ref() { - request.insert_header("x-ms-range", range); - } request.insert_header("x-ms-version", &self.version); let rsp = self .pipeline @@ -723,8 +436,8 @@ impl PageBlobClient { /// /// # Arguments /// - /// * `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. + /// * `size` - 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. /// /// ## Response Headers @@ -738,49 +451,41 @@ impl PageBlobClient { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(blob_sequence_number) = response.blob_sequence_number()? { + /// println!("x-ms-blob-sequence-number: {:?}", blob_sequence_number); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::PageBlobClientResizeResultHeaders::date) - date /// * [`etag`()](crate::generated::models::PageBlobClientResizeResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::PageBlobClientResizeResultHeaders::last_modified) - last-modified /// * [`blob_sequence_number`()](crate::generated::models::PageBlobClientResizeResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number /// /// [`PageBlobClientResizeResultHeaders`]: crate::generated::models::PageBlobClientResizeResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.resize")] + #[tracing::function("Storage.Blob.PageBlobClient.resize")] pub async fn resize( &self, - blob_content_length: u64, + size: u64, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_key_only("Resize") - .append_pair("comp", "properties"); + query_builder.append_pair("comp", "properties"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -793,7 +498,7 @@ impl PageBlobClient { if let Some(if_unmodified_since) = options.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()); + request.insert_header("x-ms-blob-content-length", size.to_string()); if let Some(encryption_algorithm) = options.encryption_algorithm.as_ref() { request.insert_header( "x-ms-encryption-algorithm", @@ -843,58 +548,50 @@ impl PageBlobClient { /// /// ## Response Headers /// - /// The returned [`Response`](azure_core::http::Response) implements the [`PageBlobClientUpdateSequenceNumberResultHeaders`] trait, which provides + /// The returned [`Response`](azure_core::http::Response) implements the [`PageBlobClientSetSequenceNumberResultHeaders`] trait, which provides /// access to response headers. For example: /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; - /// use blob_storage::models::{PageBlobClientUpdateSequenceNumberResult, PageBlobClientUpdateSequenceNumberResultHeaders}; + /// use blob_storage::models::{PageBlobClientSetSequenceNumberResult, PageBlobClientSetSequenceNumberResultHeaders}; /// async fn example() -> Result<()> { - /// let response: Response = unimplemented!(); + /// let response: Response = unimplemented!(); /// // Access response headers - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } + /// if let Some(blob_sequence_number) = response.blob_sequence_number()? { + /// println!("x-ms-blob-sequence-number: {:?}", blob_sequence_number); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers - /// * [`date`()](crate::generated::models::PageBlobClientUpdateSequenceNumberResultHeaders::date) - date - /// * [`etag`()](crate::generated::models::PageBlobClientUpdateSequenceNumberResultHeaders::etag) - etag - /// * [`last_modified`()](crate::generated::models::PageBlobClientUpdateSequenceNumberResultHeaders::last_modified) - last-modified - /// * [`blob_sequence_number`()](crate::generated::models::PageBlobClientUpdateSequenceNumberResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number + /// * [`etag`()](crate::generated::models::PageBlobClientSetSequenceNumberResultHeaders::etag) - etag + /// * [`last_modified`()](crate::generated::models::PageBlobClientSetSequenceNumberResultHeaders::last_modified) - last-modified + /// * [`blob_sequence_number`()](crate::generated::models::PageBlobClientSetSequenceNumberResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number /// - /// [`PageBlobClientUpdateSequenceNumberResultHeaders`]: crate::generated::models::PageBlobClientUpdateSequenceNumberResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.updateSequenceNumber")] - pub async fn update_sequence_number( + /// [`PageBlobClientSetSequenceNumberResultHeaders`]: crate::generated::models::PageBlobClientSetSequenceNumberResultHeaders + #[tracing::function("Storage.Blob.PageBlobClient.setSequenceNumber")] + pub async fn set_sequence_number( &self, sequence_number_action: SequenceNumberActionType, - options: Option>, - ) -> Result> { + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_key_only("UpdateSequenceNumber") - .append_pair("comp", "properties"); + query_builder.append_pair("comp", "properties"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } query_builder.build(); let mut request = Request::new(url, Method::Put); - request.insert_header("content-type", "application/xml"); if let Some(if_match) = options.if_match.as_ref() { request.insert_header("if-match", if_match); } @@ -946,6 +643,7 @@ 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. /// /// ## Response Headers @@ -962,19 +660,18 @@ impl PageBlobClient { /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } + /// if let Some(last_modified) = response.last_modified()? { + /// println!("last-modified: {:?}", last_modified); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers /// * [`content_md5`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::date) - date /// * [`etag`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::last_modified) - last-modified /// * [`blob_sequence_number`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number @@ -982,27 +679,21 @@ impl PageBlobClient { /// * [`encryption_key_sha256`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::encryption_key_sha256) - x-ms-encryption-key-sha256 /// * [`encryption_scope`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::encryption_scope) - x-ms-encryption-scope /// * [`is_server_encrypted`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted - /// * [`structured_body_type`()](crate::generated::models::PageBlobClientUploadPagesResultHeaders::structured_body_type) - x-ms-structured-body /// /// [`PageBlobClientUploadPagesResultHeaders`]: crate::generated::models::PageBlobClientUploadPagesResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.uploadPages")] + #[tracing::function("Storage.Blob.PageBlobClient.uploadPages")] pub async fn upload_pages( &self, body: RequestContent, content_length: u64, + range: String, options: Option>, ) -> Result> { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "page") - .append_key_only("update"); + query_builder.append_pair("comp", "page"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } @@ -1025,6 +716,7 @@ impl PageBlobClient { if let Some(if_unmodified_since) = options.if_unmodified_since { request.insert_header("if-unmodified-since", to_rfc7231(&if_unmodified_since)); } + request.insert_header("range", range); if let Some(transactional_content_crc64) = options.transactional_content_crc64 { request.insert_header( "x-ms-content-crc64", @@ -1072,9 +764,7 @@ impl PageBlobClient { if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } - if let Some(range) = options.range.as_ref() { - request.insert_header("x-ms-range", range); - } + request.insert_header("x-ms-page-write", "update"); if let Some(structured_body_type) = options.structured_body_type.as_ref() { request.insert_header("x-ms-structured-body", structured_body_type); } @@ -1128,19 +818,18 @@ impl PageBlobClient { /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } - /// if let Some(date) = response.date()? { - /// println!("date: {:?}", date); - /// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } + /// if let Some(last_modified) = response.last_modified()? { + /// println!("last-modified: {:?}", last_modified); + /// } /// Ok(()) /// } /// ``` /// /// ### Available headers /// * [`content_md5`()](crate::generated::models::PageBlobClientUploadPagesFromUrlResultHeaders::content_md5) - content-md5 - /// * [`date`()](crate::generated::models::PageBlobClientUploadPagesFromUrlResultHeaders::date) - date /// * [`etag`()](crate::generated::models::PageBlobClientUploadPagesFromUrlResultHeaders::etag) - etag /// * [`last_modified`()](crate::generated::models::PageBlobClientUploadPagesFromUrlResultHeaders::last_modified) - last-modified /// * [`blob_sequence_number`()](crate::generated::models::PageBlobClientUploadPagesFromUrlResultHeaders::blob_sequence_number) - x-ms-blob-sequence-number @@ -1150,7 +839,7 @@ impl PageBlobClient { /// * [`is_server_encrypted`()](crate::generated::models::PageBlobClientUploadPagesFromUrlResultHeaders::is_server_encrypted) - x-ms-request-server-encrypted /// /// [`PageBlobClientUploadPagesFromUrlResultHeaders`]: crate::generated::models::PageBlobClientUploadPagesFromUrlResultHeaders - #[tracing::function("Storage.Blob.Container.Blob.PageBlob.uploadPagesFromUrl")] + #[tracing::function("Storage.Blob.PageBlobClient.uploadPagesFromUrl")] pub async fn upload_pages_from_url( &self, source_url: String, @@ -1162,15 +851,8 @@ impl PageBlobClient { let options = options.unwrap_or_default(); let ctx = options.method_options.context.to_borrowed(); let mut url = self.endpoint.clone(); - let mut path = String::from("/{containerName}/{blobName}"); - path = path.replace("{blobName}", &self.blob_name); - path = path.replace("{containerName}", &self.container_name); - url.append_path(&path); let mut query_builder = url.query_builder(); - query_builder - .append_pair("comp", "page") - .append_key_only("fromUrl") - .append_key_only("update"); + query_builder.append_pair("comp", "page"); if let Some(timeout) = options.timeout { query_builder.set_pair("timeout", timeout.to_string()); } @@ -1208,6 +890,9 @@ impl PageBlobClient { if let Some(encryption_scope) = options.encryption_scope.as_ref() { request.insert_header("x-ms-encryption-scope", encryption_scope); } + if let Some(file_request_intent) = options.file_request_intent.as_ref() { + 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", @@ -1234,6 +919,7 @@ impl PageBlobClient { if let Some(lease_id) = options.lease_id.as_ref() { request.insert_header("x-ms-lease-id", lease_id); } + 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( @@ -1247,6 +933,21 @@ impl PageBlobClient { base64::encode(source_content_md5), ); } + if let Some(source_encryption_algorithm) = options.source_encryption_algorithm.as_ref() { + request.insert_header( + "x-ms-source-encryption-algorithm", + source_encryption_algorithm.to_string(), + ); + } + if let Some(source_encryption_key) = options.source_encryption_key.as_ref() { + request.insert_header("x-ms-source-encryption-key", source_encryption_key); + } + if let Some(source_encryption_key_sha256) = options.source_encryption_key_sha256.as_ref() { + request.insert_header( + "x-ms-source-encryption-key-sha256", + source_encryption_key_sha256, + ); + } if let Some(source_if_match) = options.source_if_match.as_ref() { request.insert_header("x-ms-source-if-match", source_if_match); } @@ -1288,7 +989,7 @@ impl Default for PageBlobClientOptions { fn default() -> Self { Self { client_options: ClientOptions::default(), - version: String::from("2025-01-05"), + version: String::from("2026-04-06"), } } } diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums.rs index 7b9823c85..9e07b58d7 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums.rs @@ -59,7 +59,7 @@ pub enum AccessTier { } /// The account kind. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum AccountKind { /// The storage account is a blob storage account. BlobStorage, @@ -75,9 +75,6 @@ pub enum AccountKind { /// The storage account is a storage V2 account. StorageV2, - - /// Any other value not defined in `AccountKind`. - UnknownValue(String), } /// The archive status. @@ -96,53 +93,25 @@ pub enum ArchiveStatus { UnknownValue(String), } +/// The blob copy source tags types. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum BlobCopySourceTags { + /// The copy blob source tags option. + Copy, + + /// The replace blob source tags option. + Replace, +} + /// The type of blob deletions. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum BlobDeleteType { /// Permanently delete the blob. Permanent, - - /// Any other value not defined in `BlobDeleteType`. - UnknownValue(String), -} - -/// The blob expiration options. -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum BlobExpiryOptions { - /// Absolute time. - Absolute, - - /// Never expire. - NeverExpire, - - /// Relative to creation time. - RelativeToCreation, - - /// Relative to now. - RelativeToNow, - - /// Any other value not defined in `BlobExpiryOptions`. - UnknownValue(String), -} - -/// The immutability policy mode. -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum BlobImmutabilityPolicyMode { - /// The immutability policy is locked. - Locked, - - /// The immutability policy is mutable. - Mutable, - - /// The immutability policy is unlocked. - Unlocked, - - /// Any other value not defined in `BlobImmutabilityPolicyMode`. - UnknownValue(String), } /// The blob type. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum BlobType { /// The blob is an append blob. AppendBlob, @@ -152,13 +121,10 @@ pub enum BlobType { /// The blob is a page blob. PageBlob, - - /// Any other value not defined in `BlobType`. - UnknownValue(String), } /// The block list types. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum BlockListType { /// Both lists together. All, @@ -168,13 +134,10 @@ pub enum BlockListType { /// The list of uncommitted blocks. Uncommitted, - - /// Any other value not defined in `BlockListType`. - UnknownValue(String), } /// The copy status. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum CopyStatus { /// The copy operation is aborted. Aborted, @@ -187,46 +150,44 @@ pub enum CopyStatus { /// The copy operation succeeded. Success, - - /// Any other value not defined in `CopyStatus`. - UnknownValue(String), } /// The delete snapshots option type. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum DeleteSnapshotsOptionType { /// The delete snapshots include option is include. Include, /// The delete snapshots include option is only. Only, - - /// Any other value not defined in `DeleteSnapshotsOptionType`. - UnknownValue(String), } /// The algorithm used to produce the encryption key hash. Currently, the only accepted value is \"AES256\". Must be provided /// if the x-ms-encryption-key header is provided. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum EncryptionAlgorithmType { /// The AES256 encryption algorithm. Aes256, +} + +/// The file share token intent types. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum FileShareTokenIntent { + /// The file share token intent is backup. + Backup, - /// Any other value not defined in `EncryptionAlgorithmType`. + /// Any other value not defined in `FileShareTokenIntent`. UnknownValue(String), } /// The filter blobs includes. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum FilterBlobsIncludeItem { /// The filter includes no versions. None, /// The filter includes n versions. Versions, - - /// Any other value not defined in `FilterBlobsIncludeItem`. - UnknownValue(String), } /// The geo replication status. @@ -245,21 +206,31 @@ pub enum GeoReplicationStatusType { UnknownValue(String), } +/// The immutability policy mode used in requests and responses. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum ImmutabilityPolicyMode { + /// The immutability policy is locked. + Locked, + + /// The immutability policy is mutable. Should never be set, only returned. + Mutable, + + /// The immutability policy is unlocked. + Unlocked, +} + /// The lease duration. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum LeaseDuration { /// The lease is of fixed duration. Fixed, /// The lease is of infinite duration. Infinite, - - /// Any other value not defined in `LeaseDuration`. - UnknownValue(String), } /// The lease state. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum LeaseState { /// The lease is available. Available, @@ -275,26 +246,20 @@ pub enum LeaseState { /// The lease is currently leased. Leased, - - /// Any other value not defined in `LeaseState`. - UnknownValue(String), } /// The lease status. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum LeaseStatus { /// The lease is locked. Locked, /// The lease is unlocked. Unlocked, - - /// Any other value not defined in `LeaseStatus`. - UnknownValue(String), } /// The list blob includes parameter values. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum ListBlobsIncludeItem { /// The include copies. Copy, @@ -325,13 +290,10 @@ pub enum ListBlobsIncludeItem { /// The include versions. Versions, - - /// Any other value not defined in `ListBlobsIncludeItem`. - UnknownValue(String), } /// Include this parameter to specify that the container's metadata be returned as part of the response body. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum ListContainersIncludeType { /// Include deleted Deleted, @@ -341,9 +303,6 @@ pub enum ListContainersIncludeType { /// Include system System, - - /// Any other value not defined in `ListContainersIncludeType`. - UnknownValue(String), } /// The premium page blob access tier types. @@ -399,35 +358,6 @@ pub enum PublicAccessType { UnknownValue(String), } -/// The query request, note only SQL supported -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum QueryRequestType { - /// The SQL request query type. - Sql, - - /// Any other value not defined in `QueryRequestType`. - UnknownValue(String), -} - -/// The query format type. -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum QueryType { - /// The query format type is Apache Arrow. - Arrow, - - /// The query format type is delimited. - Delimited, - - /// The query format type is JSON. - Json, - - /// The query format type is Parquet. - Parquet, - - /// Any other value not defined in `QueryType`. - UnknownValue(String), -} - /// If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High /// and Standard. #[derive(Clone, Debug, Eq, PartialEq)] @@ -443,7 +373,7 @@ pub enum RehydratePriority { } /// The sequence number actions. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum SequenceNumberActionType { /// Increment the sequence number. Increment, @@ -453,29 +383,378 @@ pub enum SequenceNumberActionType { /// Update the sequence number. Update, - - /// Any other value not defined in `SequenceNumberActionType`. - UnknownValue(String), } /// The SKU types -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum SkuName { /// The premium LRS SKU. PremiumLrs, + /// The premium ZRS SKU. + PremiumZrs, + /// The standard GRS SKU. StandardGrs, + /// The standard GZRS SKU. + StandardGzrs, + /// The standard LRS SKU. StandardLrs, /// The standard RAGRS SKU. StandardRagrs, + /// The standard RAGZRS SKU. + StandardRagzrs, + /// The standard ZRS SKU. StandardZrs, +} + +/// Error codes returned by the Azure Blob Storage service. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum StorageErrorCode { + /// Account already exists. + AccountAlreadyExists, + + /// Account is being created. + AccountBeingCreated, + + /// Account is disabled. + AccountIsDisabled, + + /// Append position condition not met. + AppendPositionConditionNotMet, + + /// Authentication failed. + AuthenticationFailed, + + /// Authorization failure. + AuthorizationFailure, + + /// Authorization permission mismatch. + AuthorizationPermissionMismatch, + + /// Authorization protocol mismatch. + AuthorizationProtocolMismatch, + + /// Authorization resource type mismatch. + AuthorizationResourceTypeMismatch, + + /// Authorization service mismatch. + AuthorizationServiceMismatch, + + /// Authorization source IP mismatch. + AuthorizationSourceIPMismatch, + + /// Blob access tier not supported for account type. + BlobAccessTierNotSupportedForAccountType, + + /// Blob already exists. + BlobAlreadyExists, + + /// Blob archived. + BlobArchived, + + /// Blob being rehydrated. + BlobBeingRehydrated, + + /// Blob is immutable due to policy. + BlobImmutableDueToPolicy, + + /// Blob not archived. + BlobNotArchived, + + /// Blob not found. + BlobNotFound, + + /// Blob overwritten. + BlobOverwritten, + + /// Blob tier inadequate for content length. + BlobTierInadequateForContentLength, + + /// Blob uses customer specified encryption. + BlobUsesCustomerSpecifiedEncryption, + + /// Block count exceeds limit. + BlockCountExceedsLimit, + + /// Block list too long. + BlockListTooLong, + + /// Cannot change to lower tier. + CannotChangeToLowerTier, + + /// Cannot verify copy source. + CannotVerifyCopySource, + + /// Condition headers not supported. + ConditionHeadersNotSupported, + + /// Condition not met. + ConditionNotMet, + + /// Container already exists. + ContainerAlreadyExists, + + /// Container being deleted. + ContainerBeingDeleted, + + /// Container disabled. + ContainerDisabled, + + /// Container not found. + ContainerNotFound, + + /// Content length larger than tier limit. + ContentLengthLargerThanTierLimit, + + /// Copy across accounts not supported. + CopyAcrossAccountsNotSupported, + + /// Copy ID mismatch. + CopyIdMismatch, + + /// Empty metadata key. + EmptyMetadataKey, + + /// Feature version mismatch. + FeatureVersionMismatch, + + /// Incremental copy blob mismatch. + IncrementalCopyBlobMismatch, + + /// Incremental copy of earlier version snapshot not allowed. + IncrementalCopyOfEarlierVersionSnapshotNotAllowed, + + /// Incremental copy source must be snapshot. + IncrementalCopySourceMustBeSnapshot, + + /// Infinite lease duration required. + InfiniteLeaseDurationRequired, + + /// Insufficient account permissions. + InsufficientAccountPermissions, + + /// Internal error. + InternalError, + + /// Invalid authentication information. + InvalidAuthenticationInfo, + + /// Invalid blob or block. + InvalidBlobOrBlock, + + /// Invalid blob tier. + InvalidBlobTier, + + /// Invalid blob type. + InvalidBlobType, + + /// Invalid block ID. + InvalidBlockId, + + /// Invalid block list. + InvalidBlockList, + + /// Invalid header value. + InvalidHeaderValue, + + /// Invalid HTTP verb. + InvalidHttpVerb, + + /// Invalid input. + InvalidInput, + + /// Invalid MD5. + InvalidMd5, + + /// Invalid metadata. + InvalidMetadata, + + /// Invalid operation. + InvalidOperation, + + /// Invalid page range. + InvalidPageRange, + + /// Invalid query parameter value. + InvalidQueryParameterValue, + + /// Invalid range. + InvalidRange, + + /// Invalid request URL. + InvalidRequestUrl, + + /// Invalid source blob type. + InvalidSourceBlobType, + + /// Invalid source blob URL. + InvalidSourceBlobUrl, + + /// Invalid URI. + InvalidUri, + + /// Invalid version for page blob operation. + InvalidVersionForPageBlobOperation, + + /// Invalid XML document. + InvalidXmlDocument, + + /// Invalid XML node value. + InvalidXmlNodeValue, + + /// Lease already broken. + LeaseAlreadyBroken, + + /// Lease already present. + LeaseAlreadyPresent, + + /// Lease ID mismatch with blob operation. + LeaseIdMismatchWithBlobOperation, + + /// Lease ID mismatch with container operation. + LeaseIdMismatchWithContainerOperation, + + /// Lease ID mismatch with lease operation. + LeaseIdMismatchWithLeaseOperation, + + /// Lease ID missing. + LeaseIdMissing, + + /// Lease is breaking and cannot be acquired. + LeaseIsBreakingAndCannotBeAcquired, + + /// Lease is breaking and cannot be changed. + LeaseIsBreakingAndCannotBeChanged, + + /// Lease is broken and cannot be renewed. + LeaseIsBrokenAndCannotBeRenewed, + + /// Lease lost. + LeaseLost, + + /// Lease not present with blob operation. + LeaseNotPresentWithBlobOperation, + + /// Lease not present with container operation. + LeaseNotPresentWithContainerOperation, + + /// Lease not present with lease operation. + LeaseNotPresentWithLeaseOperation, + + /// Maximum blob size condition not met. + MaxBlobSizeConditionNotMet, + + /// MD5 mismatch. + Md5Mismatch, + + /// Metadata too large. + MetadataTooLarge, + + /// Missing content length header. + MissingContentLengthHeader, + + /// Missing required header. + MissingRequiredHeader, + + /// Missing required query parameter. + MissingRequiredQueryParameter, + + /// Missing required XML node. + MissingRequiredXmlNode, + + /// Multiple condition headers not supported. + MultipleConditionHeadersNotSupported, + + /// No pending copy operation. + NoPendingCopyOperation, + + /// Operation not allowed on incremental copy blob. + OperationNotAllowedOnIncrementalCopyBlob, + + /// Operation timed out. + OperationTimedOut, + + /// Out of range input. + OutOfRangeInput, + + /// Out of range query parameter value. + OutOfRangeQueryParameterValue, + + /// Pending copy operation. + PendingCopyOperation, + + /// Previous snapshot cannot be newer. + PreviousSnapshotCannotBeNewer, + + /// Previous snapshot not found. + PreviousSnapshotNotFound, + + /// Previous snapshot operation not supported. + PreviousSnapshotOperationNotSupported, + + /// Request body too large. + RequestBodyTooLarge, + + /// Request URL failed to parse. + RequestUrlFailedToParse, + + /// Resource already exists. + ResourceAlreadyExists, + + /// Resource not found. + ResourceNotFound, + + /// Resource type mismatch. + ResourceTypeMismatch, + + /// Sequence number condition not met. + SequenceNumberConditionNotMet, + + /// Sequence number increment too large. + SequenceNumberIncrementTooLarge, + + /// Server busy. + ServerBusy, + + /// Snapshot count exceeded. + SnapshotCountExceeded, + + /// Snapshot operation rate exceeded. + SnapshotOperationRateExceeded, + + /// Snapshots present. + SnapshotsPresent, + + /// Source condition not met. + SourceConditionNotMet, + + /// System in use. + SystemInUse, + + /// Target condition not met. + TargetConditionNotMet, + + /// Unauthorized blob overwrite. + UnauthorizedBlobOverwrite, + + /// Unsupported header. + UnsupportedHeader, + + /// Unsupported HTTP verb. + UnsupportedHttpVerb, + + /// Unsupported query parameter. + UnsupportedQueryParameter, + + /// Unsupported XML node. + UnsupportedXmlNode, - /// Any other value not defined in `SkuName`. + /// Any other value not defined in `StorageErrorCode`. UnknownValue(String), } diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums_impl.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums_impl.rs index da72d30ea..5cc17d4aa 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums_impl.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums_impl.rs @@ -4,13 +4,14 @@ // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. use super::{ - AccessTier, AccountKind, ArchiveStatus, BlobDeleteType, BlobExpiryOptions, - BlobImmutabilityPolicyMode, BlobType, BlockListType, CopyStatus, DeleteSnapshotsOptionType, - EncryptionAlgorithmType, FilterBlobsIncludeItem, GeoReplicationStatusType, LeaseDuration, - LeaseState, LeaseStatus, ListBlobsIncludeItem, ListContainersIncludeType, - PremiumPageBlobAccessTier, PublicAccessType, QueryRequestType, QueryType, RehydratePriority, - SequenceNumberActionType, SkuName, + AccessTier, AccountKind, ArchiveStatus, BlobCopySourceTags, BlobDeleteType, BlobType, + BlockListType, CopyStatus, DeleteSnapshotsOptionType, EncryptionAlgorithmType, + FileShareTokenIntent, FilterBlobsIncludeItem, GeoReplicationStatusType, ImmutabilityPolicyMode, + LeaseDuration, LeaseState, LeaseStatus, ListBlobsIncludeItem, ListContainersIncludeType, + PremiumPageBlobAccessTier, PublicAccessType, RehydratePriority, SequenceNumberActionType, + SkuName, StorageErrorCode, }; +use azure_core::error::{Error, ErrorKind}; use std::{ convert::{AsRef, From, Infallible}, fmt::{Display, Formatter}, @@ -114,21 +115,8 @@ impl Display for AccessTier { } } -impl<'a> From<&'a AccountKind> for &'a str { - fn from(e: &'a AccountKind) -> Self { - match e { - AccountKind::BlobStorage => "BlobStorage", - AccountKind::BlockBlobStorage => "BlockBlobStorage", - AccountKind::FileStorage => "FileStorage", - AccountKind::Storage => "Storage", - AccountKind::StorageV2 => "StorageV2", - AccountKind::UnknownValue(s) => s.as_ref(), - } - } -} - impl FromStr for AccountKind { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "BlobStorage" => AccountKind::BlobStorage, @@ -136,7 +124,11 @@ impl FromStr for AccountKind { "FileStorage" => AccountKind::FileStorage, "Storage" => AccountKind::Storage, "StorageV2" => AccountKind::StorageV2, - _ => AccountKind::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of AccountKind found: \"{s}\"") + })) + } }) } } @@ -149,7 +141,6 @@ impl AsRef for AccountKind { AccountKind::FileStorage => "FileStorage", AccountKind::Storage => "Storage", AccountKind::StorageV2 => "StorageV2", - AccountKind::UnknownValue(s) => s.as_str(), } } } @@ -157,12 +148,11 @@ impl AsRef for AccountKind { impl Display for AccountKind { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - AccountKind::BlobStorage => f.write_str("BlobStorage"), - AccountKind::BlockBlobStorage => f.write_str("BlockBlobStorage"), - AccountKind::FileStorage => f.write_str("FileStorage"), - AccountKind::Storage => f.write_str("Storage"), - AccountKind::StorageV2 => f.write_str("StorageV2"), - AccountKind::UnknownValue(s) => f.write_str(s.as_str()), + AccountKind::BlobStorage => Display::fmt("BlobStorage", f), + AccountKind::BlockBlobStorage => Display::fmt("BlockBlobStorage", f), + AccountKind::FileStorage => Display::fmt("FileStorage", f), + AccountKind::Storage => Display::fmt("Storage", f), + AccountKind::StorageV2 => Display::fmt("StorageV2", f), } } } @@ -212,156 +202,81 @@ impl Display for ArchiveStatus { } } -impl<'a> From<&'a BlobDeleteType> for &'a str { - fn from(e: &'a BlobDeleteType) -> Self { - match e { - BlobDeleteType::Permanent => "Permanent", - BlobDeleteType::UnknownValue(s) => s.as_ref(), - } - } -} - -impl FromStr for BlobDeleteType { - type Err = Infallible; - fn from_str(s: &str) -> ::core::result::Result::Err> { - Ok(match s { - "Permanent" => BlobDeleteType::Permanent, - _ => BlobDeleteType::UnknownValue(s.to_string()), - }) - } -} - -impl AsRef for BlobDeleteType { - fn as_ref(&self) -> &str { - match self { - BlobDeleteType::Permanent => "Permanent", - BlobDeleteType::UnknownValue(s) => s.as_str(), - } - } -} - -impl Display for BlobDeleteType { - fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { - match self { - BlobDeleteType::Permanent => f.write_str("Permanent"), - BlobDeleteType::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a BlobExpiryOptions> for &'a str { - fn from(e: &'a BlobExpiryOptions) -> Self { - match e { - BlobExpiryOptions::Absolute => "Absolute", - BlobExpiryOptions::NeverExpire => "NeverExpire", - BlobExpiryOptions::RelativeToCreation => "RelativeToCreation", - BlobExpiryOptions::RelativeToNow => "RelativeToNow", - BlobExpiryOptions::UnknownValue(s) => s.as_ref(), - } - } -} - -impl FromStr for BlobExpiryOptions { - type Err = Infallible; +impl FromStr for BlobCopySourceTags { + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { - "Absolute" => BlobExpiryOptions::Absolute, - "NeverExpire" => BlobExpiryOptions::NeverExpire, - "RelativeToCreation" => BlobExpiryOptions::RelativeToCreation, - "RelativeToNow" => BlobExpiryOptions::RelativeToNow, - _ => BlobExpiryOptions::UnknownValue(s.to_string()), + "COPY" => BlobCopySourceTags::Copy, + "REPLACE" => BlobCopySourceTags::Replace, + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of BlobCopySourceTags found: \"{s}\"") + })) + } }) } } -impl AsRef for BlobExpiryOptions { +impl AsRef for BlobCopySourceTags { fn as_ref(&self) -> &str { match self { - BlobExpiryOptions::Absolute => "Absolute", - BlobExpiryOptions::NeverExpire => "NeverExpire", - BlobExpiryOptions::RelativeToCreation => "RelativeToCreation", - BlobExpiryOptions::RelativeToNow => "RelativeToNow", - BlobExpiryOptions::UnknownValue(s) => s.as_str(), + BlobCopySourceTags::Copy => "COPY", + BlobCopySourceTags::Replace => "REPLACE", } } } -impl Display for BlobExpiryOptions { +impl Display for BlobCopySourceTags { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - BlobExpiryOptions::Absolute => f.write_str("Absolute"), - BlobExpiryOptions::NeverExpire => f.write_str("NeverExpire"), - BlobExpiryOptions::RelativeToCreation => f.write_str("RelativeToCreation"), - BlobExpiryOptions::RelativeToNow => f.write_str("RelativeToNow"), - BlobExpiryOptions::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a BlobImmutabilityPolicyMode> for &'a str { - fn from(e: &'a BlobImmutabilityPolicyMode) -> Self { - match e { - BlobImmutabilityPolicyMode::Locked => "Locked", - BlobImmutabilityPolicyMode::Mutable => "Mutable", - BlobImmutabilityPolicyMode::Unlocked => "Unlocked", - BlobImmutabilityPolicyMode::UnknownValue(s) => s.as_ref(), + BlobCopySourceTags::Copy => Display::fmt("COPY", f), + BlobCopySourceTags::Replace => Display::fmt("REPLACE", f), } } } -impl FromStr for BlobImmutabilityPolicyMode { - type Err = Infallible; +impl FromStr for BlobDeleteType { + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { - "Locked" => BlobImmutabilityPolicyMode::Locked, - "Mutable" => BlobImmutabilityPolicyMode::Mutable, - "Unlocked" => BlobImmutabilityPolicyMode::Unlocked, - _ => BlobImmutabilityPolicyMode::UnknownValue(s.to_string()), + "Permanent" => BlobDeleteType::Permanent, + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of BlobDeleteType found: \"{s}\"") + })) + } }) } } -impl AsRef for BlobImmutabilityPolicyMode { +impl AsRef for BlobDeleteType { fn as_ref(&self) -> &str { match self { - BlobImmutabilityPolicyMode::Locked => "Locked", - BlobImmutabilityPolicyMode::Mutable => "Mutable", - BlobImmutabilityPolicyMode::Unlocked => "Unlocked", - BlobImmutabilityPolicyMode::UnknownValue(s) => s.as_str(), + BlobDeleteType::Permanent => "Permanent", } } } -impl Display for BlobImmutabilityPolicyMode { +impl Display for BlobDeleteType { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - BlobImmutabilityPolicyMode::Locked => f.write_str("Locked"), - BlobImmutabilityPolicyMode::Mutable => f.write_str("Mutable"), - BlobImmutabilityPolicyMode::Unlocked => f.write_str("Unlocked"), - BlobImmutabilityPolicyMode::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a BlobType> for &'a str { - fn from(e: &'a BlobType) -> Self { - match e { - BlobType::AppendBlob => "AppendBlob", - BlobType::BlockBlob => "BlockBlob", - BlobType::PageBlob => "PageBlob", - BlobType::UnknownValue(s) => s.as_ref(), + BlobDeleteType::Permanent => Display::fmt("Permanent", f), } } } impl FromStr for BlobType { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "AppendBlob" => BlobType::AppendBlob, "BlockBlob" => BlobType::BlockBlob, "PageBlob" => BlobType::PageBlob, - _ => BlobType::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of BlobType found: \"{s}\"") + })) + } }) } } @@ -372,7 +287,6 @@ impl AsRef for BlobType { BlobType::AppendBlob => "AppendBlob", BlobType::BlockBlob => "BlockBlob", BlobType::PageBlob => "PageBlob", - BlobType::UnknownValue(s) => s.as_str(), } } } @@ -380,33 +294,25 @@ impl AsRef for BlobType { impl Display for BlobType { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - BlobType::AppendBlob => f.write_str("AppendBlob"), - BlobType::BlockBlob => f.write_str("BlockBlob"), - BlobType::PageBlob => f.write_str("PageBlob"), - BlobType::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a BlockListType> for &'a str { - fn from(e: &'a BlockListType) -> Self { - match e { - BlockListType::All => "all", - BlockListType::Committed => "committed", - BlockListType::Uncommitted => "uncommitted", - BlockListType::UnknownValue(s) => s.as_ref(), + BlobType::AppendBlob => Display::fmt("AppendBlob", f), + BlobType::BlockBlob => Display::fmt("BlockBlob", f), + BlobType::PageBlob => Display::fmt("PageBlob", f), } } } impl FromStr for BlockListType { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "all" => BlockListType::All, "committed" => BlockListType::Committed, "uncommitted" => BlockListType::Uncommitted, - _ => BlockListType::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of BlockListType found: \"{s}\"") + })) + } }) } } @@ -417,7 +323,6 @@ impl AsRef for BlockListType { BlockListType::All => "all", BlockListType::Committed => "committed", BlockListType::Uncommitted => "uncommitted", - BlockListType::UnknownValue(s) => s.as_str(), } } } @@ -425,35 +330,26 @@ impl AsRef for BlockListType { impl Display for BlockListType { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - BlockListType::All => f.write_str("all"), - BlockListType::Committed => f.write_str("committed"), - BlockListType::Uncommitted => f.write_str("uncommitted"), - BlockListType::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a CopyStatus> for &'a str { - fn from(e: &'a CopyStatus) -> Self { - match e { - CopyStatus::Aborted => "aborted", - CopyStatus::Failed => "failed", - CopyStatus::Pending => "pending", - CopyStatus::Success => "success", - CopyStatus::UnknownValue(s) => s.as_ref(), + BlockListType::All => Display::fmt("all", f), + BlockListType::Committed => Display::fmt("committed", f), + BlockListType::Uncommitted => Display::fmt("uncommitted", f), } } } impl FromStr for CopyStatus { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "aborted" => CopyStatus::Aborted, "failed" => CopyStatus::Failed, "pending" => CopyStatus::Pending, "success" => CopyStatus::Success, - _ => CopyStatus::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of CopyStatus found: \"{s}\"") + })) + } }) } } @@ -465,7 +361,6 @@ impl AsRef for CopyStatus { CopyStatus::Failed => "failed", CopyStatus::Pending => "pending", CopyStatus::Success => "success", - CopyStatus::UnknownValue(s) => s.as_str(), } } } @@ -473,32 +368,25 @@ impl AsRef for CopyStatus { impl Display for CopyStatus { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - CopyStatus::Aborted => f.write_str("aborted"), - CopyStatus::Failed => f.write_str("failed"), - CopyStatus::Pending => f.write_str("pending"), - CopyStatus::Success => f.write_str("success"), - CopyStatus::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a DeleteSnapshotsOptionType> for &'a str { - fn from(e: &'a DeleteSnapshotsOptionType) -> Self { - match e { - DeleteSnapshotsOptionType::Include => "include", - DeleteSnapshotsOptionType::Only => "only", - DeleteSnapshotsOptionType::UnknownValue(s) => s.as_ref(), + CopyStatus::Aborted => Display::fmt("aborted", f), + CopyStatus::Failed => Display::fmt("failed", f), + CopyStatus::Pending => Display::fmt("pending", f), + CopyStatus::Success => Display::fmt("success", f), } } } impl FromStr for DeleteSnapshotsOptionType { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "include" => DeleteSnapshotsOptionType::Include, "only" => DeleteSnapshotsOptionType::Only, - _ => DeleteSnapshotsOptionType::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of DeleteSnapshotsOptionType found: \"{s}\"") + })) + } }) } } @@ -508,7 +396,6 @@ impl AsRef for DeleteSnapshotsOptionType { match self { DeleteSnapshotsOptionType::Include => "include", DeleteSnapshotsOptionType::Only => "only", - DeleteSnapshotsOptionType::UnknownValue(s) => s.as_str(), } } } @@ -516,28 +403,22 @@ impl AsRef for DeleteSnapshotsOptionType { impl Display for DeleteSnapshotsOptionType { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - DeleteSnapshotsOptionType::Include => f.write_str("include"), - DeleteSnapshotsOptionType::Only => f.write_str("only"), - DeleteSnapshotsOptionType::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a EncryptionAlgorithmType> for &'a str { - fn from(e: &'a EncryptionAlgorithmType) -> Self { - match e { - EncryptionAlgorithmType::Aes256 => "AES256", - EncryptionAlgorithmType::UnknownValue(s) => s.as_ref(), + DeleteSnapshotsOptionType::Include => Display::fmt("include", f), + DeleteSnapshotsOptionType::Only => Display::fmt("only", f), } } } impl FromStr for EncryptionAlgorithmType { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "AES256" => EncryptionAlgorithmType::Aes256, - _ => EncryptionAlgorithmType::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of EncryptionAlgorithmType found: \"{s}\"") + })) + } }) } } @@ -546,7 +427,6 @@ impl AsRef for EncryptionAlgorithmType { fn as_ref(&self) -> &str { match self { EncryptionAlgorithmType::Aes256 => "AES256", - EncryptionAlgorithmType::UnknownValue(s) => s.as_str(), } } } @@ -554,29 +434,59 @@ impl AsRef for EncryptionAlgorithmType { impl Display for EncryptionAlgorithmType { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - EncryptionAlgorithmType::Aes256 => f.write_str("AES256"), - EncryptionAlgorithmType::UnknownValue(s) => f.write_str(s.as_str()), + EncryptionAlgorithmType::Aes256 => Display::fmt("AES256", f), } } } -impl<'a> From<&'a FilterBlobsIncludeItem> for &'a str { - fn from(e: &'a FilterBlobsIncludeItem) -> Self { +impl<'a> From<&'a FileShareTokenIntent> for &'a str { + fn from(e: &'a FileShareTokenIntent) -> Self { match e { - FilterBlobsIncludeItem::None => "none", - FilterBlobsIncludeItem::Versions => "versions", - FilterBlobsIncludeItem::UnknownValue(s) => s.as_ref(), + FileShareTokenIntent::Backup => "backup", + FileShareTokenIntent::UnknownValue(s) => s.as_ref(), } } } -impl FromStr for FilterBlobsIncludeItem { +impl FromStr for FileShareTokenIntent { type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "backup" => FileShareTokenIntent::Backup, + _ => FileShareTokenIntent::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for FileShareTokenIntent { + fn as_ref(&self) -> &str { + match self { + FileShareTokenIntent::Backup => "backup", + FileShareTokenIntent::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for FileShareTokenIntent { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + FileShareTokenIntent::Backup => f.write_str("backup"), + FileShareTokenIntent::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl FromStr for FilterBlobsIncludeItem { + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "none" => FilterBlobsIncludeItem::None, "versions" => FilterBlobsIncludeItem::Versions, - _ => FilterBlobsIncludeItem::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of FilterBlobsIncludeItem found: \"{s}\"") + })) + } }) } } @@ -586,7 +496,6 @@ impl AsRef for FilterBlobsIncludeItem { match self { FilterBlobsIncludeItem::None => "none", FilterBlobsIncludeItem::Versions => "versions", - FilterBlobsIncludeItem::UnknownValue(s) => s.as_str(), } } } @@ -594,9 +503,8 @@ impl AsRef for FilterBlobsIncludeItem { impl Display for FilterBlobsIncludeItem { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - FilterBlobsIncludeItem::None => f.write_str("none"), - FilterBlobsIncludeItem::Versions => f.write_str("versions"), - FilterBlobsIncludeItem::UnknownValue(s) => f.write_str(s.as_str()), + FilterBlobsIncludeItem::None => Display::fmt("none", f), + FilterBlobsIncludeItem::Versions => Display::fmt("versions", f), } } } @@ -646,23 +554,53 @@ impl Display for GeoReplicationStatusType { } } -impl<'a> From<&'a LeaseDuration> for &'a str { - fn from(e: &'a LeaseDuration) -> Self { - match e { - LeaseDuration::Fixed => "fixed", - LeaseDuration::Infinite => "infinite", - LeaseDuration::UnknownValue(s) => s.as_ref(), +impl FromStr for ImmutabilityPolicyMode { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "locked" => ImmutabilityPolicyMode::Locked, + "mutable" => ImmutabilityPolicyMode::Mutable, + "unlocked" => ImmutabilityPolicyMode::Unlocked, + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of ImmutabilityPolicyMode found: \"{s}\"") + })) + } + }) + } +} + +impl AsRef for ImmutabilityPolicyMode { + fn as_ref(&self) -> &str { + match self { + ImmutabilityPolicyMode::Locked => "locked", + ImmutabilityPolicyMode::Mutable => "mutable", + ImmutabilityPolicyMode::Unlocked => "unlocked", + } + } +} + +impl Display for ImmutabilityPolicyMode { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + ImmutabilityPolicyMode::Locked => Display::fmt("locked", f), + ImmutabilityPolicyMode::Mutable => Display::fmt("mutable", f), + ImmutabilityPolicyMode::Unlocked => Display::fmt("unlocked", f), } } } impl FromStr for LeaseDuration { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "fixed" => LeaseDuration::Fixed, "infinite" => LeaseDuration::Infinite, - _ => LeaseDuration::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of LeaseDuration found: \"{s}\"") + })) + } }) } } @@ -672,7 +610,6 @@ impl AsRef for LeaseDuration { match self { LeaseDuration::Fixed => "fixed", LeaseDuration::Infinite => "infinite", - LeaseDuration::UnknownValue(s) => s.as_str(), } } } @@ -680,28 +617,14 @@ impl AsRef for LeaseDuration { impl Display for LeaseDuration { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - LeaseDuration::Fixed => f.write_str("fixed"), - LeaseDuration::Infinite => f.write_str("infinite"), - LeaseDuration::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a LeaseState> for &'a str { - fn from(e: &'a LeaseState) -> Self { - match e { - LeaseState::Available => "available", - LeaseState::Breaking => "breaking", - LeaseState::Broken => "broken", - LeaseState::Expired => "expired", - LeaseState::Leased => "leased", - LeaseState::UnknownValue(s) => s.as_ref(), + LeaseDuration::Fixed => Display::fmt("fixed", f), + LeaseDuration::Infinite => Display::fmt("infinite", f), } } } impl FromStr for LeaseState { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "available" => LeaseState::Available, @@ -709,7 +632,11 @@ impl FromStr for LeaseState { "broken" => LeaseState::Broken, "expired" => LeaseState::Expired, "leased" => LeaseState::Leased, - _ => LeaseState::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of LeaseState found: \"{s}\"") + })) + } }) } } @@ -722,7 +649,6 @@ impl AsRef for LeaseState { LeaseState::Broken => "broken", LeaseState::Expired => "expired", LeaseState::Leased => "leased", - LeaseState::UnknownValue(s) => s.as_str(), } } } @@ -730,33 +656,26 @@ impl AsRef for LeaseState { impl Display for LeaseState { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - LeaseState::Available => f.write_str("available"), - LeaseState::Breaking => f.write_str("breaking"), - LeaseState::Broken => f.write_str("broken"), - LeaseState::Expired => f.write_str("expired"), - LeaseState::Leased => f.write_str("leased"), - LeaseState::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a LeaseStatus> for &'a str { - fn from(e: &'a LeaseStatus) -> Self { - match e { - LeaseStatus::Locked => "locked", - LeaseStatus::Unlocked => "unlocked", - LeaseStatus::UnknownValue(s) => s.as_ref(), + LeaseState::Available => Display::fmt("available", f), + LeaseState::Breaking => Display::fmt("breaking", f), + LeaseState::Broken => Display::fmt("broken", f), + LeaseState::Expired => Display::fmt("expired", f), + LeaseState::Leased => Display::fmt("leased", f), } } } impl FromStr for LeaseStatus { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "locked" => LeaseStatus::Locked, "unlocked" => LeaseStatus::Unlocked, - _ => LeaseStatus::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of LeaseStatus found: \"{s}\"") + })) + } }) } } @@ -766,7 +685,6 @@ impl AsRef for LeaseStatus { match self { LeaseStatus::Locked => "locked", LeaseStatus::Unlocked => "unlocked", - LeaseStatus::UnknownValue(s) => s.as_str(), } } } @@ -774,33 +692,14 @@ impl AsRef for LeaseStatus { impl Display for LeaseStatus { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - LeaseStatus::Locked => f.write_str("locked"), - LeaseStatus::Unlocked => f.write_str("unlocked"), - LeaseStatus::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a ListBlobsIncludeItem> for &'a str { - fn from(e: &'a ListBlobsIncludeItem) -> Self { - match e { - ListBlobsIncludeItem::Copy => "copy", - ListBlobsIncludeItem::Deleted => "deleted", - ListBlobsIncludeItem::DeletedWithVersions => "deletedwithversions", - ListBlobsIncludeItem::ImmutabilityPolicy => "immutabilitypolicy", - ListBlobsIncludeItem::LegalHold => "legalhold", - ListBlobsIncludeItem::Metadata => "metadata", - ListBlobsIncludeItem::Snapshots => "snapshots", - ListBlobsIncludeItem::Tags => "tags", - ListBlobsIncludeItem::UncommittedBlobs => "uncommittedblobs", - ListBlobsIncludeItem::Versions => "versions", - ListBlobsIncludeItem::UnknownValue(s) => s.as_ref(), + LeaseStatus::Locked => Display::fmt("locked", f), + LeaseStatus::Unlocked => Display::fmt("unlocked", f), } } } impl FromStr for ListBlobsIncludeItem { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "copy" => ListBlobsIncludeItem::Copy, @@ -813,7 +712,11 @@ impl FromStr for ListBlobsIncludeItem { "tags" => ListBlobsIncludeItem::Tags, "uncommittedblobs" => ListBlobsIncludeItem::UncommittedBlobs, "versions" => ListBlobsIncludeItem::Versions, - _ => ListBlobsIncludeItem::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of ListBlobsIncludeItem found: \"{s}\"") + })) + } }) } } @@ -831,7 +734,6 @@ impl AsRef for ListBlobsIncludeItem { ListBlobsIncludeItem::Tags => "tags", ListBlobsIncludeItem::UncommittedBlobs => "uncommittedblobs", ListBlobsIncludeItem::Versions => "versions", - ListBlobsIncludeItem::UnknownValue(s) => s.as_str(), } } } @@ -839,40 +741,32 @@ impl AsRef for ListBlobsIncludeItem { impl Display for ListBlobsIncludeItem { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - ListBlobsIncludeItem::Copy => f.write_str("copy"), - ListBlobsIncludeItem::Deleted => f.write_str("deleted"), - ListBlobsIncludeItem::DeletedWithVersions => f.write_str("deletedwithversions"), - ListBlobsIncludeItem::ImmutabilityPolicy => f.write_str("immutabilitypolicy"), - ListBlobsIncludeItem::LegalHold => f.write_str("legalhold"), - ListBlobsIncludeItem::Metadata => f.write_str("metadata"), - ListBlobsIncludeItem::Snapshots => f.write_str("snapshots"), - ListBlobsIncludeItem::Tags => f.write_str("tags"), - ListBlobsIncludeItem::UncommittedBlobs => f.write_str("uncommittedblobs"), - ListBlobsIncludeItem::Versions => f.write_str("versions"), - ListBlobsIncludeItem::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a ListContainersIncludeType> for &'a str { - fn from(e: &'a ListContainersIncludeType) -> Self { - match e { - ListContainersIncludeType::Deleted => "deleted", - ListContainersIncludeType::Metadata => "metadata", - ListContainersIncludeType::System => "system", - ListContainersIncludeType::UnknownValue(s) => s.as_ref(), + ListBlobsIncludeItem::Copy => Display::fmt("copy", f), + ListBlobsIncludeItem::Deleted => Display::fmt("deleted", f), + ListBlobsIncludeItem::DeletedWithVersions => Display::fmt("deletedwithversions", f), + ListBlobsIncludeItem::ImmutabilityPolicy => Display::fmt("immutabilitypolicy", f), + ListBlobsIncludeItem::LegalHold => Display::fmt("legalhold", f), + ListBlobsIncludeItem::Metadata => Display::fmt("metadata", f), + ListBlobsIncludeItem::Snapshots => Display::fmt("snapshots", f), + ListBlobsIncludeItem::Tags => Display::fmt("tags", f), + ListBlobsIncludeItem::UncommittedBlobs => Display::fmt("uncommittedblobs", f), + ListBlobsIncludeItem::Versions => Display::fmt("versions", f), } } } impl FromStr for ListContainersIncludeType { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "deleted" => ListContainersIncludeType::Deleted, "metadata" => ListContainersIncludeType::Metadata, "system" => ListContainersIncludeType::System, - _ => ListContainersIncludeType::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of ListContainersIncludeType found: \"{s}\"") + })) + } }) } } @@ -883,7 +777,6 @@ impl AsRef for ListContainersIncludeType { ListContainersIncludeType::Deleted => "deleted", ListContainersIncludeType::Metadata => "metadata", ListContainersIncludeType::System => "system", - ListContainersIncludeType::UnknownValue(s) => s.as_str(), } } } @@ -891,10 +784,9 @@ impl AsRef for ListContainersIncludeType { impl Display for ListContainersIncludeType { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - ListContainersIncludeType::Deleted => f.write_str("deleted"), - ListContainersIncludeType::Metadata => f.write_str("metadata"), - ListContainersIncludeType::System => f.write_str("system"), - ListContainersIncludeType::UnknownValue(s) => f.write_str(s.as_str()), + ListContainersIncludeType::Deleted => Display::fmt("deleted", f), + ListContainersIncludeType::Metadata => Display::fmt("metadata", f), + ListContainersIncludeType::System => Display::fmt("system", f), } } } @@ -1017,92 +909,6 @@ impl Display for PublicAccessType { } } -impl<'a> From<&'a QueryRequestType> for &'a str { - fn from(e: &'a QueryRequestType) -> Self { - match e { - QueryRequestType::Sql => "SQL", - QueryRequestType::UnknownValue(s) => s.as_ref(), - } - } -} - -impl FromStr for QueryRequestType { - type Err = Infallible; - fn from_str(s: &str) -> ::core::result::Result::Err> { - Ok(match s { - "SQL" => QueryRequestType::Sql, - _ => QueryRequestType::UnknownValue(s.to_string()), - }) - } -} - -impl AsRef for QueryRequestType { - fn as_ref(&self) -> &str { - match self { - QueryRequestType::Sql => "SQL", - QueryRequestType::UnknownValue(s) => s.as_str(), - } - } -} - -impl Display for QueryRequestType { - fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { - match self { - QueryRequestType::Sql => f.write_str("SQL"), - QueryRequestType::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a QueryType> for &'a str { - fn from(e: &'a QueryType) -> Self { - match e { - QueryType::Arrow => "arrow", - QueryType::Delimited => "delimited", - QueryType::Json => "json", - QueryType::Parquet => "parquet", - QueryType::UnknownValue(s) => s.as_ref(), - } - } -} - -impl FromStr for QueryType { - type Err = Infallible; - fn from_str(s: &str) -> ::core::result::Result::Err> { - Ok(match s { - "arrow" => QueryType::Arrow, - "delimited" => QueryType::Delimited, - "json" => QueryType::Json, - "parquet" => QueryType::Parquet, - _ => QueryType::UnknownValue(s.to_string()), - }) - } -} - -impl AsRef for QueryType { - fn as_ref(&self) -> &str { - match self { - QueryType::Arrow => "arrow", - QueryType::Delimited => "delimited", - QueryType::Json => "json", - QueryType::Parquet => "parquet", - QueryType::UnknownValue(s) => s.as_str(), - } - } -} - -impl Display for QueryType { - fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { - match self { - QueryType::Arrow => f.write_str("arrow"), - QueryType::Delimited => f.write_str("delimited"), - QueryType::Json => f.write_str("json"), - QueryType::Parquet => f.write_str("parquet"), - QueryType::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - impl<'a> From<&'a RehydratePriority> for &'a str { fn from(e: &'a RehydratePriority) -> Self { match e { @@ -1144,25 +950,18 @@ impl Display for RehydratePriority { } } -impl<'a> From<&'a SequenceNumberActionType> for &'a str { - fn from(e: &'a SequenceNumberActionType) -> Self { - match e { - SequenceNumberActionType::Increment => "increment", - SequenceNumberActionType::Max => "max", - SequenceNumberActionType::Update => "update", - SequenceNumberActionType::UnknownValue(s) => s.as_ref(), - } - } -} - impl FromStr for SequenceNumberActionType { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "increment" => SequenceNumberActionType::Increment, "max" => SequenceNumberActionType::Max, "update" => SequenceNumberActionType::Update, - _ => SequenceNumberActionType::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of SequenceNumberActionType found: \"{s}\"") + })) + } }) } } @@ -1173,7 +972,6 @@ impl AsRef for SequenceNumberActionType { SequenceNumberActionType::Increment => "increment", SequenceNumberActionType::Max => "max", SequenceNumberActionType::Update => "update", - SequenceNumberActionType::UnknownValue(s) => s.as_str(), } } } @@ -1181,37 +979,30 @@ impl AsRef for SequenceNumberActionType { impl Display for SequenceNumberActionType { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - SequenceNumberActionType::Increment => f.write_str("increment"), - SequenceNumberActionType::Max => f.write_str("max"), - SequenceNumberActionType::Update => f.write_str("update"), - SequenceNumberActionType::UnknownValue(s) => f.write_str(s.as_str()), - } - } -} - -impl<'a> From<&'a SkuName> for &'a str { - fn from(e: &'a SkuName) -> Self { - match e { - SkuName::PremiumLrs => "Premium_LRS", - SkuName::StandardGrs => "Standard_GRS", - SkuName::StandardLrs => "Standard_LRS", - SkuName::StandardRagrs => "Standard_RAGRS", - SkuName::StandardZrs => "Standard_ZRS", - SkuName::UnknownValue(s) => s.as_ref(), + SequenceNumberActionType::Increment => Display::fmt("increment", f), + SequenceNumberActionType::Max => Display::fmt("max", f), + SequenceNumberActionType::Update => Display::fmt("update", f), } } } impl FromStr for SkuName { - type Err = Infallible; + type Err = Error; fn from_str(s: &str) -> ::core::result::Result::Err> { Ok(match s { "Premium_LRS" => SkuName::PremiumLrs, + "Premium_ZRS" => SkuName::PremiumZrs, "Standard_GRS" => SkuName::StandardGrs, + "Standard_GZRS" => SkuName::StandardGzrs, "Standard_LRS" => SkuName::StandardLrs, "Standard_RAGRS" => SkuName::StandardRagrs, + "Standard_RAGZRS" => SkuName::StandardRagzrs, "Standard_ZRS" => SkuName::StandardZrs, - _ => SkuName::UnknownValue(s.to_string()), + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of SkuName found: \"{s}\"") + })) + } }) } } @@ -1220,11 +1011,13 @@ impl AsRef for SkuName { fn as_ref(&self) -> &str { match self { SkuName::PremiumLrs => "Premium_LRS", + SkuName::PremiumZrs => "Premium_ZRS", SkuName::StandardGrs => "Standard_GRS", + SkuName::StandardGzrs => "Standard_GZRS", SkuName::StandardLrs => "Standard_LRS", SkuName::StandardRagrs => "Standard_RAGRS", + SkuName::StandardRagzrs => "Standard_RAGZRS", SkuName::StandardZrs => "Standard_ZRS", - SkuName::UnknownValue(s) => s.as_str(), } } } @@ -1232,12 +1025,691 @@ impl AsRef for SkuName { impl Display for SkuName { fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { match self { - SkuName::PremiumLrs => f.write_str("Premium_LRS"), - SkuName::StandardGrs => f.write_str("Standard_GRS"), - SkuName::StandardLrs => f.write_str("Standard_LRS"), - SkuName::StandardRagrs => f.write_str("Standard_RAGRS"), - SkuName::StandardZrs => f.write_str("Standard_ZRS"), - SkuName::UnknownValue(s) => f.write_str(s.as_str()), + SkuName::PremiumLrs => Display::fmt("Premium_LRS", f), + SkuName::PremiumZrs => Display::fmt("Premium_ZRS", f), + SkuName::StandardGrs => Display::fmt("Standard_GRS", f), + SkuName::StandardGzrs => Display::fmt("Standard_GZRS", f), + SkuName::StandardLrs => Display::fmt("Standard_LRS", f), + SkuName::StandardRagrs => Display::fmt("Standard_RAGRS", f), + SkuName::StandardRagzrs => Display::fmt("Standard_RAGZRS", f), + SkuName::StandardZrs => Display::fmt("Standard_ZRS", f), + } + } +} + +impl<'a> From<&'a StorageErrorCode> for &'a str { + fn from(e: &'a StorageErrorCode) -> Self { + match e { + StorageErrorCode::AccountAlreadyExists => "AccountAlreadyExists", + StorageErrorCode::AccountBeingCreated => "AccountBeingCreated", + StorageErrorCode::AccountIsDisabled => "AccountIsDisabled", + StorageErrorCode::AppendPositionConditionNotMet => "AppendPositionConditionNotMet", + StorageErrorCode::AuthenticationFailed => "AuthenticationFailed", + StorageErrorCode::AuthorizationFailure => "AuthorizationFailure", + StorageErrorCode::AuthorizationPermissionMismatch => "AuthorizationPermissionMismatch", + StorageErrorCode::AuthorizationProtocolMismatch => "AuthorizationProtocolMismatch", + StorageErrorCode::AuthorizationResourceTypeMismatch => { + "AuthorizationResourceTypeMismatch" + } + StorageErrorCode::AuthorizationServiceMismatch => "AuthorizationServiceMismatch", + StorageErrorCode::AuthorizationSourceIPMismatch => "AuthorizationSourceIPMismatch", + StorageErrorCode::BlobAccessTierNotSupportedForAccountType => { + "BlobAccessTierNotSupportedForAccountType" + } + StorageErrorCode::BlobAlreadyExists => "BlobAlreadyExists", + StorageErrorCode::BlobArchived => "BlobArchived", + StorageErrorCode::BlobBeingRehydrated => "BlobBeingRehydrated", + StorageErrorCode::BlobImmutableDueToPolicy => "BlobImmutableDueToPolicy", + StorageErrorCode::BlobNotArchived => "BlobNotArchived", + StorageErrorCode::BlobNotFound => "BlobNotFound", + StorageErrorCode::BlobOverwritten => "BlobOverwritten", + StorageErrorCode::BlobTierInadequateForContentLength => { + "BlobTierInadequateForContentLength" + } + StorageErrorCode::BlobUsesCustomerSpecifiedEncryption => { + "BlobUsesCustomerSpecifiedEncryption" + } + StorageErrorCode::BlockCountExceedsLimit => "BlockCountExceedsLimit", + StorageErrorCode::BlockListTooLong => "BlockListTooLong", + StorageErrorCode::CannotChangeToLowerTier => "CannotChangeToLowerTier", + StorageErrorCode::CannotVerifyCopySource => "CannotVerifyCopySource", + StorageErrorCode::ConditionHeadersNotSupported => "ConditionHeadersNotSupported", + StorageErrorCode::ConditionNotMet => "ConditionNotMet", + StorageErrorCode::ContainerAlreadyExists => "ContainerAlreadyExists", + StorageErrorCode::ContainerBeingDeleted => "ContainerBeingDeleted", + StorageErrorCode::ContainerDisabled => "ContainerDisabled", + StorageErrorCode::ContainerNotFound => "ContainerNotFound", + StorageErrorCode::ContentLengthLargerThanTierLimit => { + "ContentLengthLargerThanTierLimit" + } + StorageErrorCode::CopyAcrossAccountsNotSupported => "CopyAcrossAccountsNotSupported", + StorageErrorCode::CopyIdMismatch => "CopyIdMismatch", + StorageErrorCode::EmptyMetadataKey => "EmptyMetadataKey", + StorageErrorCode::FeatureVersionMismatch => "FeatureVersionMismatch", + StorageErrorCode::IncrementalCopyBlobMismatch => "IncrementalCopyBlobMismatch", + StorageErrorCode::IncrementalCopyOfEarlierVersionSnapshotNotAllowed => { + "IncrementalCopyOfEarlierVersionSnapshotNotAllowed" + } + StorageErrorCode::IncrementalCopySourceMustBeSnapshot => { + "IncrementalCopySourceMustBeSnapshot" + } + StorageErrorCode::InfiniteLeaseDurationRequired => "InfiniteLeaseDurationRequired", + StorageErrorCode::InsufficientAccountPermissions => "InsufficientAccountPermissions", + StorageErrorCode::InternalError => "InternalError", + StorageErrorCode::InvalidAuthenticationInfo => "InvalidAuthenticationInfo", + StorageErrorCode::InvalidBlobOrBlock => "InvalidBlobOrBlock", + StorageErrorCode::InvalidBlobTier => "InvalidBlobTier", + StorageErrorCode::InvalidBlobType => "InvalidBlobType", + StorageErrorCode::InvalidBlockId => "InvalidBlockId", + StorageErrorCode::InvalidBlockList => "InvalidBlockList", + StorageErrorCode::InvalidHeaderValue => "InvalidHeaderValue", + StorageErrorCode::InvalidHttpVerb => "InvalidHttpVerb", + StorageErrorCode::InvalidInput => "InvalidInput", + StorageErrorCode::InvalidMd5 => "InvalidMd5", + StorageErrorCode::InvalidMetadata => "InvalidMetadata", + StorageErrorCode::InvalidOperation => "InvalidOperation", + StorageErrorCode::InvalidPageRange => "InvalidPageRange", + StorageErrorCode::InvalidQueryParameterValue => "InvalidQueryParameterValue", + StorageErrorCode::InvalidRange => "InvalidRange", + StorageErrorCode::InvalidRequestUrl => "InvalidRequestUrl", + StorageErrorCode::InvalidSourceBlobType => "InvalidSourceBlobType", + StorageErrorCode::InvalidSourceBlobUrl => "InvalidSourceBlobUrl", + StorageErrorCode::InvalidUri => "InvalidUri", + StorageErrorCode::InvalidVersionForPageBlobOperation => { + "InvalidVersionForPageBlobOperation" + } + StorageErrorCode::InvalidXmlDocument => "InvalidXmlDocument", + StorageErrorCode::InvalidXmlNodeValue => "InvalidXmlNodeValue", + StorageErrorCode::LeaseAlreadyBroken => "LeaseAlreadyBroken", + StorageErrorCode::LeaseAlreadyPresent => "LeaseAlreadyPresent", + StorageErrorCode::LeaseIdMismatchWithBlobOperation => { + "LeaseIdMismatchWithBlobOperation" + } + StorageErrorCode::LeaseIdMismatchWithContainerOperation => { + "LeaseIdMismatchWithContainerOperation" + } + StorageErrorCode::LeaseIdMismatchWithLeaseOperation => { + "LeaseIdMismatchWithLeaseOperation" + } + StorageErrorCode::LeaseIdMissing => "LeaseIdMissing", + StorageErrorCode::LeaseIsBreakingAndCannotBeAcquired => { + "LeaseIsBreakingAndCannotBeAcquired" + } + StorageErrorCode::LeaseIsBreakingAndCannotBeChanged => { + "LeaseIsBreakingAndCannotBeChanged" + } + StorageErrorCode::LeaseIsBrokenAndCannotBeRenewed => "LeaseIsBrokenAndCannotBeRenewed", + StorageErrorCode::LeaseLost => "LeaseLost", + StorageErrorCode::LeaseNotPresentWithBlobOperation => { + "LeaseNotPresentWithBlobOperation" + } + StorageErrorCode::LeaseNotPresentWithContainerOperation => { + "LeaseNotPresentWithContainerOperation" + } + StorageErrorCode::LeaseNotPresentWithLeaseOperation => { + "LeaseNotPresentWithLeaseOperation" + } + StorageErrorCode::MaxBlobSizeConditionNotMet => "MaxBlobSizeConditionNotMet", + StorageErrorCode::Md5Mismatch => "Md5Mismatch", + StorageErrorCode::MetadataTooLarge => "MetadataTooLarge", + StorageErrorCode::MissingContentLengthHeader => "MissingContentLengthHeader", + StorageErrorCode::MissingRequiredHeader => "MissingRequiredHeader", + StorageErrorCode::MissingRequiredQueryParameter => "MissingRequiredQueryParameter", + StorageErrorCode::MissingRequiredXmlNode => "MissingRequiredXmlNode", + StorageErrorCode::MultipleConditionHeadersNotSupported => { + "MultipleConditionHeadersNotSupported" + } + StorageErrorCode::NoPendingCopyOperation => "NoPendingCopyOperation", + StorageErrorCode::OperationNotAllowedOnIncrementalCopyBlob => { + "OperationNotAllowedOnIncrementalCopyBlob" + } + StorageErrorCode::OperationTimedOut => "OperationTimedOut", + StorageErrorCode::OutOfRangeInput => "OutOfRangeInput", + StorageErrorCode::OutOfRangeQueryParameterValue => "OutOfRangeQueryParameterValue", + StorageErrorCode::PendingCopyOperation => "PendingCopyOperation", + StorageErrorCode::PreviousSnapshotCannotBeNewer => "PreviousSnapshotCannotBeNewer", + StorageErrorCode::PreviousSnapshotNotFound => "PreviousSnapshotNotFound", + StorageErrorCode::PreviousSnapshotOperationNotSupported => { + "PreviousSnapshotOperationNotSupported" + } + StorageErrorCode::RequestBodyTooLarge => "RequestBodyTooLarge", + StorageErrorCode::RequestUrlFailedToParse => "RequestUrlFailedToParse", + StorageErrorCode::ResourceAlreadyExists => "ResourceAlreadyExists", + StorageErrorCode::ResourceNotFound => "ResourceNotFound", + StorageErrorCode::ResourceTypeMismatch => "ResourceTypeMismatch", + StorageErrorCode::SequenceNumberConditionNotMet => "SequenceNumberConditionNotMet", + StorageErrorCode::SequenceNumberIncrementTooLarge => "SequenceNumberIncrementTooLarge", + StorageErrorCode::ServerBusy => "ServerBusy", + StorageErrorCode::SnapshotCountExceeded => "SnapshotCountExceeded", + StorageErrorCode::SnapshotOperationRateExceeded => "SnapshotOperationRateExceeded", + StorageErrorCode::SnapshotsPresent => "SnapshotsPresent", + StorageErrorCode::SourceConditionNotMet => "SourceConditionNotMet", + StorageErrorCode::SystemInUse => "SystemInUse", + StorageErrorCode::TargetConditionNotMet => "TargetConditionNotMet", + StorageErrorCode::UnauthorizedBlobOverwrite => "UnauthorizedBlobOverwrite", + StorageErrorCode::UnsupportedHeader => "UnsupportedHeader", + StorageErrorCode::UnsupportedHttpVerb => "UnsupportedHttpVerb", + StorageErrorCode::UnsupportedQueryParameter => "UnsupportedQueryParameter", + StorageErrorCode::UnsupportedXmlNode => "UnsupportedXmlNode", + StorageErrorCode::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for StorageErrorCode { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "AccountAlreadyExists" => StorageErrorCode::AccountAlreadyExists, + "AccountBeingCreated" => StorageErrorCode::AccountBeingCreated, + "AccountIsDisabled" => StorageErrorCode::AccountIsDisabled, + "AppendPositionConditionNotMet" => StorageErrorCode::AppendPositionConditionNotMet, + "AuthenticationFailed" => StorageErrorCode::AuthenticationFailed, + "AuthorizationFailure" => StorageErrorCode::AuthorizationFailure, + "AuthorizationPermissionMismatch" => StorageErrorCode::AuthorizationPermissionMismatch, + "AuthorizationProtocolMismatch" => StorageErrorCode::AuthorizationProtocolMismatch, + "AuthorizationResourceTypeMismatch" => { + StorageErrorCode::AuthorizationResourceTypeMismatch + } + "AuthorizationServiceMismatch" => StorageErrorCode::AuthorizationServiceMismatch, + "AuthorizationSourceIPMismatch" => StorageErrorCode::AuthorizationSourceIPMismatch, + "BlobAccessTierNotSupportedForAccountType" => { + StorageErrorCode::BlobAccessTierNotSupportedForAccountType + } + "BlobAlreadyExists" => StorageErrorCode::BlobAlreadyExists, + "BlobArchived" => StorageErrorCode::BlobArchived, + "BlobBeingRehydrated" => StorageErrorCode::BlobBeingRehydrated, + "BlobImmutableDueToPolicy" => StorageErrorCode::BlobImmutableDueToPolicy, + "BlobNotArchived" => StorageErrorCode::BlobNotArchived, + "BlobNotFound" => StorageErrorCode::BlobNotFound, + "BlobOverwritten" => StorageErrorCode::BlobOverwritten, + "BlobTierInadequateForContentLength" => { + StorageErrorCode::BlobTierInadequateForContentLength + } + "BlobUsesCustomerSpecifiedEncryption" => { + StorageErrorCode::BlobUsesCustomerSpecifiedEncryption + } + "BlockCountExceedsLimit" => StorageErrorCode::BlockCountExceedsLimit, + "BlockListTooLong" => StorageErrorCode::BlockListTooLong, + "CannotChangeToLowerTier" => StorageErrorCode::CannotChangeToLowerTier, + "CannotVerifyCopySource" => StorageErrorCode::CannotVerifyCopySource, + "ConditionHeadersNotSupported" => StorageErrorCode::ConditionHeadersNotSupported, + "ConditionNotMet" => StorageErrorCode::ConditionNotMet, + "ContainerAlreadyExists" => StorageErrorCode::ContainerAlreadyExists, + "ContainerBeingDeleted" => StorageErrorCode::ContainerBeingDeleted, + "ContainerDisabled" => StorageErrorCode::ContainerDisabled, + "ContainerNotFound" => StorageErrorCode::ContainerNotFound, + "ContentLengthLargerThanTierLimit" => { + StorageErrorCode::ContentLengthLargerThanTierLimit + } + "CopyAcrossAccountsNotSupported" => StorageErrorCode::CopyAcrossAccountsNotSupported, + "CopyIdMismatch" => StorageErrorCode::CopyIdMismatch, + "EmptyMetadataKey" => StorageErrorCode::EmptyMetadataKey, + "FeatureVersionMismatch" => StorageErrorCode::FeatureVersionMismatch, + "IncrementalCopyBlobMismatch" => StorageErrorCode::IncrementalCopyBlobMismatch, + "IncrementalCopyOfEarlierVersionSnapshotNotAllowed" => { + StorageErrorCode::IncrementalCopyOfEarlierVersionSnapshotNotAllowed + } + "IncrementalCopySourceMustBeSnapshot" => { + StorageErrorCode::IncrementalCopySourceMustBeSnapshot + } + "InfiniteLeaseDurationRequired" => StorageErrorCode::InfiniteLeaseDurationRequired, + "InsufficientAccountPermissions" => StorageErrorCode::InsufficientAccountPermissions, + "InternalError" => StorageErrorCode::InternalError, + "InvalidAuthenticationInfo" => StorageErrorCode::InvalidAuthenticationInfo, + "InvalidBlobOrBlock" => StorageErrorCode::InvalidBlobOrBlock, + "InvalidBlobTier" => StorageErrorCode::InvalidBlobTier, + "InvalidBlobType" => StorageErrorCode::InvalidBlobType, + "InvalidBlockId" => StorageErrorCode::InvalidBlockId, + "InvalidBlockList" => StorageErrorCode::InvalidBlockList, + "InvalidHeaderValue" => StorageErrorCode::InvalidHeaderValue, + "InvalidHttpVerb" => StorageErrorCode::InvalidHttpVerb, + "InvalidInput" => StorageErrorCode::InvalidInput, + "InvalidMd5" => StorageErrorCode::InvalidMd5, + "InvalidMetadata" => StorageErrorCode::InvalidMetadata, + "InvalidOperation" => StorageErrorCode::InvalidOperation, + "InvalidPageRange" => StorageErrorCode::InvalidPageRange, + "InvalidQueryParameterValue" => StorageErrorCode::InvalidQueryParameterValue, + "InvalidRange" => StorageErrorCode::InvalidRange, + "InvalidRequestUrl" => StorageErrorCode::InvalidRequestUrl, + "InvalidSourceBlobType" => StorageErrorCode::InvalidSourceBlobType, + "InvalidSourceBlobUrl" => StorageErrorCode::InvalidSourceBlobUrl, + "InvalidUri" => StorageErrorCode::InvalidUri, + "InvalidVersionForPageBlobOperation" => { + StorageErrorCode::InvalidVersionForPageBlobOperation + } + "InvalidXmlDocument" => StorageErrorCode::InvalidXmlDocument, + "InvalidXmlNodeValue" => StorageErrorCode::InvalidXmlNodeValue, + "LeaseAlreadyBroken" => StorageErrorCode::LeaseAlreadyBroken, + "LeaseAlreadyPresent" => StorageErrorCode::LeaseAlreadyPresent, + "LeaseIdMismatchWithBlobOperation" => { + StorageErrorCode::LeaseIdMismatchWithBlobOperation + } + "LeaseIdMismatchWithContainerOperation" => { + StorageErrorCode::LeaseIdMismatchWithContainerOperation + } + "LeaseIdMismatchWithLeaseOperation" => { + StorageErrorCode::LeaseIdMismatchWithLeaseOperation + } + "LeaseIdMissing" => StorageErrorCode::LeaseIdMissing, + "LeaseIsBreakingAndCannotBeAcquired" => { + StorageErrorCode::LeaseIsBreakingAndCannotBeAcquired + } + "LeaseIsBreakingAndCannotBeChanged" => { + StorageErrorCode::LeaseIsBreakingAndCannotBeChanged + } + "LeaseIsBrokenAndCannotBeRenewed" => StorageErrorCode::LeaseIsBrokenAndCannotBeRenewed, + "LeaseLost" => StorageErrorCode::LeaseLost, + "LeaseNotPresentWithBlobOperation" => { + StorageErrorCode::LeaseNotPresentWithBlobOperation + } + "LeaseNotPresentWithContainerOperation" => { + StorageErrorCode::LeaseNotPresentWithContainerOperation + } + "LeaseNotPresentWithLeaseOperation" => { + StorageErrorCode::LeaseNotPresentWithLeaseOperation + } + "MaxBlobSizeConditionNotMet" => StorageErrorCode::MaxBlobSizeConditionNotMet, + "Md5Mismatch" => StorageErrorCode::Md5Mismatch, + "MetadataTooLarge" => StorageErrorCode::MetadataTooLarge, + "MissingContentLengthHeader" => StorageErrorCode::MissingContentLengthHeader, + "MissingRequiredHeader" => StorageErrorCode::MissingRequiredHeader, + "MissingRequiredQueryParameter" => StorageErrorCode::MissingRequiredQueryParameter, + "MissingRequiredXmlNode" => StorageErrorCode::MissingRequiredXmlNode, + "MultipleConditionHeadersNotSupported" => { + StorageErrorCode::MultipleConditionHeadersNotSupported + } + "NoPendingCopyOperation" => StorageErrorCode::NoPendingCopyOperation, + "OperationNotAllowedOnIncrementalCopyBlob" => { + StorageErrorCode::OperationNotAllowedOnIncrementalCopyBlob + } + "OperationTimedOut" => StorageErrorCode::OperationTimedOut, + "OutOfRangeInput" => StorageErrorCode::OutOfRangeInput, + "OutOfRangeQueryParameterValue" => StorageErrorCode::OutOfRangeQueryParameterValue, + "PendingCopyOperation" => StorageErrorCode::PendingCopyOperation, + "PreviousSnapshotCannotBeNewer" => StorageErrorCode::PreviousSnapshotCannotBeNewer, + "PreviousSnapshotNotFound" => StorageErrorCode::PreviousSnapshotNotFound, + "PreviousSnapshotOperationNotSupported" => { + StorageErrorCode::PreviousSnapshotOperationNotSupported + } + "RequestBodyTooLarge" => StorageErrorCode::RequestBodyTooLarge, + "RequestUrlFailedToParse" => StorageErrorCode::RequestUrlFailedToParse, + "ResourceAlreadyExists" => StorageErrorCode::ResourceAlreadyExists, + "ResourceNotFound" => StorageErrorCode::ResourceNotFound, + "ResourceTypeMismatch" => StorageErrorCode::ResourceTypeMismatch, + "SequenceNumberConditionNotMet" => StorageErrorCode::SequenceNumberConditionNotMet, + "SequenceNumberIncrementTooLarge" => StorageErrorCode::SequenceNumberIncrementTooLarge, + "ServerBusy" => StorageErrorCode::ServerBusy, + "SnapshotCountExceeded" => StorageErrorCode::SnapshotCountExceeded, + "SnapshotOperationRateExceeded" => StorageErrorCode::SnapshotOperationRateExceeded, + "SnapshotsPresent" => StorageErrorCode::SnapshotsPresent, + "SourceConditionNotMet" => StorageErrorCode::SourceConditionNotMet, + "SystemInUse" => StorageErrorCode::SystemInUse, + "TargetConditionNotMet" => StorageErrorCode::TargetConditionNotMet, + "UnauthorizedBlobOverwrite" => StorageErrorCode::UnauthorizedBlobOverwrite, + "UnsupportedHeader" => StorageErrorCode::UnsupportedHeader, + "UnsupportedHttpVerb" => StorageErrorCode::UnsupportedHttpVerb, + "UnsupportedQueryParameter" => StorageErrorCode::UnsupportedQueryParameter, + "UnsupportedXmlNode" => StorageErrorCode::UnsupportedXmlNode, + _ => StorageErrorCode::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for StorageErrorCode { + fn as_ref(&self) -> &str { + match self { + StorageErrorCode::AccountAlreadyExists => "AccountAlreadyExists", + StorageErrorCode::AccountBeingCreated => "AccountBeingCreated", + StorageErrorCode::AccountIsDisabled => "AccountIsDisabled", + StorageErrorCode::AppendPositionConditionNotMet => "AppendPositionConditionNotMet", + StorageErrorCode::AuthenticationFailed => "AuthenticationFailed", + StorageErrorCode::AuthorizationFailure => "AuthorizationFailure", + StorageErrorCode::AuthorizationPermissionMismatch => "AuthorizationPermissionMismatch", + StorageErrorCode::AuthorizationProtocolMismatch => "AuthorizationProtocolMismatch", + StorageErrorCode::AuthorizationResourceTypeMismatch => { + "AuthorizationResourceTypeMismatch" + } + StorageErrorCode::AuthorizationServiceMismatch => "AuthorizationServiceMismatch", + StorageErrorCode::AuthorizationSourceIPMismatch => "AuthorizationSourceIPMismatch", + StorageErrorCode::BlobAccessTierNotSupportedForAccountType => { + "BlobAccessTierNotSupportedForAccountType" + } + StorageErrorCode::BlobAlreadyExists => "BlobAlreadyExists", + StorageErrorCode::BlobArchived => "BlobArchived", + StorageErrorCode::BlobBeingRehydrated => "BlobBeingRehydrated", + StorageErrorCode::BlobImmutableDueToPolicy => "BlobImmutableDueToPolicy", + StorageErrorCode::BlobNotArchived => "BlobNotArchived", + StorageErrorCode::BlobNotFound => "BlobNotFound", + StorageErrorCode::BlobOverwritten => "BlobOverwritten", + StorageErrorCode::BlobTierInadequateForContentLength => { + "BlobTierInadequateForContentLength" + } + StorageErrorCode::BlobUsesCustomerSpecifiedEncryption => { + "BlobUsesCustomerSpecifiedEncryption" + } + StorageErrorCode::BlockCountExceedsLimit => "BlockCountExceedsLimit", + StorageErrorCode::BlockListTooLong => "BlockListTooLong", + StorageErrorCode::CannotChangeToLowerTier => "CannotChangeToLowerTier", + StorageErrorCode::CannotVerifyCopySource => "CannotVerifyCopySource", + StorageErrorCode::ConditionHeadersNotSupported => "ConditionHeadersNotSupported", + StorageErrorCode::ConditionNotMet => "ConditionNotMet", + StorageErrorCode::ContainerAlreadyExists => "ContainerAlreadyExists", + StorageErrorCode::ContainerBeingDeleted => "ContainerBeingDeleted", + StorageErrorCode::ContainerDisabled => "ContainerDisabled", + StorageErrorCode::ContainerNotFound => "ContainerNotFound", + StorageErrorCode::ContentLengthLargerThanTierLimit => { + "ContentLengthLargerThanTierLimit" + } + StorageErrorCode::CopyAcrossAccountsNotSupported => "CopyAcrossAccountsNotSupported", + StorageErrorCode::CopyIdMismatch => "CopyIdMismatch", + StorageErrorCode::EmptyMetadataKey => "EmptyMetadataKey", + StorageErrorCode::FeatureVersionMismatch => "FeatureVersionMismatch", + StorageErrorCode::IncrementalCopyBlobMismatch => "IncrementalCopyBlobMismatch", + StorageErrorCode::IncrementalCopyOfEarlierVersionSnapshotNotAllowed => { + "IncrementalCopyOfEarlierVersionSnapshotNotAllowed" + } + StorageErrorCode::IncrementalCopySourceMustBeSnapshot => { + "IncrementalCopySourceMustBeSnapshot" + } + StorageErrorCode::InfiniteLeaseDurationRequired => "InfiniteLeaseDurationRequired", + StorageErrorCode::InsufficientAccountPermissions => "InsufficientAccountPermissions", + StorageErrorCode::InternalError => "InternalError", + StorageErrorCode::InvalidAuthenticationInfo => "InvalidAuthenticationInfo", + StorageErrorCode::InvalidBlobOrBlock => "InvalidBlobOrBlock", + StorageErrorCode::InvalidBlobTier => "InvalidBlobTier", + StorageErrorCode::InvalidBlobType => "InvalidBlobType", + StorageErrorCode::InvalidBlockId => "InvalidBlockId", + StorageErrorCode::InvalidBlockList => "InvalidBlockList", + StorageErrorCode::InvalidHeaderValue => "InvalidHeaderValue", + StorageErrorCode::InvalidHttpVerb => "InvalidHttpVerb", + StorageErrorCode::InvalidInput => "InvalidInput", + StorageErrorCode::InvalidMd5 => "InvalidMd5", + StorageErrorCode::InvalidMetadata => "InvalidMetadata", + StorageErrorCode::InvalidOperation => "InvalidOperation", + StorageErrorCode::InvalidPageRange => "InvalidPageRange", + StorageErrorCode::InvalidQueryParameterValue => "InvalidQueryParameterValue", + StorageErrorCode::InvalidRange => "InvalidRange", + StorageErrorCode::InvalidRequestUrl => "InvalidRequestUrl", + StorageErrorCode::InvalidSourceBlobType => "InvalidSourceBlobType", + StorageErrorCode::InvalidSourceBlobUrl => "InvalidSourceBlobUrl", + StorageErrorCode::InvalidUri => "InvalidUri", + StorageErrorCode::InvalidVersionForPageBlobOperation => { + "InvalidVersionForPageBlobOperation" + } + StorageErrorCode::InvalidXmlDocument => "InvalidXmlDocument", + StorageErrorCode::InvalidXmlNodeValue => "InvalidXmlNodeValue", + StorageErrorCode::LeaseAlreadyBroken => "LeaseAlreadyBroken", + StorageErrorCode::LeaseAlreadyPresent => "LeaseAlreadyPresent", + StorageErrorCode::LeaseIdMismatchWithBlobOperation => { + "LeaseIdMismatchWithBlobOperation" + } + StorageErrorCode::LeaseIdMismatchWithContainerOperation => { + "LeaseIdMismatchWithContainerOperation" + } + StorageErrorCode::LeaseIdMismatchWithLeaseOperation => { + "LeaseIdMismatchWithLeaseOperation" + } + StorageErrorCode::LeaseIdMissing => "LeaseIdMissing", + StorageErrorCode::LeaseIsBreakingAndCannotBeAcquired => { + "LeaseIsBreakingAndCannotBeAcquired" + } + StorageErrorCode::LeaseIsBreakingAndCannotBeChanged => { + "LeaseIsBreakingAndCannotBeChanged" + } + StorageErrorCode::LeaseIsBrokenAndCannotBeRenewed => "LeaseIsBrokenAndCannotBeRenewed", + StorageErrorCode::LeaseLost => "LeaseLost", + StorageErrorCode::LeaseNotPresentWithBlobOperation => { + "LeaseNotPresentWithBlobOperation" + } + StorageErrorCode::LeaseNotPresentWithContainerOperation => { + "LeaseNotPresentWithContainerOperation" + } + StorageErrorCode::LeaseNotPresentWithLeaseOperation => { + "LeaseNotPresentWithLeaseOperation" + } + StorageErrorCode::MaxBlobSizeConditionNotMet => "MaxBlobSizeConditionNotMet", + StorageErrorCode::Md5Mismatch => "Md5Mismatch", + StorageErrorCode::MetadataTooLarge => "MetadataTooLarge", + StorageErrorCode::MissingContentLengthHeader => "MissingContentLengthHeader", + StorageErrorCode::MissingRequiredHeader => "MissingRequiredHeader", + StorageErrorCode::MissingRequiredQueryParameter => "MissingRequiredQueryParameter", + StorageErrorCode::MissingRequiredXmlNode => "MissingRequiredXmlNode", + StorageErrorCode::MultipleConditionHeadersNotSupported => { + "MultipleConditionHeadersNotSupported" + } + StorageErrorCode::NoPendingCopyOperation => "NoPendingCopyOperation", + StorageErrorCode::OperationNotAllowedOnIncrementalCopyBlob => { + "OperationNotAllowedOnIncrementalCopyBlob" + } + StorageErrorCode::OperationTimedOut => "OperationTimedOut", + StorageErrorCode::OutOfRangeInput => "OutOfRangeInput", + StorageErrorCode::OutOfRangeQueryParameterValue => "OutOfRangeQueryParameterValue", + StorageErrorCode::PendingCopyOperation => "PendingCopyOperation", + StorageErrorCode::PreviousSnapshotCannotBeNewer => "PreviousSnapshotCannotBeNewer", + StorageErrorCode::PreviousSnapshotNotFound => "PreviousSnapshotNotFound", + StorageErrorCode::PreviousSnapshotOperationNotSupported => { + "PreviousSnapshotOperationNotSupported" + } + StorageErrorCode::RequestBodyTooLarge => "RequestBodyTooLarge", + StorageErrorCode::RequestUrlFailedToParse => "RequestUrlFailedToParse", + StorageErrorCode::ResourceAlreadyExists => "ResourceAlreadyExists", + StorageErrorCode::ResourceNotFound => "ResourceNotFound", + StorageErrorCode::ResourceTypeMismatch => "ResourceTypeMismatch", + StorageErrorCode::SequenceNumberConditionNotMet => "SequenceNumberConditionNotMet", + StorageErrorCode::SequenceNumberIncrementTooLarge => "SequenceNumberIncrementTooLarge", + StorageErrorCode::ServerBusy => "ServerBusy", + StorageErrorCode::SnapshotCountExceeded => "SnapshotCountExceeded", + StorageErrorCode::SnapshotOperationRateExceeded => "SnapshotOperationRateExceeded", + StorageErrorCode::SnapshotsPresent => "SnapshotsPresent", + StorageErrorCode::SourceConditionNotMet => "SourceConditionNotMet", + StorageErrorCode::SystemInUse => "SystemInUse", + StorageErrorCode::TargetConditionNotMet => "TargetConditionNotMet", + StorageErrorCode::UnauthorizedBlobOverwrite => "UnauthorizedBlobOverwrite", + StorageErrorCode::UnsupportedHeader => "UnsupportedHeader", + StorageErrorCode::UnsupportedHttpVerb => "UnsupportedHttpVerb", + StorageErrorCode::UnsupportedQueryParameter => "UnsupportedQueryParameter", + StorageErrorCode::UnsupportedXmlNode => "UnsupportedXmlNode", + StorageErrorCode::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for StorageErrorCode { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + StorageErrorCode::AccountAlreadyExists => f.write_str("AccountAlreadyExists"), + StorageErrorCode::AccountBeingCreated => f.write_str("AccountBeingCreated"), + StorageErrorCode::AccountIsDisabled => f.write_str("AccountIsDisabled"), + StorageErrorCode::AppendPositionConditionNotMet => { + f.write_str("AppendPositionConditionNotMet") + } + StorageErrorCode::AuthenticationFailed => f.write_str("AuthenticationFailed"), + StorageErrorCode::AuthorizationFailure => f.write_str("AuthorizationFailure"), + StorageErrorCode::AuthorizationPermissionMismatch => { + f.write_str("AuthorizationPermissionMismatch") + } + StorageErrorCode::AuthorizationProtocolMismatch => { + f.write_str("AuthorizationProtocolMismatch") + } + StorageErrorCode::AuthorizationResourceTypeMismatch => { + f.write_str("AuthorizationResourceTypeMismatch") + } + StorageErrorCode::AuthorizationServiceMismatch => { + f.write_str("AuthorizationServiceMismatch") + } + StorageErrorCode::AuthorizationSourceIPMismatch => { + f.write_str("AuthorizationSourceIPMismatch") + } + StorageErrorCode::BlobAccessTierNotSupportedForAccountType => { + f.write_str("BlobAccessTierNotSupportedForAccountType") + } + StorageErrorCode::BlobAlreadyExists => f.write_str("BlobAlreadyExists"), + StorageErrorCode::BlobArchived => f.write_str("BlobArchived"), + StorageErrorCode::BlobBeingRehydrated => f.write_str("BlobBeingRehydrated"), + StorageErrorCode::BlobImmutableDueToPolicy => f.write_str("BlobImmutableDueToPolicy"), + StorageErrorCode::BlobNotArchived => f.write_str("BlobNotArchived"), + StorageErrorCode::BlobNotFound => f.write_str("BlobNotFound"), + StorageErrorCode::BlobOverwritten => f.write_str("BlobOverwritten"), + StorageErrorCode::BlobTierInadequateForContentLength => { + f.write_str("BlobTierInadequateForContentLength") + } + StorageErrorCode::BlobUsesCustomerSpecifiedEncryption => { + f.write_str("BlobUsesCustomerSpecifiedEncryption") + } + StorageErrorCode::BlockCountExceedsLimit => f.write_str("BlockCountExceedsLimit"), + StorageErrorCode::BlockListTooLong => f.write_str("BlockListTooLong"), + StorageErrorCode::CannotChangeToLowerTier => f.write_str("CannotChangeToLowerTier"), + StorageErrorCode::CannotVerifyCopySource => f.write_str("CannotVerifyCopySource"), + StorageErrorCode::ConditionHeadersNotSupported => { + f.write_str("ConditionHeadersNotSupported") + } + StorageErrorCode::ConditionNotMet => f.write_str("ConditionNotMet"), + StorageErrorCode::ContainerAlreadyExists => f.write_str("ContainerAlreadyExists"), + StorageErrorCode::ContainerBeingDeleted => f.write_str("ContainerBeingDeleted"), + StorageErrorCode::ContainerDisabled => f.write_str("ContainerDisabled"), + StorageErrorCode::ContainerNotFound => f.write_str("ContainerNotFound"), + StorageErrorCode::ContentLengthLargerThanTierLimit => { + f.write_str("ContentLengthLargerThanTierLimit") + } + StorageErrorCode::CopyAcrossAccountsNotSupported => { + f.write_str("CopyAcrossAccountsNotSupported") + } + StorageErrorCode::CopyIdMismatch => f.write_str("CopyIdMismatch"), + StorageErrorCode::EmptyMetadataKey => f.write_str("EmptyMetadataKey"), + StorageErrorCode::FeatureVersionMismatch => f.write_str("FeatureVersionMismatch"), + StorageErrorCode::IncrementalCopyBlobMismatch => { + f.write_str("IncrementalCopyBlobMismatch") + } + StorageErrorCode::IncrementalCopyOfEarlierVersionSnapshotNotAllowed => { + f.write_str("IncrementalCopyOfEarlierVersionSnapshotNotAllowed") + } + StorageErrorCode::IncrementalCopySourceMustBeSnapshot => { + f.write_str("IncrementalCopySourceMustBeSnapshot") + } + StorageErrorCode::InfiniteLeaseDurationRequired => { + f.write_str("InfiniteLeaseDurationRequired") + } + StorageErrorCode::InsufficientAccountPermissions => { + f.write_str("InsufficientAccountPermissions") + } + StorageErrorCode::InternalError => f.write_str("InternalError"), + StorageErrorCode::InvalidAuthenticationInfo => f.write_str("InvalidAuthenticationInfo"), + StorageErrorCode::InvalidBlobOrBlock => f.write_str("InvalidBlobOrBlock"), + StorageErrorCode::InvalidBlobTier => f.write_str("InvalidBlobTier"), + StorageErrorCode::InvalidBlobType => f.write_str("InvalidBlobType"), + StorageErrorCode::InvalidBlockId => f.write_str("InvalidBlockId"), + StorageErrorCode::InvalidBlockList => f.write_str("InvalidBlockList"), + StorageErrorCode::InvalidHeaderValue => f.write_str("InvalidHeaderValue"), + StorageErrorCode::InvalidHttpVerb => f.write_str("InvalidHttpVerb"), + StorageErrorCode::InvalidInput => f.write_str("InvalidInput"), + StorageErrorCode::InvalidMd5 => f.write_str("InvalidMd5"), + StorageErrorCode::InvalidMetadata => f.write_str("InvalidMetadata"), + StorageErrorCode::InvalidOperation => f.write_str("InvalidOperation"), + StorageErrorCode::InvalidPageRange => f.write_str("InvalidPageRange"), + StorageErrorCode::InvalidQueryParameterValue => { + f.write_str("InvalidQueryParameterValue") + } + StorageErrorCode::InvalidRange => f.write_str("InvalidRange"), + StorageErrorCode::InvalidRequestUrl => f.write_str("InvalidRequestUrl"), + StorageErrorCode::InvalidSourceBlobType => f.write_str("InvalidSourceBlobType"), + StorageErrorCode::InvalidSourceBlobUrl => f.write_str("InvalidSourceBlobUrl"), + StorageErrorCode::InvalidUri => f.write_str("InvalidUri"), + StorageErrorCode::InvalidVersionForPageBlobOperation => { + f.write_str("InvalidVersionForPageBlobOperation") + } + StorageErrorCode::InvalidXmlDocument => f.write_str("InvalidXmlDocument"), + StorageErrorCode::InvalidXmlNodeValue => f.write_str("InvalidXmlNodeValue"), + StorageErrorCode::LeaseAlreadyBroken => f.write_str("LeaseAlreadyBroken"), + StorageErrorCode::LeaseAlreadyPresent => f.write_str("LeaseAlreadyPresent"), + StorageErrorCode::LeaseIdMismatchWithBlobOperation => { + f.write_str("LeaseIdMismatchWithBlobOperation") + } + StorageErrorCode::LeaseIdMismatchWithContainerOperation => { + f.write_str("LeaseIdMismatchWithContainerOperation") + } + StorageErrorCode::LeaseIdMismatchWithLeaseOperation => { + f.write_str("LeaseIdMismatchWithLeaseOperation") + } + StorageErrorCode::LeaseIdMissing => f.write_str("LeaseIdMissing"), + StorageErrorCode::LeaseIsBreakingAndCannotBeAcquired => { + f.write_str("LeaseIsBreakingAndCannotBeAcquired") + } + StorageErrorCode::LeaseIsBreakingAndCannotBeChanged => { + f.write_str("LeaseIsBreakingAndCannotBeChanged") + } + StorageErrorCode::LeaseIsBrokenAndCannotBeRenewed => { + f.write_str("LeaseIsBrokenAndCannotBeRenewed") + } + StorageErrorCode::LeaseLost => f.write_str("LeaseLost"), + StorageErrorCode::LeaseNotPresentWithBlobOperation => { + f.write_str("LeaseNotPresentWithBlobOperation") + } + StorageErrorCode::LeaseNotPresentWithContainerOperation => { + f.write_str("LeaseNotPresentWithContainerOperation") + } + StorageErrorCode::LeaseNotPresentWithLeaseOperation => { + f.write_str("LeaseNotPresentWithLeaseOperation") + } + StorageErrorCode::MaxBlobSizeConditionNotMet => { + f.write_str("MaxBlobSizeConditionNotMet") + } + StorageErrorCode::Md5Mismatch => f.write_str("Md5Mismatch"), + StorageErrorCode::MetadataTooLarge => f.write_str("MetadataTooLarge"), + StorageErrorCode::MissingContentLengthHeader => { + f.write_str("MissingContentLengthHeader") + } + StorageErrorCode::MissingRequiredHeader => f.write_str("MissingRequiredHeader"), + StorageErrorCode::MissingRequiredQueryParameter => { + f.write_str("MissingRequiredQueryParameter") + } + StorageErrorCode::MissingRequiredXmlNode => f.write_str("MissingRequiredXmlNode"), + StorageErrorCode::MultipleConditionHeadersNotSupported => { + f.write_str("MultipleConditionHeadersNotSupported") + } + StorageErrorCode::NoPendingCopyOperation => f.write_str("NoPendingCopyOperation"), + StorageErrorCode::OperationNotAllowedOnIncrementalCopyBlob => { + f.write_str("OperationNotAllowedOnIncrementalCopyBlob") + } + StorageErrorCode::OperationTimedOut => f.write_str("OperationTimedOut"), + StorageErrorCode::OutOfRangeInput => f.write_str("OutOfRangeInput"), + StorageErrorCode::OutOfRangeQueryParameterValue => { + f.write_str("OutOfRangeQueryParameterValue") + } + StorageErrorCode::PendingCopyOperation => f.write_str("PendingCopyOperation"), + StorageErrorCode::PreviousSnapshotCannotBeNewer => { + f.write_str("PreviousSnapshotCannotBeNewer") + } + StorageErrorCode::PreviousSnapshotNotFound => f.write_str("PreviousSnapshotNotFound"), + StorageErrorCode::PreviousSnapshotOperationNotSupported => { + f.write_str("PreviousSnapshotOperationNotSupported") + } + StorageErrorCode::RequestBodyTooLarge => f.write_str("RequestBodyTooLarge"), + StorageErrorCode::RequestUrlFailedToParse => f.write_str("RequestUrlFailedToParse"), + StorageErrorCode::ResourceAlreadyExists => f.write_str("ResourceAlreadyExists"), + StorageErrorCode::ResourceNotFound => f.write_str("ResourceNotFound"), + StorageErrorCode::ResourceTypeMismatch => f.write_str("ResourceTypeMismatch"), + StorageErrorCode::SequenceNumberConditionNotMet => { + f.write_str("SequenceNumberConditionNotMet") + } + StorageErrorCode::SequenceNumberIncrementTooLarge => { + f.write_str("SequenceNumberIncrementTooLarge") + } + StorageErrorCode::ServerBusy => f.write_str("ServerBusy"), + StorageErrorCode::SnapshotCountExceeded => f.write_str("SnapshotCountExceeded"), + StorageErrorCode::SnapshotOperationRateExceeded => { + f.write_str("SnapshotOperationRateExceeded") + } + StorageErrorCode::SnapshotsPresent => f.write_str("SnapshotsPresent"), + StorageErrorCode::SourceConditionNotMet => f.write_str("SourceConditionNotMet"), + StorageErrorCode::SystemInUse => f.write_str("SystemInUse"), + StorageErrorCode::TargetConditionNotMet => f.write_str("TargetConditionNotMet"), + StorageErrorCode::UnauthorizedBlobOverwrite => f.write_str("UnauthorizedBlobOverwrite"), + StorageErrorCode::UnsupportedHeader => f.write_str("UnsupportedHeader"), + StorageErrorCode::UnsupportedHttpVerb => f.write_str("UnsupportedHttpVerb"), + StorageErrorCode::UnsupportedQueryParameter => f.write_str("UnsupportedQueryParameter"), + StorageErrorCode::UnsupportedXmlNode => f.write_str("UnsupportedXmlNode"), + StorageErrorCode::UnknownValue(s) => f.write_str(s.as_str()), } } } diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums_serde.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums_serde.rs index 150da1830..1929babe9 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums_serde.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/enums_serde.rs @@ -4,12 +4,12 @@ // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. use super::{ - AccessTier, AccountKind, ArchiveStatus, BlobDeleteType, BlobExpiryOptions, - BlobImmutabilityPolicyMode, BlobType, BlockListType, CopyStatus, DeleteSnapshotsOptionType, - EncryptionAlgorithmType, FilterBlobsIncludeItem, GeoReplicationStatusType, LeaseDuration, - LeaseState, LeaseStatus, ListBlobsIncludeItem, ListContainersIncludeType, - PremiumPageBlobAccessTier, PublicAccessType, QueryRequestType, QueryType, RehydratePriority, - SequenceNumberActionType, SkuName, + AccessTier, AccountKind, ArchiveStatus, BlobCopySourceTags, BlobDeleteType, BlobType, + BlockListType, CopyStatus, DeleteSnapshotsOptionType, EncryptionAlgorithmType, + FileShareTokenIntent, FilterBlobsIncludeItem, GeoReplicationStatusType, ImmutabilityPolicyMode, + LeaseDuration, LeaseState, LeaseStatus, ListBlobsIncludeItem, ListContainersIncludeType, + PremiumPageBlobAccessTier, PublicAccessType, RehydratePriority, SequenceNumberActionType, + SkuName, StorageErrorCode, }; use serde::{Deserialize, Deserializer, Serialize, Serializer}; @@ -70,7 +70,7 @@ impl Serialize for ArchiveStatus { } } -impl<'de> Deserialize<'de> for BlobDeleteType { +impl<'de> Deserialize<'de> for BlobCopySourceTags { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -80,7 +80,7 @@ impl<'de> Deserialize<'de> for BlobDeleteType { } } -impl Serialize for BlobDeleteType { +impl Serialize for BlobCopySourceTags { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -89,7 +89,7 @@ impl Serialize for BlobDeleteType { } } -impl<'de> Deserialize<'de> for BlobExpiryOptions { +impl<'de> Deserialize<'de> for BlobDeleteType { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -99,7 +99,7 @@ impl<'de> Deserialize<'de> for BlobExpiryOptions { } } -impl Serialize for BlobExpiryOptions { +impl Serialize for BlobDeleteType { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -108,7 +108,7 @@ impl Serialize for BlobExpiryOptions { } } -impl<'de> Deserialize<'de> for BlobImmutabilityPolicyMode { +impl<'de> Deserialize<'de> for BlobType { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -118,7 +118,7 @@ impl<'de> Deserialize<'de> for BlobImmutabilityPolicyMode { } } -impl Serialize for BlobImmutabilityPolicyMode { +impl Serialize for BlobType { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -127,7 +127,7 @@ impl Serialize for BlobImmutabilityPolicyMode { } } -impl<'de> Deserialize<'de> for BlobType { +impl<'de> Deserialize<'de> for BlockListType { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -137,7 +137,7 @@ impl<'de> Deserialize<'de> for BlobType { } } -impl Serialize for BlobType { +impl Serialize for BlockListType { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -146,7 +146,7 @@ impl Serialize for BlobType { } } -impl<'de> Deserialize<'de> for BlockListType { +impl<'de> Deserialize<'de> for CopyStatus { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -156,7 +156,7 @@ impl<'de> Deserialize<'de> for BlockListType { } } -impl Serialize for BlockListType { +impl Serialize for CopyStatus { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -165,7 +165,7 @@ impl Serialize for BlockListType { } } -impl<'de> Deserialize<'de> for CopyStatus { +impl<'de> Deserialize<'de> for DeleteSnapshotsOptionType { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -175,7 +175,7 @@ impl<'de> Deserialize<'de> for CopyStatus { } } -impl Serialize for CopyStatus { +impl Serialize for DeleteSnapshotsOptionType { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -184,7 +184,7 @@ impl Serialize for CopyStatus { } } -impl<'de> Deserialize<'de> for DeleteSnapshotsOptionType { +impl<'de> Deserialize<'de> for EncryptionAlgorithmType { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -194,7 +194,7 @@ impl<'de> Deserialize<'de> for DeleteSnapshotsOptionType { } } -impl Serialize for DeleteSnapshotsOptionType { +impl Serialize for EncryptionAlgorithmType { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -203,7 +203,7 @@ impl Serialize for DeleteSnapshotsOptionType { } } -impl<'de> Deserialize<'de> for EncryptionAlgorithmType { +impl<'de> Deserialize<'de> for FileShareTokenIntent { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -213,7 +213,7 @@ impl<'de> Deserialize<'de> for EncryptionAlgorithmType { } } -impl Serialize for EncryptionAlgorithmType { +impl Serialize for FileShareTokenIntent { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -260,7 +260,7 @@ impl Serialize for GeoReplicationStatusType { } } -impl<'de> Deserialize<'de> for LeaseDuration { +impl<'de> Deserialize<'de> for ImmutabilityPolicyMode { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -270,7 +270,7 @@ impl<'de> Deserialize<'de> for LeaseDuration { } } -impl Serialize for LeaseDuration { +impl Serialize for ImmutabilityPolicyMode { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -279,7 +279,7 @@ impl Serialize for LeaseDuration { } } -impl<'de> Deserialize<'de> for LeaseState { +impl<'de> Deserialize<'de> for LeaseDuration { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -289,7 +289,7 @@ impl<'de> Deserialize<'de> for LeaseState { } } -impl Serialize for LeaseState { +impl Serialize for LeaseDuration { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -298,7 +298,7 @@ impl Serialize for LeaseState { } } -impl<'de> Deserialize<'de> for LeaseStatus { +impl<'de> Deserialize<'de> for LeaseState { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -308,7 +308,7 @@ impl<'de> Deserialize<'de> for LeaseStatus { } } -impl Serialize for LeaseStatus { +impl Serialize for LeaseState { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -317,7 +317,7 @@ impl Serialize for LeaseStatus { } } -impl<'de> Deserialize<'de> for ListBlobsIncludeItem { +impl<'de> Deserialize<'de> for LeaseStatus { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -327,7 +327,7 @@ impl<'de> Deserialize<'de> for ListBlobsIncludeItem { } } -impl Serialize for ListBlobsIncludeItem { +impl Serialize for LeaseStatus { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -336,7 +336,7 @@ impl Serialize for ListBlobsIncludeItem { } } -impl<'de> Deserialize<'de> for ListContainersIncludeType { +impl<'de> Deserialize<'de> for ListBlobsIncludeItem { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -346,7 +346,7 @@ impl<'de> Deserialize<'de> for ListContainersIncludeType { } } -impl Serialize for ListContainersIncludeType { +impl Serialize for ListBlobsIncludeItem { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -355,7 +355,7 @@ impl Serialize for ListContainersIncludeType { } } -impl<'de> Deserialize<'de> for PremiumPageBlobAccessTier { +impl<'de> Deserialize<'de> for ListContainersIncludeType { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -365,7 +365,7 @@ impl<'de> Deserialize<'de> for PremiumPageBlobAccessTier { } } -impl Serialize for PremiumPageBlobAccessTier { +impl Serialize for ListContainersIncludeType { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -374,7 +374,7 @@ impl Serialize for PremiumPageBlobAccessTier { } } -impl<'de> Deserialize<'de> for PublicAccessType { +impl<'de> Deserialize<'de> for PremiumPageBlobAccessTier { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -384,7 +384,7 @@ impl<'de> Deserialize<'de> for PublicAccessType { } } -impl Serialize for PublicAccessType { +impl Serialize for PremiumPageBlobAccessTier { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -393,7 +393,7 @@ impl Serialize for PublicAccessType { } } -impl<'de> Deserialize<'de> for QueryRequestType { +impl<'de> Deserialize<'de> for PublicAccessType { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -403,7 +403,7 @@ impl<'de> Deserialize<'de> for QueryRequestType { } } -impl Serialize for QueryRequestType { +impl Serialize for PublicAccessType { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -412,7 +412,7 @@ impl Serialize for QueryRequestType { } } -impl<'de> Deserialize<'de> for QueryType { +impl<'de> Deserialize<'de> for RehydratePriority { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -422,7 +422,7 @@ impl<'de> Deserialize<'de> for QueryType { } } -impl Serialize for QueryType { +impl Serialize for RehydratePriority { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -431,7 +431,7 @@ impl Serialize for QueryType { } } -impl<'de> Deserialize<'de> for RehydratePriority { +impl<'de> Deserialize<'de> for SequenceNumberActionType { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -441,7 +441,7 @@ impl<'de> Deserialize<'de> for RehydratePriority { } } -impl Serialize for RehydratePriority { +impl Serialize for SequenceNumberActionType { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -450,7 +450,7 @@ impl Serialize for RehydratePriority { } } -impl<'de> Deserialize<'de> for SequenceNumberActionType { +impl<'de> Deserialize<'de> for SkuName { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -460,7 +460,7 @@ impl<'de> Deserialize<'de> for SequenceNumberActionType { } } -impl Serialize for SequenceNumberActionType { +impl Serialize for SkuName { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, @@ -469,7 +469,7 @@ impl Serialize for SequenceNumberActionType { } } -impl<'de> Deserialize<'de> for SkuName { +impl<'de> Deserialize<'de> for StorageErrorCode { fn deserialize(deserializer: D) -> ::core::result::Result where D: Deserializer<'de>, @@ -479,7 +479,7 @@ impl<'de> Deserialize<'de> for SkuName { } } -impl Serialize for SkuName { +impl Serialize for StorageErrorCode { fn serialize(&self, s: S) -> ::core::result::Result where S: Serializer, diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/header_traits.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/header_traits.rs index 972e98945..1bd02dc72 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/header_traits.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/header_traits.rs @@ -4,30 +4,23 @@ // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. use super::{ - AccessTier, AccountKind, AppendBlobClientAppendBlockFromUrlResult, - AppendBlobClientAppendBlockResult, AppendBlobClientCreateResult, AppendBlobClientSealResult, - ArchiveStatus, BlobClientAbortCopyFromUrlResult, BlobClientAcquireLeaseResult, - BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, BlobClientCopyFromUrlResult, - BlobClientCreateSnapshotResult, BlobClientDeleteImmutabilityPolicyResult, - BlobClientDownloadResult, BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, - BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, BlobClientSetExpiryResult, - BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldResult, BlobClientSetTagsResult, - BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, - BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult, - BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult, - BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult, - BlobContainerClientRenameResult, BlobContainerClientRenewLeaseResult, - BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyResult, - BlobImmutabilityPolicyMode, BlobServiceClientGetAccountInfoResult, BlobTags, BlobType, - BlockBlobClientCommitBlockListResult, BlockBlobClientPutBlobFromUrlResult, - BlockBlobClientQueryResult, BlockBlobClientStageBlockFromUrlResult, - BlockBlobClientStageBlockResult, BlockBlobClientUploadResult, BlockList, CopyStatus, - FilterBlobSegment, LeaseDuration, LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse, - ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult, - PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult, PageBlobClientResizeResult, - PageBlobClientUpdateSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult, + AccountKind, AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockResult, + AppendBlobClientCreateResult, AppendBlobClientSealResult, ArchiveStatus, + BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, + BlobClientCreateSnapshotResult, BlobClientDownloadInternalResult, + BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult, + BlobClientRenewLeaseResult, BlobContainerClientAcquireLeaseResult, + BlobContainerClientBreakLeaseResult, BlobContainerClientChangeLeaseResult, + BlobContainerClientGetAccountInfoResult, BlobContainerClientGetPropertiesResult, + BlobContainerClientReleaseLeaseResult, BlobContainerClientRenewLeaseResult, + BlobServiceClientGetAccountInfoResult, BlobType, BlockBlobClientCommitBlockListResult, + BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult, + BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadInternalResult, BlockList, + CopyStatus, ImmutabilityPolicyMode, LeaseDuration, LeaseState, LeaseStatus, + PageBlobClientClearPagesResult, PageBlobClientCreateResult, PageBlobClientResizeResult, + PageBlobClientSetSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList, PublicAccessType, RehydratePriority, - SignedIdentifiers, SkuName, StorageServiceStats, UserDelegationKey, + SignedIdentifiers, SkuName, }; use azure_core::{ base64, @@ -40,7 +33,6 @@ use azure_core::{ }; use std::collections::HashMap; -const ACCEPT_RANGES: HeaderName = HeaderName::from_static("accept-ranges"); const ACCESS_TIER: HeaderName = HeaderName::from_static("x-ms-access-tier"); const ACCESS_TIER_CHANGE_TIME: HeaderName = HeaderName::from_static("x-ms-access-tier-change-time"); const ACCESS_TIER_INFERRED: HeaderName = HeaderName::from_static("x-ms-access-tier-inferred"); @@ -72,7 +64,6 @@ const COPY_SOURCE: HeaderName = HeaderName::from_static("x-ms-copy-source"); 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"); -const DATE: HeaderName = HeaderName::from_static("date"); const DEFAULT_ENCRYPTION_SCOPE: HeaderName = HeaderName::from_static("x-ms-default-encryption-scope"); const DENY_ENCRYPTION_SCOPE_OVERRIDE: HeaderName = @@ -106,9 +97,9 @@ 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_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 TAG_COUNT: HeaderName = HeaderName::from_static("x-ms-tag-count"); const VERSION_ID: HeaderName = HeaderName::from_static("x-ms-version-id"); @@ -125,18 +116,17 @@ const VERSION_ID: HeaderName = HeaderName::from_static("x-ms-version-id"); /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); +/// } /// Ok(()) /// } /// ``` pub trait AppendBlobClientAppendBlockFromUrlResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn blob_append_offset(&self) -> Result>; @@ -156,11 +146,6 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders 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| 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) @@ -224,18 +209,17 @@ impl AppendBlobClientAppendBlockFromUrlResultHeaders /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); +/// } /// Ok(()) /// } /// ``` pub trait AppendBlobClientAppendBlockResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn blob_append_offset(&self) -> Result>; @@ -244,7 +228,6 @@ pub trait AppendBlobClientAppendBlockResultHeaders: private::Sealed { fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; - fn structured_body_type(&self) -> Result>; } impl AppendBlobClientAppendBlockResultHeaders @@ -256,11 +239,6 @@ impl AppendBlobClientAppendBlockResultHeaders 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| 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) @@ -309,11 +287,6 @@ impl AppendBlobClientAppendBlockResultHeaders 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 `AppendBlobClient::create()` @@ -329,18 +302,17 @@ impl AppendBlobClientAppendBlockResultHeaders /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); +/// } /// Ok(()) /// } /// ``` pub trait AppendBlobClientCreateResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; @@ -356,11 +328,6 @@ impl AppendBlobClientCreateResultHeaders for Response Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } - /// The ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -409,31 +376,25 @@ impl AppendBlobClientCreateResultHeaders for Response Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(is_sealed) = response.is_sealed()? { +/// println!("x-ms-blob-sealed: {:?}", is_sealed); +/// } /// Ok(()) /// } /// ``` pub trait AppendBlobClientSealResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -452,35 +413,6 @@ impl AppendBlobClientSealResultHeaders for Response Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub(crate) trait BlobClientAbortCopyFromUrlResultHeaders: private::Sealed { - fn date(&self) -> Result>; -} - -impl BlobClientAbortCopyFromUrlResultHeaders - for Response -{ - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } -} - /// Provides access to typed response headers for `BlobClient::acquire_lease()` /// /// # Examples @@ -491,31 +423,25 @@ impl BlobClientAbortCopyFromUrlResultHeaders /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(lease_id) = response.lease_id()? { +/// println!("x-ms-lease-id: {:?}", lease_id); +/// } /// Ok(()) /// } /// ``` pub trait BlobClientAcquireLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -544,31 +470,25 @@ impl BlobClientAcquireLeaseResultHeaders for Response Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(lease_time) = response.lease_time()? { +/// println!("x-ms-lease-time: {:?}", lease_time); +/// } /// Ok(()) /// } /// ``` pub trait BlobClientBreakLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -597,31 +517,25 @@ impl BlobClientBreakLeaseResultHeaders for Response Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(lease_id) = response.lease_id()? { +/// println!("x-ms-lease-id: {:?}", lease_id); +/// } /// Ok(()) /// } /// ``` pub trait BlobClientChangeLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -640,96 +554,6 @@ impl BlobClientChangeLeaseResultHeaders for Response Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(content_md5) = response.content_md5()? { -/// println!("content-md5: {:?}", content_md5); -/// } -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobClientCopyFromUrlResultHeaders: private::Sealed { - fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; - fn etag(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn content_crc64(&self) -> Result>>; - fn copy_id(&self) -> Result>; - fn copy_status(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn version_id(&self) -> Result>; -} - -impl BlobClientCopyFromUrlResultHeaders for Response { - /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the - /// client can check for message content integrity. - fn content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| 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| 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 date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } - - /// 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()) - }) - } - - /// 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) - } - - /// State of the copy operation identified by x-ms-copy-id. - fn copy_status(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_STATUS) - } - - /// 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) - } - - /// 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::create_snapshot()` /// /// # Examples @@ -740,20 +564,19 @@ impl BlobClientCopyFromUrlResultHeaders for Response Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(is_server_encrypted) = response.is_server_encrypted()? { +/// println!("x-ms-request-server-encrypted: {:?}", is_server_encrypted); +/// } /// Ok(()) /// } /// ``` pub trait BlobClientCreateSnapshotResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; @@ -762,11 +585,6 @@ 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| 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) @@ -798,59 +616,29 @@ impl BlobClientCreateSnapshotResultHeaders for Response Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobClientDeleteImmutabilityPolicyResultHeaders: private::Sealed { - fn date(&self) -> Result>; -} - -impl BlobClientDeleteImmutabilityPolicyResultHeaders - for Response -{ - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } -} - -/// Provides access to typed response headers for `BlobClient::download()` +/// Provides access to typed response headers for `BlobClient::download_internal()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::AsyncResponse}; -/// use blob_storage::models::{BlobClientDownloadResult, BlobClientDownloadResultHeaders}; +/// use blob_storage::models::{BlobClientDownloadInternalResult, BlobClientDownloadInternalResultHeaders}; /// async fn example() -> Result<()> { -/// let response: AsyncResponse = unimplemented!(); +/// let response: AsyncResponse = unimplemented!(); /// // Access response headers -/// if let Some(accept_ranges) = response.accept_ranges()? { -/// println!("accept-ranges: {:?}", accept_ranges); -/// } /// if let Some(cache_control) = response.cache_control()? { /// println!("cache-control: {:?}", cache_control); /// } /// if let Some(content_disposition) = response.content_disposition()? { /// println!("content-disposition: {:?}", content_disposition); /// } +/// if let Some(content_encoding) = response.content_encoding()? { +/// println!("content-encoding: {:?}", content_encoding); +/// } /// Ok(()) /// } /// ``` -pub trait BlobClientDownloadResultHeaders: private::Sealed { - fn accept_ranges(&self) -> Result>; +pub trait BlobClientDownloadInternalResultHeaders: private::Sealed { fn cache_control(&self) -> Result>; fn content_disposition(&self) -> Result>; fn content_encoding(&self) -> Result>; @@ -875,7 +663,7 @@ pub trait BlobClientDownloadResultHeaders: private::Sealed { fn creation_time(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; - fn immutability_policy_mode(&self) -> Result>; + fn immutability_policy_mode(&self) -> Result>; fn immutability_policy_expires_on(&self) -> Result>; fn is_current_version(&self) -> Result>; fn last_accessed(&self) -> Result>; @@ -891,12 +679,7 @@ pub trait BlobClientDownloadResultHeaders: private::Sealed { fn version_id(&self) -> Result>; } -impl BlobClientDownloadResultHeaders for AsyncResponse { - /// Indicates that the service supports requests for partial blob content. - fn accept_ranges(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ACCEPT_RANGES) - } - +impl BlobClientDownloadInternalResultHeaders for AsyncResponse { /// 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) @@ -1050,7 +833,7 @@ impl BlobClientDownloadResultHeaders for AsyncResponse } /// Indicates the immutability policy mode of the blob. - fn immutability_policy_mode(&self) -> Result> { + fn immutability_policy_mode(&self) -> Result> { Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE) } @@ -1089,7 +872,7 @@ impl BlobClientDownloadResultHeaders for AsyncResponse Headers::get_optional_as(self.headers(), &LEASE_STATUS) } - /// Specifies the legal hold status to set on the blob. + /// Indicates whether the blob has a legal hold. fn legal_hold(&self) -> Result> { Headers::get_optional_as(self.headers(), &LEGAL_HOLD) } @@ -1128,7 +911,7 @@ impl BlobClientDownloadResultHeaders for AsyncResponse /// 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) } /// The number of tags associated with the blob @@ -1153,31 +936,25 @@ impl BlobClientDownloadResultHeaders for AsyncResponse /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(account_kind) = response.account_kind()? { /// println!("x-ms-account-kind: {:?}", account_kind); /// } /// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? { /// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled); /// } +/// if let Some(sku_name) = response.sku_name()? { +/// println!("x-ms-sku-name: {:?}", sku_name); +/// } /// Ok(()) /// } /// ``` pub trait BlobClientGetAccountInfoResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn account_kind(&self) -> Result>; fn is_hierarchical_namespace_enabled(&self) -> Result>; fn sku_name(&self) -> Result>; } impl BlobClientGetAccountInfoResultHeaders for Response { - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } - /// Identifies the account kind fn account_kind(&self) -> Result> { Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) @@ -1225,7 +1002,7 @@ pub trait BlobClientGetPropertiesResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; - fn tier(&self) -> Result>; + fn access_tier(&self) -> Result>; fn access_tier_change_time(&self) -> Result>; fn access_tier_inferred(&self) -> Result>; fn archive_status(&self) -> Result>; @@ -1244,7 +1021,7 @@ pub trait BlobClientGetPropertiesResultHeaders: private::Sealed { fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; fn expires_on(&self) -> Result>; - fn immutability_policy_mode(&self) -> Result>; + fn immutability_policy_mode(&self) -> Result>; fn immutability_policy_expires_on(&self) -> Result>; fn is_incremental_copy(&self) -> Result>; fn is_current_version(&self) -> Result>; @@ -1309,8 +1086,10 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { + /// The tier of page blob on a premium storage account or tier of block blob on blob storage LRS accounts. For a list of allowed + /// premium page blob tiers, see . For blob storage + /// LRS accounts, valid values are Hot/Cool/Archive. + fn access_tier(&self) -> Result> { Headers::get_optional_as(self.headers(), &ACCESS_TIER) } @@ -1430,7 +1209,7 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { + fn immutability_policy_mode(&self) -> Result> { Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE) } @@ -1474,7 +1253,7 @@ impl BlobClientGetPropertiesResultHeaders for Response Result> { Headers::get_optional_as(self.headers(), &LEGAL_HOLD) } @@ -1519,7 +1298,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 @@ -1544,9 +1323,6 @@ impl BlobClientGetPropertiesResultHeaders for Response Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } @@ -1557,17 +1333,11 @@ impl BlobClientGetPropertiesResultHeaders for Response Result>; fn etag(&self) -> Result>; fn last_modified(&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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -1591,31 +1361,25 @@ impl BlobClientReleaseLeaseResultHeaders for Response Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(lease_id) = response.lease_id()? { +/// println!("x-ms-lease-id: {:?}", lease_id); +/// } /// Ok(()) /// } /// ``` pub trait BlobClientRenewLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -1634,40 +1398,37 @@ impl BlobClientRenewLeaseResultHeaders for Response Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(lease_id) = response.lease_id()? { +/// println!("x-ms-lease-id: {:?}", lease_id); +/// } /// Ok(()) /// } /// ``` -pub trait BlobClientSetExpiryResultHeaders: private::Sealed { - fn date(&self) -> Result>; +pub trait BlobContainerClientAcquireLeaseResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; + fn lease_id(&self) -> Result>; } -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| parse_rfc7231(h.as_str())) - } - +impl BlobContainerClientAcquireLeaseResultHeaders + for Response +{ /// The ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -1679,159 +1440,198 @@ impl BlobClientSetExpiryResultHeaders for Response Result> { + Headers::get_optional_as(self.headers(), &LEASE_ID) + } } -/// Provides access to typed response headers for `BlobClient::set_immutability_policy()` +/// Provides access to typed response headers for `BlobContainerClient::break_lease()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobClientSetImmutabilityPolicyResult, BlobClientSetImmutabilityPolicyResultHeaders}; +/// use blob_storage::models::{BlobContainerClientBreakLeaseResult, BlobContainerClientBreakLeaseResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); +/// if let Some(etag) = response.etag()? { +/// println!("etag: {:?}", etag); /// } -/// if let Some(immutability_policy_mode) = response.immutability_policy_mode()? { -/// println!("x-ms-immutability-policy-mode: {:?}", immutability_policy_mode); +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); /// } -/// if let Some(immutability_policy_expires_on) = response.immutability_policy_expires_on()? { -/// println!("x-ms-immutability-policy-until-date: {:?}", immutability_policy_expires_on); +/// if let Some(lease_time) = response.lease_time()? { +/// println!("x-ms-lease-time: {:?}", lease_time); /// } /// Ok(()) /// } /// ``` -pub trait BlobClientSetImmutabilityPolicyResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn immutability_policy_mode(&self) -> Result>; - fn immutability_policy_expires_on(&self) -> Result>; +pub trait BlobContainerClientBreakLeaseResultHeaders: private::Sealed { + fn etag(&self) -> Result>; + fn last_modified(&self) -> Result>; + fn lease_time(&self) -> Result>; } -impl BlobClientSetImmutabilityPolicyResultHeaders - for Response +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())) - } - - /// Indicates the immutability policy mode of the blob. - fn immutability_policy_mode(&self) -> Result> { - Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE) + /// The ETag contains a value that you can use to perform operations conditionally. + fn etag(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ETAG) } - /// 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| { + /// The date/time that the container was last modified. + fn last_modified(&self) -> Result> { + Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { parse_rfc7231(h.as_str()) }) } + + /// Approximate time remaining in the lease period, in seconds. + fn lease_time(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_TIME) + } } -/// Provides access to typed response headers for `BlobClient::set_legal_hold()` +/// Provides access to typed response headers for `BlobContainerClient::change_lease()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobClientSetLegalHoldResult, BlobClientSetLegalHoldResultHeaders}; +/// use blob_storage::models::{BlobContainerClientChangeLeaseResult, BlobContainerClientChangeLeaseResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); +/// if let Some(etag) = response.etag()? { +/// println!("etag: {:?}", etag); +/// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); /// } -/// if let Some(legal_hold) = response.legal_hold()? { -/// println!("x-ms-legal-hold: {:?}", legal_hold); +/// if let Some(lease_id) = response.lease_id()? { +/// println!("x-ms-lease-id: {:?}", lease_id); /// } /// Ok(()) /// } /// ``` -pub trait BlobClientSetLegalHoldResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn legal_hold(&self) -> Result>; +pub trait BlobContainerClientChangeLeaseResultHeaders: private::Sealed { + fn etag(&self) -> Result>; + fn last_modified(&self) -> Result>; + fn lease_id(&self) -> Result>; } -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| parse_rfc7231(h.as_str())) +impl BlobContainerClientChangeLeaseResultHeaders + for Response +{ + /// The ETag contains a value that you can use to perform operations conditionally. + fn etag(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ETAG) } - /// Specifies the legal hold status to set on the blob. - fn legal_hold(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEGAL_HOLD) + /// The date/time that the container was last modified. + fn last_modified(&self) -> Result> { + Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { + parse_rfc7231(h.as_str()) + }) + } + + /// Uniquely identifies a blobs' lease + fn lease_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_ID) } } -/// Provides access to typed response headers for `BlobClient::set_tags()` +/// Provides access to typed response headers for `BlobContainerClient::get_account_info()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobClientSetTagsResult, BlobClientSetTagsResultHeaders}; +/// use blob_storage::models::{BlobContainerClientGetAccountInfoResult, BlobContainerClientGetAccountInfoResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); +/// if let Some(account_kind) = response.account_kind()? { +/// println!("x-ms-account-kind: {:?}", account_kind); +/// } +/// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? { +/// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled); +/// } +/// if let Some(sku_name) = response.sku_name()? { +/// println!("x-ms-sku-name: {:?}", sku_name); /// } /// Ok(()) /// } /// ``` -pub trait BlobClientSetTagsResultHeaders: private::Sealed { - fn date(&self) -> Result>; +pub trait BlobContainerClientGetAccountInfoResultHeaders: private::Sealed { + fn account_kind(&self) -> Result>; + fn is_hierarchical_namespace_enabled(&self) -> Result>; + fn sku_name(&self) -> Result>; } -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| parse_rfc7231(h.as_str())) +impl BlobContainerClientGetAccountInfoResultHeaders + for Response +{ + /// Identifies the account kind + fn account_kind(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) + } + + /// Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled. + fn is_hierarchical_namespace_enabled(&self) -> Result> { + Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED) + } + + /// Identifies the sku name of the account + fn sku_name(&self) -> Result> { + Headers::get_optional_as(self.headers(), &SKU_NAME) } } -/// Provides access to typed response headers for `BlobClient::start_copy_from_url()` +/// Provides access to typed response headers for `BlobContainerClient::get_properties()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobClientStartCopyFromUrlResult, BlobClientStartCopyFromUrlResultHeaders}; +/// use blob_storage::models::{BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(access) = response.access()? { +/// println!("x-ms-blob-public-access: {:?}", access); +/// } /// Ok(()) /// } /// ``` -pub trait BlobClientStartCopyFromUrlResultHeaders: private::Sealed { - fn date(&self) -> Result>; +pub trait BlobContainerClientGetPropertiesResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; - fn copy_id(&self) -> Result>; - fn copy_status(&self) -> Result>; - fn version_id(&self) -> Result>; + fn access(&self) -> Result>; + fn default_encryption_scope(&self) -> Result>; + fn prevent_encryption_scope_override(&self) -> Result>; + fn has_immutability_policy(&self) -> Result>; + fn has_legal_hold(&self) -> Result>; + fn is_immutable_storage_with_versioning_enabled(&self) -> Result>; + fn duration(&self) -> Result>; + fn lease_state(&self) -> Result>; + fn lease_status(&self) -> Result>; + fn metadata(&self) -> Result>; } -impl BlobClientStartCopyFromUrlResultHeaders - for Response +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| 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) @@ -1844,119 +1644,76 @@ impl BlobClientStartCopyFromUrlResultHeaders }) } - /// 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 public access setting for the container. + fn access(&self) -> Result> { + Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS) } - /// State of the copy operation identified by x-ms-copy-id. - fn copy_status(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_STATUS) + /// The default encryption scope for the container. + fn default_encryption_scope(&self) -> Result> { + Headers::get_optional_as(self.headers(), &DEFAULT_ENCRYPTION_SCOPE) } - /// 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) + /// If a blob has a lease and the lease is of infinite duration then the value of this header is set to true, otherwise it + /// is set to false. + fn prevent_encryption_scope_override(&self) -> Result> { + Headers::get_optional_as(self.headers(), &DENY_ENCRYPTION_SCOPE_OVERRIDE) } -} -/// Provides access to typed response headers for `BlobClient::undelete()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobClientUndeleteResult, BlobClientUndeleteResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobClientUndeleteResultHeaders: private::Sealed { - fn date(&self) -> Result>; -} + /// Indicates whether the container has an immutability policy set on it. + fn has_immutability_policy(&self) -> Result> { + Headers::get_optional_as(self.headers(), &HAS_IMMUTABILITY_POLICY) + } -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| parse_rfc7231(h.as_str())) + /// Indicates whether the container has a legal hold. + fn has_legal_hold(&self) -> Result> { + Headers::get_optional_as(self.headers(), &HAS_LEGAL_HOLD) } -} -/// Provides access to typed response headers for `BlobContainerClient::acquire_lease()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientAcquireLeaseResult, BlobContainerClientAcquireLeaseResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// if let Some(last_modified) = response.last_modified()? { -/// println!("last-modified: {:?}", last_modified); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobContainerClientAcquireLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn etag(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn lease_id(&self) -> Result>; -} + /// Indicates whether version level worm is enabled on a container + fn is_immutable_storage_with_versioning_enabled(&self) -> Result> { + Headers::get_optional_as(self.headers(), &IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED) + } -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())) + /// Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease + /// can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change. + fn duration(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_DURATION) } - /// The ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) + /// Lease state of the blob. + fn lease_state(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_STATE) } - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) + /// The lease status of the blob. + fn lease_status(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LEASE_STATUS) } - /// Uniquely identifies a blobs' lease - fn lease_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_ID) + /// The metadata headers. + fn metadata(&self) -> Result> { + let mut values = HashMap::new(); + for h in self.headers().iter() { + let name = h.0.as_str(); + if name.len() > META.len() && name.starts_with(META) { + values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned()); + } + } + Ok(values) } } -/// Provides access to typed response headers for `BlobContainerClient::break_lease()` +/// Provides access to typed response headers for `BlobContainerClient::release_lease()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientBreakLeaseResult, BlobContainerClientBreakLeaseResultHeaders}; +/// use blob_storage::models::{BlobContainerClientReleaseLeaseResult, BlobContainerClientReleaseLeaseResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } @@ -1966,22 +1723,14 @@ impl BlobContainerClientAcquireLeaseResultHeaders /// Ok(()) /// } /// ``` -pub trait BlobContainerClientBreakLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; +pub trait BlobContainerClientReleaseLeaseResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; - fn lease_id(&self) -> Result>; - fn lease_time(&self) -> Result>; } -impl BlobContainerClientBreakLeaseResultHeaders - for Response +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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -1993,55 +1742,39 @@ impl BlobContainerClientBreakLeaseResultHeaders parse_rfc7231(h.as_str()) }) } - - /// 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) - } } -/// Provides access to typed response headers for `BlobContainerClient::change_lease()` +/// Provides access to typed response headers for `BlobContainerClient::renew_lease()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientChangeLeaseResult, BlobContainerClientChangeLeaseResultHeaders}; +/// use blob_storage::models::{BlobContainerClientRenewLeaseResult, BlobContainerClientRenewLeaseResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(lease_id) = response.lease_id()? { +/// println!("x-ms-lease-id: {:?}", lease_id); +/// } /// Ok(()) /// } /// ``` -pub trait BlobContainerClientChangeLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; +pub trait BlobContainerClientRenewLeaseResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn lease_id(&self) -> Result>; } -impl BlobContainerClientChangeLeaseResultHeaders - for Response +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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -2060,43 +1793,37 @@ impl BlobContainerClientChangeLeaseResultHeaders } } -/// Provides access to typed response headers for `BlobContainerClient::get_account_info()` +/// Provides access to typed response headers for `BlobServiceClient::get_account_info()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientGetAccountInfoResult, BlobContainerClientGetAccountInfoResultHeaders}; +/// use blob_storage::models::{BlobServiceClientGetAccountInfoResult, BlobServiceClientGetAccountInfoResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(account_kind) = response.account_kind()? { /// println!("x-ms-account-kind: {:?}", account_kind); /// } /// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? { /// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled); /// } +/// if let Some(sku_name) = response.sku_name()? { +/// println!("x-ms-sku-name: {:?}", sku_name); +/// } /// Ok(()) /// } /// ``` -pub trait BlobContainerClientGetAccountInfoResultHeaders: private::Sealed { - fn date(&self) -> Result>; +pub trait BlobServiceClientGetAccountInfoResultHeaders: private::Sealed { fn account_kind(&self) -> Result>; fn is_hierarchical_namespace_enabled(&self) -> Result>; fn sku_name(&self) -> Result>; } -impl BlobContainerClientGetAccountInfoResultHeaders - for Response +impl BlobServiceClientGetAccountInfoResultHeaders + for Response { - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } - /// Identifies the account kind fn account_kind(&self) -> Result> { Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) @@ -2113,46 +1840,48 @@ impl BlobContainerClientGetAccountInfoResultHeaders } } -/// Provides access to typed response headers for `BlobContainerClient::get_properties()` +/// Provides access to typed response headers for `BlockBlobClient::commit_block_list()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders}; +/// use blob_storage::models::{BlockBlobClientCommitBlockListResult, BlockBlobClientCommitBlockListResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers +/// if let Some(content_md5) = response.content_md5()? { +/// println!("content-md5: {:?}", content_md5); +/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } -/// if let Some(access) = response.access()? { -/// println!("x-ms-blob-public-access: {:?}", access); -/// } /// Ok(()) /// } /// ``` -pub trait BlobContainerClientGetPropertiesResultHeaders: private::Sealed { +pub trait BlockBlobClientCommitBlockListResultHeaders: private::Sealed { + fn content_md5(&self) -> Result>>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; - fn access(&self) -> Result>; - fn default_encryption_scope(&self) -> Result>; - fn prevent_encryption_scope_override(&self) -> Result>; - fn has_immutability_policy(&self) -> Result>; - fn has_legal_hold(&self) -> Result>; - fn is_immutable_storage_with_versioning_enabled(&self) -> Result>; - fn duration(&self) -> Result>; - fn lease_state(&self) -> Result>; - fn lease_status(&self) -> Result>; - fn metadata(&self) -> Result>; + fn content_crc64(&self) -> Result>>; + fn encryption_key_sha256(&self) -> Result>; + fn encryption_scope(&self) -> Result>; + fn is_server_encrypted(&self) -> Result>; + fn version_id(&self) -> Result>; } -impl BlobContainerClientGetPropertiesResultHeaders - for Response +impl BlockBlobClientCommitBlockListResultHeaders + for Response { + /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the + /// client can check for message content integrity. + fn content_md5(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str())) + } + /// The ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -2165,760 +1894,24 @@ impl BlobContainerClientGetPropertiesResultHeaders }) } - /// The public access setting for the container. - fn access(&self) -> Result> { - Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS) - } - - /// The default encryption scope for the container. - fn default_encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &DEFAULT_ENCRYPTION_SCOPE) - } - - /// If a blob has a lease and the lease is of infinite duration then the value of this header is set to true, otherwise it - /// is set to false. - fn prevent_encryption_scope_override(&self) -> Result> { - Headers::get_optional_as(self.headers(), &DENY_ENCRYPTION_SCOPE_OVERRIDE) - } - - /// Indicates whether the container has an immutability policy set on it. - fn has_immutability_policy(&self) -> Result> { - Headers::get_optional_as(self.headers(), &HAS_IMMUTABILITY_POLICY) - } - - /// Indicates whether the container has a legal hold. - fn has_legal_hold(&self) -> Result> { - Headers::get_optional_as(self.headers(), &HAS_LEGAL_HOLD) - } - - /// Indicates whether version level worm is enabled on a container - fn is_immutable_storage_with_versioning_enabled(&self) -> Result> { - Headers::get_optional_as(self.headers(), &IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED) - } - - /// Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease - /// can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change. - fn duration(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_DURATION) - } - - /// Lease state of the blob. - fn lease_state(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_STATE) - } - - /// The lease status of the blob. - fn lease_status(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_STATUS) - } - - /// The metadata headers. - fn metadata(&self) -> Result> { - let mut values = HashMap::new(); - for h in self.headers().iter() { - let name = h.0.as_str(); - if name.len() > META.len() && name.starts_with(META) { - values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned()); - } - } - Ok(values) - } -} - -/// Provides access to typed response headers for `BlobContainerClient::release_lease()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientReleaseLeaseResult, BlobContainerClientReleaseLeaseResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// if let Some(last_modified) = response.last_modified()? { -/// println!("last-modified: {:?}", last_modified); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobContainerClientReleaseLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn etag(&self) -> Result>; - fn last_modified(&self) -> Result>; -} - -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 ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) - } - - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } -} - -/// Provides access to typed response headers for `BlobContainerClient::rename()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientRenameResult, BlobContainerClientRenameResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobContainerClientRenameResultHeaders: private::Sealed { - fn date(&self) -> Result>; -} - -impl BlobContainerClientRenameResultHeaders - for Response -{ - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } -} - -/// Provides access to typed response headers for `BlobContainerClient::renew_lease()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientRenewLeaseResult, BlobContainerClientRenewLeaseResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// if let Some(last_modified) = response.last_modified()? { -/// println!("last-modified: {:?}", last_modified); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobContainerClientRenewLeaseResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn etag(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn lease_id(&self) -> Result>; -} - -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 ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) - } - - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } - - /// Uniquely identifies a blobs' lease - fn lease_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_ID) - } -} - -/// Provides access to typed response headers for `BlobContainerClient::restore()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientRestoreResult, BlobContainerClientRestoreResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobContainerClientRestoreResultHeaders: private::Sealed { - fn date(&self) -> Result>; -} - -impl BlobContainerClientRestoreResultHeaders - for Response -{ - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } -} - -/// Provides access to typed response headers for `BlobContainerClient::set_access_policy()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetAccessPolicyResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// if let Some(last_modified) = response.last_modified()? { -/// println!("last-modified: {:?}", last_modified); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobContainerClientSetAccessPolicyResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn etag(&self) -> Result>; - fn last_modified(&self) -> Result>; -} - -impl BlobContainerClientSetAccessPolicyResultHeaders - 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 ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) - } - - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } -} - -/// Provides access to typed response headers for `BlobServiceClient::get_account_info()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlobServiceClientGetAccountInfoResult, BlobServiceClientGetAccountInfoResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// if let Some(account_kind) = response.account_kind()? { -/// println!("x-ms-account-kind: {:?}", account_kind); -/// } -/// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? { -/// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobServiceClientGetAccountInfoResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn account_kind(&self) -> Result>; - fn is_hierarchical_namespace_enabled(&self) -> Result>; - fn sku_name(&self) -> Result>; -} - -impl BlobServiceClientGetAccountInfoResultHeaders - for Response -{ - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } - - /// Identifies the account kind - fn account_kind(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ACCOUNT_KIND) - } - - /// Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled. - fn is_hierarchical_namespace_enabled(&self) -> Result> { - Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED) - } - - /// Identifies the sku name of the account - fn sku_name(&self) -> Result> { - Headers::get_optional_as(self.headers(), &SKU_NAME) - } -} - -/// Provides access to typed response headers for `BlobClient::get_tags()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, XmlFormat}}; -/// use blob_storage::models::{BlobTags, BlobTagsHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlobTagsHeaders: private::Sealed { - fn date(&self) -> Result>; -} - -impl BlobTagsHeaders for Response { - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } -} - -/// Provides access to typed response headers for `BlockBlobClient::commit_block_list()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlockBlobClientCommitBlockListResult, BlockBlobClientCommitBlockListResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(content_md5) = response.content_md5()? { -/// println!("content-md5: {:?}", content_md5); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// if let Some(last_modified) = response.last_modified()? { -/// println!("last-modified: {:?}", last_modified); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlockBlobClientCommitBlockListResultHeaders: private::Sealed { - fn content_md5(&self) -> Result>>; - fn etag(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn content_crc64(&self) -> Result>>; - fn encryption_key_sha256(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn is_server_encrypted(&self) -> Result>; - fn version_id(&self) -> Result>; -} - -impl BlockBlobClientCommitBlockListResultHeaders - for Response -{ - /// 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())) - } - - /// 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 date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } - - /// 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()) - }) - } - - /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted - /// with a customer-provided key. - fn encryption_key_sha256(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) - } - - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) - } - - /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified - /// algorithm, and false otherwise. - fn is_server_encrypted(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) - } - - /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob - /// version, and may be used in subsequent requests to access this version of the blob. - fn version_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &VERSION_ID) - } -} - -/// Provides access to typed response headers for `BlockBlobClient::put_blob_from_url()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlockBlobClientPutBlobFromUrlResult, BlockBlobClientPutBlobFromUrlResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(content_md5) = response.content_md5()? { -/// println!("content-md5: {:?}", content_md5); -/// } -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlockBlobClientPutBlobFromUrlResultHeaders: private::Sealed { - fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; - fn etag(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn encryption_key_sha256(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn is_server_encrypted(&self) -> Result>; - fn version_id(&self) -> Result>; -} - -impl BlockBlobClientPutBlobFromUrlResultHeaders - for Response -{ - /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the - /// client can check for message content integrity. - fn content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| 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| 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 date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } - - /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted - /// with a customer-provided key. - fn encryption_key_sha256(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) - } - - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) - } - - /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified - /// algorithm, and false otherwise. - fn is_server_encrypted(&self) -> Result> { - Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED) - } - - /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob - /// version, and may be used in subsequent requests to access this version of the blob. - fn version_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), &VERSION_ID) - } -} - -/// Provides access to typed response headers for `BlockBlobClient::query()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::AsyncResponse}; -/// use blob_storage::models::{BlockBlobClientQueryResult, BlockBlobClientQueryResultHeaders}; -/// async fn example() -> Result<()> { -/// let response: AsyncResponse = unimplemented!(); -/// // Access response headers -/// if let Some(accept_ranges) = response.accept_ranges()? { -/// println!("accept-ranges: {:?}", accept_ranges); -/// } -/// if let Some(cache_control) = response.cache_control()? { -/// println!("cache-control: {:?}", cache_control); -/// } -/// if let Some(content_disposition) = response.content_disposition()? { -/// println!("content-disposition: {:?}", content_disposition); -/// } -/// Ok(()) -/// } -/// ``` -pub trait BlockBlobClientQueryResultHeaders: private::Sealed { - fn accept_ranges(&self) -> Result>; - fn cache_control(&self) -> Result>; - fn content_disposition(&self) -> Result>; - fn content_encoding(&self) -> Result>; - fn content_language(&self) -> Result>; - fn content_length(&self) -> Result>; - fn content_md5(&self) -> Result>>; - fn content_range(&self) -> Result>; - fn date(&self) -> Result>; - fn etag(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn blob_committed_block_count(&self) -> Result>; - fn blob_content_md5(&self) -> Result>>; - fn blob_sequence_number(&self) -> Result>; - fn blob_type(&self) -> Result>; - fn content_crc64(&self) -> Result>>; - fn copy_completion_time(&self) -> Result>; - fn copy_id(&self) -> Result>; - fn copy_progress(&self) -> Result>; - fn copy_source(&self) -> Result>; - fn copy_status(&self) -> Result>; - fn copy_status_description(&self) -> Result>; - fn encryption_key_sha256(&self) -> Result>; - fn encryption_scope(&self) -> Result>; - fn duration(&self) -> Result>; - fn lease_state(&self) -> Result>; - fn lease_status(&self) -> Result>; - fn metadata(&self) -> Result>; - fn is_server_encrypted(&self) -> Result>; -} - -impl BlockBlobClientQueryResultHeaders for AsyncResponse { - /// Indicates that the service supports requests for partial blob content. - fn accept_ranges(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ACCEPT_RANGES) - } - - /// This header is returned if it was previously specified for the blob. - fn cache_control(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CACHE_CONTROL) - } - - /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition - /// response header field conveys additional information about how to process the response payload, and also can be used to - /// attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the - /// response, but instead show a Save As dialog with a filename other than the blob name specified. - fn content_disposition(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_DISPOSITION) - } - - /// This header returns the value that was specified for the Content-Encoding request header - fn content_encoding(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_ENCODING) - } - - /// This header returns the value that was specified for the Content-Language request header. - fn content_language(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_LANGUAGE) - } - - /// The number of bytes present in the response body. - fn content_length(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_LENGTH) - } - - /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the - /// client can check for message content integrity. - fn content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str())) - } - - /// Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' - /// request header. - fn content_range(&self) -> Result> { - Headers::get_optional_as(self.headers(), &CONTENT_RANGE) - } - - /// UTC date/time value generated by the service that indicates the time at which the response was initiated - fn date(&self) -> Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } - - /// 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 date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } - - /// The number of committed blocks present in the blob. This header is returned only for append blobs. - fn blob_committed_block_count(&self) -> Result> { - Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT) - } - - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn blob_content_md5(&self) -> Result>> { - Headers::get_optional_with(self.headers(), &BLOB_CONTENT_MD5, |h| { - base64::decode(h.as_str()) - }) - } - - /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs. - fn blob_sequence_number(&self) -> Result> { - Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER) - } - - /// The type of the blob. - fn blob_type(&self) -> Result> { - Headers::get_optional_as(self.headers(), &BLOB_TYPE) - } - /// This response header is returned so that the client can check for the integrity of the copied content. fn content_crc64(&self) -> Result>> { Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| { base64::decode(h.as_str()) - }) - } - - /// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify - /// the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob - /// has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob - /// operation using Set Blob Properties, Put Blob, or Put Block List. - fn copy_completion_time(&self) -> Result> { - Headers::get_optional_with(self.headers(), ©_COMPLETION_TIME, |h| { - parse_rfc7231(h.as_str()) - }) - } - - /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or - /// pass to Abort Copy Blob to abort a pending copy. - fn copy_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_ID) - } - - /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where - /// this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if - /// this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded - /// Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List - fn copy_progress(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_PROGRESS) - } - - /// URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this - /// blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob - /// operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, - /// or Put Block List. - fn copy_source(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_SOURCE) - } - - /// State of the copy operation identified by x-ms-copy-id. - fn copy_status(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_STATUS) - } - - /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation - /// failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this - /// blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List - fn copy_status_description(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_STATUS_DESCRIPTION) - } - - /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted - /// with a customer-provided key. - fn encryption_key_sha256(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) - } - - /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned - /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 - /// header, with the latter calculated from the requested range - fn encryption_scope(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) - } - - /// Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease - /// can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change. - fn duration(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_DURATION) - } - - /// Lease state of the blob. - fn lease_state(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_STATE) - } - - /// The lease status of the blob. - fn lease_status(&self) -> Result> { - Headers::get_optional_as(self.headers(), &LEASE_STATUS) - } - - /// The metadata headers. - fn metadata(&self) -> Result> { - let mut values = HashMap::new(); - for h in self.headers().iter() { - let name = h.0.as_str(); - if name.len() > META.len() && name.starts_with(META) { - values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned()); - } - } - Ok(values) + }) + } + + /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted + /// with a customer-provided key. + fn encryption_key_sha256(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) + } + + /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned + /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 + /// header, with the latter calculated from the requested range + fn encryption_scope(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) } /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified @@ -2926,6 +1919,12 @@ impl BlockBlobClientQueryResultHeaders for AsyncResponse 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 `BlockBlobClient::stage_block_from_url()` @@ -2941,18 +1940,17 @@ impl BlockBlobClientQueryResultHeaders for AsyncResponse Result>>; - fn date(&self) -> Result>; fn content_crc64(&self) -> Result>>; fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; @@ -2968,11 +1966,6 @@ impl BlockBlobClientStageBlockFromUrlResultHeaders 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| 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| { @@ -3066,15 +2059,15 @@ impl BlockBlobClientStageBlockResultHeaders } } -/// Provides access to typed response headers for `BlockBlobClient::upload()` +/// Provides access to typed response headers for `BlockBlobClient::upload_blob_from_url()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, NoFormat}}; -/// use blob_storage::models::{BlockBlobClientUploadResult, BlockBlobClientUploadResultHeaders}; +/// use blob_storage::models::{BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadBlobFromUrlResultHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); @@ -3088,7 +2081,7 @@ impl BlockBlobClientStageBlockResultHeaders /// Ok(()) /// } /// ``` -pub trait BlockBlobClientUploadResultHeaders: private::Sealed { +pub trait BlockBlobClientUploadBlobFromUrlResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; @@ -3098,7 +2091,9 @@ pub trait BlockBlobClientUploadResultHeaders: private::Sealed { fn version_id(&self) -> Result>; } -impl BlockBlobClientUploadResultHeaders for Response { +impl BlockBlobClientUploadBlobFromUrlResultHeaders + for Response +{ /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the /// client can check for message content integrity. fn content_md5(&self) -> Result>> { @@ -3143,35 +2138,47 @@ impl BlockBlobClientUploadResultHeaders for Response Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers +/// if let Some(content_md5) = response.content_md5()? { +/// println!("content-md5: {:?}", content_md5); +/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } -/// if let Some(blob_content_length) = response.blob_content_length()? { -/// println!("x-ms-blob-content-length: {:?}", blob_content_length); -/// } /// Ok(()) /// } /// ``` -pub trait BlockListHeaders: private::Sealed { +pub trait BlockBlobClientUploadInternalResultHeaders: private::Sealed { + fn content_md5(&self) -> Result>>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; - fn blob_content_length(&self) -> Result>; + fn encryption_key_sha256(&self) -> Result>; + fn encryption_scope(&self) -> Result>; + fn is_server_encrypted(&self) -> Result>; + fn version_id(&self) -> Result>; } -impl BlockListHeaders for Response { +impl BlockBlobClientUploadInternalResultHeaders + for Response +{ + /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the + /// client can check for message content integrity. + fn content_md5(&self) -> Result>> { + Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str())) + } + /// The ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -3184,80 +2191,76 @@ impl BlockListHeaders for Response { }) } - /// 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> { - Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH) + /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted + /// with a customer-provided key. + fn encryption_key_sha256(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256) } -} -/// Provides access to typed response headers for the following methods: -/// * `BlobContainerClient::filter_blobs()` -/// * `BlobServiceClient::filter_blobs()` -pub trait FilterBlobSegmentHeaders: private::Sealed { - fn date(&self) -> Result>; -} + /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned + /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 + /// header, with the latter calculated from the requested range + fn encryption_scope(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE) + } + + /// 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) + } -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| parse_rfc7231(h.as_str())) + /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob + /// version, and may be used in subsequent requests to access this version of the blob. + fn version_id(&self) -> Result> { + Headers::get_optional_as(self.headers(), &VERSION_ID) } } -/// Provides access to typed response headers for `BlobContainerClient::list_blob_flat_segment()` +/// Provides access to typed response headers for `BlockBlobClient::get_block_list()` /// /// # Examples /// /// ```no_run /// use azure_core::{Result, http::{Response, XmlFormat}}; -/// use blob_storage::models::{ListBlobsFlatSegmentResponse, ListBlobsFlatSegmentResponseHeaders}; +/// use blob_storage::models::{BlockList, BlockListHeaders}; /// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); +/// if let Some(etag) = response.etag()? { +/// println!("etag: {:?}", etag); +/// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); +/// } +/// if let Some(blob_content_length) = response.blob_content_length()? { +/// println!("x-ms-blob-content-length: {:?}", blob_content_length); /// } /// Ok(()) /// } /// ``` -pub trait ListBlobsFlatSegmentResponseHeaders: private::Sealed { - fn date(&self) -> Result>; +pub trait BlockListHeaders: private::Sealed { + fn etag(&self) -> Result>; + fn last_modified(&self) -> Result>; + fn blob_content_length(&self) -> Result>; } -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| parse_rfc7231(h.as_str())) +impl BlockListHeaders for Response { + /// The ETag contains a value that you can use to perform operations conditionally. + fn etag(&self) -> Result> { + Headers::get_optional_as(self.headers(), &ETAG) } -} -/// Provides access to typed response headers for `BlobContainerClient::list_blob_hierarchy_segment()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, XmlFormat}}; -/// use blob_storage::models::{ListBlobsHierarchySegmentResponse, ListBlobsHierarchySegmentResponseHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub trait ListBlobsHierarchySegmentResponseHeaders: private::Sealed { - fn date(&self) -> Result>; -} + /// The date/time that the container was last modified. + fn last_modified(&self) -> Result> { + Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { + parse_rfc7231(h.as_str()) + }) + } -impl ListBlobsHierarchySegmentResponseHeaders - 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 size of the blob in bytes. + fn blob_content_length(&self) -> Result> { + Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH) } } @@ -3274,18 +2277,17 @@ impl ListBlobsHierarchySegmentResponseHeaders /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); +/// } /// Ok(()) /// } /// ``` pub trait PageBlobClientClearPagesResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; @@ -3299,11 +2301,6 @@ impl PageBlobClientClearPagesResultHeaders for Response Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } - /// The ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -3329,68 +2326,6 @@ impl PageBlobClientClearPagesResultHeaders for Response Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// if let Some(etag) = response.etag()? { -/// println!("etag: {:?}", etag); -/// } -/// if let Some(last_modified) = response.last_modified()? { -/// println!("last-modified: {:?}", last_modified); -/// } -/// Ok(()) -/// } -/// ``` -pub trait PageBlobClientCopyIncrementalResultHeaders: private::Sealed { - fn date(&self) -> Result>; - fn etag(&self) -> Result>; - fn last_modified(&self) -> Result>; - fn copy_id(&self) -> Result>; - fn copy_status(&self) -> Result>; -} - -impl PageBlobClientCopyIncrementalResultHeaders - 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 ETag contains a value that you can use to perform operations conditionally. - fn etag(&self) -> Result> { - Headers::get_optional_as(self.headers(), &ETAG) - } - - /// The date/time that the container was last modified. - fn last_modified(&self) -> Result> { - Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| { - parse_rfc7231(h.as_str()) - }) - } - - /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or - /// pass to Abort Copy Blob to abort a pending copy. - fn copy_id(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_ID) - } - - /// State of the copy operation identified by x-ms-copy-id. - fn copy_status(&self) -> Result> { - Headers::get_optional_as(self.headers(), ©_STATUS) - } -} - /// Provides access to typed response headers for `PageBlobClient::create()` /// /// # Examples @@ -3404,18 +2339,17 @@ impl PageBlobClientCopyIncrementalResultHeaders /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); +/// } /// Ok(()) /// } /// ``` pub trait PageBlobClientCreateResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn encryption_key_sha256(&self) -> Result>; @@ -3431,11 +2365,6 @@ impl PageBlobClientCreateResultHeaders for Response Result> { - Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str())) - } - /// The ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -3484,31 +2413,25 @@ impl PageBlobClientCreateResultHeaders for Response Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(blob_sequence_number) = response.blob_sequence_number()? { +/// println!("x-ms-blob-sequence-number: {:?}", blob_sequence_number); +/// } /// Ok(()) /// } /// ``` pub trait PageBlobClientResizeResultHeaders: private::Sealed { - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&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| 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) @@ -3527,43 +2450,37 @@ impl PageBlobClientResizeResultHeaders for Response Result<()> { -/// let response: Response = unimplemented!(); +/// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(blob_sequence_number) = response.blob_sequence_number()? { +/// println!("x-ms-blob-sequence-number: {:?}", blob_sequence_number); +/// } /// Ok(()) /// } /// ``` -pub trait PageBlobClientUpdateSequenceNumberResultHeaders: private::Sealed { - fn date(&self) -> Result>; +pub trait PageBlobClientSetSequenceNumberResultHeaders: private::Sealed { fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; } -impl PageBlobClientUpdateSequenceNumberResultHeaders - for Response +impl PageBlobClientSetSequenceNumberResultHeaders + 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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -3595,18 +2512,17 @@ impl PageBlobClientUpdateSequenceNumberResultHeaders /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); +/// } /// Ok(()) /// } /// ``` pub trait PageBlobClientUploadPagesFromUrlResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; @@ -3625,11 +2541,6 @@ impl PageBlobClientUploadPagesFromUrlResultHeaders 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| 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) @@ -3687,18 +2598,17 @@ impl PageBlobClientUploadPagesFromUrlResultHeaders /// if let Some(content_md5) = response.content_md5()? { /// println!("content-md5: {:?}", content_md5); /// } -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); +/// } /// Ok(()) /// } /// ``` pub trait PageBlobClientUploadPagesResultHeaders: private::Sealed { fn content_md5(&self) -> Result>>; - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn blob_sequence_number(&self) -> Result>; @@ -3706,7 +2616,6 @@ pub trait PageBlobClientUploadPagesResultHeaders: private::Sealed { fn encryption_key_sha256(&self) -> Result>; fn encryption_scope(&self) -> Result>; fn is_server_encrypted(&self) -> Result>; - fn structured_body_type(&self) -> Result>; } impl PageBlobClientUploadPagesResultHeaders @@ -3718,11 +2627,6 @@ impl PageBlobClientUploadPagesResultHeaders 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| 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) @@ -3765,29 +2669,37 @@ impl PageBlobClientUploadPagesResultHeaders 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 the following methods: -/// * `PageBlobClient::get_page_ranges()` -/// * `PageBlobClient::get_page_ranges_diff()` +/// Provides access to typed response headers for `PageBlobClient::get_page_ranges()` +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::{Response, XmlFormat}}; +/// use blob_storage::models::{PageList, PageListHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(etag) = response.etag()? { +/// println!("etag: {:?}", etag); +/// } +/// if let Some(last_modified) = response.last_modified()? { +/// println!("last-modified: {:?}", last_modified); +/// } +/// if let Some(blob_content_length) = response.blob_content_length()? { +/// println!("x-ms-blob-content-length: {:?}", blob_content_length); +/// } +/// Ok(()) +/// } +/// ``` pub trait PageListHeaders: private::Sealed { - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; - fn blob_content_length(&self) -> Result>; + fn blob_content_length(&self) -> Result>; } 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| 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) @@ -3800,9 +2712,8 @@ impl PageListHeaders for Response { }) } - /// 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) } } @@ -3817,31 +2728,25 @@ impl PageListHeaders for Response { /// async fn example() -> Result<()> { /// let response: Response = unimplemented!(); /// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } /// if let Some(etag) = response.etag()? { /// println!("etag: {:?}", etag); /// } /// if let Some(last_modified) = response.last_modified()? { /// println!("last-modified: {:?}", last_modified); /// } +/// if let Some(access) = response.access()? { +/// println!("x-ms-blob-public-access: {:?}", access); +/// } /// Ok(()) /// } /// ``` pub trait SignedIdentifiersHeaders: private::Sealed { - fn date(&self) -> Result>; fn etag(&self) -> Result>; fn last_modified(&self) -> Result>; fn access(&self) -> Result>; } impl SignedIdentifiersHeaders 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 ETag contains a value that you can use to perform operations conditionally. fn etag(&self) -> Result> { Headers::get_optional_as(self.headers(), &ETAG) @@ -3860,143 +2765,61 @@ impl SignedIdentifiersHeaders for Response { } } -/// Provides access to typed response headers for `BlobServiceClient::get_statistics()` -/// -/// # Examples -/// -/// ```no_run -/// use azure_core::{Result, http::{Response, XmlFormat}}; -/// use blob_storage::models::{StorageServiceStats, StorageServiceStatsHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub trait StorageServiceStatsHeaders: private::Sealed { - fn date(&self) -> Result>; -} - -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| parse_rfc7231(h.as_str())) - } -} - -/// Provides access to typed response headers for `BlobServiceClient::get_user_delegation_key()` -/// -/// # Examples -/// -/// ```ignore -/// use azure_core::{Result, http::{Response, XmlFormat}}; -/// use blob_storage::models::{UserDelegationKey, UserDelegationKeyHeaders}; -/// async fn example() -> Result<()> { -/// let response: Response = unimplemented!(); -/// // Access response headers -/// if let Some(date) = response.date()? { -/// println!("date: {:?}", date); -/// } -/// Ok(()) -/// } -/// ``` -pub(crate) trait UserDelegationKeyHeaders: private::Sealed { - fn date(&self) -> Result>; -} - -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| parse_rfc7231(h.as_str())) - } -} - mod private { use super::{ AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockResult, - AppendBlobClientCreateResult, AppendBlobClientSealResult, BlobClientAbortCopyFromUrlResult, - BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, - BlobClientCopyFromUrlResult, BlobClientCreateSnapshotResult, - BlobClientDeleteImmutabilityPolicyResult, BlobClientDownloadResult, - BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, - BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, BlobClientSetExpiryResult, - BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldResult, - BlobClientSetTagsResult, BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult, + AppendBlobClientCreateResult, AppendBlobClientSealResult, BlobClientAcquireLeaseResult, + BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, BlobClientCreateSnapshotResult, + BlobClientDownloadInternalResult, BlobClientGetAccountInfoResult, + BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult, BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult, BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult, - BlobContainerClientRenameResult, BlobContainerClientRenewLeaseResult, - BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyResult, - BlobServiceClientGetAccountInfoResult, BlobTags, BlockBlobClientCommitBlockListResult, - BlockBlobClientPutBlobFromUrlResult, BlockBlobClientQueryResult, - BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult, - BlockBlobClientUploadResult, BlockList, FilterBlobSegment, ListBlobsFlatSegmentResponse, - ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult, - PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult, - PageBlobClientResizeResult, PageBlobClientUpdateSequenceNumberResult, - PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList, - SignedIdentifiers, StorageServiceStats, UserDelegationKey, + BlobContainerClientRenewLeaseResult, BlobServiceClientGetAccountInfoResult, + BlockBlobClientCommitBlockListResult, BlockBlobClientStageBlockFromUrlResult, + BlockBlobClientStageBlockResult, BlockBlobClientUploadBlobFromUrlResult, + BlockBlobClientUploadInternalResult, BlockList, PageBlobClientClearPagesResult, + PageBlobClientCreateResult, PageBlobClientResizeResult, + PageBlobClientSetSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult, + PageBlobClientUploadPagesResult, PageList, SignedIdentifiers, }; use azure_core::http::{AsyncResponse, NoFormat, Response, XmlFormat}; pub trait Sealed {} - impl Sealed for AsyncResponse {} - impl Sealed for AsyncResponse {} + impl Sealed for AsyncResponse {} 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 {} - 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 {} - 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 {} impl Sealed for Response {} impl Sealed for Response {} impl Sealed for Response {} - impl Sealed for Response {} - impl Sealed for Response {} } diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/method_options.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/method_options.rs index fede5f403..d8fcb4a0c 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/method_options.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/method_options.rs @@ -4,9 +4,10 @@ // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. use super::{ - AccessTier, BlobDeleteType, BlobImmutabilityPolicyMode, DeleteSnapshotsOptionType, - EncryptionAlgorithmType, FilterBlobsIncludeItem, LeaseDuration, ListBlobsIncludeItem, - ListContainersIncludeType, PremiumPageBlobAccessTier, PublicAccessType, RehydratePriority, + AccessTier, BlobCopySourceTags, BlobDeleteType, DeleteSnapshotsOptionType, + EncryptionAlgorithmType, FileShareTokenIntent, FilterBlobsIncludeItem, ImmutabilityPolicyMode, + ListBlobsIncludeItem, ListContainersIncludeType, PremiumPageBlobAccessTier, PublicAccessType, + RehydratePriority, }; use azure_core::{ fmt::SafeDebug, @@ -40,19 +41,19 @@ pub struct AppendBlobClientAppendBlockOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -112,19 +113,22 @@ pub struct AppendBlobClientAppendBlockFromUrlOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// Valid value is backup + pub file_request_intent: Option, + + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -144,6 +148,16 @@ pub struct AppendBlobClientAppendBlockFromUrlOptions<'a> { /// Specify the md5 calculated for the range of bytes that must be read from the copy source. pub source_content_md5: Option>, + /// The algorithm used to produce the source encryption key hash. Currently, the only accepted value is "AES256". Must be + /// provided if the x-ms-source-encryption-key is provided. + pub source_encryption_algorithm: Option, + + /// Optional. Specifies the source encryption key to use to encrypt the source data provided in the request. + pub source_encryption_key: Option, + + /// The SHA-256 hash of the provided source encryption key. Must be provided if the x-ms-source-encryption-key header is provided. + pub source_encryption_key_sha256: Option, + /// Specify an ETag value to operate only on blobs with a matching value. pub source_if_match: Option, @@ -213,26 +227,26 @@ pub struct AppendBlobClientCreateOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// Specifies the date time when the blobs immutability policy is set to expire. pub immutability_policy_expiry: Option, /// Specifies the immutability policy mode to set on the blob. - pub immutability_policy_mode: Option, + pub immutability_policy_mode: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -258,16 +272,16 @@ pub struct AppendBlobClientSealOptions<'a> { /// the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). pub append_position: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -280,39 +294,22 @@ pub struct AppendBlobClientSealOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlobClient::abort_copy_from_url()` -#[derive(Clone, Default, SafeDebug)] -pub(crate) struct BlobClientAbortCopyFromUrlOptions<'a> { - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. - pub(crate) lease_id: Option, - - /// Allows customization of the method call. - pub(crate) method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub(crate) timeout: Option, -} - /// Options to be passed to `BlobClient::acquire_lease()` #[derive(Clone, Default, SafeDebug)] pub struct BlobClientAcquireLeaseOptions<'a> { - /// 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, - - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// Allows customization of the method call. @@ -335,19 +332,19 @@ pub struct BlobClientBreakLeaseOptions<'a> { /// the remaining lease period elapses, and an infinite lease breaks immediately. pub break_period: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// Allows customization of the method call. @@ -360,95 +357,24 @@ pub struct BlobClientBreakLeaseOptions<'a> { /// Options to be passed to `BlobClient::change_lease()` #[derive(Clone, Default, SafeDebug)] pub struct BlobClientChangeLeaseOptions<'a> { - /// The request should only proceed if an entity matches this string. - pub if_match: Option, - - /// The request should only proceed if the entity was modified after this time. - pub if_modified_since: Option, - - /// The request should only proceed if no entity matches this string. - pub if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, - - /// The request should only proceed if the entity was not modified after this time. - pub if_unmodified_since: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -/// Options to be passed to `BlobClient::copy_from_url()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobClientCopyFromUrlOptions<'a> { - /// Optional. Used to set blob tags in various blob operations. - pub blob_tags_string: Option, - - /// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. - pub copy_source_authorization: Option, - - /// Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags. - pub copy_source_tags: Option, - - /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_scope: Option, - - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, - /// Specifies the date time when the blobs immutability policy is set to expire. - pub immutability_policy_expiry: Option, - - /// Specifies the immutability policy mode to set on the blob. - pub immutability_policy_mode: Option, - - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. - pub lease_id: Option, - - /// Specified if a legal hold should be set on the blob. - pub legal_hold: Option, - - /// The metadata headers. - pub metadata: Option>, - /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Specify the md5 calculated for the range of bytes that must be read from the copy source. - pub source_content_md5: Option>, - - /// Specify an ETag value to operate only on blobs with a matching value. - pub source_if_match: Option, - - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_modified_since: Option, - - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_none_match: Option, - - /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. - pub source_if_unmodified_since: Option, - - /// The tier to be set on the blob. - pub tier: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } @@ -473,19 +399,19 @@ pub struct BlobClientCreateSnapshotOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -504,6 +430,12 @@ pub struct BlobClientCreateSnapshotOptions<'a> { /// Options to be passed to `BlobClient::delete()` #[derive(Clone, Default, SafeDebug)] pub struct BlobClientDeleteOptions<'a> { + /// Specify this header value to operate only on a blob if the access-tier has been modified since the specified date/time. + pub access_tier_if_modified_since: Option, + + /// Specify this header value to operate only on a blob if the access-tier has not been modified since the specified date/time. + pub access_tier_if_unmodified_since: Option, + /// Optional. Only possible value is 'permanent', which specifies to permanently delete a blob if blob soft delete is enabled. pub blob_delete_type: Option, @@ -511,19 +443,19 @@ pub struct BlobClientDeleteOptions<'a> { /// and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself pub delete_snapshots: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -562,9 +494,9 @@ pub struct BlobClientDeleteImmutabilityPolicyOptions<'a> { pub version_id: Option, } -/// Options to be passed to `BlobClient::download()` +/// Options to be passed to `BlobClient::download_internal()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobClientDownloadOptions<'a> { +pub struct BlobClientDownloadInternalOptions<'a> { /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is /// AES256. pub encryption_algorithm: Option, @@ -614,7 +546,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) @@ -651,19 +584,19 @@ pub struct BlobClientGetPropertiesOptions<'a> { /// with a client token, this header should be specified using the SHA256 hash of the encryption key. pub encryption_key_sha256: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -687,9 +620,21 @@ pub struct BlobClientGetPropertiesOptions<'a> { /// Options to be passed to `BlobClient::get_tags()` #[derive(Clone, Default, SafeDebug)] pub struct BlobClientGetTagsOptions<'a> { + /// Specify an ETag value to operate only on blobs with a matching value. + pub if_match: Option, + + /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. + pub if_modified_since: Option, + + /// Specify an ETag value to operate only on blobs without a matching value. + pub if_none_match: Option, + /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, + /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. + pub if_unmodified_since: Option, + /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -711,19 +656,19 @@ pub struct BlobClientGetTagsOptions<'a> { /// Options to be passed to `BlobClient::release_lease()` #[derive(Clone, Default, SafeDebug)] pub struct BlobClientReleaseLeaseOptions<'a> { - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// Allows customization of the method call. @@ -736,19 +681,19 @@ pub struct BlobClientReleaseLeaseOptions<'a> { /// Options to be passed to `BlobClient::renew_lease()` #[derive(Clone, Default, SafeDebug)] pub struct BlobClientRenewLeaseOptions<'a> { - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// Allows customization of the method call. @@ -758,30 +703,14 @@ pub struct BlobClientRenewLeaseOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlobClient::set_expiry()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobClientSetExpiryOptions<'a> { - /// The time this blob will expire. - pub expires_on: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - /// Options to be passed to `BlobClient::set_immutability_policy()` #[derive(Clone, Default, SafeDebug)] pub struct BlobClientSetImmutabilityPolicyOptions<'a> { /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, - /// Specifies the date time when the blobs immutability policy is set to expire. - pub immutability_policy_expiry: Option, - /// Specifies the immutability policy mode to set on the blob. - pub immutability_policy_mode: Option, + pub immutability_policy_mode: Option, /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, @@ -836,27 +765,24 @@ pub struct BlobClientSetMetadataOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, - /// The metadata headers. - pub metadata: Option>, - /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, @@ -890,19 +816,19 @@ pub struct BlobClientSetPropertiesOptions<'a> { /// Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. pub blob_content_type: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -918,9 +844,21 @@ pub struct BlobClientSetPropertiesOptions<'a> { /// Options to be passed to `BlobClient::set_tags()` #[derive(Clone, Default, SafeDebug)] pub struct BlobClientSetTagsOptions<'a> { + /// Specify an ETag value to operate only on blobs with a matching value. + pub if_match: Option, + + /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. + pub if_modified_since: Option, + + /// Specify an ETag value to operate only on blobs without a matching value. + pub if_none_match: Option, + /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, + /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. + pub if_unmodified_since: Option, + /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -970,106 +908,34 @@ pub struct BlobClientSetTierOptions<'a> { pub version_id: Option, } -/// Options to be passed to `BlobClient::start_copy_from_url()` +/// Options to be passed to `BlobClient::undelete()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobClientStartCopyFromUrlOptions<'a> { - /// Optional. Used to set blob tags in various blob operations. - pub blob_tags_string: Option, +pub struct BlobClientUndeleteOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, - /// The request should only proceed if an entity matches this string. - pub if_match: Option, + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} - /// The request should only proceed if the entity was modified after this time. +/// Options to be passed to `BlobContainerClient::acquire_lease()` +#[derive(Clone, Default, SafeDebug)] +pub struct BlobContainerClientAcquireLeaseOptions<'a> { + /// 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, - /// The request should only proceed if no entity matches this string. - pub if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, - - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, - /// Specifies the date time when the blobs immutability policy is set to expire. - pub immutability_policy_expiry: Option, - - /// Specifies the immutability policy mode to set on the blob. - pub immutability_policy_mode: Option, - - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. - pub lease_id: Option, - - /// Specified if a legal hold should be set on the blob. - pub legal_hold: Option, - - /// The metadata headers. - pub metadata: Option>, - /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High - /// and Standard. - pub rehydrate_priority: Option, - - /// Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. - pub seal_blob: Option, - - /// Specify an ETag value to operate only on blobs with a matching value. - pub source_if_match: Option, + /// Optional. The proposed lease ID for the container. + pub proposed_lease_id: Option, - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_modified_since: Option, - - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub source_if_tags: Option, - - /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. - pub source_if_unmodified_since: Option, - - /// The tier to be set on the blob. - pub tier: Option, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -/// Options to be passed to `BlobClient::undelete()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobClientUndeleteOptions<'a> { - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -/// Options to be passed to `BlobContainerClient::acquire_lease()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientAcquireLeaseOptions<'a> { - /// 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, - - /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. - pub if_unmodified_since: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// Optional. The proposed lease ID for the container. - pub proposed_lease_id: Option, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) + pub timeout: Option, +} /// Options to be passed to `BlobContainerClient::break_lease()` #[derive(Clone, Default, SafeDebug)] @@ -1153,9 +1019,9 @@ pub struct BlobContainerClientDeleteOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlobContainerClient::filter_blobs()` +/// Options to be passed to `BlobContainerClient::find_blobs_by_tags()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientFilterBlobsOptions<'a> { +pub struct BlobContainerClientFindBlobsByTagsOptions<'a> { /// Include this parameter to specify one or more datasets to include in the response. pub include: Option>, @@ -1174,9 +1040,6 @@ pub struct BlobContainerClientFilterBlobsOptions<'a> { /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, - - /// Filters the results to return only to return only blobs whose tags match the specified expression. - pub where_param: Option, } /// Options to be passed to `BlobContainerClient::get_access_policy()` @@ -1215,9 +1078,9 @@ pub struct BlobContainerClientGetPropertiesOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlobContainerClient::list_blob_flat_segment()` +/// Options to be passed to `BlobContainerClient::list_blobs()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientListBlobFlatSegmentOptions<'a> { +pub struct BlobContainerClientListBlobsOptions<'a> { /// Include this parameter to specify one or more datasets to include in the response. pub include: Option>, @@ -1237,57 +1100,18 @@ pub struct BlobContainerClientListBlobFlatSegmentOptions<'a> { /// Filters the results to return only containers whose name begins with the specified prefix. pub prefix: Option, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -impl BlobContainerClientListBlobFlatSegmentOptions<'_> { - /// Transforms this [`BlobContainerClientListBlobFlatSegmentOptions`] into a new `BlobContainerClientListBlobFlatSegmentOptions` that owns the underlying data, cloning it if necessary. - pub fn into_owned(self) -> BlobContainerClientListBlobFlatSegmentOptions<'static> { - BlobContainerClientListBlobFlatSegmentOptions { - include: self.include, - marker: self.marker, - maxresults: self.maxresults, - method_options: PagerOptions { - context: self.method_options.context.into_owned(), - ..self.method_options - }, - prefix: self.prefix, - timeout: self.timeout, - } - } -} - -/// Options to be passed to `BlobContainerClient::list_blob_hierarchy_segment()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientListBlobHierarchySegmentOptions<'a> { - /// Include this parameter to specify one or more datasets to include in the response. - pub include: Option>, - - /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The - /// operation returns the NextMarker value within the response body if the listing operation did not return all containers - /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in - /// a subsequent call to request the next page of list items. The marker value is opaque to the client. - pub marker: Option, - - /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value - /// greater than 5000, the server will return up to 5000 items. - pub maxresults: Option, - - /// Allows customization of the method call. - pub method_options: PagerOptions<'a>, - - /// Filters the results to return only containers whose name begins with the specified prefix. - pub prefix: Option, + /// Specifies the relative path to list paths from. For non-recursive list, only one entity level is supported; For recursive + /// list, multiple entity levels are supported. (Inclusive) + pub start_from: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } -impl BlobContainerClientListBlobHierarchySegmentOptions<'_> { - /// Transforms this [`BlobContainerClientListBlobHierarchySegmentOptions`] into a new `BlobContainerClientListBlobHierarchySegmentOptions` that owns the underlying data, cloning it if necessary. - pub fn into_owned(self) -> BlobContainerClientListBlobHierarchySegmentOptions<'static> { - BlobContainerClientListBlobHierarchySegmentOptions { +impl BlobContainerClientListBlobsOptions<'_> { + /// Transforms this [`BlobContainerClientListBlobsOptions`] into a new `BlobContainerClientListBlobsOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> BlobContainerClientListBlobsOptions<'static> { + BlobContainerClientListBlobsOptions { include: self.include, marker: self.marker, maxresults: self.maxresults, @@ -1296,6 +1120,7 @@ impl BlobContainerClientListBlobHierarchySegmentOptions<'_> { ..self.method_options }, prefix: self.prefix, + start_from: self.start_from, timeout: self.timeout, } } @@ -1317,19 +1142,6 @@ pub struct BlobContainerClientReleaseLeaseOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlobContainerClient::rename()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientRenameOptions<'a> { - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. - pub source_lease_id: Option, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - /// Options to be passed to `BlobContainerClient::renew_lease()` #[derive(Clone, Default, SafeDebug)] pub struct BlobContainerClientRenewLeaseOptions<'a> { @@ -1346,22 +1158,6 @@ pub struct BlobContainerClientRenewLeaseOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlobContainerClient::restore()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlobContainerClientRestoreOptions<'a> { - /// Optional. Version 2019-12-12 and later. Specifies the name of the deleted container to restore. - pub deleted_container_name: Option, - - /// Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. - pub deleted_container_version: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - /// Options to be passed to `BlobContainerClient::set_access_policy()` #[derive(Clone, Default, SafeDebug)] pub struct BlobContainerClientSetAccessPolicyOptions<'a> { @@ -1393,9 +1189,6 @@ pub struct BlobContainerClientSetMetadataOptions<'a> { /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, - /// The metadata headers. - pub metadata: Option>, - /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, @@ -1403,9 +1196,9 @@ pub struct BlobContainerClientSetMetadataOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlobServiceClient::filter_blobs()` +/// Options to be passed to `BlobServiceClient::find_blobs_by_tags()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobServiceClientFilterBlobsOptions<'a> { +pub struct BlobServiceClientFindBlobsByTagsOptions<'a> { /// Include this parameter to specify one or more datasets to include in the response. pub include: Option>, @@ -1424,9 +1217,6 @@ pub struct BlobServiceClientFilterBlobsOptions<'a> { /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, - - /// Filters the results to return only to return only blobs whose tags match the specified expression. - pub where_param: Option, } /// Options to be passed to `BlobServiceClient::get_account_info()` @@ -1459,19 +1249,9 @@ pub struct BlobServiceClientGetStatisticsOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlobServiceClient::get_user_delegation_key()` -#[derive(Clone, Default, SafeDebug)] -pub(crate) struct BlobServiceClientGetUserDelegationKeyOptions<'a> { - /// Allows customization of the method call. - pub(crate) method_options: ClientMethodOptions<'a>, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub(crate) timeout: Option, -} - -/// Options to be passed to `BlobServiceClient::list_containers_segment()` +/// Options to be passed to `BlobServiceClient::list_containers()` #[derive(Clone, Default, SafeDebug)] -pub struct BlobServiceClientListContainersSegmentOptions<'a> { +pub struct BlobServiceClientListContainersOptions<'a> { /// Include this parameter to specify that the container's metadata be returned as part of the response body. pub include: Option>, @@ -1495,10 +1275,10 @@ pub struct BlobServiceClientListContainersSegmentOptions<'a> { pub timeout: Option, } -impl BlobServiceClientListContainersSegmentOptions<'_> { - /// Transforms this [`BlobServiceClientListContainersSegmentOptions`] into a new `BlobServiceClientListContainersSegmentOptions` that owns the underlying data, cloning it if necessary. - pub fn into_owned(self) -> BlobServiceClientListContainersSegmentOptions<'static> { - BlobServiceClientListContainersSegmentOptions { +impl BlobServiceClientListContainersOptions<'_> { + /// Transforms this [`BlobServiceClientListContainersOptions`] into a new `BlobServiceClientListContainersOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> BlobServiceClientListContainersOptions<'static> { + BlobServiceClientListContainersOptions { include: self.include, marker: self.marker, maxresults: self.maxresults, @@ -1568,26 +1348,26 @@ pub struct BlockBlobClientCommitBlockListOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// Specifies the date time when the blobs immutability policy is set to expire. pub immutability_policy_expiry: Option, /// Specifies the immutability policy mode to set on the blob. - pub immutability_policy_mode: Option, + pub immutability_policy_mode: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -1635,44 +1415,9 @@ pub struct BlockBlobClientGetBlockListOptions<'a> { pub timeout: Option, } -/// Options to be passed to `BlockBlobClient::put_blob_from_url()` +/// Options to be passed to `BlockBlobClient::stage_block()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientPutBlobFromUrlOptions<'a> { - /// Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read - /// request. - pub blob_cache_control: Option, - - /// Optional. Sets the blob's content disposition. If specified, this property is stored with the blob and returned with a - /// read request. - pub blob_content_disposition: Option, - - /// Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read - /// request. - pub blob_content_encoding: Option, - - /// Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read - /// request. - pub blob_content_language: Option, - - /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks - /// were validated when each was uploaded. - pub blob_content_md5: Option>, - - /// Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. - pub blob_content_type: Option, - - /// Optional. Used to set blob tags in various blob operations. - pub blob_tags_string: Option, - - /// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. - pub copy_source_authorization: Option, - - /// Optional, default is true. Indicates if properties from the source blob should be copied. - pub copy_source_blob_properties: Option, - - /// Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags. - pub copy_source_tags: Option, - +pub struct BlockBlobClientStageBlockOptions<'a> { /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is /// AES256. pub encryption_algorithm: Option, @@ -1690,62 +1435,36 @@ pub struct BlockBlobClientPutBlobFromUrlOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. - pub if_match: Option, - - /// The request should only proceed if the entity was modified after this time. - pub if_modified_since: Option, - - /// The request should only proceed if no entity matches this string. - pub if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, - - /// The request should only proceed if the entity was not modified after this time. - pub if_unmodified_since: Option, - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, - /// The metadata headers. - pub metadata: Option>, - /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Specify the md5 calculated for the range of bytes that must be read from the copy source. - pub source_content_md5: Option>, - - /// Specify an ETag value to operate only on blobs with a matching value. - pub source_if_match: Option, - - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_modified_since: Option, - - /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. - pub source_if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub source_if_tags: Option, - - /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. - pub source_if_unmodified_since: Option, + /// Required if the request body is a structured message. Specifies the message schema version and properties. + pub structured_body_type: Option, - /// The tier to be set on the blob. - pub tier: Option, + /// Required if the request body is a structured message. Specifies the length of the blob/file content inside the message + /// body. Will always be smaller than Content-Length. + pub structured_content_length: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, + /// Specify the transactional crc64 for the body, to be validated by the service. + pub transactional_content_crc64: Option>, + /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks /// were validated when each was uploaded. pub transactional_content_md5: Option>, } -/// Options to be passed to `BlockBlobClient::query()` +/// Options to be passed to `BlockBlobClient::stage_block_from_url()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientQueryOptions<'a> { +pub struct BlockBlobClientStageBlockFromUrlOptions<'a> { + /// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. + pub copy_source_authorization: Option, + /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is /// AES256. pub encryption_algorithm: Option, @@ -1759,20 +1478,12 @@ pub struct BlockBlobClientQueryOptions<'a> { /// with a client token, this header should be specified using the SHA256 hash of the encryption key. pub encryption_key_sha256: Option, - /// The request should only proceed if an entity matches this string. - pub if_match: Option, - - /// The request should only proceed if the entity was modified after this time. - pub if_modified_since: Option, - - /// The request should only proceed if no entity matches this string. - pub if_none_match: Option, + /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. + /// If not specified, the request will be encrypted with the root account key. + pub encryption_scope: Option, - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, - - /// The request should only proceed if the entity was not modified after this time. - pub if_unmodified_since: 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, @@ -1780,57 +1491,79 @@ pub struct BlockBlobClientQueryOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more - /// information on working with blob snapshots, see [Creating a Snapshot of a Blob.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob) - pub snapshot: Option, + /// Specify the crc64 calculated for the range of bytes that must be read from the copy source. + pub source_content_crc64: Option>, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} + /// Specify the md5 calculated for the range of bytes that must be read from the copy source. + pub source_content_md5: Option>, -/// Options to be passed to `BlockBlobClient::stage_block()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientStageBlockOptions<'a> { - /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is - /// AES256. - pub encryption_algorithm: Option, + /// The algorithm used to produce the source encryption key hash. Currently, the only accepted value is "AES256". Must be + /// provided if the x-ms-source-encryption-key is provided. + pub source_encryption_algorithm: Option, - /// Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_key: Option, + /// Optional. Specifies the source encryption key to use to encrypt the source data provided in the request. + pub source_encryption_key: Option, - /// Optional. Version 2019-07-07 and later. Specifies the SHA256 hash of the encryption key used to encrypt the data provided - /// in the request. This header is only used for encryption with a customer-provided key. If the request is authenticated - /// with a client token, this header should be specified using the SHA256 hash of the encryption key. - pub encryption_key_sha256: Option, + /// The SHA-256 hash of the provided source encryption key. Must be provided if the x-ms-source-encryption-key header is provided. + pub source_encryption_key_sha256: Option, - /// Optional. Version 2019-07-07 and later. Specifies the encryption scope to use to encrypt the data provided in the request. - /// If not specified, the request will be encrypted with the root account key. - pub encryption_scope: Option, + /// Specify an ETag value to operate only on blobs with a matching value. + pub source_if_match: Option, - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. - pub lease_id: Option, + /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. + pub source_if_modified_since: Option, - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, + /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. + pub source_if_none_match: Option, + + /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. + pub source_if_unmodified_since: Option, + + /// Bytes of source data in the specified range. + pub source_range: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, +} - /// Specify the transactional crc64 for the body, to be validated by the service. - pub transactional_content_crc64: Option>, +/// Options to be passed to `BlockBlobClient::upload_blob_from_url()` +#[derive(Clone, Default, SafeDebug)] +pub struct BlockBlobClientUploadBlobFromUrlOptions<'a> { + /// Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read + /// request. + pub blob_cache_control: Option, + + /// Optional. Sets the blob's content disposition. If specified, this property is stored with the blob and returned with a + /// read request. + pub blob_content_disposition: Option, + + /// Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read + /// request. + pub blob_content_encoding: Option, + + /// Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read + /// request. + pub blob_content_language: Option, /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks /// were validated when each was uploaded. - pub transactional_content_md5: Option>, -} + pub blob_content_md5: Option>, + + /// Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. + pub blob_content_type: Option, + + /// Optional. Used to set blob tags in various blob operations. + pub blob_tags_string: Option, -/// Options to be passed to `BlockBlobClient::stage_block_from_url()` -#[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientStageBlockFromUrlOptions<'a> { /// Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. pub copy_source_authorization: Option, + /// Optional, default is true. Indicates if properties from the source blob should be copied. + pub copy_source_blob_properties: Option, + + /// Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags. + pub copy_source_tags: Option, + /// Optional. Version 2019-07-07 and later. Specifies the algorithm to use for encryption. If not specified, the default is /// AES256. pub encryption_algorithm: Option, @@ -1848,18 +1581,46 @@ 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, + + /// A condition that must be met in order for the request to be processed. + pub if_match: Option, + + /// A date-time value. A request is made under the condition that the resource has been modified since the specified date-time. + pub if_modified_since: Option, + + /// A condition that must be met in order for the request to be processed. + pub if_none_match: Option, + + /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + pub if_tags: Option, + + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. + pub if_unmodified_since: Option, + /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, + /// The metadata headers. + pub metadata: Option>, + /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Specify the crc64 calculated for the range of bytes that must be read from the copy source. - pub source_content_crc64: Option>, - /// Specify the md5 calculated for the range of bytes that must be read from the copy source. pub source_content_md5: Option>, + /// The algorithm used to produce the source encryption key hash. Currently, the only accepted value is "AES256". Must be + /// provided if the x-ms-source-encryption-key is provided. + pub source_encryption_algorithm: Option, + + /// Optional. Specifies the source encryption key to use to encrypt the source data provided in the request. + pub source_encryption_key: Option, + + /// The SHA-256 hash of the provided source encryption key. Must be provided if the x-ms-source-encryption-key header is provided. + pub source_encryption_key_sha256: Option, + /// Specify an ETag value to operate only on blobs with a matching value. pub source_if_match: Option, @@ -1869,19 +1630,26 @@ pub struct BlockBlobClientStageBlockFromUrlOptions<'a> { /// Specify this header value to operate only on a blob if it has been modified since the specified date/time. pub source_if_none_match: Option, + /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + pub source_if_tags: Option, + /// Specify this header value to operate only on a blob if it has not been modified since the specified date/time. pub source_if_unmodified_since: Option, - /// Bytes of source data in the specified range. - pub source_range: Option, + /// The tier to be set on the blob. + pub tier: Option, /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, + + /// Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks + /// were validated when each was uploaded. + pub transactional_content_md5: Option>, } -/// Options to be passed to `BlockBlobClient::upload()` +/// Options to be passed to `BlockBlobClient::upload_internal()` #[derive(Clone, Default, SafeDebug)] -pub struct BlockBlobClientUploadOptions<'a> { +pub struct BlockBlobClientUploadInternalOptions<'a> { /// Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read /// request. pub blob_cache_control: Option, @@ -1925,26 +1693,26 @@ pub struct BlockBlobClientUploadOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// Specifies the date time when the blobs immutability policy is set to expire. pub immutability_policy_expiry: Option, /// Specifies the immutability policy mode to set on the blob. - pub immutability_policy_mode: Option, + pub immutability_policy_mode: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -1958,6 +1726,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, @@ -1992,13 +1767,13 @@ pub struct PageBlobClientClearPagesOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify this header value to operate only on a blob if it has the specified sequence number. @@ -2013,7 +1788,7 @@ pub struct PageBlobClientClearPagesOptions<'a> { /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -2022,34 +1797,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, -} - -/// Options to be passed to `PageBlobClient::copy_incremental()` -#[derive(Clone, Default, SafeDebug)] -pub struct PageBlobClientCopyIncrementalOptions<'a> { - /// The request should only proceed if an entity matches this string. - pub if_match: Option, - - /// The request should only proceed if the entity was modified after this time. - pub if_modified_since: Option, - - /// The request should only proceed if no entity matches this string. - pub if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, - - /// The request should only proceed if the entity was not modified after this time. - pub if_unmodified_since: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) pub timeout: Option, } @@ -2104,26 +1851,26 @@ pub struct PageBlobClientCreateOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// Specifies the date time when the blobs immutability policy is set to expire. pub immutability_policy_expiry: Option, /// Specifies the immutability policy mode to set on the blob. - pub immutability_policy_mode: Option, + pub immutability_policy_mode: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. pub lease_id: Option, @@ -2147,64 +1894,19 @@ pub struct PageBlobClientCreateOptions<'a> { /// Options to be passed to `PageBlobClient::get_page_ranges()` #[derive(Clone, Default, SafeDebug)] pub struct PageBlobClientGetPageRangesOptions<'a> { - /// The request should only proceed if an entity matches this string. - pub if_match: Option, - - /// The request should only proceed if the entity was modified after this time. - pub if_modified_since: Option, - - /// The request should only proceed if no entity matches this string. - pub if_none_match: Option, - - /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - pub if_tags: Option, - - /// The request should only proceed if the entity was not modified after this time. - pub if_unmodified_since: Option, - - /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. - pub lease_id: Option, - - /// A string value that identifies the portion of the list of containers to be returned with the next listing operation. The - /// operation returns the NextMarker value within the response body if the listing operation did not return all containers - /// remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in - /// a subsequent call to request the next page of list items. The marker value is opaque to the client. - pub marker: Option, - - /// Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value - /// greater than 5000, the server will return up to 5000 items. - pub maxresults: Option, - - /// Allows customization of the method call. - pub method_options: ClientMethodOptions<'a>, - - /// Return only the bytes of the blob in the specified range. - pub range: Option, - - /// The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more - /// information on working with blob snapshots, see [Creating a Snapshot of a Blob.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob) - pub snapshot: Option, - - /// The timeout parameter is expressed in seconds. For more information, see [Setting Timeouts for Blob Service Operations.](https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations) - pub timeout: Option, -} - -/// Options to be passed to `PageBlobClient::get_page_ranges_diff()` -#[derive(Clone, Default, SafeDebug)] -pub struct PageBlobClientGetPageRangesDiffOptions<'a> { - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -2223,16 +1925,6 @@ pub struct PageBlobClientGetPageRangesDiffOptions<'a> { /// Allows customization of the method call. pub method_options: ClientMethodOptions<'a>, - /// Optional. This header is only supported in service versions 2019-04-19 and after and specifies the URL of a previous snapshot - /// of the target blob. The response will only contain pages that were changed between the target blob and its previous snapshot. - pub prev_snapshot_url: Option, - - /// Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response - /// will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated - /// and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of - /// the two. Note that incremental snapshots are currently supported only for blobs created on or after January 1, 2016. - pub prevsnapshot: Option, - /// Return only the bytes of the blob in the specified range. pub range: Option, @@ -2264,19 +1956,19 @@ pub struct PageBlobClientResizeOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -2289,26 +1981,26 @@ pub struct PageBlobClientResizeOptions<'a> { pub timeout: Option, } -/// Options to be passed to `PageBlobClient::update_sequence_number()` +/// Options to be passed to `PageBlobClient::set_sequence_number()` #[derive(Clone, Default, SafeDebug)] -pub struct PageBlobClientUpdateSequenceNumberOptions<'a> { +pub struct PageBlobClientSetSequenceNumberOptions<'a> { /// Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value /// of the sequence number must be between 0 and 2^63 - 1. pub blob_sequence_number: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -2341,13 +2033,13 @@ pub struct PageBlobClientUploadPagesOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify this header value to operate only on a blob if it has the specified sequence number. @@ -2362,7 +2054,7 @@ pub struct PageBlobClientUploadPagesOptions<'a> { /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -2371,9 +2063,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, @@ -2415,13 +2104,16 @@ pub struct PageBlobClientUploadPagesFromUrlOptions<'a> { /// If not specified, the request will be encrypted with the root account key. pub encryption_scope: Option, - /// The request should only proceed if an entity matches this string. + /// Valid value is backup + pub file_request_intent: Option, + + /// A condition that must be met in order for the request to be processed. pub if_match: Option, - /// The request should only proceed if the entity was modified after this time. + /// 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, - /// The request should only proceed if no entity matches this string. + /// A condition that must be met in order for the request to be processed. pub if_none_match: Option, /// Specify this header value to operate only on a blob if it has the specified sequence number. @@ -2436,7 +2128,7 @@ pub struct PageBlobClientUploadPagesFromUrlOptions<'a> { /// Specify a SQL where clause on blob tags to operate only on blobs with a matching value. pub if_tags: Option, - /// The request should only proceed if the entity was not modified after this time. + /// A date-time value. A request is made under the condition that the resource has not been modified since the specified date-time. pub if_unmodified_since: Option, /// If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -2451,6 +2143,16 @@ pub struct PageBlobClientUploadPagesFromUrlOptions<'a> { /// Specify the md5 calculated for the range of bytes that must be read from the copy source. pub source_content_md5: Option>, + /// The algorithm used to produce the source encryption key hash. Currently, the only accepted value is "AES256". Must be + /// provided if the x-ms-source-encryption-key is provided. + pub source_encryption_algorithm: Option, + + /// Optional. Specifies the source encryption key to use to encrypt the source data provided in the request. + pub source_encryption_key: Option, + + /// The SHA-256 hash of the provided source encryption key. Must be provided if the x-ms-source-encryption-key header is provided. + pub source_encryption_key_sha256: Option, + /// Specify an ETag value to operate only on blobs with a matching value. pub source_if_match: Option, diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models.rs index d1b6e24eb..daaae7b41 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models.rs @@ -6,15 +6,14 @@ use super::{ models_serde, xml_helpers::{ - Blob_tag_setTag, BlobsBlob, Clear_rangeClearRange, Committed_blocksBlock, - Container_itemsContainer, CorsCorsRule, Page_rangePageRange, SchemaField, + Blob_tag_setTag, BlobsBlob, Committed_blocksBlock, Container_itemsContainer, CorsCorsRule, Uncommitted_blocksBlock, }, - AccessTier, ArchiveStatus, BlobImmutabilityPolicyMode, BlobType, CopyStatus, - GeoReplicationStatusType, LeaseDuration, LeaseState, LeaseStatus, PublicAccessType, - QueryRequestType, QueryType, RehydratePriority, + AccessTier, ArchiveStatus, BlobType, CopyStatus, GeoReplicationStatusType, + ImmutabilityPolicyMode, LeaseDuration, LeaseState, LeaseStatus, PublicAccessType, + RehydratePriority, }; -use azure_core::{base64, fmt::SafeDebug, time::OffsetDateTime, Value}; +use azure_core::{base64, fmt::SafeDebug, time::OffsetDateTime}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -60,45 +59,6 @@ pub struct AppendBlobClientCreateResult; #[derive(SafeDebug)] pub struct AppendBlobClientSealResult; -/// Represents the Apache Arrow configuration. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -pub struct ArrowConfiguration { - /// The Apache Arrow schema - #[serde( - default, - deserialize_with = "SchemaField::unwrap", - rename = "Schema", - serialize_with = "SchemaField::wrap", - skip_serializing_if = "Option::is_none" - )] - pub schema: Option>, -} - -/// Represents an Apache Arrow field. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -#[serde(rename = "Field")] -pub struct ArrowField { - /// The arrow field name. - #[serde(rename = "Name", skip_serializing_if = "Option::is_none")] - pub name: Option, - - /// The arrow field precision. - #[serde(rename = "Precision", skip_serializing_if = "Option::is_none")] - pub precision: Option, - - /// The arrow field scale. - #[serde(rename = "Scale", skip_serializing_if = "Option::is_none")] - pub scale: Option, - - /// The arrow field type. - #[serde(rename = "Type", skip_serializing_if = "Option::is_none")] - pub type_prop: Option, -} - -/// Contains results for `BlobClient::abort_copy_from_url()` -#[derive(SafeDebug)] -pub(crate) struct BlobClientAbortCopyFromUrlResult; - /// Contains results for `BlobClient::acquire_lease()` #[derive(SafeDebug)] pub struct BlobClientAcquireLeaseResult; @@ -111,21 +71,13 @@ pub struct BlobClientBreakLeaseResult; #[derive(SafeDebug)] pub struct BlobClientChangeLeaseResult; -/// Contains results for `BlobClient::copy_from_url()` -#[derive(SafeDebug)] -pub struct BlobClientCopyFromUrlResult; - /// Contains results for `BlobClient::create_snapshot()` #[derive(SafeDebug)] pub struct BlobClientCreateSnapshotResult; -/// Contains results for `BlobClient::delete_immutability_policy()` -#[derive(SafeDebug)] -pub struct BlobClientDeleteImmutabilityPolicyResult; - -/// Contains results for `BlobClient::download()` +/// Contains results for `BlobClient::download_internal()` #[derive(SafeDebug)] -pub struct BlobClientDownloadResult; +pub struct BlobClientDownloadInternalResult; /// Contains results for `BlobClient::get_account_info()` #[derive(SafeDebug)] @@ -143,30 +95,6 @@ pub struct BlobClientReleaseLeaseResult; #[derive(SafeDebug)] pub struct BlobClientRenewLeaseResult; -/// Contains results for `BlobClient::set_expiry()` -#[derive(SafeDebug)] -pub struct BlobClientSetExpiryResult; - -/// Contains results for `BlobClient::set_immutability_policy()` -#[derive(SafeDebug)] -pub struct BlobClientSetImmutabilityPolicyResult; - -/// Contains results for `BlobClient::set_legal_hold()` -#[derive(SafeDebug)] -pub struct BlobClientSetLegalHoldResult; - -/// Contains results for `BlobClient::set_tags()` -#[derive(SafeDebug)] -pub struct BlobClientSetTagsResult; - -/// Contains results for `BlobClient::start_copy_from_url()` -#[derive(SafeDebug)] -pub struct BlobClientStartCopyFromUrlResult; - -/// Contains results for `BlobClient::undelete()` -#[derive(SafeDebug)] -pub struct BlobClientUndeleteResult; - /// Contains results for `BlobContainerClient::acquire_lease()` #[derive(SafeDebug)] pub struct BlobContainerClientAcquireLeaseResult; @@ -191,58 +119,33 @@ pub struct BlobContainerClientGetPropertiesResult; #[derive(SafeDebug)] pub struct BlobContainerClientReleaseLeaseResult; -/// Contains results for `BlobContainerClient::rename()` -#[derive(SafeDebug)] -pub struct BlobContainerClientRenameResult; - /// Contains results for `BlobContainerClient::renew_lease()` #[derive(SafeDebug)] pub struct BlobContainerClientRenewLeaseResult; -/// Contains results for `BlobContainerClient::restore()` -#[derive(SafeDebug)] -pub struct BlobContainerClientRestoreResult; - -/// Contains results for `BlobContainerClient::set_access_policy()` -#[derive(SafeDebug)] -pub struct BlobContainerClientSetAccessPolicyResult; - /// The blob flat list segment. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] pub struct BlobFlatListSegment { /// The blob items. #[serde(default, rename = "Blob")] - pub blob_items: Vec, -} - -/// Represents an array of blobs. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -#[non_exhaustive] -pub struct BlobHierarchyListSegment { - /// The blob items - #[serde(default, rename = "Blob")] - pub blob_items: Vec, - - /// The blob prefixes. - #[serde(rename = "BlobPrefix", skip_serializing_if = "Option::is_none")] - pub blob_prefixes: Option>, + pub blob_items: Vec, } /// An Azure Storage Blob #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] #[serde(rename = "Blob")] -pub struct BlobItemInternal { +pub struct BlobItem { /// The tags of the blob. - #[serde(rename = "BlobTags", skip_serializing_if = "Option::is_none")] + #[serde(rename = "Tags", skip_serializing_if = "Option::is_none")] pub blob_tags: Option, /// Whether the blob is deleted. #[serde(rename = "Deleted", skip_serializing_if = "Option::is_none")] pub deleted: Option, - /// Whether the blog has versions only. + /// Whether the blob has versions only. #[serde(rename = "HasVersionsOnly", skip_serializing_if = "Option::is_none")] pub has_versions_only: Option, @@ -256,7 +159,7 @@ pub struct BlobItemInternal { /// The name of the blob. #[serde(rename = "Name", skip_serializing_if = "Option::is_none")] - pub name: Option, + pub name: Option, /// The object replication metadata of the blob. #[serde(rename = "OrMetadata", skip_serializing_if = "Option::is_none")] @@ -264,7 +167,7 @@ pub struct BlobItemInternal { /// The properties of the blob. #[serde(rename = "Properties", skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub properties: Option, /// The snapshot of the blob. #[serde(rename = "Snapshot", skip_serializing_if = "Option::is_none")] @@ -299,20 +202,11 @@ pub struct BlobName { pub encoded: Option, } -/// Represents a blob prefix. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -#[non_exhaustive] -pub struct BlobPrefix { - /// The blob name. - #[serde(rename = "Name", skip_serializing_if = "Option::is_none")] - pub name: Option, -} - /// The properties of a blob. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] #[serde(rename = "Properties")] -pub struct BlobPropertiesInternal { +pub struct BlobProperties { /// The access tier of the blob. #[serde(rename = "AccessTier", skip_serializing_if = "Option::is_none")] pub access_tier: Option, @@ -450,8 +344,8 @@ pub struct BlobPropertiesInternal { #[serde(rename = "EncryptionScope", skip_serializing_if = "Option::is_none")] pub encryption_scope: Option, - /// The blog ETag. - #[serde(rename = "ETag", skip_serializing_if = "Option::is_none")] + /// The blob ETag. + #[serde(rename = "Etag", skip_serializing_if = "Option::is_none")] pub etag: Option, /// The expire time of the blob. @@ -477,9 +371,9 @@ pub struct BlobPropertiesInternal { rename = "ImmutabilityPolicyMode", skip_serializing_if = "Option::is_none" )] - pub immutability_policy_mode: Option, + pub immutability_policy_mode: Option, - /// Whether the blog is incremental copy. + /// Whether the blob is incremental copy. #[serde(rename = "IncrementalCopy", skip_serializing_if = "Option::is_none")] pub incremental_copy: Option, @@ -532,7 +426,7 @@ pub struct BlobPropertiesInternal { )] pub remaining_retention_days: Option, - /// Whether the blog is encrypted on the server. + /// Whether the blob is encrypted on the server. #[serde(rename = "ServerEncrypted", skip_serializing_if = "Option::is_none")] pub server_encrypted: Option, @@ -545,6 +439,51 @@ pub struct BlobPropertiesInternal { #[derive(SafeDebug)] pub struct BlobServiceClientGetAccountInfoResult; +/// The service properties. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[serde(rename = "StorageServiceProperties")] +pub struct BlobServiceProperties { + /// The CORS properties. + #[serde( + default, + deserialize_with = "CorsCorsRule::unwrap", + rename = "Cors", + serialize_with = "CorsCorsRule::wrap", + skip_serializing_if = "Option::is_none" + )] + pub cors: Option>, + + /// The default service version. + #[serde( + rename = "DefaultServiceVersion", + skip_serializing_if = "Option::is_none" + )] + pub default_service_version: Option, + + /// The delete retention policy. + #[serde( + rename = "DeleteRetentionPolicy", + skip_serializing_if = "Option::is_none" + )] + pub delete_retention_policy: Option, + + /// The hour metrics properties. + #[serde(rename = "HourMetrics", skip_serializing_if = "Option::is_none")] + pub hour_metrics: Option, + + /// The logging properties. + #[serde(rename = "Logging", skip_serializing_if = "Option::is_none")] + pub logging: Option, + + /// The minute metrics properties. + #[serde(rename = "MinuteMetrics", skip_serializing_if = "Option::is_none")] + pub minute_metrics: Option, + + /// The static website properties. + #[serde(rename = "StaticWebsite", skip_serializing_if = "Option::is_none")] + pub static_website: Option, +} + /// The blob tags. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[serde(rename = "Tag")] @@ -596,14 +535,6 @@ pub struct Block { #[derive(SafeDebug)] pub struct BlockBlobClientCommitBlockListResult; -/// Contains results for `BlockBlobClient::put_blob_from_url()` -#[derive(SafeDebug)] -pub struct BlockBlobClientPutBlobFromUrlResult; - -/// Contains results for `BlockBlobClient::query()` -#[derive(SafeDebug)] -pub struct BlockBlobClientQueryResult; - /// Contains results for `BlockBlobClient::stage_block_from_url()` #[derive(SafeDebug)] pub struct BlockBlobClientStageBlockFromUrlResult; @@ -612,9 +543,13 @@ pub struct BlockBlobClientStageBlockFromUrlResult; #[derive(SafeDebug)] pub struct BlockBlobClientStageBlockResult; -/// Contains results for `BlockBlobClient::upload()` +/// Contains results for `BlockBlobClient::upload_blob_from_url()` +#[derive(SafeDebug)] +pub struct BlockBlobClientUploadBlobFromUrlResult; + +/// Contains results for `BlockBlobClient::upload_internal()` #[derive(SafeDebug)] -pub struct BlockBlobClientUploadResult; +pub struct BlockBlobClientUploadInternalResult; /// Contains the committed and uncommitted blocks in a block blob. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] @@ -733,7 +668,7 @@ pub struct ContainerProperties { pub deleted_time: Option, /// The ETag of the container. - #[serde(rename = "ETag", skip_serializing_if = "Option::is_none")] + #[serde(rename = "Etag", skip_serializing_if = "Option::is_none")] pub etag: Option, /// Whether it has an immutability policy. @@ -820,30 +755,6 @@ pub struct CorsRule { pub max_age_in_seconds: Option, } -/// Represents the delimited text configuration. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -pub struct DelimitedTextConfiguration { - /// The string used to separate columns. - #[serde(rename = "ColumnSeparator", skip_serializing_if = "Option::is_none")] - pub column_separator: Option, - - /// The string used to escape a quote character in a field. - #[serde(rename = "EscapeChar", skip_serializing_if = "Option::is_none")] - pub escape_char: Option, - - /// The string used to quote a specific field. - #[serde(rename = "FieldQuote", skip_serializing_if = "Option::is_none")] - pub field_quote: Option, - - /// Represents whether the data has headers. - #[serde(rename = "HasHeaders", skip_serializing_if = "Option::is_none")] - pub headers_present: Option, - - /// The string used to separate records. - #[serde(rename = "RecordSeparator", skip_serializing_if = "Option::is_none")] - pub record_separator: Option, -} - /// The filter blob item. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] @@ -862,7 +773,7 @@ pub struct FilterBlobItem { pub name: Option, /// The metadata of the blob. - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(rename = "Tags", skip_serializing_if = "Option::is_none")] pub tags: Option, /// The version ID of the blob. @@ -917,31 +828,11 @@ pub struct GeoReplication { pub status: Option, } -/// Represents the JSON text configuration. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -pub struct JsonTextConfiguration { - /// The string used to separate records. - #[serde(rename = "RecordSeparator", skip_serializing_if = "Option::is_none")] - pub record_separator: Option, -} - -/// Key information -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -pub(crate) struct KeyInfo { - /// The date-time the key expires. - #[serde(rename = "Expiry", skip_serializing_if = "Option::is_none")] - pub(crate) expiry: Option, - - /// The date-time the key is active. - #[serde(rename = "Start", skip_serializing_if = "Option::is_none")] - pub(crate) start: Option, -} - /// An enumeration of blobs. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] #[serde(rename = "EnumerationResults")] -pub struct ListBlobsFlatSegmentResponse { +pub struct ListBlobsResponse { /// The container name. #[serde(rename = "@ContainerName", skip_serializing_if = "Option::is_none")] pub container_name: Option, @@ -971,44 +862,6 @@ pub struct ListBlobsFlatSegmentResponse { pub service_endpoint: Option, } -/// An enumeration of blobs -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -#[non_exhaustive] -#[serde(rename = "EnumerationResults")] -pub struct ListBlobsHierarchySegmentResponse { - /// The container name. - #[serde(rename = "@ContainerName", skip_serializing_if = "Option::is_none")] - pub container_name: Option, - - /// The delimiter of the blobs. - #[serde(rename = "Delimiter", skip_serializing_if = "Option::is_none")] - pub delimiter: Option, - - /// The marker of the blobs. - #[serde(rename = "Marker", skip_serializing_if = "Option::is_none")] - pub marker: Option, - - /// The max results of the blobs. - #[serde(rename = "MaxResults", skip_serializing_if = "Option::is_none")] - pub max_results: Option, - - /// The next marker of the blobs. - #[serde(rename = "NextMarker", skip_serializing_if = "Option::is_none")] - pub next_marker: Option, - - /// The prefix of the blobs. - #[serde(rename = "Prefix", skip_serializing_if = "Option::is_none")] - pub prefix: Option, - - /// The blob segment. - #[serde(default, rename = "Blobs")] - pub segment: BlobHierarchyListSegment, - - /// The service endpoint. - #[serde(rename = "@ServiceEndpoint", skip_serializing_if = "Option::is_none")] - pub service_endpoint: Option, -} - /// The list container segment response #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] @@ -1100,10 +953,6 @@ pub struct ObjectReplicationMetadata { #[derive(SafeDebug)] pub struct PageBlobClientClearPagesResult; -/// Contains results for `PageBlobClient::copy_incremental()` -#[derive(SafeDebug)] -pub struct PageBlobClientCopyIncrementalResult; - /// Contains results for `PageBlobClient::create()` #[derive(SafeDebug)] pub struct PageBlobClientCreateResult; @@ -1112,9 +961,9 @@ pub struct PageBlobClientCreateResult; #[derive(SafeDebug)] pub struct PageBlobClientResizeResult; -/// Contains results for `PageBlobClient::update_sequence_number()` +/// Contains results for `PageBlobClient::set_sequence_number()` #[derive(SafeDebug)] -pub struct PageBlobClientUpdateSequenceNumberResult; +pub struct PageBlobClientSetSequenceNumberResult; /// Contains results for `PageBlobClient::upload_pages_from_url()` #[derive(SafeDebug)] @@ -1129,13 +978,7 @@ pub struct PageBlobClientUploadPagesResult; #[non_exhaustive] pub struct PageList { /// The clear ranges. - #[serde( - default, - deserialize_with = "Clear_rangeClearRange::unwrap", - rename = "ClearRange", - serialize_with = "Clear_rangeClearRange::wrap", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "ClearRange", skip_serializing_if = "Option::is_none")] pub clear_range: Option>, /// The next marker. @@ -1143,13 +986,7 @@ pub struct PageList { pub next_marker: Option, /// The page ranges. - #[serde( - default, - deserialize_with = "Page_rangePageRange::unwrap", - rename = "PageRange", - serialize_with = "Page_rangePageRange::wrap", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "PageRange", skip_serializing_if = "Option::is_none")] pub page_range: Option>, } @@ -1166,77 +1003,6 @@ pub struct PageRange { pub start: Option, } -/// Represents the Parquet configuration. -#[derive(Clone, Default, SafeDebug)] -pub struct ParquetConfiguration { - /// Contains unnamed additional properties. - pub additional_properties: Option>, -} - -/// The query format settings. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -pub struct QueryFormat { - /// The Apache Arrow configuration. - #[serde(rename = "ArrowConfiguration", skip_serializing_if = "Option::is_none")] - pub arrow_configuration: Option, - - /// The delimited text configuration. - #[serde( - rename = "DelimitedTextConfiguration", - skip_serializing_if = "Option::is_none" - )] - pub delimited_text_configuration: Option, - - /// The JSON text configuration. - #[serde( - rename = "JsonTextConfiguration", - skip_serializing_if = "Option::is_none" - )] - pub json_text_configuration: Option, - - /// The Parquet configuration. - #[serde( - rename = "ParquetConfiguration", - skip_serializing_if = "Option::is_none" - )] - pub parquet_text_configuration: Option, - - /// The query type. - #[serde(rename = "Type", skip_serializing_if = "Option::is_none")] - pub type_prop: Option, -} - -/// Groups the set of query request settings. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -pub struct QueryRequest { - /// The query expression in SQL. The maximum size of the query expression is 256KiB. - #[serde(rename = "Expression", skip_serializing_if = "Option::is_none")] - pub expression: Option, - - /// The input serialization settings. - #[serde(rename = "InputSerialization", skip_serializing_if = "Option::is_none")] - pub input_serialization: Option, - - /// The output serialization settings. - #[serde( - rename = "OutputSerialization", - skip_serializing_if = "Option::is_none" - )] - pub output_serialization: Option, - - /// Required. The type of the provided query expression. - #[serde(rename = "QueryType", skip_serializing_if = "Option::is_none")] - pub query_type: Option, -} - -/// The query serialization settings. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -pub struct QuerySerialization { - /// The query format. - #[serde(rename = "Format", skip_serializing_if = "Option::is_none")] - pub format: Option, -} - /// The retention policy. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] pub struct RetentionPolicy { @@ -1272,6 +1038,7 @@ pub struct SignedIdentifier { /// Represents an array of signed identifiers #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] pub struct SignedIdentifiers { + /// The array of signed identifiers. #[serde(rename = "SignedIdentifier", skip_serializing_if = "Option::is_none")] pub items: Option>, } @@ -1302,50 +1069,6 @@ pub struct StaticWebsite { pub index_document: Option, } -/// The service properties. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -pub struct StorageServiceProperties { - /// The CORS properties. - #[serde( - default, - deserialize_with = "CorsCorsRule::unwrap", - rename = "Cors", - serialize_with = "CorsCorsRule::wrap", - skip_serializing_if = "Option::is_none" - )] - pub cors: Option>, - - /// The default service version. - #[serde( - rename = "DefaultServiceVersion", - skip_serializing_if = "Option::is_none" - )] - pub default_service_version: Option, - - /// The delete retention policy. - #[serde( - rename = "DeleteRetentionPolicy", - skip_serializing_if = "Option::is_none" - )] - pub delete_retention_policy: Option, - - /// The hour metrics properties. - #[serde(rename = "HourMetrics", skip_serializing_if = "Option::is_none")] - pub hour_metrics: Option, - - /// The logging properties. - #[serde(rename = "Logging", skip_serializing_if = "Option::is_none")] - pub logging: Option, - - /// The minute metrics properties. - #[serde(rename = "MinuteMetrics", skip_serializing_if = "Option::is_none")] - pub minute_metrics: Option, - - /// The static website properties. - #[serde(rename = "StaticWebsite", skip_serializing_if = "Option::is_none")] - pub static_website: Option, -} - /// Stats for the storage service. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] #[non_exhaustive] @@ -1354,42 +1077,3 @@ pub struct StorageServiceStats { #[serde(rename = "GeoReplication", skip_serializing_if = "Option::is_none")] pub geo_replication: Option, } - -/// A user delegation key. -#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] -#[non_exhaustive] -pub(crate) struct UserDelegationKey { - /// The date-time the key expires. - #[serde(rename = "SignedExpiry", skip_serializing_if = "Option::is_none")] - pub(crate) signed_expiry: Option, - - /// The Azure Active Directory object ID in GUID format. - #[serde(rename = "SignedOid", skip_serializing_if = "Option::is_none")] - pub(crate) signed_oid: Option, - - /// Abbreviation of the Azure Storage service that accepts the key. - #[serde(rename = "SignedService", skip_serializing_if = "Option::is_none")] - pub(crate) signed_service: Option, - - /// The date-time the key is active. - #[serde(rename = "SignedStart", skip_serializing_if = "Option::is_none")] - pub(crate) signed_start: Option, - - /// The Azure Active Directory tenant ID in GUID format. - #[serde(rename = "SignedTid", skip_serializing_if = "Option::is_none")] - pub(crate) signed_tid: Option, - - /// The service version that created the key. - #[serde(rename = "SignedVersion", skip_serializing_if = "Option::is_none")] - pub(crate) signed_version: Option, - - /// The key as a base64 string. - #[serde( - default, - deserialize_with = "base64::option::deserialize", - rename = "Value", - serialize_with = "base64::option::serialize", - skip_serializing_if = "Option::is_none" - )] - pub(crate) value: Option>, -} diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models_impl.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models_impl.rs index 1456c0f9e..d24cd32d4 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models_impl.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models_impl.rs @@ -4,9 +4,8 @@ // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. use super::{ - BlobItemInternal, BlobTags, BlockLookupList, ContainerItem, KeyInfo, - ListBlobsFlatSegmentResponse, ListBlobsHierarchySegmentResponse, ListContainersSegmentResponse, - QueryRequest, SignedIdentifiers, StorageServiceProperties, + BlobItem, BlobServiceProperties, BlobTags, BlockLookupList, ContainerItem, ListBlobsResponse, + ListContainersSegmentResponse, SignedIdentifiers, }; use async_trait::async_trait; use azure_core::{ @@ -16,18 +15,9 @@ use azure_core::{ }; #[async_trait] -impl Page for ListBlobsFlatSegmentResponse { - type Item = BlobItemInternal; - type IntoIter = as IntoIterator>::IntoIter; - async fn into_items(self) -> Result { - Ok(self.segment.blob_items.into_iter()) - } -} - -#[async_trait] -impl Page for ListBlobsHierarchySegmentResponse { - type Item = BlobItemInternal; - type IntoIter = as IntoIterator>::IntoIter; +impl Page for ListBlobsResponse { + type Item = BlobItem; + type IntoIter = as IntoIterator>::IntoIter; async fn into_items(self) -> Result { Ok(self.segment.blob_items.into_iter()) } @@ -42,30 +32,23 @@ impl Page for ListContainersSegmentResponse { } } -impl TryFrom for RequestContent { - type Error = azure_core::Error; - fn try_from(value: BlobTags) -> Result { - Ok(to_xml(&value)?.into()) - } -} - -impl TryFrom for RequestContent { +impl TryFrom for RequestContent { type Error = azure_core::Error; - fn try_from(value: BlockLookupList) -> Result { + fn try_from(value: BlobServiceProperties) -> Result { Ok(to_xml(&value)?.into()) } } -impl TryFrom for RequestContent { +impl TryFrom for RequestContent { type Error = azure_core::Error; - fn try_from(value: KeyInfo) -> Result { + fn try_from(value: BlobTags) -> Result { Ok(to_xml(&value)?.into()) } } -impl TryFrom for RequestContent { +impl TryFrom for RequestContent { type Error = azure_core::Error; - fn try_from(value: QueryRequest) -> Result { + fn try_from(value: BlockLookupList) -> Result { Ok(to_xml(&value)?.into()) } } @@ -76,10 +59,3 @@ impl TryFrom for RequestContent Ok(to_xml(&value)?.into()) } } - -impl TryFrom for RequestContent { - type Error = azure_core::Error; - fn try_from(value: StorageServiceProperties) -> Result { - Ok(to_xml(&value)?.into()) - } -} diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models_serde.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models_serde.rs index 5214196a3..5c1c0e641 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models_serde.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/models_serde.rs @@ -3,8 +3,7 @@ // // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use super::{BlobMetadata, ObjectReplicationMetadata, ParquetConfiguration}; -use azure_core::Value; +use super::{BlobMetadata, ObjectReplicationMetadata}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -124,58 +123,6 @@ impl Serialize for ObjectReplicationMetadata { } } -impl<'de> Deserialize<'de> for ParquetConfiguration { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - struct AdditionalPropertiesVisitor; - impl<'de> serde::de::Visitor<'de> for AdditionalPropertiesVisitor { - type Value = ParquetConfiguration; - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { - formatter.write_str("a ParquetConfiguration struct definition") - } - fn visit_map(self, mut map: A) -> Result - where - A: serde::de::MapAccess<'de>, - { - let mut additional_properties = HashMap::new(); - while let Some(key) = map.next_key::()? { - let value: Value = map.next_value()?; - additional_properties.insert(key, value); - } - let additional_properties = match additional_properties.len() { - 0 => None, - _ => Some(additional_properties), - }; - Ok(ParquetConfiguration { - additional_properties, - }) - } - } - deserializer.deserialize_map(AdditionalPropertiesVisitor) - } -} - -impl Serialize for ParquetConfiguration { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - use serde::ser::SerializeMap; - let mut map = serializer.serialize_map(Some(match &self.additional_properties { - Some(additional_properties) => additional_properties.len(), - None => 0, - }))?; - if let Some(additional_properties) = &self.additional_properties { - for (k, v) in additional_properties { - map.serialize_entry(k, v)?; - } - } - map.end() - } -} - pub mod option_offset_date_time_rfc3339_fixed_width { #![allow(clippy::type_complexity)] use azure_core::time::{parse_rfc3339, OffsetDateTime}; diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/xml_helpers.rs b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/xml_helpers.rs index 6d084adec..d9ea95ae3 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/xml_helpers.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/generated/models/xml_helpers.rs @@ -6,9 +6,7 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -use super::{ - ArrowField, BlobTag, Block, ClearRange, ContainerItem, CorsRule, FilterBlobItem, PageRange, -}; +use super::{BlobTag, Block, ContainerItem, CorsRule, FilterBlobItem}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[derive(Deserialize, Serialize)] @@ -66,32 +64,6 @@ impl BlobsBlob { } } -#[derive(Deserialize, Serialize)] -#[serde(rename = "ClearRange")] -pub(crate) struct Clear_rangeClearRange { - #[serde(default)] - ClearRange: Option>, -} - -impl Clear_rangeClearRange { - pub fn unwrap<'de, D>(deserializer: D) -> Result>, D::Error> - where - D: Deserializer<'de>, - { - Ok(Clear_rangeClearRange::deserialize(deserializer)?.ClearRange) - } - - pub fn wrap(to_serialize: &Option>, serializer: S) -> Result - where - S: Serializer, - { - Clear_rangeClearRange { - ClearRange: to_serialize.to_owned(), - } - .serialize(serializer) - } -} - #[derive(Deserialize, Serialize)] #[serde(rename = "CommittedBlocks")] pub(crate) struct Committed_blocksBlock { @@ -170,58 +142,6 @@ impl CorsCorsRule { } } -#[derive(Deserialize, Serialize)] -#[serde(rename = "PageRange")] -pub(crate) struct Page_rangePageRange { - #[serde(default)] - PageRange: Option>, -} - -impl Page_rangePageRange { - pub fn unwrap<'de, D>(deserializer: D) -> Result>, D::Error> - where - D: Deserializer<'de>, - { - Ok(Page_rangePageRange::deserialize(deserializer)?.PageRange) - } - - pub fn wrap(to_serialize: &Option>, serializer: S) -> Result - where - S: Serializer, - { - Page_rangePageRange { - PageRange: to_serialize.to_owned(), - } - .serialize(serializer) - } -} - -#[derive(Deserialize, Serialize)] -#[serde(rename = "Schema")] -pub(crate) struct SchemaField { - #[serde(default)] - Field: Option>, -} - -impl SchemaField { - pub fn unwrap<'de, D>(deserializer: D) -> Result>, D::Error> - where - D: Deserializer<'de>, - { - Ok(SchemaField::deserialize(deserializer)?.Field) - } - - pub fn wrap(to_serialize: &Option>, serializer: S) -> Result - where - S: Serializer, - { - SchemaField { - Field: to_serialize.to_owned(), - } - .serialize(serializer) - } -} - #[derive(Deserialize, Serialize)] #[serde(rename = "UncommittedBlocks")] pub(crate) struct Uncommitted_blocksBlock { diff --git a/packages/typespec-rust/test/sdk/blob_storage/src/lib.rs b/packages/typespec-rust/test/sdk/blob_storage/src/lib.rs index 8bead0851..cc784e401 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/src/lib.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/src/lib.rs @@ -7,40 +7,3 @@ mod generated; pub use generated::*; - -// Keep dead_code on globally but silence these two crate-private generated types. -#[allow(dead_code, unused_imports)] -pub(crate) mod allowed_unused { - pub(crate) use super::generated::models::{ - BlobClientAbortCopyFromUrlOptions, BlobServiceClientGetUserDelegationKeyOptions, - }; -} - -// Touch the fields so `dead_code` stays enabled elsewhere without modifying generated files. -#[allow(dead_code)] -const _: () = { - fn _touch_blob_client_abort_options() { - let mut o: crate::generated::models::BlobClientAbortCopyFromUrlOptions = Default::default(); - let _ = (&mut o.lease_id, &mut o.method_options, &mut o.timeout); - } - - fn _touch_blob_service_get_user_delegation_key_options() { - let mut o: crate::generated::models::BlobServiceClientGetUserDelegationKeyOptions = - Default::default(); - let _ = (&mut o.method_options, &mut o.timeout); - } - - fn _touch_blob_client_abort_copy_from_url_result_headers< - T: crate::generated::models::BlobClientAbortCopyFromUrlResultHeaders, - >( - _value: &T, - ) { - let _ = _value.date(); - } - - fn _touch_user_delegation_key_headers( - _value: &T, - ) { - let _ = _value.date(); - } -}; diff --git a/packages/typespec-rust/test/sdk/blob_storage/tests/testing.rs b/packages/typespec-rust/test/sdk/blob_storage/tests/testing.rs index e324e4c02..acfb5f139 100644 --- a/packages/typespec-rust/test/sdk/blob_storage/tests/testing.rs +++ b/packages/typespec-rust/test/sdk/blob_storage/tests/testing.rs @@ -8,8 +8,8 @@ use azure_core::{ xml::to_xml, }; use blob_storage::models::{ - AccessPolicy, BlobItemInternal, BlobMetadata, GeoReplication, GeoReplicationStatusType, - ListBlobsFlatSegmentResponse, ObjectReplicationMetadata, SignedIdentifier, SignedIdentifiers, + AccessPolicy, BlobItem, BlobMetadata, GeoReplication, GeoReplicationStatusType, + ListBlobsResponse, ObjectReplicationMetadata, SignedIdentifier, SignedIdentifiers, StorageServiceStats, }; use std::collections::HashMap; @@ -57,7 +57,7 @@ async fn additional_properties_de() { "#; - let resp: Response = + let resp: Response = RawResponse::from_bytes(StatusCode::Ok, Headers::new(), xml_data).into(); let body = resp.into_model().unwrap(); @@ -65,13 +65,13 @@ async fn additional_properties_de() { let blob0 = &body.segment.blob_items[0]; let blob0_name = blob0.name.as_ref().unwrap(); - assert_eq!(blob0_name.content, Some("blob0".to_string())); + assert_eq!(blob0_name, "blob0"); assert!(blob0.metadata.is_none()); assert!(blob0.object_replication_metadata.is_none()); let blob1 = &body.segment.blob_items[1]; let blob1_name = blob1.name.as_ref().unwrap(); - assert_eq!(blob1_name.content, Some("blob1".to_string())); + assert_eq!(blob1_name, "blob1"); let blob1_metadata = blob1.metadata.as_ref().unwrap(); let blob1_or_metadata = blob1.object_replication_metadata.as_ref().unwrap(); assert!(blob1_metadata.additional_properties.is_none()); @@ -80,7 +80,7 @@ async fn additional_properties_de() { let blob2 = &body.segment.blob_items[2]; let blob2_name = blob2.name.as_ref().unwrap(); - assert_eq!(blob2_name.content, Some("blob2".to_string())); + assert_eq!(blob2_name, "blob2"); let blob2_metadata = blob2.metadata.as_ref().unwrap(); let blob2_addl_props = blob2_metadata.additional_properties.as_ref().unwrap(); assert_eq!(blob2_addl_props.len(), 2); @@ -91,7 +91,7 @@ async fn additional_properties_de() { let blob3 = &body.segment.blob_items[3]; let blob3_name = blob3.name.as_ref().unwrap(); - assert_eq!(blob3_name.content, Some("blob3".to_string())); + assert_eq!(blob3_name, "blob3"); assert!(blob3.metadata.is_none()); let blob3_or_metadata = blob3.object_replication_metadata.as_ref().unwrap(); let blob3_or_addl_props = blob3_or_metadata.additional_properties.as_ref().unwrap(); @@ -101,7 +101,7 @@ async fn additional_properties_de() { let blob4 = &body.segment.blob_items[4]; let blob4_name = blob4.name.as_ref().unwrap(); - assert_eq!(blob4_name.content, Some("blob4".to_string())); + assert_eq!(blob4_name, "blob4"); let blob4_metadata = blob4.metadata.as_ref().unwrap(); let blob4_addl_props = blob4_metadata.additional_properties.as_ref().unwrap(); assert_eq!(blob4_addl_props.len(), 2); @@ -126,7 +126,7 @@ async fn additional_properties_se() { or_metadata.additional_properties = Some(HashMap::from([("ding".to_string(), "Dong".to_string())])); - let mut blob_item_internal = BlobItemInternal::default(); + let mut blob_item_internal = BlobItem::default(); blob_item_internal.metadata = Some(blob_metadata); blob_item_internal.object_replication_metadata = Some(or_metadata); diff --git a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/client.tsp b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/client.tsp index d745c98d7..60b1c85f1 100644 --- a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/client.tsp +++ b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/client.tsp @@ -7,87 +7,140 @@ using Storage.Blob; namespace Customizations; -/** Parameters to be added in client constructors */ -model BlobServiceClientParameters { - ...ContainerNamePathParameter; - ...BlobPathParameter; -} +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" +@client( + { + service: Storage.Blob, + }, + "rust" +) +interface BlobServiceClient extends Storage.Blob.Service {} -@@clientNamespace(Storage.Blob, "Azure.Storage.Blobs"); -@@clientNamespace(Storage.Blob.Container, "Azure.Storage.Blobs"); -@@clientNamespace(Storage.Blob.Container.Blob, "Azure.Storage.Blobs"); -@@clientNamespace(Storage.Blob.Container.Blob.AppendBlob, - "Azure.Storage.Blobs" -); -@@clientNamespace(Storage.Blob.Container.Blob.BlockBlob, "Azure.Storage.Blobs"); -@@clientNamespace(Storage.Blob.Container.Blob.PageBlob, "Azure.Storage.Blobs"); - -@@clientName(Storage.Blob, "BlobServiceClient", "rust"); -@@clientName(Storage.Blob.Container, "BlobContainerClient", "rust"); -@@clientName(Storage.Blob.Container.Blob, "BlobClient", "rust"); -@@clientName(Storage.Blob.Container.Blob.AppendBlob, - "AppendBlobClient", +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" +@client( + { + service: Storage.Blob, + }, "rust" -); -@@clientName(Storage.Blob.Container.Blob.BlockBlob, "BlockBlobClient", "rust"); -@@clientName(Storage.Blob.Container.Blob.PageBlob, "PageBlobClient", "rust"); -@@clientName(Storage.Blob.Container.Blob.setHttpHeaders, - "SetProperties", +) +interface BlobContainerClient extends Storage.Blob.Container {} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" +@client( + { + service: Storage.Blob, + }, + "rust" +) +interface BlobClient extends Storage.Blob.Blob {} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" +@client( + { + service: Storage.Blob, + }, + "rust" +) +interface AppendBlobClient extends Storage.Blob.AppendBlob {} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" +@client( + { + service: Storage.Blob, + }, + "rust" +) +interface BlockBlobClient extends Storage.Blob.BlockBlob {} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" +@client( + { + service: Storage.Blob, + }, "rust" +) +interface PageBlobClient extends Storage.Blob.PageBlob {} + +@@clientInitialization(BlobServiceClient, + { + initializedBy: InitializedBy.customizeCode, + } ); -@@clientInitialization(Storage.Blob.Container, +@@clientInitialization(BlobContainerClient, { - parameters: ContainerNamePathParameter, - initializedBy: InitializedBy.parent | InitializedBy.individually, + initializedBy: InitializedBy.customizeCode, } ); -@@clientInitialization(Storage.Blob.Container.Blob, + +@@clientInitialization(BlobClient, { - parameters: BlobServiceClientParameters, - initializedBy: InitializedBy.parent | InitializedBy.individually, + initializedBy: InitializedBy.customizeCode, } ); -@@clientInitialization(Storage.Blob.Container.Blob.AppendBlob, + +@@clientInitialization(AppendBlobClient, { - parameters: BlobServiceClientParameters, - initializedBy: InitializedBy.parent | InitializedBy.individually, + initializedBy: InitializedBy.customizeCode, } ); -@@clientInitialization(Storage.Blob.Container.Blob.BlockBlob, + +@@clientInitialization(BlockBlobClient, { - parameters: BlobServiceClientParameters, - initializedBy: InitializedBy.parent | InitializedBy.individually, + initializedBy: InitializedBy.customizeCode, } ); -@@clientInitialization(Storage.Blob.Container.Blob.PageBlob, + +@@clientInitialization(PageBlobClient, { - parameters: BlobServiceClientParameters, - initializedBy: InitializedBy.parent | InitializedBy.individually, + initializedBy: InitializedBy.customizeCode, } ); +@@usage(BlobName, Usage.output, "rust"); + +@@alternateType(BlobItem.name, string, "rust"); +@@alternateType(BlobPrefix.name, string, "rust"); + +@@clientNamespace(Storage.Blob, "Azure.Storage.Blobs"); +@@clientNamespace(Storage.Blob.Container, "Azure.Storage.Blobs"); +@@clientNamespace(Storage.Blob.Blob, "Azure.Storage.Blobs"); +@@clientNamespace(Storage.Blob.AppendBlob, "Azure.Storage.Blobs"); +@@clientNamespace(Storage.Blob.BlockBlob, "Azure.Storage.Blobs"); +@@clientNamespace(Storage.Blob.PageBlob, "Azure.Storage.Blobs"); + +@@clientNamespace(BlobServiceClient, "Azure.Storage.Blobs"); +@@clientNamespace(BlobContainerClient, "Azure.Storage.Blobs"); +@@clientNamespace(BlobClient, "Azure.Storage.Blobs"); +@@clientNamespace(AppendBlobClient, "Azure.Storage.Blobs"); +@@clientNamespace(BlockBlobClient, "Azure.Storage.Blobs"); +@@clientNamespace(PageBlobClient, "Azure.Storage.Blobs"); + +@@clientName(Storage.Blob.BlockBlob.upload, "upload_internal", "rust"); +@@clientName(Storage.Blob.Blob.download, "download_internal", "rust"); + @@clientName(ContainerProperties.denyEncryptionScopeOverride, "PreventEncryptionScopeOverride" ); @@clientName(ContainerProperties.immutableStorageWithVersioningEnabled, "IsImmutableStorageWithVersioningEnabled" ); -@@clientName(BlobPropertiesInternal.expiryTime, "ExpiresOn"); -@@clientName(BlobPropertiesInternal.sealed, "IsSealed"); -@@clientName(BlobPropertiesInternal.lastAccessTime, "LastAccessedOn"); -@@clientName(BlobPropertiesInternal.immutabilityPolicyUntilDate, +@@clientName(BlobProperties.expiryTime, "ExpiresOn"); +@@clientName(BlobProperties.sealed, "IsSealed"); +@@clientName(BlobProperties.lastAccessTime, "LastAccessedOn"); +@@clientName(BlobProperties.immutabilityPolicyUntilDate, "ImmutabilityPolicyExpiresOn" ); - @@clientName(MetadataHeaders.metadata, "metadata", "rust"); @@clientName(ObjectReplicationHeaders.objectReplicationRules, "objectReplicationRules", "rust" ); - -@@alternateType(BlobPropertiesInternal.contentLength, uint64, "rust"); -@@alternateType(BlobContentLengthRequired.blobContentLength, uint64, "rust"); +@@clientName(ImmutabilityPolicyExpiryRequiredParameter.immutabilityPolicyExpiry, + "expiry" +); +@@alternateType(BlobProperties.contentLength, uint64, "rust"); +@@alternateType(BlobContentLengthRequired.size, uint64, "rust"); @@alternateType(ContentLengthResponseHeader.contentLength, uint64, "rust"); @@alternateType(ContentLengthParameter.contentLength, uint64, "rust"); @@alternateType(StructuredContentLengthParameter.structuredContentLength, @@ -99,5 +152,16 @@ model BlobServiceClientParameters { "rust" ); -@@access(Storage.Blob.getUserDelegationKey, Access.internal); -@@access(Storage.Blob.Container.Blob.abortCopyFromUrl, Access.internal); +@@scope(Storage.Blob.Container.submitBatch, "!rust"); +@@scope(Storage.Blob.Service.submitBatch, "!rust"); +@@scope(Storage.Blob.Service.getUserDelegationKey, "!rust"); +@@scope(Storage.Blob.Container.listBlobHierarchySegment, "!rust"); +@@scope(Storage.Blob.Container.rename, "!rust"); +@@scope(Storage.Blob.Container.restore, "!rust"); +@@scope(Storage.Blob.Blob.abortCopyFromUrl, "!rust"); +@@scope(Storage.Blob.Blob.copyFromUrl, "!rust"); +@@scope(Storage.Blob.Blob.setExpiry, "!rust"); +@@scope(Storage.Blob.Blob.startCopyFromUrl, "!rust"); +@@scope(Storage.Blob.BlockBlob.query, "!rust"); +@@scope(Storage.Blob.PageBlob.copyIncremental, "!rust"); +@@scope(Storage.Blob.PageBlob.getPageRangesDiff, "!rust"); diff --git a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/main.tsp b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/main.tsp index 9c53fcd07..0b25e6ed5 100644 --- a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/main.tsp +++ b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/main.tsp @@ -33,6 +33,12 @@ namespace Storage.Blob; #suppress "@azure-tools/typespec-azure-core/no-enum" "Following standard typespec recommendation" @doc("The Azure.Storage.Blob service versions.") enum Versions { - @doc("The 2025-01-05 version of the Azure.Storage.Blob service.") - v2025_01_05: "2025-01-05", + @doc("The 2025-11-05 version of the Azure.Storage.Blob service.") + v2025_11_05: "2025-11-05", + + @doc("The 2026-02-06 version of the Azure.Storage.Blob service.") + v2026_02_06: "2026-02-06", + + @doc("The 2026-04-06 version of the Azure.Storage.Blob service.") + v2026_04_06: "2026-04-06", } diff --git a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/models.tsp b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/models.tsp index 48b8143ec..d2b15a071 100644 --- a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/models.tsp +++ b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/models.tsp @@ -6,6 +6,7 @@ import "@azure-tools/typespec-client-generator-core"; using Azure.Core; using TypeSpec.Http; +using TypeSpec.Versioning; using Azure.ClientGenerator.Core; namespace Storage.Blob; @@ -13,19 +14,369 @@ namespace Storage.Blob; @encode(BytesKnownEncoding.base64) scalar base64Bytes extends bytes; -/** The error response. */ +/** + * The error response. + * + * This defines the wire format only. Language SDKs wrap this in idiomatic error types. + */ @error @mediaTypeHint("application/xml") -model StorageError { +model Error { /** The error code. */ #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing API" - Code?: string; + Code?: StorageErrorCode; /** The error message. */ #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing API" Message?: string; } +/** Error codes returned by the Azure Blob Storage service. */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +union StorageErrorCode { + /** Account already exists. */ + AccountAlreadyExists: "AccountAlreadyExists", + + /** Account is being created. */ + AccountBeingCreated: "AccountBeingCreated", + + /** Account is disabled. */ + AccountIsDisabled: "AccountIsDisabled", + + /** Authentication failed. */ + AuthenticationFailed: "AuthenticationFailed", + + /** Authorization failure. */ + AuthorizationFailure: "AuthorizationFailure", + + /** Condition headers not supported. */ + ConditionHeadersNotSupported: "ConditionHeadersNotSupported", + + /** Condition not met. */ + ConditionNotMet: "ConditionNotMet", + + /** Empty metadata key. */ + EmptyMetadataKey: "EmptyMetadataKey", + + /** Insufficient account permissions. */ + InsufficientAccountPermissions: "InsufficientAccountPermissions", + + /** Internal error. */ + InternalError: "InternalError", + + /** Invalid authentication information. */ + InvalidAuthenticationInfo: "InvalidAuthenticationInfo", + + /** Invalid header value. */ + InvalidHeaderValue: "InvalidHeaderValue", + + /** Invalid HTTP verb. */ + InvalidHttpVerb: "InvalidHttpVerb", + + /** Invalid input. */ + InvalidInput: "InvalidInput", + + /** Invalid MD5. */ + InvalidMd5: "InvalidMd5", + + /** Invalid metadata. */ + InvalidMetadata: "InvalidMetadata", + + /** Invalid query parameter value. */ + InvalidQueryParameterValue: "InvalidQueryParameterValue", + + /** Invalid range. */ + InvalidRange: "InvalidRange", + + /** Invalid request URL. */ + InvalidRequestUrl: "InvalidRequestUrl", + + /** Invalid URI. */ + InvalidUri: "InvalidUri", + + /** Invalid XML document. */ + InvalidXmlDocument: "InvalidXmlDocument", + + /** Invalid XML node value. */ + InvalidXmlNodeValue: "InvalidXmlNodeValue", + + /** MD5 mismatch. */ + Md5Mismatch: "Md5Mismatch", + + /** Metadata too large. */ + MetadataTooLarge: "MetadataTooLarge", + + /** Missing content length header. */ + MissingContentLengthHeader: "MissingContentLengthHeader", + + /** Missing required XML node. */ + MissingRequiredXmlNode: "MissingRequiredXmlNode", + + /** Missing required header. */ + MissingRequiredHeader: "MissingRequiredHeader", + + /** Missing required query parameter. */ + MissingRequiredQueryParameter: "MissingRequiredQueryParameter", + + /** Multiple condition headers not supported. */ + MultipleConditionHeadersNotSupported: "MultipleConditionHeadersNotSupported", + + /** Operation timed out. */ + OperationTimedOut: "OperationTimedOut", + + /** Out of range input. */ + OutOfRangeInput: "OutOfRangeInput", + + /** Out of range query parameter value. */ + OutOfRangeQueryParameterValue: "OutOfRangeQueryParameterValue", + + /** Request body too large. */ + RequestBodyTooLarge: "RequestBodyTooLarge", + + /** Resource type mismatch. */ + ResourceTypeMismatch: "ResourceTypeMismatch", + + /** Request URL failed to parse. */ + RequestUrlFailedToParse: "RequestUrlFailedToParse", + + /** Resource already exists. */ + ResourceAlreadyExists: "ResourceAlreadyExists", + + /** Resource not found. */ + ResourceNotFound: "ResourceNotFound", + + /** Server busy. */ + ServerBusy: "ServerBusy", + + /** Unsupported header. */ + UnsupportedHeader: "UnsupportedHeader", + + /** Unsupported XML node. */ + UnsupportedXmlNode: "UnsupportedXmlNode", + + /** Unsupported query parameter. */ + UnsupportedQueryParameter: "UnsupportedQueryParameter", + + /** Unsupported HTTP verb. */ + UnsupportedHttpVerb: "UnsupportedHttpVerb", + + /** Append position condition not met. */ + AppendPositionConditionNotMet: "AppendPositionConditionNotMet", + + /** Blob already exists. */ + BlobAlreadyExists: "BlobAlreadyExists", + + /** Blob is immutable due to policy. */ + BlobImmutableDueToPolicy: "BlobImmutableDueToPolicy", + + /** Blob not found. */ + BlobNotFound: "BlobNotFound", + + /** Blob overwritten. */ + BlobOverwritten: "BlobOverwritten", + + /** Blob tier inadequate for content length. */ + BlobTierInadequateForContentLength: "BlobTierInadequateForContentLength", + + /** Blob uses customer specified encryption. */ + BlobUsesCustomerSpecifiedEncryption: "BlobUsesCustomerSpecifiedEncryption", + + /** Block count exceeds limit. */ + BlockCountExceedsLimit: "BlockCountExceedsLimit", + + /** Block list too long. */ + BlockListTooLong: "BlockListTooLong", + + /** Cannot change to lower tier. */ + CannotChangeToLowerTier: "CannotChangeToLowerTier", + + /** Cannot verify copy source. */ + CannotVerifyCopySource: "CannotVerifyCopySource", + + /** Container already exists. */ + ContainerAlreadyExists: "ContainerAlreadyExists", + + /** Container being deleted. */ + ContainerBeingDeleted: "ContainerBeingDeleted", + + /** Container disabled. */ + ContainerDisabled: "ContainerDisabled", + + /** Container not found. */ + ContainerNotFound: "ContainerNotFound", + + /** Content length larger than tier limit. */ + ContentLengthLargerThanTierLimit: "ContentLengthLargerThanTierLimit", + + /** Copy across accounts not supported. */ + CopyAcrossAccountsNotSupported: "CopyAcrossAccountsNotSupported", + + /** Copy ID mismatch. */ + CopyIdMismatch: "CopyIdMismatch", + + /** Feature version mismatch. */ + FeatureVersionMismatch: "FeatureVersionMismatch", + + /** Incremental copy blob mismatch. */ + IncrementalCopyBlobMismatch: "IncrementalCopyBlobMismatch", + + /** Incremental copy of earlier version snapshot not allowed. */ + IncrementalCopyOfEarlierVersionSnapshotNotAllowed: "IncrementalCopyOfEarlierVersionSnapshotNotAllowed", + + /** Incremental copy source must be snapshot. */ + IncrementalCopySourceMustBeSnapshot: "IncrementalCopySourceMustBeSnapshot", + + /** Infinite lease duration required. */ + InfiniteLeaseDurationRequired: "InfiniteLeaseDurationRequired", + + /** Invalid blob or block. */ + InvalidBlobOrBlock: "InvalidBlobOrBlock", + + /** Invalid blob tier. */ + InvalidBlobTier: "InvalidBlobTier", + + /** Invalid blob type. */ + InvalidBlobType: "InvalidBlobType", + + /** Invalid block ID. */ + InvalidBlockId: "InvalidBlockId", + + /** Invalid block list. */ + InvalidBlockList: "InvalidBlockList", + + /** Invalid operation. */ + InvalidOperation: "InvalidOperation", + + /** Invalid page range. */ + InvalidPageRange: "InvalidPageRange", + + /** Invalid source blob type. */ + InvalidSourceBlobType: "InvalidSourceBlobType", + + /** Invalid source blob URL. */ + InvalidSourceBlobUrl: "InvalidSourceBlobUrl", + + /** Invalid version for page blob operation. */ + InvalidVersionForPageBlobOperation: "InvalidVersionForPageBlobOperation", + + /** Lease already present. */ + LeaseAlreadyPresent: "LeaseAlreadyPresent", + + /** Lease already broken. */ + LeaseAlreadyBroken: "LeaseAlreadyBroken", + + /** Lease ID mismatch with blob operation. */ + LeaseIdMismatchWithBlobOperation: "LeaseIdMismatchWithBlobOperation", + + /** Lease ID mismatch with container operation. */ + LeaseIdMismatchWithContainerOperation: "LeaseIdMismatchWithContainerOperation", + + /** Lease ID mismatch with lease operation. */ + LeaseIdMismatchWithLeaseOperation: "LeaseIdMismatchWithLeaseOperation", + + /** Lease ID missing. */ + LeaseIdMissing: "LeaseIdMissing", + + /** Lease is breaking and cannot be acquired. */ + LeaseIsBreakingAndCannotBeAcquired: "LeaseIsBreakingAndCannotBeAcquired", + + /** Lease is breaking and cannot be changed. */ + LeaseIsBreakingAndCannotBeChanged: "LeaseIsBreakingAndCannotBeChanged", + + /** Lease is broken and cannot be renewed. */ + LeaseIsBrokenAndCannotBeRenewed: "LeaseIsBrokenAndCannotBeRenewed", + + /** Lease lost. */ + LeaseLost: "LeaseLost", + + /** Lease not present with blob operation. */ + LeaseNotPresentWithBlobOperation: "LeaseNotPresentWithBlobOperation", + + /** Lease not present with container operation. */ + LeaseNotPresentWithContainerOperation: "LeaseNotPresentWithContainerOperation", + + /** Lease not present with lease operation. */ + LeaseNotPresentWithLeaseOperation: "LeaseNotPresentWithLeaseOperation", + + /** Maximum blob size condition not met. */ + MaxBlobSizeConditionNotMet: "MaxBlobSizeConditionNotMet", + + /** No pending copy operation. */ + NoPendingCopyOperation: "NoPendingCopyOperation", + + /** Operation not allowed on incremental copy blob. */ + OperationNotAllowedOnIncrementalCopyBlob: "OperationNotAllowedOnIncrementalCopyBlob", + + /** Pending copy operation. */ + PendingCopyOperation: "PendingCopyOperation", + + /** Previous snapshot not found. */ + PreviousSnapshotNotFound: "PreviousSnapshotNotFound", + + /** Previous snapshot operation not supported. */ + PreviousSnapshotOperationNotSupported: "PreviousSnapshotOperationNotSupported", + + /** Previous snapshot cannot be newer. */ + PreviousSnapshotCannotBeNewer: "PreviousSnapshotCannotBeNewer", + + /** Sequence number condition not met. */ + SequenceNumberConditionNotMet: "SequenceNumberConditionNotMet", + + /** Sequence number increment too large. */ + SequenceNumberIncrementTooLarge: "SequenceNumberIncrementTooLarge", + + /** Snapshot count exceeded. */ + SnapshotCountExceeded: "SnapshotCountExceeded", + + /** Snapshot operation rate exceeded. */ + SnapshotOperationRateExceeded: "SnapshotOperationRateExceeded", + + /** Snapshots present. */ + SnapshotsPresent: "SnapshotsPresent", + + /** Source condition not met. */ + SourceConditionNotMet: "SourceConditionNotMet", + + /** System in use. */ + SystemInUse: "SystemInUse", + + /** Target condition not met. */ + TargetConditionNotMet: "TargetConditionNotMet", + + /** Unauthorized blob overwrite. */ + UnauthorizedBlobOverwrite: "UnauthorizedBlobOverwrite", + + /** Blob being rehydrated. */ + BlobBeingRehydrated: "BlobBeingRehydrated", + + /** Blob archived. */ + BlobArchived: "BlobArchived", + + /** Blob not archived. */ + BlobNotArchived: "BlobNotArchived", + + /** Authorization source IP mismatch. */ + AuthorizationSourceIPMismatch: "AuthorizationSourceIPMismatch", + + /** Authorization protocol mismatch. */ + AuthorizationProtocolMismatch: "AuthorizationProtocolMismatch", + + /** Authorization permission mismatch. */ + AuthorizationPermissionMismatch: "AuthorizationPermissionMismatch", + + /** Authorization service mismatch. */ + AuthorizationServiceMismatch: "AuthorizationServiceMismatch", + + /** Authorization resource type mismatch. */ + AuthorizationResourceTypeMismatch: "AuthorizationResourceTypeMismatch", + + /** Blob access tier not supported for account type. */ + BlobAccessTierNotSupportedForAccountType: "BlobAccessTierNotSupportedForAccountType", + + /** Extensible */ + string, +} + /// Models /** Represents a single block in a block blob. It describes the block's ID and size. */ @@ -71,6 +422,7 @@ model BlockLookupList { /** Represents an array of signed identifiers */ model SignedIdentifiers { + /** The array of signed identifiers. */ @Xml.unwrapped @Xml.name("SignedIdentifier") items: Array; @@ -115,7 +467,7 @@ model FilterBlobItem { @Xml.name("ContainerName") containerName: string; /** The metadata of the blob. */ - @Xml.unwrapped tags?: BlobTags; + @Xml.name("Tags") tags?: BlobTags; /** The version ID of the blob. */ @Xml.name("VersionId") versionId?: string; @@ -125,7 +477,8 @@ model FilterBlobItem { } /** Include this parameter to specify that the container's metadata be returned as part of the response body. */ -union ListContainersIncludeType { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum ListContainersIncludeType { /** Include metadata */ metadata: "metadata", @@ -134,24 +487,21 @@ union ListContainersIncludeType { /** Include system */ system: "system", - - string, } /** The filter blobs includes. */ -union FilterBlobsIncludeItem { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum FilterBlobsIncludeItem { /** The filter includes no versions. */ None: "none", /** The filter includes n versions. */ Versions: "versions", - - /** Extensible */ - string, } /** The account kind. */ -union AccountKind { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum AccountKind { /** The storage account is a general-purpose account. */ Storage: "Storage", @@ -166,13 +516,11 @@ union AccountKind { /** The storage account is a block blob storage account. */ BlockBlobStorage: "BlockBlobStorage", - - /** Extensible */ - string, } /** The SKU types */ -union SkuName { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum SkuName { /** The standard LRS SKU. */ StandardLRS: "Standard_LRS", @@ -188,8 +536,17 @@ union SkuName { /** The premium LRS SKU. */ PremiumLRS: "Premium_LRS", - /** Extensible */ - string, + /** The standard GZRS SKU. */ + @added(Versions.v2026_04_06) + StandardGZRS: "Standard_GZRS", + + /** The premium ZRS SKU. */ + @added(Versions.v2026_04_06) + PremiumZRS: "Premium_ZRS", + + /** The standard RAGZRS SKU. */ + @added(Versions.v2026_04_06) + StandardRAGZRS: "Standard_RAGZRS", } /** The list container segment response */ @@ -250,7 +607,7 @@ model ContainerProperties { lastModified: utcDateTime; /** The ETag of the container. */ - @Xml.name("ETag") eTag: string; + @Xml.name("Etag") eTag: string; /** The lease status of the container. */ @Xml.name("LeaseStatus") leaseStatus?: LeaseStatus; @@ -331,6 +688,11 @@ model KeyInfo { /** The date-time the key expires. */ @Xml.name("Expiry") expiry: string; + + /** The delegated user tenant id in Azure AD. */ + @Xml.name("DelegatedUserTid") + @added(Versions.v2026_04_06) + delegatedUserTid?: uuid; } /** A user delegation key. */ @@ -342,10 +704,14 @@ model UserDelegationKey { @Xml.name("SignedTid") signedTid: uuid; /** The date-time the key is active. */ - @Xml.name("SignedStart") signedStart: string; + @encode("rfc7231") + @Xml.name("SignedStart") + signedStart: utcDateTime; /** The date-time the key expires. */ - @Xml.name("SignedExpiry") signedExpiry: string; + @encode("rfc7231") + @Xml.name("SignedExpiry") + signedExpiry: utcDateTime; /** Abbreviation of the Azure Storage service that accepts the key. */ @Xml.name("SignedService") signedService: string; @@ -353,6 +719,11 @@ model UserDelegationKey { /** The service version that created the key. */ @Xml.name("SignedVersion") signedVersion: string; + /** The delegated user tenant id in Azure AD. Return if DelegatedUserTid is specified. */ + @Xml.name("SignedDelegatedUserTid") + @added(Versions.v2026_04_06) + signedDelegatedUserTid?: uuid; + /** The key as a base64 string. */ @Xml.name("Value") value: base64Bytes; @@ -371,7 +742,8 @@ union PublicAccessType { } /** The copy status. */ -union CopyStatus { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum CopyStatus { /** The copy operation is pending. */ Pending: "pending", @@ -383,25 +755,21 @@ union CopyStatus { /** The copy operation is aborted. */ Aborted: "aborted", - - /** Extensible */ - string, } /** The lease duration. */ -union LeaseDuration { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum LeaseDuration { /** The lease is of infinite duration. */ Infinite: "infinite", /** The lease is of fixed duration. */ Fixed: "fixed", - - /** Extensible */ - string, } /** The lease state. */ -union LeaseState { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum LeaseState { /** The lease is available. */ Available: "available", @@ -416,21 +784,16 @@ union LeaseState { /** The lease is broken. */ Broken: "broken", - - /** Extensible */ - string, } /** The lease status. */ -union LeaseStatus { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum LeaseStatus { /** The lease is unlocked. */ Unlocked: "unlocked", /** The lease is locked. */ Locked: "locked", - - /** Extensible */ - string, } /** Represents an access policy. */ @@ -520,7 +883,7 @@ union ArchiveStatus { /** An Azure Storage Blob */ @Xml.name("Blob") -model BlobItemInternal { +model BlobItem { /** The name of the blob. */ @Xml.name("Name") name: BlobName; @@ -537,26 +900,26 @@ model BlobItemInternal { @Xml.name("IsCurrentVersion") isCurrentVersion?: boolean; /** The properties of the blob. */ - @Xml.name("Properties") properties: BlobPropertiesInternal; + @Xml.name("Properties") properties: BlobProperties; /** The metadata of the blob. */ @Xml.name("Metadata") metadata?: BlobMetadata; /** The tags of the blob. */ - @Xml.name("BlobTags") blobTags?: BlobTags; + @Xml.name("Tags") blobTags?: BlobTags; /** The object replication metadata of the blob. */ #suppress "@azure-tools/typespec-autorest/unsupported-param-type" "Existing API" @Xml.name("OrMetadata") objectReplicationMetadata?: ObjectReplicationMetadata; - /** Whether the blog has versions only. */ + /** Whether the blob has versions only. */ @Xml.name("HasVersionsOnly") hasVersionsOnly?: boolean; } /** The properties of a blob. */ @Xml.name("Properties") -model BlobPropertiesInternal { +model BlobProperties { /** The date-time the blob was created in RFC1123 format. */ #suppress "@azure-tools/typespec-azure-core/known-encoding" "Existing API" @encode("rfc7231") @@ -569,8 +932,8 @@ model BlobPropertiesInternal { @Xml.name("Last-Modified") lastModified: utcDateTime; - /** The blog ETag. */ - @Xml.name("ETag") eTag: string; + /** The blob ETag. */ + @Xml.name("Etag") eTag: string; /** The content length of the blob. */ @Xml.name("Content-Length") contentLength?: int64; @@ -629,10 +992,10 @@ model BlobPropertiesInternal { /** The copy status description of the blob. */ @Xml.name("CopyStatusDescription") copyStatusDescription?: string; - /** Whether the blog is encrypted on the server. */ + /** Whether the blob is encrypted on the server. */ @Xml.name("ServerEncrypted") serverEncrypted?: boolean; - /** Whether the blog is incremental copy. */ + /** Whether the blob is incremental copy. */ @Xml.name("IncrementalCopy") incrementalCopy?: boolean; /** The name of the destination snapshot. */ @@ -698,29 +1061,28 @@ model BlobPropertiesInternal { /** The immutability policy mode of the blob. */ @Xml.name("ImmutabilityPolicyMode") - immutabilityPolicyMode?: BlobImmutabilityPolicyMode; + immutabilityPolicyMode?: ImmutabilityPolicyMode; /** Whether the blob is under legal hold. */ @Xml.name("LegalHold") legalHold?: boolean; } -/** The immutability policy mode. */ -union BlobImmutabilityPolicyMode { - /** The immutability policy is mutable. */ - Mutable: "Mutable", +/** The immutability policy mode used in requests and responses. */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum ImmutabilityPolicyMode { + /** The immutability policy is mutable. Should never be set, only returned. */ + Mutable: "mutable", /** The immutability policy is locked. */ - Locked: "Locked", + Locked: "locked", /** The immutability policy is unlocked. */ - Unlocked: "Unlocked", - - /** Extensible */ - string, + Unlocked: "unlocked", } /** The blob type. */ -union BlobType { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum BlobType { /** The blob is a block blob. */ BlockBlob: "BlockBlob", @@ -729,9 +1091,6 @@ union BlobType { /** The blob is an append blob. */ AppendBlob: "AppendBlob", - - /** Extensible */ - string, } /** If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard. */ @@ -776,7 +1135,8 @@ model ObjectReplicationMetadata is Record; /// Service Properties /** The service properties. */ -model StorageServiceProperties { +@Xml.name("StorageServiceProperties") +model BlobServiceProperties { /** The logging properties. */ @Xml.name("Logging") logging?: Logging; @@ -885,7 +1245,7 @@ model RetentionPolicy { /** An enumeration of blobs. */ @Xml.name("EnumerationResults") -model ListBlobsFlatSegmentResponse { +model ListBlobsResponse { /** The service endpoint. */ @Xml.attribute @Xml.name("ServiceEndpoint") @@ -921,16 +1281,20 @@ model BlobFlatListSegment { @pageItems @Xml.name("Blob") @Xml.unwrapped - blobItems: BlobItemInternal[]; + blobItems: BlobItem[]; } /** Represents a page list. */ model PageList { /** The page ranges. */ - @Xml.name("PageRange") pageRange?: PageRange[]; + @Xml.unwrapped + @Xml.name("PageRange") + pageRange?: PageRange[]; /** The clear ranges. */ - @Xml.name("ClearRange") clearRange?: ClearRange[]; + @Xml.unwrapped + @Xml.name("ClearRange") + clearRange?: ClearRange[]; /** The next marker. */ @continuationToken @@ -964,12 +1328,10 @@ model BlobTags { } /** The query request, note only SQL supported */ -union QueryRequestType { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum QueryRequestType { /** The SQL request query type. */ SQL: "SQL", - - /** Extensible */ - string, } /** Groups the set of query request settings. */ @@ -1066,8 +1428,9 @@ model ArrowField { model ParquetConfiguration is Record; /** The query format type. */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" @Xml.name("Type") -union QueryType { +enum QueryType { /** The query format type is delimited. */ Delimited: "delimited", @@ -1079,9 +1442,6 @@ union QueryType { /** The query format type is Parquet. */ Parquet: "parquet", - - /** Extensible */ - string, } /// Parameters @@ -1115,7 +1475,8 @@ alias SequenceNumberActionParameter = { }; /** The sequence number actions. */ -union SequenceNumberActionType { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum SequenceNumberActionType { /** Increment the sequence number. */ Increment: "increment", @@ -1124,9 +1485,6 @@ union SequenceNumberActionType { /** Update the sequence number. */ Update: "update", - - /** Extensible */ - string, } /** The sequence number parameter. */ @@ -1136,11 +1494,17 @@ alias SequenceNumberParameter = { blobSequenceNumber?: int64 = 0; }; +/** The blob content length required parameter. */ +alias BlobContentLengthResponseHeader = { + /** The size of the blob in bytes. */ + @header("x-ms-blob-content-length") + blobContentLength?: int64; +}; /** The blob content length required parameter. */ alias BlobContentLengthRequired = { /** 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. */ @header("x-ms-blob-content-length") - blobContentLength: int64; + size: int64; }; /** The deny encryption scope override response header. */ @@ -1185,6 +1549,17 @@ alias ImmutabilityPolicyExpiresOnResponseHeader = { immutabilityPolicyUntilDate?: utcDateTime; }; +/** The immutability policy expires on response header. */ +alias ImmutabilityPolicyExpiresOnResponseHeaderPrivate = { + /** UTC date/time value generated by the service that indicates the time at which the blob immutability policy will expire. */ + #suppress "@azure-tools/typespec-azure-core/known-encoding" "Existing API" + @clientName("ImmutabilityPolicyExpiresOn") + @encode("rfc7231") + @access(Access.internal) + @header("x-ms-immutability-policy-until-date") + immutabilityPolicyUntilDate?: utcDateTime; +}; + /** The last accessed response header. */ alias LastAccessedResponseHeader = { /** UTC date/time value generated by the service that indicates the time at which the blob was last read or written to */ @@ -1221,6 +1596,14 @@ alias AcceptRangesResponseHeader = { @header("Accept-Ranges") acceptRanges?: string; }; +/** The private accept ranges response header. */ +alias AcceptRangesResponseHeaderPrivate = { + /** Indicates that the service supports requests for partial blob content. */ + @access(Access.internal) + @header("Accept-Ranges") + acceptRanges?: string; +}; + /** The is current version response header. */ alias IsCurrentVersionResponseHeader = { /** The value of this header indicates whether version of this blob is a current version, see also x-ms-version-id header. */ @@ -1308,7 +1691,8 @@ alias IfSequenceNumberLessThanOrEqualToParameter = { }; /** The block list types. */ -union BlockListType { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum BlockListType { /** The list of committed blocks. */ Committed: "committed", @@ -1317,9 +1701,6 @@ union BlockListType { /** Both lists together. */ All: "all", - - /** Extensible */ - string, } /** The source content CRC64 parameter. */ @@ -1369,14 +1750,14 @@ alias SkuNameResponseHeader = { alias ContentCrc64ResponseHeader = { /** This response header is returned so that the client can check for the integrity of the copied content. */ @header("x-ms-content-crc64") - contentCrc64: bytes; + contentCrc64?: bytes; }; /** The copy status response header. */ alias CopyStatusResponseHeader = { /** State of the copy operation identified by x-ms-copy-id. */ @header("x-ms-copy-status") - copyStatus: CopyStatus; + copyStatus?: CopyStatus; }; /** The copy ID response header. */ @@ -1429,17 +1810,54 @@ alias LeaseIdResponseHeader = { leaseId?: string; }; -/** The is server encrypted response header. */ -alias IsServerEncryptedResponseHeader = { +/** The request server encrypted response header. */ +alias RequestServerEncryptedResponseHeader = { /** 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. */ - @clientName("isServerEncrypted") @header("x-ms-request-server-encrypted") - requestServerEncrypted?: boolean; + isServerEncrypted?: boolean; +}; + +/** The private request server encrypted response header. */ +alias RequestServerEncryptedResponseHeaderPrivate = { + /** 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. */ + @access(Access.internal) + @header("x-ms-request-server-encrypted") + isServerEncrypted?: boolean; +}; + +/** The server encrypted response header. */ +alias ServerEncryptedResponseHeader = { + /** 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. */ + @header("x-ms-server-encrypted") + isServerEncrypted?: boolean; +}; + +/** The server encrypted response header. */ +alias ServerEncryptedResponseHeaderPrivate = { + /** 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. */ + @access(Access.internal) + @header("x-ms-server-encrypted") + isServerEncrypted?: boolean; +}; + +/** The legal hold response header. */ +alias LegalHoldOptionalResponseHeader = { + /** Indicates whether the blob has a legal hold. */ + @header("x-ms-legal-hold") + legalHold?: boolean; }; /** The legal hold response header. */ alias LegalHoldResponseHeader = { + /** Indicates whether the blob has a legal hold. */ + @header("x-ms-legal-hold") + legalHold: boolean; +}; + +/** The legal hold response header. */ +alias LegalHoldResponseHeaderPrivate = { /** Specifies the legal hold status to set on the blob. */ + @access(Access.internal) @header("x-ms-legal-hold") legalHold: boolean; }; @@ -1455,7 +1873,15 @@ alias LegalHoldRequiredParameter = { alias ImmutabilityPolicyModeResponseHeader = { /** Indicates the immutability policy mode of the blob. */ @header("x-ms-immutability-policy-mode") - immutabilityPolicyMode: BlobImmutabilityPolicyMode; + immutabilityPolicyMode: ImmutabilityPolicyMode; +}; + +/** The immutability policy mode response header. */ +alias ImmutabilityPolicyModeResponseHeaderPrivate = { + /** Indicates the immutability policy mode of the blob. */ + @access(Access.internal) + @header("x-ms-immutability-policy-mode") + immutabilityPolicyMode: ImmutabilityPolicyMode; }; /** The blob sequence number response header. */ @@ -1465,6 +1891,14 @@ alias BlobSequenceNumberResponseHeader = { blobSequenceNumber: int64; }; +/** The private blob sequence number response header. */ +alias BlobSequenceNumberResponseHeaderPrivate = { + /** The current sequence number for a page blob. This header is not returned for block blobs or append blobs. */ + @access(Access.internal) + @header("x-ms-blob-sequence-number") + blobSequenceNumber: int64; +}; + /** The blob expiration options parameter. */ alias BlobExpiryOptionsParameter = { /** Required. Indicates mode of the expiry time */ @@ -1539,6 +1973,14 @@ alias VersionIdResponseHeader = { versionId: string; }; +/** The private version ID response header. */ +alias VersionIdResponseHeaderPrivate = { + /** 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. */ + @access(Access.internal) + @header("x-ms-version-id") + versionId: string; +}; + /** The creation time response header. */ alias CreationTimeResponseHeader = { /** Returns the date and time the blob was created. */ @@ -1557,6 +1999,16 @@ alias LastModifiedResponseHeader = { lastModified: utcDateTime; }; +/** The private last modified response header */ +alias LastModifiedResponseHeaderPrivate = { + /** The date/time that the container was last modified. */ + #suppress "@azure-tools/typespec-azure-core/known-encoding" "Existing API" + @encode("rfc7231") + @access(Access.internal) + @header("Last-Modified") + lastModified: utcDateTime; +}; + /** The Date response header */ alias DateResponseHeader = { /** UTC date/time value generated by the service that indicates the time at which the response was initiated */ @@ -1566,29 +2018,45 @@ alias DateResponseHeader = { date: utcDateTime; }; +/** The private Date response header */ +alias DateResponseHeaderPrivate = { + /** UTC date/time value generated by the service that indicates the time at which the response was initiated */ + #suppress "@azure-tools/typespec-azure-core/known-encoding" "Existing API" + @encode("rfc7231") + @access(Access.internal) + @header("Date") + date: utcDateTime; +}; + /** The ETag response header */ alias EtagResponseHeader = { /** The ETag contains a value that you can use to perform operations conditionally. */ @header("ETag") eTag: string; }; +/** The private ETag response header */ +alias EtagResponseHeaderPrivate = { + /** The ETag contains a value that you can use to perform operations conditionally. */ + @access(Access.internal) + @header("ETag") + eTag: string; +}; + /** The copy source tags header parameter. */ alias CopySourceTagsParameter = { /** Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags. */ @header("x-ms-copy-source-tag-option") - copySourceTags?: string; + copySourceTags?: BlobCopySourceTags; }; /** The blob copy source tags types. */ -union BlobCopySourceTags { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum BlobCopySourceTags { /** The replace blob source tags option. */ Replace: "REPLACE", /** The copy blob source tags option. */ Copy: "COPY", - - /** Extensible */ - string, } /** The copy source authorization header parameter */ @@ -1598,6 +2066,27 @@ alias CopySourceAuthorizationParameter = { copySourceAuthorization?: string; }; +alias SourceEncryptionKeyParameter = { + /** Optional. Specifies the source encryption key to use to encrypt the source data provided in the request. */ + @added(Versions.v2026_04_06) + @header("x-ms-source-encryption-key") + sourceEncryptionKey?: string; +}; + +alias SourceEncryptionKeySha256Parameter = { + /** The SHA-256 hash of the provided source encryption key. Must be provided if the x-ms-source-encryption-key header is provided. */ + @added(Versions.v2026_04_06) + @header("x-ms-source-encryption-key-sha256") + sourceEncryptionKeySha256?: string; +}; + +alias SourceEncryptionAlgorithmParameter = { + /** The algorithm used to produce the source encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-source-encryption-key is provided. */ + @added(Versions.v2026_04_06) + @header("x-ms-source-encryption-algorithm") + sourceEncryptionAlgorithm?: EncryptionAlgorithmType; +}; + /** The copy source blob properties parameter. */ alias CopySourceBlobPropertiesParameter = { /** Optional, default is true. Indicates if properties from the source blob should be copied. */ @@ -1658,7 +2147,7 @@ alias ContentCrc64Parameter = { }; /** The access tier optional parameter. */ -alias AccessTierOptional = { +alias AccessTierHeader = { /** The tier to be set on the blob. */ @header("x-ms-access-tier") tier?: AccessTier; @@ -1683,7 +2172,16 @@ alias LegalHoldOptionalParameter = { alias ImmutabilityPolicyModeParameter = { /** Specifies the immutability policy mode to set on the blob. */ @header("x-ms-immutability-policy-mode") - immutabilityPolicyMode?: BlobImmutabilityPolicyMode; + immutabilityPolicyMode?: ImmutabilityPolicyMode; +}; + +/** The immutability policy expiration parameter. */ +alias ImmutabilityPolicyExpiryRequiredParameter = { + /** Specifies the date time when the blobs immutability policy is set to expire. */ + #suppress "@azure-tools/typespec-azure-core/known-encoding" "Existing API" + @encode("rfc7231") + @header("x-ms-immutability-policy-until-date") + immutabilityPolicyExpiry: utcDateTime; }; /** The immutability policy expiration parameter. */ @@ -1717,6 +2215,14 @@ alias EncryptionScopeResponseHeader = { encryptionScope?: string; }; +/** The private encryption scope response header. */ +alias EncryptionScopeResponseHeaderPrivate = { + /** 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 */ + @access(Access.internal) + @header("x-ms-encryption-scope") + encryptionScope?: string; +}; + /** The blob content disposition parameter. */ alias BlobContentDispositionParameter = { /** Optional. Sets the blob's content disposition. If specified, this property is stored with the blob and returned with a read request. */ @@ -1805,35 +2311,21 @@ union PremiumPageBlobAccessTier { string, } -/** The blob name parameter. */ -alias BlobPathParameter = { - /** The name of the blob. */ - @minLength(1) - @maxLength(1024) - @pattern("^[a-zA-Z0-9]+(?:/[a-zA-Z0-9]+)*(?:\\.[a-zA-Z0-9]+){0,1}$") - @path - blobName: string; -}; - /** The type of blob deletions. */ -union BlobDeleteType { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum BlobDeleteType { /** Permanently delete the blob. */ Permanent: "Permanent", - - /** Extensible */ - string, } /** The delete snapshots option type. */ -union DeleteSnapshotsOptionType { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum DeleteSnapshotsOptionType { /** The delete snapshots include option is only. */ Only: "only", /** The delete snapshots include option is include. */ Include: "include", - - /** Extensible */ - string, } /** The encryption algorithm parameter. */ @@ -1844,12 +2336,10 @@ alias EncryptionAlgorithmParameter = { }; /** The algorithm used to produce the encryption key hash. Currently, the only accepted value is \"AES256\". Must be provided if the x-ms-encryption-key header is provided. */ -union EncryptionAlgorithmType { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum EncryptionAlgorithmType { /** The AES256 encryption algorithm. */ AES256: "AES256", - - /** Extensible */ - string, } /** The encryption key SHA256 hash parameter. */ @@ -1866,6 +2356,14 @@ alias EncryptionKeySha256ResponseHeader = { encryptionKeySha256?: string; }; +/** The private encryption key SHA256 response header. */ +alias EncryptionKeySha256ResponseHeaderPrivate = { + /** 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. */ + @access(Access.internal) + @header("x-ms-encryption-key-sha256") + encryptionKeySha256?: string; +}; + /** The encryption key parameter. */ alias EncryptionKeyParameter = { /** Optional. Version 2019-07-07 and later. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, the request will be encrypted with the root account key. */ @@ -1873,6 +2371,22 @@ alias EncryptionKeyParameter = { encryptionKey?: string; }; +alias AccessTierIfModifiedSinceParameter = { + /** Specify this header value to operate only on a blob if the access-tier has been modified since the specified date/time. */ + @added(Versions.v2026_04_06) + @header("x-ms-access-tier-if-modified-since") + @encode("rfc7231") + accessTierIfModifiedSince?: utcDateTime; +}; + +alias AccessTierIfUnmodifiedSinceParameter = { + /** Specify this header value to operate only on a blob if the access-tier has not been modified since the specified date/time. */ + @added(Versions.v2026_04_06) + @header("x-ms-access-tier-if-unmodified-since") + @encode("rfc7231") + accessTierIfUnmodifiedSince?: utcDateTime; +}; + /** The If-Tags parameters. */ alias IfTagsParameter = { /** Specify a SQL where clause on blob tags to operate only on blobs with a matching value. */ @@ -1897,7 +2411,7 @@ alias IfNoneMatchParameter = { /** The range parameter. */ alias RangeParameter = { /** Return only the bytes of the blob in the specified range. */ - @header("x-ms-range") + @header("Range") range?: string; }; @@ -1939,7 +2453,7 @@ model BlobHierarchyListSegment { @pageItems @Xml.name("Blob") @Xml.unwrapped - blobItems: BlobItemInternal[]; + blobItems: BlobItem[]; /** The blob prefixes. */ @Xml.name("BlobPrefix") @@ -1990,7 +2504,8 @@ alias ListBlobsIncludeParameter = { }; /** The list blob includes parameter values. */ -union ListBlobsIncludeItem { +#suppress "@azure-tools/typespec-azure-core/no-enum" "Existing API" +enum ListBlobsIncludeItem { /** The include copies. */ Copy: "copy", @@ -2020,23 +2535,28 @@ union ListBlobsIncludeItem { /** The include deleted with versions. */ DeletedWithVersions: "deletedwithversions", - - /** Extensible */ - string, } /** The lease duration parameter. */ -alias LeaseDurationHeader = { +alias LeaseDurationResponseHeader = { /** 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. */ @header("x-ms-lease-duration") duration?: LeaseDuration; }; -/** The container name path parameter */ -alias ContainerNamePathParameter = { - /** The name of the container. */ - @path - containerName: string; +/** The lease duration parameter. */ +alias LeaseDurationHeaderParameter = { + /** 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. */ + @header("x-ms-lease-duration") + duration: int32; +}; + +// NOTE: This does not explicitly let emitters know that this is a collection header for metadata. Logic should be handwritten to handle this. +alias MetadataHeadersParameter = { + /** The metadata headers. */ + @alternateType(Record, "rust") + @header("x-ms-meta") + metadata: string; }; // NOTE: This does not explicitly let emitters know that this is a collection header for metadata. Logic should be handwritten to handle this. @@ -2084,7 +2604,8 @@ alias FilterBlobsIncludeParameter = { alias FilterBlobsWhereParameter = { /** Filters the results to return only to return only blobs whose tags match the specified expression. */ @query - where?: string; + @clientName("filterExpression") + where: string; }; /** The Content-Length header. */ @@ -2146,7 +2667,6 @@ alias BodyParameter = { alias MultipartBodyParameter = { /** The body of the request. */ @multipartBody body: { - name: HttpPart; body: HttpPart; }; }; @@ -2159,6 +2679,7 @@ alias IsHierarchicalNamespaceEnabled = { alias StructuredBodyTypeResponseHeader = { /** Indicates the response body contains a structured message and specifies the message schema version and properties. */ + @access(Access.internal) @header("x-ms-structured-body") structuredBodyType?: string; }; @@ -2171,12 +2692,93 @@ alias StructuredContentLengthParameter = { alias StructuredContentLengthResponseHeader = { /** 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. */ + @access(Access.internal) @header("x-ms-structured-content-length") structuredContentLength?: int64; }; alias StructuredBodyParameter = { /** Required if the request body is a structured message. Specifies the message schema version and properties. */ + @access(Access.internal) @header("x-ms-structured-body") structuredBodyType?: string; }; + +/** The file share token intent types. */ +union FileShareTokenIntent { + /** The file share token intent is backup. */ + Backup: "backup", + + /** Extensible */ + string, +} + +alias FileRequestIntentParameter = { + /** Valid value is backup */ + @header("x-ms-file-request-intent") + fileRequestIntent?: FileShareTokenIntent; +}; + +alias ClientRequestIdHeader = { + @access(Access.internal) + @header("x-ms-client-request-id") + @doc("An opaque, globally-unique, client-generated string identifier for the request.") + clientRequestId?: uuid; +}; + +alias RequestIdResponseHeader = { + @access(Access.internal) + @visibility(Lifecycle.Read) + @header("x-ms-request-id") + @doc("An opaque, globally-unique, server-generated string identifier for the request.") + requestId?: uuid; +}; + +alias LeaseActionParameter = { + /** Describes what lease action to take. */ + @header("x-ms-lease-action") + action: TAction; +}; + +alias PageWriteParameter = { + /** Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size. */ + @header("x-ms-page-write") + pageWrite: TPageWrite; +}; + +alias IfBlobMatchHeader = { + /** Specify an ETag value to operate only on blobs with a matching value. */ + @added(Versions.v2026_02_06) + @header("x-ms-blob-if-match") + ifMatch?: string; +}; + +alias IfBlobModifiedSinceHeader = { + /** Specify this header value to operate only on a blob if it has been modified since the specified date/time. */ + @added(Versions.v2026_02_06) + @header("x-ms-blob-if-modified-since") + @encode("rfc7231") + ifModifiedSince?: utcDateTime; +}; + +alias IfBlobNoneMatchHeader = { + /** Specify an ETag value to operate only on blobs without a matching value. */ + @added(Versions.v2026_02_06) + @header("x-ms-blob-if-none-match") + ifNoneMatch?: string; +}; + +alias IfBlobUnmodifiedSinceHeader = { + /** Specify this header value to operate only on a blob if it has not been modified since the specified date/time. */ + @added(Versions.v2026_02_06) + @header("x-ms-blob-if-unmodified-since") + @encode("rfc7231") + ifUnmodifiedSince?: utcDateTime; +}; + +alias ListBlobsStartFrom = { + /** Specifies the relative path to list paths from. For non-recursive list, only one entity level is supported; For recursive list, multiple entity levels are supported. (Inclusive) */ + @added(Versions.v2026_02_06) + @query + startFrom?: string; +}; diff --git a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/routes.tsp b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/routes.tsp index 905f5fd6f..e2f9cbad1 100644 --- a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/routes.tsp +++ b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/routes.tsp @@ -2,67 +2,112 @@ import "@azure-tools/typespec-azure-core"; import "@typespec/http"; import "./models.tsp"; +namespace Storage.Blob; + using TypeSpec.Http; using Azure.Core; using Azure.ClientGenerator.Core; +alias ApiVersionHeader = { + /** Specifies the version of the operation to use for this request. */ + @apiVersion + @access(Access.internal) + @header("x-ms-version") + version: string; +}; + +/** Azure Storage Blob basic operation template */ +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." +op StorageOperation< + TParams extends TypeSpec.Reflection.Model | void, + TResponse extends TypeSpec.Reflection.Model | void, + RequestMediaType extends string = "application/xml", + ResponseMediaType extends string = "application/xml", + TError = Error +>( + /** Content-Type header */ + #suppress "@typespec/http/content-type-ignored" "Template for existing API" + @header("Content-Type") + contentType: RequestMediaType, + + ...ApiVersionHeader, + ...ClientRequestIdHeader, + ...TParams, +): (TResponse & { + /** Content-Type header */ + #suppress "@typespec/http/content-type-ignored" "Template for existing API" + @header("Content-Type") + contentType: ResponseMediaType; + + ...DateResponseHeaderPrivate; + ...ApiVersionHeader; + ...RequestIdResponseHeader; + ...ClientRequestIdHeader; +}) | TError; + +/** Azure Storage Blob basic operation template */ +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." +op StorageOperationNoBody< + TParams extends TypeSpec.Reflection.Model | void, + TResponse extends TypeSpec.Reflection.Model | void, + TError = Error +>(...ApiVersionHeader, ...ClientRequestIdHeader, ...TParams): (TResponse & { + ...DateResponseHeaderPrivate; + ...ApiVersionHeader; + ...RequestIdResponseHeader; + ...ClientRequestIdHeader; +}) | TError; + +/** Azure Storage Blob basic operation template */ #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." -namespace Storage.Blob { - alias ApiVersionHeader = { - /** Specifies the version of the operation to use for this request. */ - @apiVersion - @header("x-ms-version") - version: string; - }; - - /** Azure Storage Blob basic operation template */ - #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." - op StorageOperation< - TParams extends TypeSpec.Reflection.Model | void, - TResponse extends TypeSpec.Reflection.Model | void, - RequestMediaType extends string = "application/xml", - ResponseMediaType extends string = "application/xml", - TError = StorageError - >( +op StorageOperationResponseBody< + TParams extends TypeSpec.Reflection.Model | void, + TResponse extends TypeSpec.Reflection.Model | void, + ResponseMediaType extends string = "application/xml", + TError = Error +> is StorageOperationNoBody< + TParams, + { /** Content-Type header */ #suppress "@typespec/http/content-type-ignored" "Template for existing API" @header("Content-Type") - contentType: RequestMediaType, + contentType: ResponseMediaType; + } & TResponse, + TError +>; - ...ApiVersionHeader, - ...TParams, - ...ClientRequestIdHeader, - ): (TResponse & { +/** Azure Storage Blob basic operation template */ +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." +op StorageOperationRequestBody< + TParams extends TypeSpec.Reflection.Model | void, + TResponse extends TypeSpec.Reflection.Model | void, + RequestMediaType extends string = "application/xml", + TError = Error +> is StorageOperationNoBody< + { /** Content-Type header */ #suppress "@typespec/http/content-type-ignored" "Template for existing API" @header("Content-Type") - contentType: ResponseMediaType; - }) | TError; - - /** Azure Storage Blob basic operation template */ - #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." - op StorageOperationNoBody< - TParams extends TypeSpec.Reflection.Model | void, - TResponse extends TypeSpec.Reflection.Model | void, - TError = StorageError - >( - ...ApiVersionHeader, - ...TParams, - ...ClientRequestIdHeader, - ): TResponse | TError; + contentType: RequestMediaType; + } & TParams, + TResponse, + TError +>; +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." +interface Service { /** Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules */ #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" @put @route("?restype=service&comp=properties") - op setProperties is StorageOperation< + setProperties is StorageOperationRequestBody< { ...TimeoutParameter; /** The storage service properties to set. */ @body - storageServiceProperties: StorageServiceProperties; + storageServiceProperties: BlobServiceProperties; }, { @statusCode statusCode: 202; @@ -73,20 +118,18 @@ namespace Storage.Blob { #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" @get @route("?restype=service&comp=properties") - op getProperties is StorageOperation< + getProperties is StorageOperationResponseBody< TimeoutParameter, - StorageServiceProperties + BlobServiceProperties >; /** Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. */ #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" @get @route("?restype=service&comp=stats") - op getStatistics is StorageOperation< + getStatistics is StorageOperationResponseBody< TimeoutParameter, { - ...DateResponseHeader; - /** Storage service statistics */ @body storageServiceStats: StorageServiceStats; @@ -99,7 +142,7 @@ namespace Storage.Blob { @get @list @route("?comp=list") - op listContainersSegment is StorageOperation< + listContainers is StorageOperationResponseBody< { ...PrefixParameter; ...MarkerParameter; @@ -116,7 +159,7 @@ namespace Storage.Blob { #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" @post @route("?restype=service&comp=userdelegationkey") - op getUserDelegationKey is StorageOperation< + getUserDelegationKey is StorageOperation< { /** Key information provided in the request */ @body @@ -128,8 +171,6 @@ namespace Storage.Blob { /** The user delegation key */ @body userDelegationKey: UserDelegationKey; - - ...DateResponseHeader; } >; @@ -138,10 +179,10 @@ namespace Storage.Blob { #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" @get @route("?restype=account&comp=properties") - op getAccountInfo is StorageOperation< + @sharedRoute + getAccountInfo is StorageOperationNoBody< TimeoutParameter, { - ...DateResponseHeader; ...SkuNameResponseHeader; ...AccountKindResponseHeader; @@ -156,8 +197,7 @@ namespace Storage.Blob { #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" @post @route("?comp=batch") - @scope("!rust") - op submitBatch( + submitBatch( /** Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_ */ @header("Content-Type") multipartContentType: "multipart/mixed", @@ -173,16 +213,17 @@ namespace Storage.Blob { @header("Content-Type") contentType: "multipart/mixed"; + ...ApiVersionHeader; ...RequestIdResponseHeader; ...ClientRequestIdHeader; - }) | StorageError; + }) | Error; /** The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search expression. */ #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" @get @route("?comp=blobs") - op filterBlobs is StorageOperation< + findBlobsByTags is StorageOperationResponseBody< { ...TimeoutParameter; ...FilterBlobsWhereParameter; @@ -191,2039 +232,2096 @@ namespace Storage.Blob { ...FilterBlobsIncludeParameter; }, { - ...DateResponseHeader; - /** The filter blobs enumeration results */ @body enumerationResults: FilterBlobSegment; } >; +} + +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." +interface Container { + /** Creates a new container under the specified account. If the container with the same name already exists, the operation fails. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @route("?restype=container") + create is StorageOperationNoBody< + { + ...TimeoutParameter; + ...MetadataHeaders; + ...BlobPublicAccess; + + /** Optional. Version 2019-07-07 and later. Specifies the default encryption scope to set on the container and use for all future writes. */ + @header("x-ms-default-encryption-scope") + defaultEncryptionScope?: string; + + ...DenyEncryptionScopeOverride; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeaderPrivate; + ...LastModifiedResponseHeaderPrivate; + } + >; - #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." - namespace Container { - /** Creates a new container under the specified account. If the container with the same name already exists, the operation fails. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @route("{containerName}?restype=container") - op create is StorageOperation< - { - ...ContainerNamePathParameter; - ...TimeoutParameter; - ...MetadataHeaders; - ...BlobPublicAccess; - - /** Optional. Version 2019-07-07 and later. Specifies the default encryption scope to set on the container and use for all future writes. */ - @header("x-ms-default-encryption-scope") - defaultEncryptionScope?: string; - - ...DenyEncryptionScopeOverride; - }, - { - @statusCode statusCode: 201; - } - >; - - /** returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @get - @route("{containerName}?restype=container") - op getProperties is StorageOperation< - { - ...ContainerNamePathParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - }, - { - ...MetadataHeaders; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...LeaseDurationHeader; - ...LeaseStateResponseHeader; - ...LeaseStatusResponseHeader; - ...BlobPublicAccess; - - /** Indicates whether the container has an immutability policy set on it. */ - @header("x-ms-has-immutability-policy") - hasImmutabilityPolicy?: boolean; - - /** Indicates whether the container has a legal hold. */ - @header("x-ms-has-legal-hold") - hasLegalHold?: boolean; - - /** The default encryption scope for the container. */ - @header("x-ms-default-encryption-scope") - defaultEncryptionScope?: string; - - ...DenyEncryptionScopeOverride; - - /** Indicates whether version level worm is enabled on a container */ - @header("x-ms-immutable-storage-with-versioning-enabled") - isImmutableStorageWithVersioningEnabled?: boolean; - } - >; - - /** operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @delete - @route("{containerName}?restype=container") - op delete is StorageOperation< - { - ...ContainerNamePathParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...IfModifiedSinceParameter; - ...IfUnmodifiedSinceParameter; - }, - { - @statusCode statusCode: 202; - } - >; - - /** operation sets one or more user-defined name-value pairs for the specified container. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{containerName}?restype=container&comp=metadata") - op setMetadata is StorageOperation< - { - ...ContainerNamePathParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...MetadataHeaders; - ...IfModifiedSinceParameter; - }, - {} - >; - - /** gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - @get - @route("{containerName}?restype=container&comp=acl") - op getAccessPolicy is StorageOperation< - { - ...ContainerNamePathParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - }, - { - /** Signed identifiers */ - @body body: SignedIdentifiers; - - ...BlobPublicAccess; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - } - >; - - /** sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{containerName}?restype=container&comp=acl") - op setAccessPolicy is StorageOperation< - { - ...ContainerNamePathParameter; - - /** The access control list for the container. */ - #suppress "@azure-tools/typespec-azure-core/request-body-problem" "Existing API" - @body - containerAcl: SignedIdentifiers; - - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...BlobPublicAccess; - ...IfModifiedSinceParameter; - ...IfUnmodifiedSinceParameter; - }, - { - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - } - >; - - /** Restores a previously-deleted container. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{containerName}?restype=container&comp=undelete") - op restore is StorageOperation< - { - ...ContainerNamePathParameter; - - /** Optional. Version 2019-12-12 and later. Specifies the name of the deleted container to restore. */ - @header("x-ms-deleted-container-name") - deletedContainerName?: string; - - /** Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. */ - @header("x-ms-deleted-container-version") - deletedContainerVersion?: string; - - ...TimeoutParameter; - }, - { - @statusCode statusCode: 201; - ...DateResponseHeader; - } - >; - - /** Renames an existing container. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{containerName}?restype=container&comp=rename") - op rename is StorageOperation< - { - ...ContainerNamePathParameter; - - /** Required. Specifies the name of the container to rename. */ - @header("x-ms-source-container-name") - sourceContainerName: string; - - /** A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. */ - @header("x-ms-source-lease-id") - sourceLeaseId?: string; - - ...TimeoutParameter; - }, - DateResponseHeader - >; - - /** The Batch operation allows multiple API calls to be embedded into a single HTTP request. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @post - @route("{containerName}?restype=container&comp=batch") - @scope("!rust") - op submitBatch( - ...ContainerNamePathParameter, - - /** The batch request content */ - ...MultipartBodyParameter, - - /** Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_ */ - @header("Content-Type") - multipartContentType: "multipart/mixed", + /** returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @get + @route("?restype=container") + getProperties is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + }, + { + ...MetadataHeaders; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...LeaseDurationResponseHeader; + ...LeaseStateResponseHeader; + ...LeaseStatusResponseHeader; + ...BlobPublicAccess; + + /** Indicates whether the container has an immutability policy set on it. */ + @header("x-ms-has-immutability-policy") + hasImmutabilityPolicy?: boolean; + + /** Indicates whether the container has a legal hold. */ + @header("x-ms-has-legal-hold") + hasLegalHold?: boolean; + + /** The default encryption scope for the container. */ + @header("x-ms-default-encryption-scope") + defaultEncryptionScope?: string; + + ...DenyEncryptionScopeOverride; + + /** Indicates whether version level worm is enabled on a container */ + @header("x-ms-immutable-storage-with-versioning-enabled") + isImmutableStorageWithVersioningEnabled?: boolean; + } + >; - ...ContentLengthParameter, - ...TimeoutParameter, - ...ApiVersionHeader, - ...ClientRequestIdHeader, - ): ({ + /** operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @delete + @route("?restype=container") + delete is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + }, + { @statusCode statusCode: 202; + } + >; - /** Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_ */ - @header("Content-Type") - multipartContentType: "multipart/mixed"; - - ...RequestIdResponseHeader; - } & MultipartBodyParameter) | StorageError; - - /** The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search expression. Filter blobs searches within the given container. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @get - @route("{containerName}?restype=container&comp=blobs") - op filterBlobs is StorageOperation< - { - ...ContainerNamePathParameter; - ...TimeoutParameter; - ...FilterBlobsWhereParameter; - ...MarkerParameter; - ...MaxResultsParameter; - ...FilterBlobsIncludeParameter; - }, - { - ...DateResponseHeader; - - /** The container filter blob enumeration results */ - @body - enumerationResults: FilterBlobSegment; - } - >; - - /** The Acquire Lease operation requests a new lease on a container. The lease lock duration can be 15 to 60 seconds, or can be infinite. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{containerName}?comp=lease&restype=container&acquire") - op acquireLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...LeaseDurationHeader; - ...TimeoutParameter; - ...ProposedLeaseIdOptionalParameter; - ...IfModifiedSinceParameter; - ...IfUnmodifiedSinceParameter; - }, - { - @statusCode statusCode: 201; - ...LeaseIdResponseHeader; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - } - >; - - /** The Release Lease operation frees the lease if it's no longer needed, so that another client can immediately acquire a lease against the container. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{containerName}?comp=lease&restype=container&release") - op releaseLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...LeaseIdRequiredParameter; - ...TimeoutParameter; - ...IfModifiedSinceParameter; - ...IfUnmodifiedSinceParameter; - }, - { - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - } - >; - - /** The Renew Lease operation renews an existing lease. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{containerName}?comp=lease&restype=container&renew") - op renewLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...LeaseIdRequiredParameter; - ...TimeoutParameter; - ...IfModifiedSinceParameter; - ...IfUnmodifiedSinceParameter; - }, - { - ...LeaseIdResponseHeader; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - } - >; - - /** The Break Lease operation ends a lease and ensures that another client can't acquire a new lease until the current lease period has expired. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @route("{containerName}?comp=lease&restype=container&break") - op breakLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...TimeoutParameter; - ...IfModifiedSinceParameter; - ...IfUnmodifiedSinceParameter; - ...LeaseBreakPeriodParameter; - }, - { - @statusCode statusCode: 202; - ...LeaseTimeResponseHeader; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...LeaseIdResponseHeader; - ...DateResponseHeader; - } - >; - - /** The Change Lease operation is used to change the ID of an existing lease. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{containerName}?comp=lease&restype=container&change") - op changeLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...LeaseIdRequiredParameter; - ...ProposedLeaseIdRequiredParameter; - ...TimeoutParameter; - ...IfModifiedSinceParameter; - ...IfUnmodifiedSinceParameter; - }, - { - ...LeaseIdResponseHeader; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - } - >; - - /** The List Blobs operation returns a list of the blobs under the specified container. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @get - @list - @route("{containerName}?restype=container&comp=list&flat") - op listBlobFlatSegment is StorageOperation< - { - ...ContainerNamePathParameter; - ...PrefixParameter; - ...MarkerParameter; - ...MaxResultsParameter; - ...ListBlobsIncludeParameter; - ...TimeoutParameter; - }, - { - ...DateResponseHeader; - - /** The list of blobs in the container */ - @body - enumerationResults: ListBlobsFlatSegmentResponse; - } - >; - - /** The List Blobs operation returns a list of the blobs under the specified container. A delimiter can be used to traverse a virtual hierarchy of blobs as though it were a file system. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @get - @list - @route("{containerName}?restype=container&comp=list&hierarchy") - op listBlobHierarchySegment is StorageOperation< - { - ...ContainerNamePathParameter; - - /** When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string. */ - @query delimiter: string; - - ...PrefixParameter; - ...MarkerParameter; - ...MaxResultsParameter; - ...ListBlobsIncludeParameter; - ...TimeoutParameter; - }, - { - ...DateResponseHeader; - - /** The list of blobs in the container */ - @body - enumerationResults: ListBlobsHierarchySegmentResponse; - } - >; - - /** Returns the sku name and account kind */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @get - @route("{containerName}?restype=account&comp=properties") - op getAccountInfo is StorageOperation< - { - ...ContainerNamePathParameter; - ...TimeoutParameter; - }, - { - ...DateResponseHeader; - ...SkuNameResponseHeader; - ...AccountKindResponseHeader; - ...IsHierarchicalNamespaceEnabled; - } - >; - - #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." - @route("{containerName}") - namespace Blob { - /** The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @get - @route("{blobName}") - op download( - ...ApiVersionHeader, - ...ClientRequestIdHeader, - ...ContainerNamePathParameter, - ...BlobPathParameter, - ...SnapshotParameter, - ...VersionIdParameter, - ...TimeoutParameter, - ...RangeParameter, - ...LeaseIdOptionalParameter, - - /** When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. */ - @header("x-ms-range-get-content-md5") - rangeGetContentMd5?: boolean, - - /** Optional. When this header is set to true and specified together with the Range header, the service returns the CRC64 hash for the range, as long as the range is less than or equal to 4 MB in size. */ - @header("x-ms-range-get-content-crc64") - rangeGetContentCrc64?: boolean, - - ...EncryptionKeyParameter, - ...EncryptionKeySha256Parameter, - ...EncryptionAlgorithmParameter, - ...IfTagsParameter, - ...ConditionalRequestHeaders, - ...StructuredBodyParameter, - ): (BodyParameter & { - /** The media type of the body of the response. */ - @header("Content-Type") - contentType: "application/octet-stream"; - - ...MetadataHeaders; - ...ObjectReplicationHeaders; - ...LastModifiedResponseHeader; - ...CreationTimeResponseHeader; - ...ObjectReplicationPolicyIdResponseHeader; - ...ContentLengthResponseHeader; - ...ContentRangeResponseHeader; - ...EtagResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentEncodingResponseParameter; - ...CacheControlResponseHeader; - ...ContentDispositionResponseHeader; - ...ContentLanguageResponseHeader; - ...BlobSequenceNumberResponseHeader; - ...BlobTypeResponseHeader; - ...CopyCompletionTimeResponseHeader; - ...CopyStatusDescriptionResponseHeader; - ...CopyIdResponseHeader; - ...CopyProgressResponseHeader; - ...CopyStatusResponseHeader; - ...CopySourceResponseHeader; - ...LeaseDurationHeader; - ...LeaseStateResponseHeader; - ...LeaseStatusResponseHeader; - ...VersionIdResponseHeader; - ...IsCurrentVersionResponseHeader; - ...BlobCommittedBlockCountResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - ...BlobContentMd5ResponseHeader; - ...TagCountResponseHeader; - ...IsSealedResponseHeader; - ...LastAccessedResponseHeader; - ...ImmutabilityPolicyExpiresOnResponseHeader; - ...ImmutabilityPolicyModeResponseHeader; - ...LegalHoldResponseHeader; - }) | (BodyParameter & { - #suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Following standard pattern" - @statusCode statusCode: 206; - - /** The media type of the body of the response. */ - @header("Content-Type") - contentType: "application/octet-stream"; - - ...MetadataHeaders; - ...ObjectReplicationHeaders; - ...LastModifiedResponseHeader; - ...CreationTimeResponseHeader; - ...ObjectReplicationPolicyIdResponseHeader; - ...ContentLengthResponseHeader; - ...ContentRangeResponseHeader; - ...EtagResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentEncodingResponseParameter; - ...CacheControlResponseHeader; - ...ContentDispositionResponseHeader; - ...ContentLanguageResponseHeader; - ...BlobSequenceNumberResponseHeader; - ...BlobTypeResponseHeader; - ...ContentCrc64ResponseHeader; - ...CopyCompletionTimeResponseHeader; - ...CopyStatusDescriptionResponseHeader; - ...CopyIdResponseHeader; - ...CopyProgressResponseHeader; - ...CopyStatusResponseHeader; - ...CopySourceResponseHeader; - ...LeaseDurationHeader; - ...LeaseStateResponseHeader; - ...LeaseStatusResponseHeader; - ...VersionIdResponseHeader; - ...IsCurrentVersionResponseHeader; - ...AcceptRangesResponseHeader; - ...BlobCommittedBlockCountResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - ...BlobContentMd5ResponseHeader; - ...TagCountResponseHeader; - ...IsSealedResponseHeader; - ...LastAccessedResponseHeader; - ...ImmutabilityPolicyExpiresOnResponseHeader; - ...ImmutabilityPolicyModeResponseHeader; - ...LegalHoldResponseHeader; - }) | StorageError; - - /** The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @head - @route("{blobName}") - op getProperties is StorageOperationNoBody< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...SnapshotParameter; - ...VersionIdParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - { - ...MetadataHeaders; - ...ObjectReplicationHeaders; - ...LastModifiedResponseHeader; - ...CreationTimeResponseHeader; - ...ObjectReplicationPolicyIdResponseHeader; - ...BlobTypeResponseHeader; - ...CopyCompletionTimeResponseHeader; - ...CopyStatusDescriptionResponseHeader; - ...CopyIdResponseHeader; - ...CopyProgressResponseHeader; - ...CopyStatusResponseHeader; - ...CopySourceResponseHeader; - - /** Included if the blob is incremental copy blob. */ - @header("x-ms-incremental-copy") - isIncrementalCopy?: boolean; - - /** Included if the blob is incremental copy blob or incremental copy snapshot, if x-ms-copy-status is success. Snapshot time of the last successful incremental copy snapshot for this blob. */ - @header("x-ms-copy-destination-snapshot") - destinationSnapshot?: string; - - ...LeaseDurationHeader; - ...LeaseStateResponseHeader; - ...LeaseStatusResponseHeader; - ...ContentLengthResponseHeader; - ...EtagResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentEncodingResponseParameter; - ...ContentDispositionResponseHeader; - ...ContentLanguageResponseHeader; - ...CacheControlResponseHeader; - ...BlobSequenceNumberResponseHeader; - ...BlobCommittedBlockCountResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - ...AccessTierOptional; - - /** For page blobs on a premium storage account only. If the access tier is not explicitly set on the blob, the tier is inferred based on its content length and this header will be returned with true value. */ - @header("x-ms-access-tier-inferred") - accessTierInferred?: boolean; - - /** For blob storage LRS accounts, valid values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the blob is being rehydrated and is not complete then this header is returned indicating that rehydrate is pending and also tells the destination tier. */ - @header("x-ms-archive-status") - archiveStatus?: ArchiveStatus; - - /** The time the tier was changed on the object. This is only returned if the tier on the block blob was ever set. */ - #suppress "@azure-tools/typespec-azure-core/known-encoding" "Existing API" - @encode("rfc7231") - @header("x-ms-access-tier-change-time") - accessTierChangeTime?: utcDateTime; - - ...VersionIdResponseHeader; - ...IsCurrentVersionResponseHeader; - ...TagCountResponseHeader; - ...ExpiryTimeHeader; - ...IsSealedResponseHeader; - ...RehydratePriorityHeader; - ...LastAccessedResponseHeader; - ...ImmutabilityPolicyExpiresOnResponseHeader; - ...ImmutabilityPolicyModeResponseHeader; - ...LegalHoldResponseHeader; - } - >; - - /** If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @delete - @route("{blobName}") - op delete is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...SnapshotParameter; - ...VersionIdParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - - /** Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself */ - @header("x-ms-delete-snapshots") - deleteSnapshots?: DeleteSnapshotsOptionType; - - ...ConditionalRequestHeaders; - ...IfTagsParameter; - - /** Optional. Only possible value is 'permanent', which specifies to permanently delete a blob if blob soft delete is enabled. */ - @query - @clientName("blobDeleteType") - deletetype?: BlobDeleteType; - }, - { - @statusCode statusCode: 202; - } - >; - - /** Undelete a blob that was previously soft deleted */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @route("{blobName}?comp=undelete") - op undelete is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - }, - DateResponseHeader - >; - - /** Set the expiration time of a blob */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @route("{blobName}?comp=expiry") - op setExpiry is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...BlobExpiryOptionsParameter; - ...ExpiryTimeHeader; - }, - { - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - } - >; - - /** The Set HTTP Headers operation sets system properties on the blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{blobName}?comp=properties&SetHTTPHeaders") - op setHttpHeaders is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...BlobCacheControlParameter; - ...BlobContentTypeParameter; - ...BlobContentMd5Parameter; - ...BlobContentEncodingParameter; - ...BlobContentLanguageParameter; - ...LeaseIdOptionalParameter; - ...BlobContentDispositionParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - {} - >; - - /** Set the immutability policy of a blob */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{blobName}?comp=immutabilityPolicies") - op setImmutabilityPolicy is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...IfUnmodifiedSinceParameter; - ...ImmutabilityPolicyExpiryParameter; - ...ImmutabilityPolicyModeParameter; - ...SnapshotParameter; - ...VersionIdParameter; - }, - { - ...DateResponseHeader; - ...ImmutabilityPolicyExpiresOnResponseHeader; - ...ImmutabilityPolicyModeResponseHeader; - } - >; - - /** The Delete Immutability Policy operation deletes the immutability policy on the blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @delete - @route("{blobName}?comp=immutabilityPolicies") - op deleteImmutabilityPolicy is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...SnapshotParameter; - ...VersionIdParameter; - }, - DateResponseHeader - >; - - /** The Set Legal Hold operation sets a legal hold on the blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{blobName}?comp=legalhold") - op setLegalHold is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...LegalHoldRequiredParameter; - ...SnapshotParameter; - ...VersionIdParameter; - }, - { - ...DateResponseHeader; - ...LegalHoldResponseHeader; - } - >; - - /** The Set Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{blobName}?comp=metadata") - op setMetadata is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...MetadataHeaders; - ...LeaseIdOptionalParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - {} - >; - - /** The Acquire Lease operation requests a new lease on a blob. The lease lock duration can be 15 to 60 seconds, or can be infinite. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{blobName}?comp=lease&acquire") - op acquireLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...LeaseDurationHeader; - ...ProposedLeaseIdOptionalParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - ...LeaseIdResponseHeader; - } - >; - - /** The Release Lease operation frees the lease if it's no longer needed, so that another client can immediately acquire a lease against the blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{blobName}?comp=lease&release") - op releaseLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...LeaseIdRequiredParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - { - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - } - >; - - /** The Renew Lease operation renews an existing lease. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{blobName}?comp=lease&renew") - op renewLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...LeaseIdRequiredParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - { - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - ...LeaseIdResponseHeader; - } - >; - - /** The Change Lease operation is used to change the ID of an existing lease. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @route("{blobName}?comp=lease&change") - op changeLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...LeaseIdRequiredParameter; - ...ProposedLeaseIdRequiredParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - { - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - ...LeaseIdResponseHeader; - } - >; - - /** The Break Lease operation ends a lease and ensures that another client can't acquire a new lease until the current lease period has expired. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=lease&break") - op breakLease is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...LeaseBreakPeriodParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - { - @statusCode statusCode: 202; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - ...LeaseTimeResponseHeader; - } - >; - - /** The Create Snapshot operation creates a read-only snapshot of a blob */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=snapshot") - op createSnapshot is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...MetadataHeaders; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...LeaseIdOptionalParameter; - }, - { - @statusCode statusCode: 201; - - /** Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests to access the snapshot. */ - @header("x-ms-snapshot") - snapshot?: string; - - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...VersionIdResponseHeader; - ...DateResponseHeader; - ...IsServerEncryptedResponseHeader; - } - >; - - /** The Start Copy From URL operation copies a blob or an internet resource to a new blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @sharedRoute - @route("{blobName}") - op startCopyFromUrl is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...MetadataHeaders; - ...AccessTierOptional; - ...RehydratePriorityHeader; - ...SourceIfModifiedSinceParameter; - ...SourceIfUnmodifiedSinceParameter; - ...SourceIfMatchParameter; - ...SourceIfNoneMatchParameter; - ...SourceIfTagsParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...CopySourceParameter; - ...LeaseIdOptionalParameter; - ...BlobTagsHeaderParameter; - - /** Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. */ - @header("x-ms-seal-blob") - sealBlob?: boolean; - - ...ImmutabilityPolicyExpiryParameter; - ...ImmutabilityPolicyModeParameter; - ...LegalHoldOptionalParameter; - }, - { - @statusCode statusCode: 202; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...VersionIdResponseHeader; - ...DateResponseHeader; - ...CopyIdResponseHeader; - ...CopyStatusResponseHeader; - } - >; - - /** The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=copy&sync") - op copyFromUrl is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...MetadataHeaders; - ...AccessTierOptional; - ...SourceIfModifiedSinceParameter; - ...SourceIfUnmodifiedSinceParameter; - ...SourceIfMatchParameter; - ...SourceIfNoneMatchParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...CopySourceParameter; - ...LeaseIdOptionalParameter; - ...SourceContentMd5Parameter; - ...BlobTagsHeaderParameter; - ...ImmutabilityPolicyExpiryParameter; - ...ImmutabilityPolicyModeParameter; - ...LegalHoldOptionalParameter; - ...CopySourceAuthorizationParameter; - ...EncryptionScopeParameter; - ...CopySourceTagsParameter; - }, - { - @statusCode statusCode: 202; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...VersionIdResponseHeader; - ...DateResponseHeader; - ...CopyIdResponseHeader; - ...CopyStatusResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentCrc64ResponseHeader; - ...EncryptionScopeResponseHeader; - } - >; - - /** The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=copy©id") - op abortCopyFromUrl is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - - /** The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. */ - @clientName("copyId") - @query - copyid: string; - - ...LeaseIdOptionalParameter; - }, - { - @statusCode statusCode: 204; - ...DateResponseHeader; - } - >; - - /** The Set Tier operation sets the tier on a block blob. The operation is allowed on a page blob or block blob, but not on an append blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=tier") - op setTier is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...SnapshotParameter; - ...VersionIdParameter; - ...TimeoutParameter; - - /** Indicates the tier to be set on the blob. */ - @header("x-ms-access-tier") - tier: AccessTier; - - ...RehydratePriorityHeader; - ...LeaseIdOptionalParameter; - ...IfTagsParameter; - }, - { - #suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Following standard pattern" - @statusCode statusCode: 200 | 202; - } - >; - - /** Returns the sku name and account kind */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @get - @sharedRoute - @route("{blobName}?restype=account&comp=properties&blob") - op getAccountInfo is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - }, - { - ...DateResponseHeader; - ...AccountKindResponseHeader; - ...SkuNameResponseHeader; - ...IsHierarchicalNamespaceEnabled; - } - >; - - /** The Get Blob Tags operation enables users to get tags on a blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - @get - @sharedRoute - @route("{blobName}?comp=tags") - op getTags is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...SnapshotParameter; - ...VersionIdParameter; - ...LeaseIdOptionalParameter; - ...IfTagsParameter; - }, - { - ...DateResponseHeader; - - /** The blob tags. */ - @body - tags: BlobTags; - } - >; - - /** The Set Tags operation enables users to set tags on a blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - @put - @route("{blobName}?comp=tags") - op setTags is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...VersionIdParameter; - ...ContentMd5Parameter; - ...ContentCrc64Parameter; - ...IfTagsParameter; - ...LeaseIdOptionalParameter; - - /** The blob tags. */ - @body - tags: BlobTags; - }, - { - @statusCode statusCode: 204; - ...DateResponseHeader; - } - >; - - #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." - namespace PageBlob { - /** The Create operation creates a new page blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @sharedRoute - @route("{blobName}?PageBlob") - op create is StorageOperationNoBody< - { - ...MetadataHeaders; - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...ContentLengthParameter; - - /** Optional. Indicates the tier to be set on the page blob. */ - @header("x-ms-access-tier") - tier?: PremiumPageBlobAccessTier; - - ...BlobContentTypeParameter; - ...BlobContentEncodingParameter; - ...BlobContentLanguageParameter; - ...BlobContentMd5Parameter; - ...BlobCacheControlParameter; - ...LeaseIdOptionalParameter; - ...BlobContentDispositionParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...BlobContentLengthRequired; - ...SequenceNumberParameter; - ...BlobTagsHeaderParameter; - ...ImmutabilityPolicyExpiryParameter; - ...ImmutabilityPolicyModeParameter; - ...LegalHoldOptionalParameter; - - /** The type of the blob. */ - @header("x-ms-blob-type") - blobType: BlobType.PageBlob; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...VersionIdResponseHeader; - ...DateResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - } - >; - - /** The Upload Pages operation writes a range of pages to a page blob */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=page&update") - op uploadPages is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - - /** The data to upload. */ - ...BodyParameter; - - ...ContentLengthParameter; - ...ContentMd5Parameter; - ...ContentCrc64Parameter; - ...TimeoutParameter; - ...RangeParameter; - ...LeaseIdOptionalParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...IfSequenceNumberLessThanOrEqualToParameter; - ...IfSequenceNumberLessThanParameter; - ...IfSequenceNumberEqualToParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...StructuredBodyParameter; - ...StructuredContentLengthParameter; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentCrc64ResponseHeader; - ...BlobSequenceNumberResponseHeader; - ...DateResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - ...StructuredBodyTypeResponseHeader; - }, - "application/octet-stream" - >; - - /** The Clear Pages operation clears a range of pages from a page blob */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=page&clear") - op clearPages is StorageOperationNoBody< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...ContentLengthParameter; - ...TimeoutParameter; - ...RangeParameter; - ...LeaseIdOptionalParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...IfSequenceNumberLessThanOrEqualToParameter; - ...IfSequenceNumberLessThanParameter; - ...IfSequenceNumberEqualToParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentCrc64ResponseHeader; - ...BlobSequenceNumberResponseHeader; - ...DateResponseHeader; - } - >; - - /** The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=page&update&fromUrl") - op uploadPagesFromUrl is StorageOperationNoBody< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...SourceUrlParameter; - - /** Bytes of source data in the specified range. The length of this range should match the ContentLength header and x-ms-range/Range destination range header. */ - @header("x-ms-source-range") - sourceRange: string; - - ...SourceContentMd5Parameter; - ...SourceContentCrc64Parameter; - ...ContentLengthParameter; - ...TimeoutParameter; - - /** Bytes of source data in the specified range. The length of this range should match the ContentLength header and x-ms-range/Range destination range header. */ - @header("x-ms-range") - range: string; - - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...LeaseIdOptionalParameter; - ...IfSequenceNumberLessThanOrEqualToParameter; - ...IfSequenceNumberLessThanParameter; - ...IfSequenceNumberEqualToParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...SourceIfModifiedSinceParameter; - ...SourceIfUnmodifiedSinceParameter; - ...SourceIfMatchParameter; - ...SourceIfNoneMatchParameter; - ...CopySourceAuthorizationParameter; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentCrc64ResponseHeader; - ...BlobSequenceNumberResponseHeader; - ...DateResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - } - >; - - /** The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a page blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @get - @route("{blobName}?comp=pagelist") - op getPageRanges is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...SnapshotParameter; - ...TimeoutParameter; - ...RangeParameter; - ...LeaseIdOptionalParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...MarkerParameter; - ...MaxResultsParameter; - }, - PageList & { - ...LastModifiedResponseHeader; - ...EtagResponseHeader; - ...BlobContentLengthRequired; - ...DateResponseHeader; - } - >; - - /** The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob or snapshot of a page blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @get - @route("{blobName}?comp=pagelist&diff") - op getPageRangesDiff is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...SnapshotParameter; - ...TimeoutParameter; - - /** Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs created on or after January 1, 2016. */ - @query - prevsnapshot?: string; - - /** Optional. This header is only supported in service versions 2019-04-19 and after and specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were changed between the target blob and its previous snapshot. */ - @header("x-ms-previous-snapshot-url") - prevSnapshotUrl?: string; - - ...RangeParameter; - ...LeaseIdOptionalParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...MarkerParameter; - ...MaxResultsParameter; - }, - PageList & { - ...LastModifiedResponseHeader; - ...EtagResponseHeader; - ...BlobContentLengthRequired; - ...DateResponseHeader; - } - >; - - /** The Resize operation increases the size of the page blob to the specified size. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=properties&Resize") - op resize is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...BlobContentLengthRequired; - }, - { - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...BlobSequenceNumberResponseHeader; - ...DateResponseHeader; - } - >; - - /** The Update Sequence Number operation sets the blob's sequence number. The operation will fail if the specified sequence number is less than the current sequence number of the blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=properties&UpdateSequenceNumber") - op updateSequenceNumber is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...SequenceNumberActionParameter; - ...SequenceNumberParameter; - }, - { - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...BlobSequenceNumberResponseHeader; - ...DateResponseHeader; - } - >; - - /** The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=incrementalcopy") - op copyIncremental is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...CopySourceParameter; - }, - { - @statusCode statusCode: 202; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - ...CopyIdResponseHeader; - ...CopyStatusResponseHeader; - } - >; - } - - #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." - namespace AppendBlob { - /** The Create operation creates a new append blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - @put - @sharedRoute - @route("{blobName}?AppendBlob") - op create is StorageOperationNoBody< - { - ...MetadataHeaders; - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...ContentLengthParameter; - ...BlobContentTypeParameter; - ...BlobContentEncodingParameter; - ...BlobContentLanguageParameter; - ...BlobContentMd5Parameter; - ...BlobCacheControlParameter; - ...LeaseIdOptionalParameter; - ...BlobContentDispositionParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...BlobTagsHeaderParameter; - ...ImmutabilityPolicyExpiryParameter; - ...ImmutabilityPolicyModeParameter; - ...LegalHoldOptionalParameter; - - /** The type of the blob. */ - @header("x-ms-blob-type") - blobType: BlobType.AppendBlob; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...VersionIdResponseHeader; - ...DateResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - } - >; - - /** The Append Block operation commits a new block of data to the end of an append blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=appendblock") - op appendBlock is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - - /** The data to upload. */ - ...BodyParameter; - - ...TimeoutParameter; - ...ContentLengthParameter; - ...ContentMd5Parameter; - ...ContentCrc64Parameter; - ...LeaseIdOptionalParameter; - ...BlobConditionMaxSizeParameter; - ...BlobConditionAppendPosParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...StructuredBodyParameter; - ...StructuredContentLengthParameter; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentCrc64ResponseHeader; - ...DateResponseHeader; - ...BlobAppendOffsetResponseHeader; - ...BlobCommittedBlockCountResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - ...StructuredBodyTypeResponseHeader; - }, - "application/octet-stream" - >; - - /** The Append Block From URL operation creates a new block to be committed as part of an append blob where the contents are read from a URL. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=appendblock&fromUrl") - op appendBlockFromUrl is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...SourceUrlParameter; - ...SourceRangeParameter; - ...SourceContentMd5Parameter; - ...SourceContentCrc64Parameter; - ...TimeoutParameter; - ...ContentLengthParameter; - ...ContentMd5Parameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...LeaseIdOptionalParameter; - ...BlobConditionMaxSizeParameter; - ...BlobConditionAppendPosParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...SourceIfModifiedSinceParameter; - ...SourceIfUnmodifiedSinceParameter; - ...SourceIfMatchParameter; - ...SourceIfNoneMatchParameter; - ...CopySourceAuthorizationParameter; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentCrc64ResponseHeader; - ...DateResponseHeader; - ...BlobAppendOffsetResponseHeader; - ...BlobCommittedBlockCountResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - } - >; - - /** The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 version or later. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=seal") - op seal is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...ConditionalRequestHeaders; - ...BlobConditionAppendPosParameter; - }, - { - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...DateResponseHeader; - ...IsSealedResponseHeader; - } - >; - } - - #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." - namespace BlockBlob { - /** The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the Put Block List operation. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" - @put - @sharedRoute - @route("{blobName}?BlockBlob") - op upload is StorageOperation< - { - ...MetadataHeaders; - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...BodyParameter; - ...TimeoutParameter; - ...ContentMd5Parameter; - ...ContentLengthParameter; - ...BlobContentTypeParameter; - ...BlobContentEncodingParameter; - ...BlobContentLanguageParameter; - ...BlobContentMd5Parameter; - ...BlobCacheControlParameter; - ...LeaseIdOptionalParameter; - ...BlobContentDispositionParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...AccessTierOptional; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...BlobTagsHeaderParameter; - ...ImmutabilityPolicyExpiryParameter; - ...ImmutabilityPolicyModeParameter; - ...LegalHoldOptionalParameter; - ...ContentCrc64Parameter; - - /** The type of the blob. */ - @header("x-ms-blob-type") - blobType: BlobType.BlockBlob; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...VersionIdResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - }, - "application/octet-stream" - >; - - /** The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blob’s contents using a source URL, use the Put Block from URL API in conjunction with Put Block List. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @sharedRoute - @route("{blobName}?BlockBlob&fromUrl") - op putBlobFromUrl is StorageOperationNoBody< - { - ...MetadataHeaders; - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...ContentMd5Parameter; - ...ContentLengthParameter; - ...BlobContentTypeParameter; - ...BlobContentEncodingParameter; - ...BlobContentLanguageParameter; - ...BlobContentMd5Parameter; - ...BlobCacheControlParameter; - ...LeaseIdOptionalParameter; - ...BlobContentDispositionParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...AccessTierOptional; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - ...SourceIfModifiedSinceParameter; - ...SourceIfUnmodifiedSinceParameter; - ...SourceIfMatchParameter; - ...SourceIfNoneMatchParameter; - ...SourceIfTagsParameter; - ...SourceContentMd5Parameter; - ...BlobTagsHeaderParameter; - ...CopySourceParameter; - ...CopySourceBlobPropertiesParameter; - ...CopySourceAuthorizationParameter; - ...CopySourceTagsParameter; - - /** The type of the blob. */ - @header("x-ms-blob-type") - blobType: BlobType.BlockBlob; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...VersionIdResponseHeader; - ...DateResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - } - >; - - /** The Stage Block operation creates a new block to be committed as part of a blob */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=block") - op stageBlock is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...BlockIdParameter; - ...ContentLengthParameter; - ...ContentMd5Parameter; - ...ContentCrc64Parameter; - ...BodyParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - }, - { - @statusCode statusCode: 201; - ...ContentMd5ResponseHeader; - ...ContentCrc64ResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - }, - "application/octet-stream" - >; - - /** The Stage Block From URL operation creates a new block to be committed as part of a blob where the contents are read from a URL. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=block&fromURL") - op stageBlockFromUrl is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...BlockIdParameter; - ...ContentLengthParameter; - ...SourceUrlParameter; - ...SourceRangeParameter; - ...SourceContentMd5Parameter; - ...SourceContentCrc64Parameter; - ...TimeoutParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...LeaseIdOptionalParameter; - ...SourceIfModifiedSinceParameter; - ...SourceIfUnmodifiedSinceParameter; - ...SourceIfMatchParameter; - ...SourceIfNoneMatchParameter; - ...CopySourceAuthorizationParameter; - }, - { - @statusCode statusCode: 201; - ...DateResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentCrc64ResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - } - >; - - /** The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" - #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" - @put - @sharedRoute - @route("{blobName}?comp=blocklist") - op commitBlockList is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...TimeoutParameter; - ...BlobCacheControlParameter; - ...BlobContentTypeParameter; - ...BlobContentEncodingParameter; - ...BlobContentLanguageParameter; - ...BlobContentMd5Parameter; - ...ContentMd5Parameter; - ...ContentCrc64Parameter; - ...MetadataHeaders; - ...LeaseIdOptionalParameter; - ...BlobContentDispositionParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...EncryptionScopeParameter; - ...AccessTierOptional; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - - /** Blob Blocks. */ - @body blocks: BlockLookupList; - - ...BlobTagsHeaderParameter; - ...ImmutabilityPolicyExpiryParameter; - ...ImmutabilityPolicyModeParameter; - ...LegalHoldOptionalParameter; - }, - { - @statusCode statusCode: 201; - ...EtagResponseHeader; - ...LastModifiedResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentCrc64ResponseHeader; - ...VersionIdResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - } - >; - - /** The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - @get - @route("{blobName}?comp=blocklist") - op getBlockList is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - ...SnapshotParameter; - - /** Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. */ - @query - @clientName("listType") - blocklisttype: BlockListType; - - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...IfTagsParameter; - }, - { - /** Block list */ - @body - blockList: BlockList; - - ...LastModifiedResponseHeader; - ...EtagResponseHeader; - ...BlobContentLengthRequired; - } - >; - - /** The Query operation enables users to select/project on blob data by providing simple query expressions. */ - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" - #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" - @post - @route("{blobName}?comp=query") - op query is StorageOperation< - { - ...ContainerNamePathParameter; - ...BlobPathParameter; - - /** The query request */ - @body - queryRequest: QueryRequest; - - ...SnapshotParameter; - ...TimeoutParameter; - ...LeaseIdOptionalParameter; - ...EncryptionKeyParameter; - ...EncryptionKeySha256Parameter; - ...EncryptionAlgorithmParameter; - ...ConditionalRequestHeaders; - ...IfTagsParameter; - }, - BodyParameter & { - #suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Following standard pattern" - @statusCode statusCode: 200 | 206; - ...MetadataHeaders; - ...LastModifiedResponseHeader; - ...ContentLengthResponseHeader; - ...ContentRangeResponseHeader; - ...EtagResponseHeader; - ...ContentMd5ResponseHeader; - ...ContentEncodingResponseParameter; - ...CacheControlResponseHeader; - ...ContentDispositionResponseHeader; - ...ContentLanguageResponseHeader; - ...BlobSequenceNumberResponseHeader; - ...BlobTypeResponseHeader; - ...ContentCrc64ResponseHeader; - ...CopyCompletionTimeResponseHeader; - ...CopyStatusDescriptionResponseHeader; - ...CopyIdResponseHeader; - ...CopyProgressResponseHeader; - ...CopySourceResponseHeader; - ...CopyStatusResponseHeader; - ...LeaseDurationHeader; - ...LeaseStateResponseHeader; - ...LeaseStatusResponseHeader; - ...AcceptRangesResponseHeader; - ...DateResponseHeader; - ...BlobCommittedBlockCountResponseHeader; - ...IsServerEncryptedResponseHeader; - ...EncryptionKeySha256ResponseHeader; - ...EncryptionScopeResponseHeader; - ...BlobContentMd5ResponseHeader; - }, - "application/xml", - "application/octet-stream" - >; - } + /** operation sets one or more user-defined name-value pairs for the specified container. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @route("?restype=container&comp=metadata") + setMetadata is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...MetadataHeadersParameter; + ...IfModifiedSinceParameter; + }, + { + ...EtagResponseHeaderPrivate; + ...LastModifiedResponseHeaderPrivate; + } + >; + + /** gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + @get + @route("?restype=container&comp=acl") + getAccessPolicy is StorageOperationResponseBody< + { + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + }, + { + /** Signed identifiers */ + @body body: SignedIdentifiers; + + ...BlobPublicAccess; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + } + >; + + /** sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @route("?restype=container&comp=acl") + setAccessPolicy is StorageOperationRequestBody< + { + /** The access control list for the container. */ + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "Existing API" + @body + containerAcl: SignedIdentifiers; + + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...BlobPublicAccess; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + }, + { + ...EtagResponseHeaderPrivate; + ...LastModifiedResponseHeaderPrivate; + } + >; + + /** Restores a previously-deleted container. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @route("?restype=container&comp=undelete") + restore is StorageOperationNoBody< + { + /** Optional. Version 2019-12-12 and later. Specifies the name of the deleted container to restore. */ + @header("x-ms-deleted-container-name") + deletedContainerName?: string; + + /** Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. */ + @header("x-ms-deleted-container-version") + deletedContainerVersion?: string; + + ...TimeoutParameter; + }, + { + @statusCode statusCode: 201; + } + >; + + /** Renames an existing container. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @route("?restype=container&comp=rename") + rename is StorageOperationNoBody< + { + /** Required. Specifies the name of the container to rename. */ + @header("x-ms-source-container-name") + sourceContainerName: string; + + /** A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. */ + @header("x-ms-source-lease-id") + sourceLeaseId?: string; + + ...TimeoutParameter; + }, + {} + >; + + /** The Batch operation allows multiple API calls to be embedded into a single HTTP request. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @post + @route("?restype=container&comp=batch") + submitBatch( + /** The batch request content */ + ...MultipartBodyParameter, + + /** Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_ */ + @header("Content-Type") + multipartContentType: "multipart/mixed", + + ...ContentLengthParameter, + ...TimeoutParameter, + ...ApiVersionHeader, + ...ClientRequestIdHeader, + ): ({ + @statusCode statusCode: 202; + + /** Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_ */ + @header("Content-Type") + multipartContentType: "multipart/mixed"; + + ...RequestIdResponseHeader; + ...ApiVersionHeader; + } & MultipartBodyParameter) | Error; + + /** The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search expression. Filter blobs searches within the given container. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @get + @route("?restype=container&comp=blobs") + findBlobsByTags is StorageOperationResponseBody< + { + ...TimeoutParameter; + ...FilterBlobsWhereParameter; + ...MarkerParameter; + ...MaxResultsParameter; + ...FilterBlobsIncludeParameter; + }, + { + /** The container filter blob enumeration results */ + @body + enumerationResults: FilterBlobSegment; + } + >; + + /** The Acquire Lease operation requests a new lease on a container. The lease lock duration can be 15 to 60 seconds, or can be infinite. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=lease&restype=container") + acquireLease is StorageOperationNoBody< + { + ...LeaseDurationHeaderParameter; + ...TimeoutParameter; + ...ProposedLeaseIdOptionalParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...LeaseActionParameter<"acquire">; + }, + { + @statusCode statusCode: 201; + ...LeaseIdResponseHeader; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + } + >; + + /** The Release Lease operation frees the lease if it's no longer needed, so that another client can immediately acquire a lease against the container. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=lease&restype=container") + releaseLease is StorageOperationNoBody< + { + ...LeaseIdRequiredParameter; + ...TimeoutParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...LeaseActionParameter<"release">; + }, + { + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + } + >; + + /** The Renew Lease operation renews an existing lease. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=lease&restype=container") + renewLease is StorageOperationNoBody< + { + ...LeaseIdRequiredParameter; + ...TimeoutParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...LeaseActionParameter<"renew">; + }, + { + ...LeaseIdResponseHeader; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + } + >; + + /** The Break Lease operation ends a lease and ensures that another client can't acquire a new lease until the current lease period has expired. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @sharedRoute + @route("?comp=lease&restype=container") + breakLease is StorageOperationNoBody< + { + ...TimeoutParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...LeaseBreakPeriodParameter; + ...LeaseActionParameter<"break">; + }, + { + @statusCode statusCode: 202; + ...LeaseTimeResponseHeader; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + } + >; + + /** The Change Lease operation is used to change the ID of an existing lease. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=lease&restype=container") + changeLease is StorageOperationNoBody< + { + ...LeaseIdRequiredParameter; + ...ProposedLeaseIdRequiredParameter; + ...TimeoutParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...LeaseActionParameter<"change">; + }, + { + ...LeaseIdResponseHeader; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + } + >; + + /** The List Blobs operation returns a list of the blobs under the specified container. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @get + @list + @sharedRoute + @route("?restype=container&comp=list") + listBlobs is StorageOperationResponseBody< + { + ...PrefixParameter; + ...MarkerParameter; + ...MaxResultsParameter; + ...ListBlobsIncludeParameter; + ...TimeoutParameter; + ...ListBlobsStartFrom; + }, + { + /** The list of blobs in the container */ + @body + enumerationResults: ListBlobsResponse; + } + >; + + /** The List Blobs operation returns a list of the blobs under the specified container. A delimiter can be used to traverse a virtual hierarchy of blobs as though it were a file system. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @get + @list + @sharedRoute + @route("?restype=container&comp=list") + listBlobHierarchySegment is StorageOperationResponseBody< + { + /** When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string. */ + @query delimiter: string; + + ...PrefixParameter; + ...MarkerParameter; + ...MaxResultsParameter; + ...ListBlobsIncludeParameter; + ...TimeoutParameter; + ...ListBlobsStartFrom; + }, + { + /** The list of blobs in the container */ + @body + enumerationResults: ListBlobsHierarchySegmentResponse; + } + >; + + /** Returns the sku name and account kind */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @get + @route("?restype=account&comp=properties") + @sharedRoute + getAccountInfo is StorageOperationNoBody< + { + ...TimeoutParameter; + }, + { + ...SkuNameResponseHeader; + ...AccountKindResponseHeader; + ...IsHierarchicalNamespaceEnabled; } - } + >; +} + +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." +interface Blob { + /** The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @get + download( + ...ApiVersionHeader, + ...ClientRequestIdHeader, + ...SnapshotParameter, + ...VersionIdParameter, + ...TimeoutParameter, + ...RangeParameter, + ...LeaseIdOptionalParameter, + + /** When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. */ + @header("x-ms-range-get-content-md5") + rangeGetContentMd5?: boolean, + + /** Optional. When this header is set to true and specified together with the Range header, the service returns the CRC64 hash for the range, as long as the range is less than or equal to 4 MB in size. */ + @header("x-ms-range-get-content-crc64") + rangeGetContentCrc64?: boolean, + + /** Specifies the response content should be returned as a structured message and specifies the message schema version and properties. */ + @access(Access.internal) + @header("x-ms-structured-body") + structuredBodyType?: string, + + ...EncryptionKeyParameter, + ...EncryptionKeySha256Parameter, + ...EncryptionAlgorithmParameter, + ...IfTagsParameter, + ...ConditionalRequestHeaders, + ): (BodyParameter & { + /** The media type of the body of the response. */ + @header("Content-Type") + contentType: "application/octet-stream"; + + ...RequestIdResponseHeader; + ...ClientRequestIdHeader; + ...MetadataHeaders; + ...ObjectReplicationHeaders; + ...LastModifiedResponseHeader; + ...CreationTimeResponseHeader; + ...ObjectReplicationPolicyIdResponseHeader; + ...ContentLengthResponseHeader; + ...ContentRangeResponseHeader; + ...EtagResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentEncodingResponseParameter; + ...CacheControlResponseHeader; + ...ContentDispositionResponseHeader; + ...ContentLanguageResponseHeader; + ...BlobSequenceNumberResponseHeader; + ...BlobTypeResponseHeader; + ...CopyCompletionTimeResponseHeader; + ...CopyStatusDescriptionResponseHeader; + ...CopyIdResponseHeader; + ...CopyProgressResponseHeader; + ...CopyStatusResponseHeader; + ...CopySourceResponseHeader; + ...LeaseDurationResponseHeader; + ...LeaseStateResponseHeader; + ...LeaseStatusResponseHeader; + ...VersionIdResponseHeader; + ...IsCurrentVersionResponseHeader; + ...AcceptRangesResponseHeaderPrivate; + ...DateResponseHeaderPrivate; + ...BlobCommittedBlockCountResponseHeader; + ...ServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + ...BlobContentMd5ResponseHeader; + ...TagCountResponseHeader; + ...IsSealedResponseHeader; + ...LastAccessedResponseHeader; + ...ImmutabilityPolicyExpiresOnResponseHeader; + ...ImmutabilityPolicyModeResponseHeader; + ...LegalHoldOptionalResponseHeader; + ...StructuredBodyTypeResponseHeader; + ...StructuredContentLengthResponseHeader; + ...ApiVersionHeader; + }) | (BodyParameter & { + #suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Following standard pattern" + @statusCode statusCode: 206; + + /** The media type of the body of the response. */ + @header("Content-Type") + contentType: "application/octet-stream"; + + ...RequestIdResponseHeader; + ...ClientRequestIdHeader; + ...MetadataHeaders; + ...ObjectReplicationHeaders; + ...LastModifiedResponseHeader; + ...CreationTimeResponseHeader; + ...ObjectReplicationPolicyIdResponseHeader; + ...ContentLengthResponseHeader; + ...ContentRangeResponseHeader; + ...EtagResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentEncodingResponseParameter; + ...CacheControlResponseHeader; + ...ContentDispositionResponseHeader; + ...ContentLanguageResponseHeader; + ...BlobSequenceNumberResponseHeader; + ...BlobTypeResponseHeader; + ...ContentCrc64ResponseHeader; + ...CopyCompletionTimeResponseHeader; + ...CopyStatusDescriptionResponseHeader; + ...CopyIdResponseHeader; + ...CopyProgressResponseHeader; + ...CopyStatusResponseHeader; + ...CopySourceResponseHeader; + ...LeaseDurationResponseHeader; + ...LeaseStateResponseHeader; + ...LeaseStatusResponseHeader; + ...VersionIdResponseHeader; + ...IsCurrentVersionResponseHeader; + ...AcceptRangesResponseHeaderPrivate; + ...DateResponseHeaderPrivate; + ...BlobCommittedBlockCountResponseHeader; + ...ServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + ...BlobContentMd5ResponseHeader; + ...TagCountResponseHeader; + ...IsSealedResponseHeader; + ...LastAccessedResponseHeader; + ...ImmutabilityPolicyExpiresOnResponseHeader; + ...ImmutabilityPolicyModeResponseHeader; + ...LegalHoldOptionalResponseHeader; + ...StructuredBodyTypeResponseHeader; + ...StructuredContentLengthResponseHeader; + ...ApiVersionHeader; + }) | Error; + + /** The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @head + getProperties is StorageOperationNoBody< + { + ...SnapshotParameter; + ...VersionIdParameter; + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + }, + { + /** Content-type. */ + #suppress "@typespec/http/content-type-ignored" "This is a HEAD operation, so content-type header can be returned." + @header("Content-Type") + contentType?: string; + + ...MetadataHeaders; + ...ObjectReplicationHeaders; + ...LastModifiedResponseHeader; + ...CreationTimeResponseHeader; + ...ObjectReplicationPolicyIdResponseHeader; + ...BlobTypeResponseHeader; + ...CopyCompletionTimeResponseHeader; + ...CopyStatusDescriptionResponseHeader; + ...CopyIdResponseHeader; + ...CopyProgressResponseHeader; + ...CopyStatusResponseHeader; + ...CopySourceResponseHeader; + + /** Included if the blob is incremental copy blob. */ + @header("x-ms-incremental-copy") + isIncrementalCopy?: boolean; + + /** Included if the blob is incremental copy blob or incremental copy snapshot, if x-ms-copy-status is success. Snapshot time of the last successful incremental copy snapshot for this blob. */ + @header("x-ms-copy-destination-snapshot") + destinationSnapshot?: string; + + ...LeaseDurationResponseHeader; + ...LeaseStateResponseHeader; + ...LeaseStatusResponseHeader; + ...ContentLengthResponseHeader; + ...EtagResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentEncodingResponseParameter; + ...ContentDispositionResponseHeader; + ...ContentLanguageResponseHeader; + ...CacheControlResponseHeader; + ...BlobSequenceNumberResponseHeader; + ...AcceptRangesResponseHeaderPrivate; + ...BlobCommittedBlockCountResponseHeader; + ...ServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + + /** The tier of page blob on a premium storage account or tier of block blob on blob storage LRS accounts. For a list of allowed premium page blob tiers, see https://learn.microsoft.com/azure/virtual-machines/disks-types#premium-ssd. For blob storage LRS accounts, valid values are Hot/Cool/Archive. */ + @header("x-ms-access-tier") + accessTier?: string; + + /** For page blobs on a premium storage account only. If the access tier is not explicitly set on the blob, the tier is inferred based on its content length and this header will be returned with true value. */ + @header("x-ms-access-tier-inferred") + accessTierInferred?: boolean; + + /** For blob storage LRS accounts, valid values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the blob is being rehydrated and is not complete then this header is returned indicating that rehydrate is pending and also tells the destination tier. */ + @header("x-ms-archive-status") + archiveStatus?: ArchiveStatus; + + /** The time the tier was changed on the object. This is only returned if the tier on the block blob was ever set. */ + #suppress "@azure-tools/typespec-azure-core/known-encoding" "Existing API" + @encode("rfc7231") + @header("x-ms-access-tier-change-time") + accessTierChangeTime?: utcDateTime; + + ...VersionIdResponseHeader; + ...IsCurrentVersionResponseHeader; + ...TagCountResponseHeader; + ...ExpiryTimeHeader; + ...IsSealedResponseHeader; + ...RehydratePriorityHeader; + ...LastAccessedResponseHeader; + ...ImmutabilityPolicyExpiresOnResponseHeader; + ...ImmutabilityPolicyModeResponseHeader; + ...LegalHoldOptionalResponseHeader; + } + >; + + /** If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @delete + delete is StorageOperationNoBody< + { + ...SnapshotParameter; + ...VersionIdParameter; + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + + /** Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself */ + @header("x-ms-delete-snapshots") + deleteSnapshots?: DeleteSnapshotsOptionType; + + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + + /** Optional. Only possible value is 'permanent', which specifies to permanently delete a blob if blob soft delete is enabled. */ + @query + @clientName("blobDeleteType") + deletetype?: BlobDeleteType; + + ...AccessTierIfModifiedSinceParameter; + ...AccessTierIfUnmodifiedSinceParameter; + }, + { + @statusCode statusCode: 202; + } + >; + + /** Undelete a blob that was previously soft deleted */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @route("?comp=undelete") + undelete is StorageOperationNoBody< + { + ...TimeoutParameter; + }, + {} + >; + + /** Set the expiration time of a blob */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @route("?comp=expiry") + setExpiry is StorageOperationNoBody< + { + ...TimeoutParameter; + ...BlobExpiryOptionsParameter; + ...ExpiryTimeHeader; + }, + { + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + } + >; + + /** The Set HTTP Headers operation sets system properties on the blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=properties") + setProperties is StorageOperationNoBody< + { + ...TimeoutParameter; + ...BlobCacheControlParameter; + ...BlobContentTypeParameter; + ...BlobContentMd5Parameter; + ...BlobContentEncodingParameter; + ...BlobContentLanguageParameter; + ...LeaseIdOptionalParameter; + ...BlobContentDispositionParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + }, + { + ...EtagResponseHeaderPrivate; + ...LastModifiedResponseHeaderPrivate; + ...BlobSequenceNumberResponseHeaderPrivate; + } + >; + + /** Set the immutability policy of a blob */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @route("?comp=immutabilityPolicies") + setImmutabilityPolicy is StorageOperationNoBody< + { + ...TimeoutParameter; + ...IfUnmodifiedSinceParameter; + ...ImmutabilityPolicyExpiryRequiredParameter; + ...ImmutabilityPolicyModeParameter; + ...SnapshotParameter; + ...VersionIdParameter; + }, + { + ...ImmutabilityPolicyExpiresOnResponseHeaderPrivate; + ...ImmutabilityPolicyModeResponseHeaderPrivate; + } + >; + + /** The Delete Immutability Policy operation deletes the immutability policy on the blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @delete + @route("?comp=immutabilityPolicies") + deleteImmutabilityPolicy is StorageOperationNoBody< + { + ...TimeoutParameter; + ...SnapshotParameter; + ...VersionIdParameter; + }, + {} + >; + + /** The Set Legal Hold operation sets a legal hold on the blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @route("?comp=legalhold") + setLegalHold is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LegalHoldRequiredParameter; + ...SnapshotParameter; + ...VersionIdParameter; + }, + { + ...LegalHoldResponseHeaderPrivate; + } + >; + + /** The Set Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @route("?comp=metadata") + setMetadata is StorageOperationNoBody< + { + ...TimeoutParameter; + ...MetadataHeadersParameter; + ...LeaseIdOptionalParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + }, + { + ...EtagResponseHeaderPrivate; + ...LastModifiedResponseHeaderPrivate; + ...VersionIdResponseHeaderPrivate; + ...RequestServerEncryptedResponseHeaderPrivate; + ...EncryptionKeySha256ResponseHeaderPrivate; + ...EncryptionScopeResponseHeaderPrivate; + } + >; + + /** The Acquire Lease operation requests a new lease on a blob. The lease lock duration can be 15 to 60 seconds, or can be infinite. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=lease") + acquireLease is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseDurationHeaderParameter; + ...ProposedLeaseIdOptionalParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...LeaseActionParameter<"acquire">; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...LeaseIdResponseHeader; + } + >; + + /** The Release Lease operation frees the lease if it's no longer needed, so that another client can immediately acquire a lease against the blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=lease") + releaseLease is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseIdRequiredParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...LeaseActionParameter<"release">; + }, + { + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + } + >; + + /** The Renew Lease operation renews an existing lease. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=lease") + renewLease is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseIdRequiredParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...LeaseActionParameter<"renew">; + }, + { + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...LeaseIdResponseHeader; + } + >; + + /** The Change Lease operation is used to change the ID of an existing lease. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=lease") + changeLease is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseIdRequiredParameter; + ...ProposedLeaseIdRequiredParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...LeaseActionParameter<"change">; + }, + { + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...LeaseIdResponseHeader; + } + >; + + /** The Break Lease operation ends a lease and ensures that another client can't acquire a new lease until the current lease period has expired. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @sharedRoute + @route("?comp=lease") + breakLease is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseBreakPeriodParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...LeaseActionParameter<"break">; + }, + { + @statusCode statusCode: 202; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...LeaseTimeResponseHeader; + } + >; + + /** The Create Snapshot operation creates a read-only snapshot of a blob */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @sharedRoute + @route("?comp=snapshot") + createSnapshot is StorageOperationNoBody< + { + ...TimeoutParameter; + ...MetadataHeaders; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...LeaseIdOptionalParameter; + }, + { + @statusCode statusCode: 201; + + /** Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests to access the snapshot. */ + @header("x-ms-snapshot") + snapshot?: string; + + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...VersionIdResponseHeader; + ...RequestServerEncryptedResponseHeader; + } + >; + + /** The Start Copy From URL operation copies a blob or an internet resource to a new blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @sharedRoute + startCopyFromUrl is StorageOperationNoBody< + { + ...TimeoutParameter; + ...MetadataHeaders; + ...AccessTierHeader; + ...RehydratePriorityHeader; + ...SourceIfModifiedSinceParameter; + ...SourceIfUnmodifiedSinceParameter; + ...SourceIfMatchParameter; + ...SourceIfNoneMatchParameter; + ...SourceIfTagsParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...CopySourceParameter; + ...LeaseIdOptionalParameter; + ...BlobTagsHeaderParameter; + + /** Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. */ + @header("x-ms-seal-blob") + sealBlob?: boolean; + + ...ImmutabilityPolicyExpiryParameter; + ...ImmutabilityPolicyModeParameter; + ...LegalHoldOptionalParameter; + }, + { + @statusCode statusCode: 202; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...VersionIdResponseHeader; + ...CopyIdResponseHeader; + ...CopyStatusResponseHeader; + } + >; + + /** The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @sharedRoute + @route("?comp=copy&sync") + copyFromUrl is StorageOperationNoBody< + { + ...TimeoutParameter; + ...MetadataHeaders; + ...AccessTierHeader; + ...SourceIfModifiedSinceParameter; + ...SourceIfUnmodifiedSinceParameter; + ...SourceIfMatchParameter; + ...SourceIfNoneMatchParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...CopySourceParameter; + ...LeaseIdOptionalParameter; + ...SourceContentMd5Parameter; + ...BlobTagsHeaderParameter; + ...ImmutabilityPolicyExpiryParameter; + ...ImmutabilityPolicyModeParameter; + ...LegalHoldOptionalParameter; + ...CopySourceAuthorizationParameter; + ...EncryptionScopeParameter; + ...CopySourceTagsParameter; + ...FileRequestIntentParameter; + + /** This header indicates that this is a synchronous Copy Blob From URL instead of a Asynchronous Copy Blob. */ + @header("x-ms-requires-sync") + requiresSync: "true"; + }, + { + @statusCode statusCode: 202; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...VersionIdResponseHeader; + ...CopyIdResponseHeader; + + /** State of the copy operation identified by x-ms-copy-id. */ + @header("x-ms-copy-status") + copyStatus?: "success"; + + ...ContentMd5ResponseHeader; + ...ContentCrc64ResponseHeader; + ...EncryptionScopeResponseHeader; + } + >; + + /** The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + @put + @sharedRoute + @route("?comp=copy") + abortCopyFromUrl is StorageOperationNoBody< + { + ...TimeoutParameter; + + /** The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. */ + @clientName("copyId") + @query + copyid: string; + + ...LeaseIdOptionalParameter; + + /** The copy action to be performed. */ + @header("x-ms-copy-action") + copyActionAbortConstant: "abort"; + }, + { + @statusCode statusCode: 204; + } + >; + + /** The Set Tier operation sets the tier on a block blob. The operation is allowed on a page blob or block blob, but not on an append blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=tier") + setTier is StorageOperationNoBody< + { + ...SnapshotParameter; + ...VersionIdParameter; + ...TimeoutParameter; + + /** Indicates the tier to be set on the blob. */ + @header("x-ms-access-tier") + tier: AccessTier; + + ...RehydratePriorityHeader; + ...LeaseIdOptionalParameter; + ...IfTagsParameter; + }, + { + #suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Following standard pattern" + @statusCode statusCode: 200 | 202; + } + >; + + /** Returns the sku name and account kind */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @get + @sharedRoute + @route("?restype=account&comp=properties") + getAccountInfo is StorageOperationNoBody< + { + ...TimeoutParameter; + }, + { + ...AccountKindResponseHeader; + ...SkuNameResponseHeader; + ...IsHierarchicalNamespaceEnabled; + } + >; + + /** The Get Blob Tags operation enables users to get tags on a blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + @get + @sharedRoute + @route("?comp=tags") + getTags is StorageOperationResponseBody< + { + ...TimeoutParameter; + ...SnapshotParameter; + ...VersionIdParameter; + ...LeaseIdOptionalParameter; + ...IfTagsParameter; + ...IfBlobModifiedSinceHeader; + ...IfBlobUnmodifiedSinceHeader; + ...IfBlobMatchHeader; + ...IfBlobNoneMatchHeader; + }, + { + /** The blob tags. */ + @body + tags: BlobTags; + } + >; + + /** The Set Tags operation enables users to set tags on a blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + @put + @route("?comp=tags") + setTags is StorageOperationRequestBody< + { + ...TimeoutParameter; + ...VersionIdParameter; + ...ContentMd5Parameter; + ...ContentCrc64Parameter; + ...IfTagsParameter; + ...LeaseIdOptionalParameter; + + /** The blob tags. */ + @body + tags: BlobTags; + + ...IfBlobModifiedSinceHeader; + ...IfBlobUnmodifiedSinceHeader; + ...IfBlobMatchHeader; + ...IfBlobNoneMatchHeader; + }, + { + @statusCode statusCode: 204; + } + >; +} + +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." +interface PageBlob { + /** The Create operation creates a new page blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @sharedRoute + create is StorageOperationNoBody< + { + ...MetadataHeaders; + ...TimeoutParameter; + + /** Optional. Indicates the tier to be set on the page blob. */ + @header("x-ms-access-tier") + tier?: PremiumPageBlobAccessTier; + + ...BlobContentTypeParameter; + ...BlobContentEncodingParameter; + ...BlobContentLanguageParameter; + ...BlobContentMd5Parameter; + ...BlobCacheControlParameter; + ...LeaseIdOptionalParameter; + ...BlobContentDispositionParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...BlobContentLengthRequired; + ...SequenceNumberParameter; + ...BlobTagsHeaderParameter; + ...ImmutabilityPolicyExpiryParameter; + ...ImmutabilityPolicyModeParameter; + ...LegalHoldOptionalParameter; + + /** the initial size of the page blob */ + @header("Content-Length") + contentLength: 0; + + /** The type of the blob. */ + @header("x-ms-blob-type") + blobType: "PageBlob"; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...VersionIdResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + } + >; + + /** The Upload Pages operation writes a range of pages to a page blob */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" + @put + @sharedRoute + @route("?comp=page") + uploadPages is StorageOperationRequestBody< + { + /** The data to upload. */ + ...BodyParameter; + + ...ContentLengthParameter; + ...ContentMd5Parameter; + ...ContentCrc64Parameter; + ...TimeoutParameter; + + /** Bytes of data in the specified range. */ + @header("Range") + range: string; + + ...LeaseIdOptionalParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...IfSequenceNumberLessThanOrEqualToParameter; + ...IfSequenceNumberLessThanParameter; + ...IfSequenceNumberEqualToParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...StructuredBodyParameter; + ...StructuredContentLengthParameter; + ...PageWriteParameter<"update">; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentCrc64ResponseHeader; + ...BlobSequenceNumberResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + ...StructuredBodyTypeResponseHeader; + }, + "application/octet-stream" + >; + + /** The Clear Pages operation clears a range of pages from a page blob */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=page") + clearPages is StorageOperationNoBody< + { + /** value must be 0 when x-ms-page-write is clear */ + @header("Content-Length") + contentLength: 0; + + ...TimeoutParameter; + + /** Bytes of data in the specified range. */ + @header("Range") + range: string; + + ...LeaseIdOptionalParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...IfSequenceNumberLessThanOrEqualToParameter; + ...IfSequenceNumberLessThanParameter; + ...IfSequenceNumberEqualToParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...PageWriteParameter<"clear">; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentCrc64ResponseHeader; + ...BlobSequenceNumberResponseHeader; + } + >; + + /** The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @sharedRoute + @route("?comp=page") + uploadPagesFromUrl is StorageOperationNoBody< + { + ...SourceUrlParameter; + + /** Bytes of source data in the specified range. The length of this range should match the ContentLength header and x-ms-range/Range destination range header. */ + @header("x-ms-source-range") + sourceRange: string; + + ...SourceContentMd5Parameter; + ...SourceContentCrc64Parameter; + ...ContentLengthParameter; + ...TimeoutParameter; + + /** Bytes of source data in the specified range. The length of this range should match the ContentLength header and x-ms-range/Range destination range header. */ + @header("x-ms-range") + range: string; + + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...LeaseIdOptionalParameter; + ...IfSequenceNumberLessThanOrEqualToParameter; + ...IfSequenceNumberLessThanParameter; + ...IfSequenceNumberEqualToParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...SourceIfModifiedSinceParameter; + ...SourceIfUnmodifiedSinceParameter; + ...SourceIfMatchParameter; + ...SourceIfNoneMatchParameter; + ...CopySourceAuthorizationParameter; + ...FileRequestIntentParameter; + ...PageWriteParameter<"update">; + ...SourceEncryptionKeyParameter; + ...SourceEncryptionKeySha256Parameter; + ...SourceEncryptionAlgorithmParameter; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentCrc64ResponseHeader; + ...BlobSequenceNumberResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + } + >; + + /** The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a page blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @get + @sharedRoute + @route("?comp=pagelist") + getPageRanges is StorageOperationResponseBody< + { + ...SnapshotParameter; + ...TimeoutParameter; + ...RangeParameter; + ...LeaseIdOptionalParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...MarkerParameter; + ...MaxResultsParameter; + }, + PageList & { + ...LastModifiedResponseHeader; + ...EtagResponseHeader; + ...BlobContentLengthResponseHeader; + } + >; + + /** The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob or snapshot of a page blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @get + @sharedRoute + @route("?comp=pagelist") + getPageRangesDiff is StorageOperationResponseBody< + { + ...SnapshotParameter; + ...TimeoutParameter; + + /** Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs created on or after January 1, 2016. */ + @query + prevsnapshot?: string; + + /** Optional. This header is only supported in service versions 2019-04-19 and after and specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were changed between the target blob and its previous snapshot. */ + @header("x-ms-previous-snapshot-url") + prevSnapshotUrl?: string; + + ...RangeParameter; + ...LeaseIdOptionalParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...MarkerParameter; + ...MaxResultsParameter; + }, + PageList & { + ...LastModifiedResponseHeader; + ...EtagResponseHeader; + ...BlobContentLengthResponseHeader; + } + >; + + /** The Resize operation increases the size of the page blob to the specified size. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=properties") + resize is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...BlobContentLengthRequired; + }, + { + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...BlobSequenceNumberResponseHeader; + } + >; + + /** The Update Sequence Number operation sets the blob's sequence number. The operation will fail if the specified sequence number is less than the current sequence number of the blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=properties") + setSequenceNumber is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...SequenceNumberActionParameter; + ...SequenceNumberParameter; + }, + { + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...BlobSequenceNumberResponseHeader; + } + >; + + /** The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @sharedRoute + @route("?comp=incrementalcopy") + copyIncremental is StorageOperationNoBody< + { + ...TimeoutParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...CopySourceParameter; + }, + { + @statusCode statusCode: 202; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...CopyIdResponseHeader; + ...CopyStatusResponseHeader; + } + >; +} + +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." +interface AppendBlob { + /** The Create operation creates a new append blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + @put + @sharedRoute + create is StorageOperationNoBody< + { + ...MetadataHeaders; + ...TimeoutParameter; + ...BlobContentTypeParameter; + ...BlobContentEncodingParameter; + ...BlobContentLanguageParameter; + ...BlobContentMd5Parameter; + ...BlobCacheControlParameter; + ...LeaseIdOptionalParameter; + ...BlobContentDispositionParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...BlobTagsHeaderParameter; + ...ImmutabilityPolicyExpiryParameter; + ...ImmutabilityPolicyModeParameter; + ...LegalHoldOptionalParameter; + + /** the initial size of the append blob */ + @header("Content-Length") + contentLength: 0; + + /** The type of the blob. */ + @header("x-ms-blob-type") + blobType: "AppendBlob"; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...VersionIdResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + } + >; + + /** The Append Block operation commits a new block of data to the end of an append blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" + @put + @sharedRoute + @route("?comp=appendblock") + appendBlock is StorageOperationRequestBody< + { + /** The data to upload. */ + ...BodyParameter; + + ...TimeoutParameter; + ...ContentLengthParameter; + ...ContentMd5Parameter; + ...ContentCrc64Parameter; + ...LeaseIdOptionalParameter; + ...BlobConditionMaxSizeParameter; + ...BlobConditionAppendPosParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...StructuredBodyParameter; + ...StructuredContentLengthParameter; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentCrc64ResponseHeader; + ...BlobAppendOffsetResponseHeader; + ...BlobCommittedBlockCountResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + ...StructuredBodyTypeResponseHeader; + }, + "application/octet-stream" + >; + + /** The Append Block From URL operation creates a new block to be committed as part of an append blob where the contents are read from a URL. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=appendblock") + appendBlockFromUrl is StorageOperationNoBody< + { + ...SourceUrlParameter; + ...SourceRangeParameter; + ...SourceContentMd5Parameter; + ...SourceContentCrc64Parameter; + ...TimeoutParameter; + ...ContentLengthParameter; + ...ContentMd5Parameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...LeaseIdOptionalParameter; + ...BlobConditionMaxSizeParameter; + ...BlobConditionAppendPosParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...SourceIfModifiedSinceParameter; + ...SourceIfUnmodifiedSinceParameter; + ...SourceIfMatchParameter; + ...SourceIfNoneMatchParameter; + ...CopySourceAuthorizationParameter; + ...FileRequestIntentParameter; + ...SourceEncryptionKeyParameter; + ...SourceEncryptionKeySha256Parameter; + ...SourceEncryptionAlgorithmParameter; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentCrc64ResponseHeader; + ...BlobAppendOffsetResponseHeader; + ...BlobCommittedBlockCountResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + } + >; + + /** The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 version or later. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=seal") + seal is StorageOperationNoBody< + { + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...BlobConditionAppendPosParameter; + }, + { + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...IsSealedResponseHeader; + } + >; +} + +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "Existing API. Storage API version parameter pre-dates current guidance." +interface BlockBlob { + /** The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the Put Block List operation. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" + @put + @sharedRoute + upload is StorageOperationRequestBody< + { + ...MetadataHeaders; + ...BodyParameter; + ...TimeoutParameter; + ...ContentMd5Parameter; + ...ContentLengthParameter; + ...BlobContentTypeParameter; + ...BlobContentEncodingParameter; + ...BlobContentLanguageParameter; + ...BlobContentMd5Parameter; + ...BlobCacheControlParameter; + ...LeaseIdOptionalParameter; + ...BlobContentDispositionParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...AccessTierHeader; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...BlobTagsHeaderParameter; + ...ImmutabilityPolicyExpiryParameter; + ...ImmutabilityPolicyModeParameter; + ...LegalHoldOptionalParameter; + ...ContentCrc64Parameter; + ...StructuredBodyParameter; + ...StructuredContentLengthParameter; + + /** The type of the blob. */ + @header("x-ms-blob-type") + blobType: "BlockBlob"; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...VersionIdResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + ...StructuredBodyTypeResponseHeader; + }, + "application/octet-stream" + >; + + /** The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blob’s contents using a source URL, use the Put Block from URL API in conjunction with Put Block List. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + uploadBlobFromUrl is StorageOperationNoBody< + { + ...MetadataHeaders; + ...TimeoutParameter; + ...ContentMd5Parameter; + ...BlobContentTypeParameter; + ...BlobContentEncodingParameter; + ...BlobContentLanguageParameter; + ...BlobContentMd5Parameter; + ...BlobCacheControlParameter; + ...LeaseIdOptionalParameter; + ...BlobContentDispositionParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...AccessTierHeader; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + ...SourceIfModifiedSinceParameter; + ...SourceIfUnmodifiedSinceParameter; + ...SourceIfMatchParameter; + ...SourceIfNoneMatchParameter; + ...SourceIfTagsParameter; + ...SourceContentMd5Parameter; + ...BlobTagsHeaderParameter; + ...CopySourceParameter; + + /** Required to be 0 for Put Blob from URL operation. */ + @header("Content-Length") + contentLength: 0; + + ...CopySourceBlobPropertiesParameter; + ...CopySourceAuthorizationParameter; + ...CopySourceTagsParameter; + + /** The type of the blob. */ + @header("x-ms-blob-type") + blobType: "BlockBlob"; + + ...FileRequestIntentParameter; + ...SourceEncryptionKeyParameter; + ...SourceEncryptionKeySha256Parameter; + ...SourceEncryptionAlgorithmParameter; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...VersionIdResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + } + >; + + /** The Stage Block operation creates a new block to be committed as part of a blob */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" + @put + @sharedRoute + @route("?comp=block") + stageBlock is StorageOperationRequestBody< + { + ...BlockIdParameter; + ...ContentLengthParameter; + ...ContentMd5Parameter; + ...ContentCrc64Parameter; + ...BodyParameter; + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...StructuredBodyParameter; + ...StructuredContentLengthParameter; + }, + { + @statusCode statusCode: 201; + ...ContentMd5ResponseHeader; + ...ContentCrc64ResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + ...StructuredBodyTypeResponseHeader; + }, + "application/octet-stream" + >; + + /** The Stage Block From URL operation creates a new block to be committed as part of a blob where the contents are read from a URL. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=block") + stageBlockFromUrl is StorageOperationNoBody< + { + ...BlockIdParameter; + ...ContentLengthParameter; + ...SourceUrlParameter; + ...SourceRangeParameter; + ...SourceContentMd5Parameter; + ...SourceContentCrc64Parameter; + ...TimeoutParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...LeaseIdOptionalParameter; + ...SourceIfModifiedSinceParameter; + ...SourceIfUnmodifiedSinceParameter; + ...SourceIfMatchParameter; + ...SourceIfNoneMatchParameter; + ...CopySourceAuthorizationParameter; + ...FileRequestIntentParameter; + ...SourceEncryptionKeyParameter; + ...SourceEncryptionKeySha256Parameter; + ...SourceEncryptionAlgorithmParameter; + }, + { + @statusCode statusCode: 201; + ...ContentMd5ResponseHeader; + ...ContentCrc64ResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + } + >; + + /** The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API" + #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API" + @put + @sharedRoute + @route("?comp=blocklist") + commitBlockList is StorageOperationRequestBody< + { + ...TimeoutParameter; + ...BlobCacheControlParameter; + ...BlobContentTypeParameter; + ...BlobContentEncodingParameter; + ...BlobContentLanguageParameter; + ...BlobContentMd5Parameter; + ...ContentMd5Parameter; + ...ContentCrc64Parameter; + ...MetadataHeaders; + ...LeaseIdOptionalParameter; + ...BlobContentDispositionParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...EncryptionScopeParameter; + ...AccessTierHeader; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + + /** Blob Blocks. */ + @body blocks: BlockLookupList; + + ...BlobTagsHeaderParameter; + ...ImmutabilityPolicyExpiryParameter; + ...ImmutabilityPolicyModeParameter; + ...LegalHoldOptionalParameter; + }, + { + @statusCode statusCode: 201; + ...EtagResponseHeader; + ...LastModifiedResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentCrc64ResponseHeader; + ...VersionIdResponseHeader; + ...RequestServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + } + >; + + /** The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + @get + @route("?comp=blocklist") + getBlockList is StorageOperationResponseBody< + { + ...SnapshotParameter; + + /** Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. */ + @query + @clientName("listType") + blocklisttype: BlockListType; + + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...IfTagsParameter; + }, + { + /** Block list */ + @body + blockList: BlockList; + + ...LastModifiedResponseHeader; + ...EtagResponseHeader; + ...BlobContentLengthResponseHeader; + } + >; + + /** The Query operation enables users to select/project on blob data by providing simple query expressions. */ + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API" + #suppress "@azure-tools/typespec-azure-core/byos" "Existing API" + @post + @route("?comp=query") + query is StorageOperation< + { + /** The query request */ + @body + queryRequest: QueryRequest; + + ...SnapshotParameter; + ...TimeoutParameter; + ...LeaseIdOptionalParameter; + ...EncryptionKeyParameter; + ...EncryptionKeySha256Parameter; + ...EncryptionAlgorithmParameter; + ...IfModifiedSinceParameter; + ...IfUnmodifiedSinceParameter; + ...IfNoneMatchParameter; + ...IfMatchParameter; + ...IfTagsParameter; + }, + BodyParameter & { + #suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Following standard pattern" + @statusCode statusCode: 200 | 206; + ...MetadataHeaders; + ...LastModifiedResponseHeader; + ...ContentLengthResponseHeader; + ...ContentRangeResponseHeader; + ...EtagResponseHeader; + ...ContentMd5ResponseHeader; + ...ContentEncodingResponseParameter; + ...CacheControlResponseHeader; + ...ContentDispositionResponseHeader; + ...ContentLanguageResponseHeader; + ...BlobSequenceNumberResponseHeader; + ...BlobTypeResponseHeader; + ...ContentCrc64ResponseHeader; + ...CopyCompletionTimeResponseHeader; + ...CopyStatusDescriptionResponseHeader; + ...CopyIdResponseHeader; + ...CopyProgressResponseHeader; + ...CopySourceResponseHeader; + ...CopyStatusResponseHeader; + ...LeaseDurationResponseHeader; + ...LeaseStateResponseHeader; + ...LeaseStatusResponseHeader; + ...AcceptRangesResponseHeader; + ...BlobCommittedBlockCountResponseHeader; + ...ServerEncryptedResponseHeader; + ...EncryptionKeySha256ResponseHeader; + ...EncryptionScopeResponseHeader; + ...BlobContentMd5ResponseHeader; + }, + "application/xml", + "application/octet-stream" + >; } From 36c9e4b0eb6ecf99f4e265abd34554ecf9f0fd00 Mon Sep 17 00:00:00 2001 From: Joel Hendrix Date: Tue, 24 Feb 2026 16:09:02 -0800 Subject: [PATCH 2/2] remove namespaces for clients (for now) --- .../test/tsp/Microsoft.BlobStorage/client.tsp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/client.tsp b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/client.tsp index 60b1c85f1..3d55d0394 100644 --- a/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/client.tsp +++ b/packages/typespec-rust/test/tsp/Microsoft.BlobStorage/client.tsp @@ -109,13 +109,6 @@ interface PageBlobClient extends Storage.Blob.PageBlob {} @@clientNamespace(Storage.Blob.BlockBlob, "Azure.Storage.Blobs"); @@clientNamespace(Storage.Blob.PageBlob, "Azure.Storage.Blobs"); -@@clientNamespace(BlobServiceClient, "Azure.Storage.Blobs"); -@@clientNamespace(BlobContainerClient, "Azure.Storage.Blobs"); -@@clientNamespace(BlobClient, "Azure.Storage.Blobs"); -@@clientNamespace(AppendBlobClient, "Azure.Storage.Blobs"); -@@clientNamespace(BlockBlobClient, "Azure.Storage.Blobs"); -@@clientNamespace(PageBlobClient, "Azure.Storage.Blobs"); - @@clientName(Storage.Blob.BlockBlob.upload, "upload_internal", "rust"); @@clientName(Storage.Blob.Blob.download, "download_internal", "rust");