1#![allow(unused_mut)]
2#![allow(unused_variables)]
3#![allow(unused_imports)]
4#![allow(clippy::redundant_clone)]
5pub mod models;
6#[derive(Clone)]
7pub struct Client {
8 endpoint: azure_core::Url,
9 credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
10 scopes: Vec<String>,
11 pipeline: azure_core::Pipeline,
12}
13#[derive(Clone)]
14pub struct ClientBuilder {
15 credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
16 endpoint: Option<azure_core::Url>,
17 scopes: Option<Vec<String>>,
18 options: azure_core::ClientOptions,
19}
20pub use azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD as DEFAULT_ENDPOINT;
21impl ClientBuilder {
22 #[doc = "Create a new instance of `ClientBuilder`."]
23 #[must_use]
24 pub fn new(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> Self {
25 Self {
26 credential,
27 endpoint: None,
28 scopes: None,
29 options: azure_core::ClientOptions::default(),
30 }
31 }
32 #[doc = "Set the endpoint."]
33 #[must_use]
34 pub fn endpoint(mut self, endpoint: impl Into<azure_core::Url>) -> Self {
35 self.endpoint = Some(endpoint.into());
36 self
37 }
38 #[doc = "Set the scopes."]
39 #[must_use]
40 pub fn scopes(mut self, scopes: &[&str]) -> Self {
41 self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
42 self
43 }
44 #[doc = "Set the retry options."]
45 #[must_use]
46 pub fn retry(mut self, retry: impl Into<azure_core::RetryOptions>) -> Self {
47 self.options = self.options.retry(retry);
48 self
49 }
50 #[doc = "Set the transport options."]
51 #[must_use]
52 pub fn transport(mut self, transport: impl Into<azure_core::TransportOptions>) -> Self {
53 self.options = self.options.transport(transport);
54 self
55 }
56 #[doc = "Convert the builder into a `Client` instance."]
57 pub fn build(self) -> azure_core::Result<Client> {
58 let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
59 let scopes = if let Some(scopes) = self.scopes {
60 scopes
61 } else {
62 vec![endpoint.join(azure_core::auth::DEFAULT_SCOPE_SUFFIX)?.to_string()]
63 };
64 Ok(Client::new(endpoint, self.credential, scopes, self.options))
65 }
66}
67impl Client {
68 pub(crate) async fn bearer_token(&self) -> azure_core::Result<azure_core::auth::Secret> {
69 let credential = self.token_credential();
70 let response = credential.get_token(&self.scopes()).await?;
71 Ok(response.token)
72 }
73 pub(crate) fn endpoint(&self) -> &azure_core::Url {
74 &self.endpoint
75 }
76 pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential {
77 self.credential.as_ref()
78 }
79 pub(crate) fn scopes(&self) -> Vec<&str> {
80 self.scopes.iter().map(String::as_str).collect()
81 }
82 pub(crate) async fn send(&self, request: &mut azure_core::Request) -> azure_core::Result<azure_core::Response> {
83 let context = azure_core::Context::default();
84 self.pipeline.send(&context, request).await
85 }
86 #[doc = "Create a new `ClientBuilder`."]
87 #[must_use]
88 pub fn builder(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> ClientBuilder {
89 ClientBuilder::new(credential)
90 }
91 #[doc = "Create a new `Client`."]
92 #[must_use]
93 pub fn new(
94 endpoint: impl Into<azure_core::Url>,
95 credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
96 scopes: Vec<String>,
97 options: azure_core::ClientOptions,
98 ) -> Self {
99 let endpoint = endpoint.into();
100 let pipeline = azure_core::Pipeline::new(
101 option_env!("CARGO_PKG_NAME"),
102 option_env!("CARGO_PKG_VERSION"),
103 options,
104 Vec::new(),
105 Vec::new(),
106 );
107 Self {
108 endpoint,
109 credential,
110 scopes,
111 pipeline,
112 }
113 }
114 pub fn append_blob_client(&self) -> append_blob::Client {
115 append_blob::Client(self.clone())
116 }
117 pub fn blob_client(&self) -> blob::Client {
118 blob::Client(self.clone())
119 }
120 pub fn block_blob_client(&self) -> block_blob::Client {
121 block_blob::Client(self.clone())
122 }
123 pub fn container_client(&self) -> container::Client {
124 container::Client(self.clone())
125 }
126 pub fn page_blob_client(&self) -> page_blob::Client {
127 page_blob::Client(self.clone())
128 }
129 pub fn service_client(&self) -> service::Client {
130 service::Client(self.clone())
131 }
132}
133pub mod service {
134 use super::models;
135 #[cfg(not(target_arch = "wasm32"))]
136 use futures::future::BoxFuture;
137 #[cfg(target_arch = "wasm32")]
138 use futures::future::LocalBoxFuture as BoxFuture;
139 pub struct Client(pub(crate) super::Client);
140 impl Client {
141 #[doc = "gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules."]
142 pub fn get_properties(&self) -> get_properties::RequestBuilder {
143 get_properties::RequestBuilder {
144 client: self.0.clone(),
145 timeout: None,
146 x_ms_client_request_id: None,
147 }
148 }
149 #[doc = "Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules"]
150 #[doc = ""]
151 #[doc = "Arguments:"]
152 #[doc = "* `storage_service_properties`: The StorageService properties."]
153 pub fn set_properties(
154 &self,
155 storage_service_properties: impl Into<models::StorageServiceProperties>,
156 ) -> set_properties::RequestBuilder {
157 set_properties::RequestBuilder {
158 client: self.0.clone(),
159 storage_service_properties: storage_service_properties.into(),
160 timeout: None,
161 x_ms_client_request_id: None,
162 }
163 }
164 #[doc = "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."]
165 pub fn get_statistics(&self) -> get_statistics::RequestBuilder {
166 get_statistics::RequestBuilder {
167 client: self.0.clone(),
168 timeout: None,
169 x_ms_client_request_id: None,
170 }
171 }
172 #[doc = "The List Containers Segment operation returns a list of the containers under the specified account"]
173 pub fn list_containers_segment(&self) -> list_containers_segment::RequestBuilder {
174 list_containers_segment::RequestBuilder {
175 client: self.0.clone(),
176 prefix: None,
177 marker: None,
178 maxresults: None,
179 include: Vec::new(),
180 timeout: None,
181 x_ms_client_request_id: None,
182 }
183 }
184 #[doc = "Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication."]
185 #[doc = ""]
186 #[doc = "Arguments:"]
187 #[doc = "* `key_info`: Key information"]
188 pub fn get_user_delegation_key(&self, key_info: impl Into<models::KeyInfo>) -> get_user_delegation_key::RequestBuilder {
189 get_user_delegation_key::RequestBuilder {
190 client: self.0.clone(),
191 key_info: key_info.into(),
192 timeout: None,
193 x_ms_client_request_id: None,
194 }
195 }
196 #[doc = "Returns the sku name and account kind "]
197 pub fn get_account_info(&self) -> get_account_info::RequestBuilder {
198 get_account_info::RequestBuilder { client: self.0.clone() }
199 }
200 #[doc = "The Batch operation allows multiple API calls to be embedded into a single HTTP request."]
201 #[doc = ""]
202 #[doc = "Arguments:"]
203 #[doc = "* `body`: Initial data"]
204 #[doc = "* `content_length`: The length of the request."]
205 #[doc = "* `content_type`: Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_<GUID>"]
206 pub fn submit_batch(
207 &self,
208 body: impl Into<serde_json::Value>,
209 content_length: i64,
210 content_type: impl Into<String>,
211 ) -> submit_batch::RequestBuilder {
212 submit_batch::RequestBuilder {
213 client: self.0.clone(),
214 body: body.into(),
215 content_length,
216 content_type: content_type.into(),
217 timeout: None,
218 x_ms_client_request_id: None,
219 }
220 }
221 #[doc = "The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search expression. Filter blobs searches across all containers within a storage account but can be scoped within the expression to a single container."]
222 pub fn filter_blobs(&self) -> filter_blobs::RequestBuilder {
223 filter_blobs::RequestBuilder {
224 client: self.0.clone(),
225 timeout: None,
226 x_ms_client_request_id: None,
227 where_: None,
228 marker: None,
229 maxresults: None,
230 include: Vec::new(),
231 }
232 }
233 }
234 pub mod get_properties {
235 use super::models;
236 #[cfg(not(target_arch = "wasm32"))]
237 use futures::future::BoxFuture;
238 #[cfg(target_arch = "wasm32")]
239 use futures::future::LocalBoxFuture as BoxFuture;
240 #[derive(Debug)]
241 pub struct Response(azure_core::Response);
242 impl Response {
243 pub async fn into_body(self) -> azure_core::Result<models::StorageServiceProperties> {
244 let bytes = self.0.into_body().collect().await?;
245 let body: models::StorageServiceProperties = azure_core::xml::read_xml(&bytes)?;
246 Ok(body)
247 }
248 pub fn into_raw_response(self) -> azure_core::Response {
249 self.0
250 }
251 pub fn as_raw_response(&self) -> &azure_core::Response {
252 &self.0
253 }
254 pub fn headers(&self) -> Headers {
255 Headers(self.0.headers())
256 }
257 }
258 impl From<Response> for azure_core::Response {
259 fn from(rsp: Response) -> Self {
260 rsp.into_raw_response()
261 }
262 }
263 impl AsRef<azure_core::Response> for Response {
264 fn as_ref(&self) -> &azure_core::Response {
265 self.as_raw_response()
266 }
267 }
268 pub struct Headers<'a>(&'a azure_core::headers::Headers);
269 impl<'a> Headers<'a> {
270 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
271 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
272 self.0
273 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
274 }
275 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
276 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
277 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
278 }
279 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
280 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
281 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
282 }
283 }
284 #[derive(Clone)]
285 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
286 #[doc = r""]
287 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
288 #[doc = r" parameters can be chained."]
289 #[doc = r""]
290 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
291 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
292 #[doc = r" executes the request and returns a `Result` with the parsed"]
293 #[doc = r" response."]
294 #[doc = r""]
295 #[doc = r" In order to execute the request without polling the service"]
296 #[doc = r" until the operation completes, use `.send().await` instead."]
297 #[doc = r""]
298 #[doc = r" If you need lower-level access to the raw response details"]
299 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
300 #[doc = r" can finalize the request using the"]
301 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
302 #[doc = r" that resolves to a lower-level [`Response`] value."]
303 pub struct RequestBuilder {
304 pub(crate) client: super::super::Client,
305 pub(crate) timeout: Option<i64>,
306 pub(crate) x_ms_client_request_id: Option<String>,
307 }
308 impl RequestBuilder {
309 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
310 pub fn timeout(mut self, timeout: i64) -> Self {
311 self.timeout = Some(timeout);
312 self
313 }
314 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
315 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
316 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
317 self
318 }
319 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
320 #[doc = ""]
321 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
322 #[doc = "However, this function can provide more flexibility when required."]
323 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
324 Box::pin({
325 let this = self.clone();
326 async move {
327 let url = this.url()?;
328 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
329 let bearer_token = this.client.bearer_token().await?;
330 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
331 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
332 if let Some(timeout) = &this.timeout {
333 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
334 }
335 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
336 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
337 }
338 let req_body = azure_core::EMPTY_BODY;
339 req.set_body(req_body);
340 Ok(Response(this.client.send(&mut req).await?))
341 }
342 })
343 }
344 fn url(&self) -> azure_core::Result<azure_core::Url> {
345 let mut url = self.client.endpoint().clone();
346 url.set_path("/?restype=service&comp=properties");
347 Ok(url)
348 }
349 }
350 impl std::future::IntoFuture for RequestBuilder {
351 type Output = azure_core::Result<models::StorageServiceProperties>;
352 type IntoFuture = BoxFuture<'static, azure_core::Result<models::StorageServiceProperties>>;
353 #[doc = "Returns a future that sends the request and returns the parsed response body."]
354 #[doc = ""]
355 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
356 #[doc = ""]
357 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
358 fn into_future(self) -> Self::IntoFuture {
359 Box::pin(async move { self.send().await?.into_body().await })
360 }
361 }
362 }
363 pub mod set_properties {
364 use super::models;
365 #[cfg(not(target_arch = "wasm32"))]
366 use futures::future::BoxFuture;
367 #[cfg(target_arch = "wasm32")]
368 use futures::future::LocalBoxFuture as BoxFuture;
369 #[derive(Debug)]
370 pub struct Response(azure_core::Response);
371 impl Response {
372 pub fn into_raw_response(self) -> azure_core::Response {
373 self.0
374 }
375 pub fn as_raw_response(&self) -> &azure_core::Response {
376 &self.0
377 }
378 pub fn headers(&self) -> Headers {
379 Headers(self.0.headers())
380 }
381 }
382 impl From<Response> for azure_core::Response {
383 fn from(rsp: Response) -> Self {
384 rsp.into_raw_response()
385 }
386 }
387 impl AsRef<azure_core::Response> for Response {
388 fn as_ref(&self) -> &azure_core::Response {
389 self.as_raw_response()
390 }
391 }
392 pub struct Headers<'a>(&'a azure_core::headers::Headers);
393 impl<'a> Headers<'a> {
394 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
395 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
396 self.0
397 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
398 }
399 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
400 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
401 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
402 }
403 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
404 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
405 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
406 }
407 }
408 #[derive(Clone)]
409 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
410 #[doc = r""]
411 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
412 #[doc = r" parameters can be chained."]
413 #[doc = r""]
414 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
415 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
416 #[doc = r" executes the request and returns a `Result` with the parsed"]
417 #[doc = r" response."]
418 #[doc = r""]
419 #[doc = r" In order to execute the request without polling the service"]
420 #[doc = r" until the operation completes, use `.send().await` instead."]
421 #[doc = r""]
422 #[doc = r" If you need lower-level access to the raw response details"]
423 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
424 #[doc = r" can finalize the request using the"]
425 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
426 #[doc = r" that resolves to a lower-level [`Response`] value."]
427 pub struct RequestBuilder {
428 pub(crate) client: super::super::Client,
429 pub(crate) storage_service_properties: models::StorageServiceProperties,
430 pub(crate) timeout: Option<i64>,
431 pub(crate) x_ms_client_request_id: Option<String>,
432 }
433 impl RequestBuilder {
434 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
435 pub fn timeout(mut self, timeout: i64) -> Self {
436 self.timeout = Some(timeout);
437 self
438 }
439 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
440 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
441 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
442 self
443 }
444 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
445 #[doc = ""]
446 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
447 #[doc = "However, this function can provide more flexibility when required."]
448 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
449 Box::pin({
450 let this = self.clone();
451 async move {
452 let url = this.url()?;
453 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
454 let bearer_token = this.client.bearer_token().await?;
455 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
456 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
457 req.insert_header("content-type", "application/xml");
458 let req_body = azure_core::xml::to_xml(&this.storage_service_properties)?;
459 if let Some(timeout) = &this.timeout {
460 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
461 }
462 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
463 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
464 }
465 req.set_body(req_body);
466 Ok(Response(this.client.send(&mut req).await?))
467 }
468 })
469 }
470 fn url(&self) -> azure_core::Result<azure_core::Url> {
471 let mut url = self.client.endpoint().clone();
472 url.set_path("/?restype=service&comp=properties");
473 Ok(url)
474 }
475 }
476 }
477 pub mod get_statistics {
478 use super::models;
479 #[cfg(not(target_arch = "wasm32"))]
480 use futures::future::BoxFuture;
481 #[cfg(target_arch = "wasm32")]
482 use futures::future::LocalBoxFuture as BoxFuture;
483 #[derive(Debug)]
484 pub struct Response(azure_core::Response);
485 impl Response {
486 pub async fn into_body(self) -> azure_core::Result<models::StorageServiceStats> {
487 let bytes = self.0.into_body().collect().await?;
488 let body: models::StorageServiceStats = azure_core::xml::read_xml(&bytes)?;
489 Ok(body)
490 }
491 pub fn into_raw_response(self) -> azure_core::Response {
492 self.0
493 }
494 pub fn as_raw_response(&self) -> &azure_core::Response {
495 &self.0
496 }
497 pub fn headers(&self) -> Headers {
498 Headers(self.0.headers())
499 }
500 }
501 impl From<Response> for azure_core::Response {
502 fn from(rsp: Response) -> Self {
503 rsp.into_raw_response()
504 }
505 }
506 impl AsRef<azure_core::Response> for Response {
507 fn as_ref(&self) -> &azure_core::Response {
508 self.as_raw_response()
509 }
510 }
511 pub struct Headers<'a>(&'a azure_core::headers::Headers);
512 impl<'a> Headers<'a> {
513 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
514 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
515 self.0
516 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
517 }
518 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
519 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
520 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
521 }
522 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
523 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
524 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
525 }
526 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
527 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
528 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
529 }
530 }
531 #[derive(Clone)]
532 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
533 #[doc = r""]
534 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
535 #[doc = r" parameters can be chained."]
536 #[doc = r""]
537 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
538 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
539 #[doc = r" executes the request and returns a `Result` with the parsed"]
540 #[doc = r" response."]
541 #[doc = r""]
542 #[doc = r" In order to execute the request without polling the service"]
543 #[doc = r" until the operation completes, use `.send().await` instead."]
544 #[doc = r""]
545 #[doc = r" If you need lower-level access to the raw response details"]
546 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
547 #[doc = r" can finalize the request using the"]
548 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
549 #[doc = r" that resolves to a lower-level [`Response`] value."]
550 pub struct RequestBuilder {
551 pub(crate) client: super::super::Client,
552 pub(crate) timeout: Option<i64>,
553 pub(crate) x_ms_client_request_id: Option<String>,
554 }
555 impl RequestBuilder {
556 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
557 pub fn timeout(mut self, timeout: i64) -> Self {
558 self.timeout = Some(timeout);
559 self
560 }
561 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
562 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
563 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
564 self
565 }
566 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
567 #[doc = ""]
568 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
569 #[doc = "However, this function can provide more flexibility when required."]
570 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
571 Box::pin({
572 let this = self.clone();
573 async move {
574 let url = this.url()?;
575 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
576 let bearer_token = this.client.bearer_token().await?;
577 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
578 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
579 if let Some(timeout) = &this.timeout {
580 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
581 }
582 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
583 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
584 }
585 let req_body = azure_core::EMPTY_BODY;
586 req.set_body(req_body);
587 Ok(Response(this.client.send(&mut req).await?))
588 }
589 })
590 }
591 fn url(&self) -> azure_core::Result<azure_core::Url> {
592 let mut url = self.client.endpoint().clone();
593 url.set_path("/?restype=service&comp=stats");
594 Ok(url)
595 }
596 }
597 impl std::future::IntoFuture for RequestBuilder {
598 type Output = azure_core::Result<models::StorageServiceStats>;
599 type IntoFuture = BoxFuture<'static, azure_core::Result<models::StorageServiceStats>>;
600 #[doc = "Returns a future that sends the request and returns the parsed response body."]
601 #[doc = ""]
602 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
603 #[doc = ""]
604 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
605 fn into_future(self) -> Self::IntoFuture {
606 Box::pin(async move { self.send().await?.into_body().await })
607 }
608 }
609 }
610 pub mod list_containers_segment {
611 use super::models;
612 #[cfg(not(target_arch = "wasm32"))]
613 use futures::future::BoxFuture;
614 #[cfg(target_arch = "wasm32")]
615 use futures::future::LocalBoxFuture as BoxFuture;
616 #[derive(Debug)]
617 pub struct Response(azure_core::Response);
618 impl Response {
619 pub async fn into_body(self) -> azure_core::Result<models::ListContainersSegmentResponse> {
620 let bytes = self.0.into_body().collect().await?;
621 let body: models::ListContainersSegmentResponse = azure_core::xml::read_xml(&bytes)?;
622 Ok(body)
623 }
624 pub fn into_raw_response(self) -> azure_core::Response {
625 self.0
626 }
627 pub fn as_raw_response(&self) -> &azure_core::Response {
628 &self.0
629 }
630 pub fn headers(&self) -> Headers {
631 Headers(self.0.headers())
632 }
633 }
634 impl From<Response> for azure_core::Response {
635 fn from(rsp: Response) -> Self {
636 rsp.into_raw_response()
637 }
638 }
639 impl AsRef<azure_core::Response> for Response {
640 fn as_ref(&self) -> &azure_core::Response {
641 self.as_raw_response()
642 }
643 }
644 pub struct Headers<'a>(&'a azure_core::headers::Headers);
645 impl<'a> Headers<'a> {
646 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
647 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
648 self.0
649 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
650 }
651 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
652 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
653 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
654 }
655 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
656 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
657 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
658 }
659 }
660 #[derive(Clone)]
661 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
662 #[doc = r""]
663 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
664 #[doc = r" parameters can be chained."]
665 #[doc = r""]
666 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
667 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
668 #[doc = r" executes the request and returns a `Result` with the parsed"]
669 #[doc = r" response."]
670 #[doc = r""]
671 #[doc = r" In order to execute the request without polling the service"]
672 #[doc = r" until the operation completes, use `.send().await` instead."]
673 #[doc = r""]
674 #[doc = r" If you need lower-level access to the raw response details"]
675 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
676 #[doc = r" can finalize the request using the"]
677 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
678 #[doc = r" that resolves to a lower-level [`Response`] value."]
679 pub struct RequestBuilder {
680 pub(crate) client: super::super::Client,
681 pub(crate) prefix: Option<String>,
682 pub(crate) marker: Option<String>,
683 pub(crate) maxresults: Option<i64>,
684 pub(crate) include: Vec<String>,
685 pub(crate) timeout: Option<i64>,
686 pub(crate) x_ms_client_request_id: Option<String>,
687 }
688 impl RequestBuilder {
689 #[doc = "Filters the results to return only containers whose name begins with the specified prefix."]
690 pub fn prefix(mut self, prefix: impl Into<String>) -> Self {
691 self.prefix = Some(prefix.into());
692 self
693 }
694 #[doc = "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."]
695 pub fn marker(mut self, marker: impl Into<String>) -> Self {
696 self.marker = Some(marker.into());
697 self
698 }
699 #[doc = "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. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000."]
700 pub fn maxresults(mut self, maxresults: i64) -> Self {
701 self.maxresults = Some(maxresults);
702 self
703 }
704 #[doc = "Include this parameter to specify that the container's metadata be returned as part of the response body."]
705 pub fn include(mut self, include: Vec<String>) -> Self {
706 self.include = include;
707 self
708 }
709 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
710 pub fn timeout(mut self, timeout: i64) -> Self {
711 self.timeout = Some(timeout);
712 self
713 }
714 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
715 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
716 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
717 self
718 }
719 pub fn into_stream(self) -> azure_core::Pageable<models::ListContainersSegmentResponse, azure_core::error::Error> {
720 let make_request = move |continuation: Option<String>| {
721 let this = self.clone();
722 async move {
723 let mut url = this.url()?;
724 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
725 let bearer_token = this.client.bearer_token().await?;
726 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
727 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
728 if let Some(prefix) = &this.prefix {
729 req.url_mut().query_pairs_mut().append_pair("prefix", prefix);
730 }
731 if let Some(marker) = &this.marker {
732 req.url_mut().query_pairs_mut().append_pair("marker", marker);
733 }
734 if let Some(maxresults) = &this.maxresults {
735 req.url_mut().query_pairs_mut().append_pair("maxresults", &maxresults.to_string());
736 }
737 if let Some(timeout) = &this.timeout {
738 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
739 }
740 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
741 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
742 }
743 let req_body = azure_core::EMPTY_BODY;
744 if let Some(value) = continuation.as_ref() {
745 req.url_mut().query_pairs_mut().append_pair("marker", value);
746 }
747 req.set_body(req_body);
748 let rsp = this.client.send(&mut req).await?;
749 let rsp = match rsp.status() {
750 azure_core::StatusCode::Ok => Ok(Response(rsp)),
751 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
752 status: status_code,
753 error_code: None,
754 })),
755 };
756 rsp?.into_body().await
757 }
758 };
759 azure_core::Pageable::new(make_request)
760 }
761 fn url(&self) -> azure_core::Result<azure_core::Url> {
762 let mut url = self.client.endpoint().clone();
763 url.set_path("/?comp=list");
764 Ok(url)
765 }
766 }
767 }
768 pub mod get_user_delegation_key {
769 use super::models;
770 #[cfg(not(target_arch = "wasm32"))]
771 use futures::future::BoxFuture;
772 #[cfg(target_arch = "wasm32")]
773 use futures::future::LocalBoxFuture as BoxFuture;
774 #[derive(Debug)]
775 pub struct Response(azure_core::Response);
776 impl Response {
777 pub async fn into_body(self) -> azure_core::Result<models::UserDelegationKey> {
778 let bytes = self.0.into_body().collect().await?;
779 let body: models::UserDelegationKey = azure_core::xml::read_xml(&bytes)?;
780 Ok(body)
781 }
782 pub fn into_raw_response(self) -> azure_core::Response {
783 self.0
784 }
785 pub fn as_raw_response(&self) -> &azure_core::Response {
786 &self.0
787 }
788 pub fn headers(&self) -> Headers {
789 Headers(self.0.headers())
790 }
791 }
792 impl From<Response> for azure_core::Response {
793 fn from(rsp: Response) -> Self {
794 rsp.into_raw_response()
795 }
796 }
797 impl AsRef<azure_core::Response> for Response {
798 fn as_ref(&self) -> &azure_core::Response {
799 self.as_raw_response()
800 }
801 }
802 pub struct Headers<'a>(&'a azure_core::headers::Headers);
803 impl<'a> Headers<'a> {
804 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
805 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
806 self.0
807 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
808 }
809 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
810 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
811 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
812 }
813 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
814 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
815 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
816 }
817 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
818 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
819 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
820 }
821 }
822 #[derive(Clone)]
823 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
824 #[doc = r""]
825 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
826 #[doc = r" parameters can be chained."]
827 #[doc = r""]
828 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
829 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
830 #[doc = r" executes the request and returns a `Result` with the parsed"]
831 #[doc = r" response."]
832 #[doc = r""]
833 #[doc = r" In order to execute the request without polling the service"]
834 #[doc = r" until the operation completes, use `.send().await` instead."]
835 #[doc = r""]
836 #[doc = r" If you need lower-level access to the raw response details"]
837 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
838 #[doc = r" can finalize the request using the"]
839 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
840 #[doc = r" that resolves to a lower-level [`Response`] value."]
841 pub struct RequestBuilder {
842 pub(crate) client: super::super::Client,
843 pub(crate) key_info: models::KeyInfo,
844 pub(crate) timeout: Option<i64>,
845 pub(crate) x_ms_client_request_id: Option<String>,
846 }
847 impl RequestBuilder {
848 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
849 pub fn timeout(mut self, timeout: i64) -> Self {
850 self.timeout = Some(timeout);
851 self
852 }
853 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
854 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
855 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
856 self
857 }
858 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
859 #[doc = ""]
860 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
861 #[doc = "However, this function can provide more flexibility when required."]
862 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
863 Box::pin({
864 let this = self.clone();
865 async move {
866 let url = this.url()?;
867 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
868 let bearer_token = this.client.bearer_token().await?;
869 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
870 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
871 req.insert_header("content-type", "application/xml");
872 let req_body = azure_core::xml::to_xml(&this.key_info)?;
873 if let Some(timeout) = &this.timeout {
874 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
875 }
876 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
877 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
878 }
879 req.set_body(req_body);
880 Ok(Response(this.client.send(&mut req).await?))
881 }
882 })
883 }
884 fn url(&self) -> azure_core::Result<azure_core::Url> {
885 let mut url = self.client.endpoint().clone();
886 url.set_path("/?restype=service&comp=userdelegationkey");
887 Ok(url)
888 }
889 }
890 impl std::future::IntoFuture for RequestBuilder {
891 type Output = azure_core::Result<models::UserDelegationKey>;
892 type IntoFuture = BoxFuture<'static, azure_core::Result<models::UserDelegationKey>>;
893 #[doc = "Returns a future that sends the request and returns the parsed response body."]
894 #[doc = ""]
895 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
896 #[doc = ""]
897 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
898 fn into_future(self) -> Self::IntoFuture {
899 Box::pin(async move { self.send().await?.into_body().await })
900 }
901 }
902 }
903 pub mod get_account_info {
904 use super::models;
905 #[cfg(not(target_arch = "wasm32"))]
906 use futures::future::BoxFuture;
907 #[cfg(target_arch = "wasm32")]
908 use futures::future::LocalBoxFuture as BoxFuture;
909 #[derive(Debug)]
910 pub struct Response(azure_core::Response);
911 impl Response {
912 pub fn into_raw_response(self) -> azure_core::Response {
913 self.0
914 }
915 pub fn as_raw_response(&self) -> &azure_core::Response {
916 &self.0
917 }
918 pub fn headers(&self) -> Headers {
919 Headers(self.0.headers())
920 }
921 }
922 impl From<Response> for azure_core::Response {
923 fn from(rsp: Response) -> Self {
924 rsp.into_raw_response()
925 }
926 }
927 impl AsRef<azure_core::Response> for Response {
928 fn as_ref(&self) -> &azure_core::Response {
929 self.as_raw_response()
930 }
931 }
932 pub struct Headers<'a>(&'a azure_core::headers::Headers);
933 impl<'a> Headers<'a> {
934 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
935 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
936 self.0
937 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
938 }
939 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
940 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
941 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
942 }
943 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
944 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
945 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
946 }
947 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
948 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
949 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
950 }
951 #[doc = "Identifies the sku name of the account"]
952 pub fn x_ms_sku_name(&self) -> azure_core::Result<&str> {
953 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-sku-name"))
954 }
955 #[doc = "Identifies the account kind"]
956 pub fn x_ms_account_kind(&self) -> azure_core::Result<&str> {
957 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-account-kind"))
958 }
959 #[doc = "Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled."]
960 pub fn x_ms_is_hns_enabled(&self) -> azure_core::Result<bool> {
961 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-is-hns-enabled"))
962 }
963 }
964 #[derive(Clone)]
965 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
966 #[doc = r""]
967 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
968 #[doc = r" parameters can be chained."]
969 #[doc = r""]
970 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
971 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
972 #[doc = r" executes the request and returns a `Result` with the parsed"]
973 #[doc = r" response."]
974 #[doc = r""]
975 #[doc = r" In order to execute the request without polling the service"]
976 #[doc = r" until the operation completes, use `.send().await` instead."]
977 #[doc = r""]
978 #[doc = r" If you need lower-level access to the raw response details"]
979 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
980 #[doc = r" can finalize the request using the"]
981 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
982 #[doc = r" that resolves to a lower-level [`Response`] value."]
983 pub struct RequestBuilder {
984 pub(crate) client: super::super::Client,
985 }
986 impl RequestBuilder {
987 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
988 #[doc = ""]
989 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
990 #[doc = "However, this function can provide more flexibility when required."]
991 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
992 Box::pin({
993 let this = self.clone();
994 async move {
995 let url = this.url()?;
996 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
997 let bearer_token = this.client.bearer_token().await?;
998 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
999 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
1000 let req_body = azure_core::EMPTY_BODY;
1001 req.set_body(req_body);
1002 Ok(Response(this.client.send(&mut req).await?))
1003 }
1004 })
1005 }
1006 fn url(&self) -> azure_core::Result<azure_core::Url> {
1007 let mut url = self.client.endpoint().clone();
1008 url.set_path("/?restype=account&comp=properties");
1009 Ok(url)
1010 }
1011 }
1012 }
1013 pub mod submit_batch {
1014 use super::models;
1015 #[cfg(not(target_arch = "wasm32"))]
1016 use futures::future::BoxFuture;
1017 #[cfg(target_arch = "wasm32")]
1018 use futures::future::LocalBoxFuture as BoxFuture;
1019 #[derive(Debug)]
1020 pub struct Response(azure_core::Response);
1021 impl Response {
1022 pub async fn into_body(self) -> azure_core::Result<bytes::Bytes> {
1023 let bytes = self.0.into_body().collect().await?;
1024 let body = bytes;
1025 Ok(body)
1026 }
1027 pub fn into_raw_response(self) -> azure_core::Response {
1028 self.0
1029 }
1030 pub fn as_raw_response(&self) -> &azure_core::Response {
1031 &self.0
1032 }
1033 pub fn headers(&self) -> Headers {
1034 Headers(self.0.headers())
1035 }
1036 }
1037 impl From<Response> for azure_core::Response {
1038 fn from(rsp: Response) -> Self {
1039 rsp.into_raw_response()
1040 }
1041 }
1042 impl AsRef<azure_core::Response> for Response {
1043 fn as_ref(&self) -> &azure_core::Response {
1044 self.as_raw_response()
1045 }
1046 }
1047 pub struct Headers<'a>(&'a azure_core::headers::Headers);
1048 impl<'a> Headers<'a> {
1049 #[doc = "The media type of the body of the response. For batch requests, this is multipart/mixed; boundary=batchresponse_GUID"]
1050 pub fn content_type(&self) -> azure_core::Result<&str> {
1051 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-type"))
1052 }
1053 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
1054 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
1055 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
1056 }
1057 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
1058 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
1059 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
1060 }
1061 }
1062 #[derive(Clone)]
1063 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1064 #[doc = r""]
1065 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1066 #[doc = r" parameters can be chained."]
1067 #[doc = r""]
1068 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1069 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1070 #[doc = r" executes the request and returns a `Result` with the parsed"]
1071 #[doc = r" response."]
1072 #[doc = r""]
1073 #[doc = r" In order to execute the request without polling the service"]
1074 #[doc = r" until the operation completes, use `.send().await` instead."]
1075 #[doc = r""]
1076 #[doc = r" If you need lower-level access to the raw response details"]
1077 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1078 #[doc = r" can finalize the request using the"]
1079 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1080 #[doc = r" that resolves to a lower-level [`Response`] value."]
1081 pub struct RequestBuilder {
1082 pub(crate) client: super::super::Client,
1083 pub(crate) body: serde_json::Value,
1084 pub(crate) content_length: i64,
1085 pub(crate) content_type: String,
1086 pub(crate) timeout: Option<i64>,
1087 pub(crate) x_ms_client_request_id: Option<String>,
1088 }
1089 impl RequestBuilder {
1090 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
1091 pub fn timeout(mut self, timeout: i64) -> Self {
1092 self.timeout = Some(timeout);
1093 self
1094 }
1095 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
1096 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
1097 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
1098 self
1099 }
1100 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1101 #[doc = ""]
1102 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1103 #[doc = "However, this function can provide more flexibility when required."]
1104 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1105 Box::pin({
1106 let this = self.clone();
1107 async move {
1108 let url = this.url()?;
1109 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
1110 let bearer_token = this.client.bearer_token().await?;
1111 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1112 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
1113 let req_body = azure_core::to_json(&this.body)?;
1114 req.insert_header("content-length", this.content_length.to_string());
1115 req.insert_header("content-type", &this.content_type);
1116 if let Some(timeout) = &this.timeout {
1117 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
1118 }
1119 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
1120 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
1121 }
1122 req.set_body(req_body);
1123 Ok(Response(this.client.send(&mut req).await?))
1124 }
1125 })
1126 }
1127 fn url(&self) -> azure_core::Result<azure_core::Url> {
1128 let mut url = self.client.endpoint().clone();
1129 url.set_path("/?comp=batch");
1130 Ok(url)
1131 }
1132 }
1133 impl std::future::IntoFuture for RequestBuilder {
1134 type Output = azure_core::Result<bytes::Bytes>;
1135 type IntoFuture = BoxFuture<'static, azure_core::Result<bytes::Bytes>>;
1136 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1137 #[doc = ""]
1138 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1139 #[doc = ""]
1140 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1141 fn into_future(self) -> Self::IntoFuture {
1142 Box::pin(async move { self.send().await?.into_body().await })
1143 }
1144 }
1145 }
1146 pub mod filter_blobs {
1147 use super::models;
1148 #[cfg(not(target_arch = "wasm32"))]
1149 use futures::future::BoxFuture;
1150 #[cfg(target_arch = "wasm32")]
1151 use futures::future::LocalBoxFuture as BoxFuture;
1152 #[derive(Debug)]
1153 pub struct Response(azure_core::Response);
1154 impl Response {
1155 pub async fn into_body(self) -> azure_core::Result<models::FilterBlobSegment> {
1156 let bytes = self.0.into_body().collect().await?;
1157 let body: models::FilterBlobSegment = azure_core::xml::read_xml(&bytes)?;
1158 Ok(body)
1159 }
1160 pub fn into_raw_response(self) -> azure_core::Response {
1161 self.0
1162 }
1163 pub fn as_raw_response(&self) -> &azure_core::Response {
1164 &self.0
1165 }
1166 pub fn headers(&self) -> Headers {
1167 Headers(self.0.headers())
1168 }
1169 }
1170 impl From<Response> for azure_core::Response {
1171 fn from(rsp: Response) -> Self {
1172 rsp.into_raw_response()
1173 }
1174 }
1175 impl AsRef<azure_core::Response> for Response {
1176 fn as_ref(&self) -> &azure_core::Response {
1177 self.as_raw_response()
1178 }
1179 }
1180 pub struct Headers<'a>(&'a azure_core::headers::Headers);
1181 impl<'a> Headers<'a> {
1182 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
1183 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
1184 self.0
1185 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
1186 }
1187 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
1188 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
1189 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
1190 }
1191 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
1192 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
1193 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
1194 }
1195 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
1196 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
1197 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
1198 }
1199 }
1200 #[derive(Clone)]
1201 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1202 #[doc = r""]
1203 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1204 #[doc = r" parameters can be chained."]
1205 #[doc = r""]
1206 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1207 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1208 #[doc = r" executes the request and returns a `Result` with the parsed"]
1209 #[doc = r" response."]
1210 #[doc = r""]
1211 #[doc = r" In order to execute the request without polling the service"]
1212 #[doc = r" until the operation completes, use `.send().await` instead."]
1213 #[doc = r""]
1214 #[doc = r" If you need lower-level access to the raw response details"]
1215 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1216 #[doc = r" can finalize the request using the"]
1217 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1218 #[doc = r" that resolves to a lower-level [`Response`] value."]
1219 pub struct RequestBuilder {
1220 pub(crate) client: super::super::Client,
1221 pub(crate) timeout: Option<i64>,
1222 pub(crate) x_ms_client_request_id: Option<String>,
1223 pub(crate) where_: Option<String>,
1224 pub(crate) marker: Option<String>,
1225 pub(crate) maxresults: Option<i64>,
1226 pub(crate) include: Vec<String>,
1227 }
1228 impl RequestBuilder {
1229 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
1230 pub fn timeout(mut self, timeout: i64) -> Self {
1231 self.timeout = Some(timeout);
1232 self
1233 }
1234 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
1235 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
1236 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
1237 self
1238 }
1239 #[doc = "Filters the results to return only to return only blobs whose tags match the specified expression."]
1240 pub fn where_(mut self, where_: impl Into<String>) -> Self {
1241 self.where_ = Some(where_.into());
1242 self
1243 }
1244 #[doc = "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."]
1245 pub fn marker(mut self, marker: impl Into<String>) -> Self {
1246 self.marker = Some(marker.into());
1247 self
1248 }
1249 #[doc = "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. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000."]
1250 pub fn maxresults(mut self, maxresults: i64) -> Self {
1251 self.maxresults = Some(maxresults);
1252 self
1253 }
1254 #[doc = "Include this parameter to specify one or more datasets to include in the response."]
1255 pub fn include(mut self, include: Vec<String>) -> Self {
1256 self.include = include;
1257 self
1258 }
1259 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1260 #[doc = ""]
1261 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1262 #[doc = "However, this function can provide more flexibility when required."]
1263 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1264 Box::pin({
1265 let this = self.clone();
1266 async move {
1267 let url = this.url()?;
1268 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1269 let bearer_token = this.client.bearer_token().await?;
1270 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1271 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
1272 if let Some(timeout) = &this.timeout {
1273 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
1274 }
1275 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
1276 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
1277 }
1278 if let Some(where_) = &this.where_ {
1279 req.url_mut().query_pairs_mut().append_pair("where", where_);
1280 }
1281 if let Some(marker) = &this.marker {
1282 req.url_mut().query_pairs_mut().append_pair("marker", marker);
1283 }
1284 if let Some(maxresults) = &this.maxresults {
1285 req.url_mut().query_pairs_mut().append_pair("maxresults", &maxresults.to_string());
1286 }
1287 let req_body = azure_core::EMPTY_BODY;
1288 req.set_body(req_body);
1289 Ok(Response(this.client.send(&mut req).await?))
1290 }
1291 })
1292 }
1293 fn url(&self) -> azure_core::Result<azure_core::Url> {
1294 let mut url = self.client.endpoint().clone();
1295 url.set_path("/?comp=blobs");
1296 Ok(url)
1297 }
1298 }
1299 impl std::future::IntoFuture for RequestBuilder {
1300 type Output = azure_core::Result<models::FilterBlobSegment>;
1301 type IntoFuture = BoxFuture<'static, azure_core::Result<models::FilterBlobSegment>>;
1302 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1303 #[doc = ""]
1304 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1305 #[doc = ""]
1306 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1307 fn into_future(self) -> Self::IntoFuture {
1308 Box::pin(async move { self.send().await?.into_body().await })
1309 }
1310 }
1311 }
1312}
1313pub mod container {
1314 use super::models;
1315 #[cfg(not(target_arch = "wasm32"))]
1316 use futures::future::BoxFuture;
1317 #[cfg(target_arch = "wasm32")]
1318 use futures::future::LocalBoxFuture as BoxFuture;
1319 pub struct Client(pub(crate) super::Client);
1320 impl Client {
1321 #[doc = "returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs"]
1322 #[doc = ""]
1323 #[doc = "Arguments:"]
1324 #[doc = "* `container_name`: The container name."]
1325 pub fn get_properties(&self, container_name: impl Into<String>) -> get_properties::RequestBuilder {
1326 get_properties::RequestBuilder {
1327 client: self.0.clone(),
1328 container_name: container_name.into(),
1329 timeout: None,
1330 x_ms_lease_id: None,
1331 x_ms_client_request_id: None,
1332 }
1333 }
1334 #[doc = "creates a new container under the specified account. If the container with the same name already exists, the operation fails"]
1335 #[doc = ""]
1336 #[doc = "Arguments:"]
1337 #[doc = "* `container_name`: The container name."]
1338 pub fn create(&self, container_name: impl Into<String>) -> create::RequestBuilder {
1339 create::RequestBuilder {
1340 client: self.0.clone(),
1341 container_name: container_name.into(),
1342 timeout: None,
1343 x_ms_meta: None,
1344 x_ms_blob_public_access: None,
1345 x_ms_client_request_id: None,
1346 x_ms_default_encryption_scope: None,
1347 x_ms_deny_encryption_scope_override: None,
1348 }
1349 }
1350 #[doc = "operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection"]
1351 #[doc = ""]
1352 #[doc = "Arguments:"]
1353 #[doc = "* `container_name`: The container name."]
1354 pub fn delete(&self, container_name: impl Into<String>) -> delete::RequestBuilder {
1355 delete::RequestBuilder {
1356 client: self.0.clone(),
1357 container_name: container_name.into(),
1358 timeout: None,
1359 x_ms_lease_id: None,
1360 if_modified_since: None,
1361 if_unmodified_since: None,
1362 x_ms_client_request_id: None,
1363 }
1364 }
1365 #[doc = "operation sets one or more user-defined name-value pairs for the specified container."]
1366 #[doc = ""]
1367 #[doc = "Arguments:"]
1368 #[doc = "* `container_name`: The container name."]
1369 pub fn set_metadata(&self, container_name: impl Into<String>) -> set_metadata::RequestBuilder {
1370 set_metadata::RequestBuilder {
1371 client: self.0.clone(),
1372 container_name: container_name.into(),
1373 timeout: None,
1374 x_ms_lease_id: None,
1375 x_ms_meta: None,
1376 if_modified_since: None,
1377 x_ms_client_request_id: None,
1378 }
1379 }
1380 #[doc = "gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly."]
1381 #[doc = ""]
1382 #[doc = "Arguments:"]
1383 #[doc = "* `container_name`: The container name."]
1384 pub fn get_access_policy(&self, container_name: impl Into<String>) -> get_access_policy::RequestBuilder {
1385 get_access_policy::RequestBuilder {
1386 client: self.0.clone(),
1387 container_name: container_name.into(),
1388 timeout: None,
1389 x_ms_lease_id: None,
1390 x_ms_client_request_id: None,
1391 }
1392 }
1393 #[doc = "sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly."]
1394 #[doc = ""]
1395 #[doc = "Arguments:"]
1396 #[doc = "* `container_name`: The container name."]
1397 pub fn set_access_policy(&self, container_name: impl Into<String>) -> set_access_policy::RequestBuilder {
1398 set_access_policy::RequestBuilder {
1399 client: self.0.clone(),
1400 container_name: container_name.into(),
1401 container_acl: None,
1402 timeout: None,
1403 x_ms_lease_id: None,
1404 x_ms_blob_public_access: None,
1405 if_modified_since: None,
1406 if_unmodified_since: None,
1407 x_ms_client_request_id: None,
1408 }
1409 }
1410 #[doc = "Restores a previously-deleted container."]
1411 #[doc = ""]
1412 #[doc = "Arguments:"]
1413 #[doc = "* `container_name`: The container name."]
1414 pub fn restore(&self, container_name: impl Into<String>) -> restore::RequestBuilder {
1415 restore::RequestBuilder {
1416 client: self.0.clone(),
1417 container_name: container_name.into(),
1418 timeout: None,
1419 x_ms_client_request_id: None,
1420 x_ms_deleted_container_name: None,
1421 x_ms_deleted_container_version: None,
1422 }
1423 }
1424 #[doc = "Renames an existing container."]
1425 #[doc = ""]
1426 #[doc = "Arguments:"]
1427 #[doc = "* `container_name`: The container name."]
1428 #[doc = "* `x_ms_source_container_name`: Required. Specifies the name of the container to rename."]
1429 pub fn rename(&self, container_name: impl Into<String>, x_ms_source_container_name: impl Into<String>) -> rename::RequestBuilder {
1430 rename::RequestBuilder {
1431 client: self.0.clone(),
1432 container_name: container_name.into(),
1433 x_ms_source_container_name: x_ms_source_container_name.into(),
1434 timeout: None,
1435 x_ms_client_request_id: None,
1436 x_ms_source_lease_id: None,
1437 }
1438 }
1439 #[doc = "The Batch operation allows multiple API calls to be embedded into a single HTTP request."]
1440 #[doc = ""]
1441 #[doc = "Arguments:"]
1442 #[doc = "* `container_name`: The container name."]
1443 #[doc = "* `body`: Initial data"]
1444 #[doc = "* `content_length`: The length of the request."]
1445 #[doc = "* `content_type`: Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_<GUID>"]
1446 pub fn submit_batch(
1447 &self,
1448 container_name: impl Into<String>,
1449 body: impl Into<serde_json::Value>,
1450 content_length: i64,
1451 content_type: impl Into<String>,
1452 ) -> submit_batch::RequestBuilder {
1453 submit_batch::RequestBuilder {
1454 client: self.0.clone(),
1455 container_name: container_name.into(),
1456 body: body.into(),
1457 content_length,
1458 content_type: content_type.into(),
1459 timeout: None,
1460 x_ms_client_request_id: None,
1461 }
1462 }
1463 #[doc = "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."]
1464 #[doc = ""]
1465 #[doc = "Arguments:"]
1466 #[doc = "* `container_name`: The container name."]
1467 pub fn filter_blobs(&self, container_name: impl Into<String>) -> filter_blobs::RequestBuilder {
1468 filter_blobs::RequestBuilder {
1469 client: self.0.clone(),
1470 container_name: container_name.into(),
1471 timeout: None,
1472 x_ms_client_request_id: None,
1473 where_: None,
1474 marker: None,
1475 maxresults: None,
1476 include: Vec::new(),
1477 }
1478 }
1479 #[doc = "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite"]
1480 #[doc = ""]
1481 #[doc = "Arguments:"]
1482 #[doc = "* `container_name`: The container name."]
1483 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
1484 pub fn acquire_lease(
1485 &self,
1486 container_name: impl Into<String>,
1487 x_ms_lease_action: impl Into<String>,
1488 ) -> acquire_lease::RequestBuilder {
1489 acquire_lease::RequestBuilder {
1490 client: self.0.clone(),
1491 container_name: container_name.into(),
1492 x_ms_lease_action: x_ms_lease_action.into(),
1493 timeout: None,
1494 x_ms_lease_duration: None,
1495 x_ms_proposed_lease_id: None,
1496 if_modified_since: None,
1497 if_unmodified_since: None,
1498 x_ms_client_request_id: None,
1499 }
1500 }
1501 #[doc = "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite"]
1502 #[doc = ""]
1503 #[doc = "Arguments:"]
1504 #[doc = "* `container_name`: The container name."]
1505 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
1506 #[doc = "* `x_ms_lease_id`: Specifies the current lease ID on the resource."]
1507 pub fn release_lease(
1508 &self,
1509 container_name: impl Into<String>,
1510 x_ms_lease_action: impl Into<String>,
1511 x_ms_lease_id: impl Into<String>,
1512 ) -> release_lease::RequestBuilder {
1513 release_lease::RequestBuilder {
1514 client: self.0.clone(),
1515 container_name: container_name.into(),
1516 x_ms_lease_action: x_ms_lease_action.into(),
1517 x_ms_lease_id: x_ms_lease_id.into(),
1518 timeout: None,
1519 if_modified_since: None,
1520 if_unmodified_since: None,
1521 x_ms_client_request_id: None,
1522 }
1523 }
1524 #[doc = "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite"]
1525 #[doc = ""]
1526 #[doc = "Arguments:"]
1527 #[doc = "* `container_name`: The container name."]
1528 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
1529 #[doc = "* `x_ms_lease_id`: Specifies the current lease ID on the resource."]
1530 pub fn renew_lease(
1531 &self,
1532 container_name: impl Into<String>,
1533 x_ms_lease_action: impl Into<String>,
1534 x_ms_lease_id: impl Into<String>,
1535 ) -> renew_lease::RequestBuilder {
1536 renew_lease::RequestBuilder {
1537 client: self.0.clone(),
1538 container_name: container_name.into(),
1539 x_ms_lease_action: x_ms_lease_action.into(),
1540 x_ms_lease_id: x_ms_lease_id.into(),
1541 timeout: None,
1542 if_modified_since: None,
1543 if_unmodified_since: None,
1544 x_ms_client_request_id: None,
1545 }
1546 }
1547 #[doc = "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite"]
1548 #[doc = ""]
1549 #[doc = "Arguments:"]
1550 #[doc = "* `container_name`: The container name."]
1551 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
1552 pub fn break_lease(&self, container_name: impl Into<String>, x_ms_lease_action: impl Into<String>) -> break_lease::RequestBuilder {
1553 break_lease::RequestBuilder {
1554 client: self.0.clone(),
1555 container_name: container_name.into(),
1556 x_ms_lease_action: x_ms_lease_action.into(),
1557 timeout: None,
1558 x_ms_lease_break_period: None,
1559 if_modified_since: None,
1560 if_unmodified_since: None,
1561 x_ms_client_request_id: None,
1562 }
1563 }
1564 #[doc = "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite"]
1565 #[doc = ""]
1566 #[doc = "Arguments:"]
1567 #[doc = "* `container_name`: The container name."]
1568 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
1569 #[doc = "* `x_ms_lease_id`: Specifies the current lease ID on the resource."]
1570 #[doc = "* `x_ms_proposed_lease_id`: Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats."]
1571 pub fn change_lease(
1572 &self,
1573 container_name: impl Into<String>,
1574 x_ms_lease_action: impl Into<String>,
1575 x_ms_lease_id: impl Into<String>,
1576 x_ms_proposed_lease_id: impl Into<String>,
1577 ) -> change_lease::RequestBuilder {
1578 change_lease::RequestBuilder {
1579 client: self.0.clone(),
1580 container_name: container_name.into(),
1581 x_ms_lease_action: x_ms_lease_action.into(),
1582 x_ms_lease_id: x_ms_lease_id.into(),
1583 x_ms_proposed_lease_id: x_ms_proposed_lease_id.into(),
1584 timeout: None,
1585 if_modified_since: None,
1586 if_unmodified_since: None,
1587 x_ms_client_request_id: None,
1588 }
1589 }
1590 #[doc = "[Update] The List Blobs operation returns a list of the blobs under the specified container"]
1591 #[doc = ""]
1592 #[doc = "Arguments:"]
1593 #[doc = "* `container_name`: The container name."]
1594 pub fn list_blob_flat_segment(&self, container_name: impl Into<String>) -> list_blob_flat_segment::RequestBuilder {
1595 list_blob_flat_segment::RequestBuilder {
1596 client: self.0.clone(),
1597 container_name: container_name.into(),
1598 prefix: None,
1599 marker: None,
1600 maxresults: None,
1601 include: Vec::new(),
1602 timeout: None,
1603 x_ms_client_request_id: None,
1604 }
1605 }
1606 #[doc = "[Update] The List Blobs operation returns a list of the blobs under the specified container"]
1607 #[doc = ""]
1608 #[doc = "Arguments:"]
1609 #[doc = "* `container_name`: The container name."]
1610 #[doc = "* `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."]
1611 pub fn list_blob_hierarchy_segment(
1612 &self,
1613 container_name: impl Into<String>,
1614 delimiter: impl Into<String>,
1615 ) -> list_blob_hierarchy_segment::RequestBuilder {
1616 list_blob_hierarchy_segment::RequestBuilder {
1617 client: self.0.clone(),
1618 container_name: container_name.into(),
1619 delimiter: delimiter.into(),
1620 prefix: None,
1621 marker: None,
1622 maxresults: None,
1623 include: Vec::new(),
1624 timeout: None,
1625 x_ms_client_request_id: None,
1626 }
1627 }
1628 #[doc = "Returns the sku name and account kind "]
1629 #[doc = ""]
1630 #[doc = "Arguments:"]
1631 #[doc = "* `container_name`: The container name."]
1632 pub fn get_account_info(&self, container_name: impl Into<String>) -> get_account_info::RequestBuilder {
1633 get_account_info::RequestBuilder {
1634 client: self.0.clone(),
1635 container_name: container_name.into(),
1636 }
1637 }
1638 }
1639 pub mod get_properties {
1640 use super::models;
1641 #[cfg(not(target_arch = "wasm32"))]
1642 use futures::future::BoxFuture;
1643 #[cfg(target_arch = "wasm32")]
1644 use futures::future::LocalBoxFuture as BoxFuture;
1645 #[derive(Debug)]
1646 pub struct Response(azure_core::Response);
1647 impl Response {
1648 pub fn into_raw_response(self) -> azure_core::Response {
1649 self.0
1650 }
1651 pub fn as_raw_response(&self) -> &azure_core::Response {
1652 &self.0
1653 }
1654 pub fn headers(&self) -> Headers {
1655 Headers(self.0.headers())
1656 }
1657 }
1658 impl From<Response> for azure_core::Response {
1659 fn from(rsp: Response) -> Self {
1660 rsp.into_raw_response()
1661 }
1662 }
1663 impl AsRef<azure_core::Response> for Response {
1664 fn as_ref(&self) -> &azure_core::Response {
1665 self.as_raw_response()
1666 }
1667 }
1668 pub struct Headers<'a>(&'a azure_core::headers::Headers);
1669 impl<'a> Headers<'a> {
1670 pub fn x_ms_meta(&self) -> azure_core::Result<&str> {
1671 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-meta"))
1672 }
1673 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
1674 pub fn e_tag(&self) -> azure_core::Result<&str> {
1675 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
1676 }
1677 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
1678 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
1679 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
1680 }
1681 #[doc = "When a blob is leased, specifies whether the lease is of infinite or fixed duration."]
1682 pub fn x_ms_lease_duration(&self) -> azure_core::Result<&str> {
1683 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-duration"))
1684 }
1685 #[doc = "Lease state of the blob."]
1686 pub fn x_ms_lease_state(&self) -> azure_core::Result<&str> {
1687 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-state"))
1688 }
1689 #[doc = "The current lease status of the blob."]
1690 pub fn x_ms_lease_status(&self) -> azure_core::Result<&str> {
1691 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-status"))
1692 }
1693 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
1694 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
1695 self.0
1696 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
1697 }
1698 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
1699 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
1700 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
1701 }
1702 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
1703 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
1704 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
1705 }
1706 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
1707 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
1708 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
1709 }
1710 #[doc = "Indicated whether data in the container may be accessed publicly and the level of access"]
1711 pub fn x_ms_blob_public_access(&self) -> azure_core::Result<&str> {
1712 self.0
1713 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-blob-public-access"))
1714 }
1715 #[doc = "Indicates whether the container has an immutability policy set on it."]
1716 pub fn x_ms_has_immutability_policy(&self) -> azure_core::Result<bool> {
1717 self.0
1718 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-has-immutability-policy"))
1719 }
1720 #[doc = "Indicates whether the container has a legal hold."]
1721 pub fn x_ms_has_legal_hold(&self) -> azure_core::Result<bool> {
1722 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-has-legal-hold"))
1723 }
1724 #[doc = "The default encryption scope for the container."]
1725 pub fn x_ms_default_encryption_scope(&self) -> azure_core::Result<&str> {
1726 self.0
1727 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-default-encryption-scope"))
1728 }
1729 #[doc = "Indicates whether the container's default encryption scope can be overriden."]
1730 pub fn x_ms_deny_encryption_scope_override(&self) -> azure_core::Result<bool> {
1731 self.0
1732 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-deny-encryption-scope-override"))
1733 }
1734 #[doc = "Indicates whether version level worm is enabled on a container."]
1735 pub fn x_ms_immutable_storage_with_versioning_enabled(&self) -> azure_core::Result<bool> {
1736 self.0.get_as(&azure_core::headers::HeaderName::from_static(
1737 "x-ms-immutable-storage-with-versioning-enabled",
1738 ))
1739 }
1740 }
1741 #[derive(Clone)]
1742 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1743 #[doc = r""]
1744 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1745 #[doc = r" parameters can be chained."]
1746 #[doc = r""]
1747 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1748 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1749 #[doc = r" executes the request and returns a `Result` with the parsed"]
1750 #[doc = r" response."]
1751 #[doc = r""]
1752 #[doc = r" In order to execute the request without polling the service"]
1753 #[doc = r" until the operation completes, use `.send().await` instead."]
1754 #[doc = r""]
1755 #[doc = r" If you need lower-level access to the raw response details"]
1756 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1757 #[doc = r" can finalize the request using the"]
1758 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1759 #[doc = r" that resolves to a lower-level [`Response`] value."]
1760 pub struct RequestBuilder {
1761 pub(crate) client: super::super::Client,
1762 pub(crate) container_name: String,
1763 pub(crate) timeout: Option<i64>,
1764 pub(crate) x_ms_lease_id: Option<String>,
1765 pub(crate) x_ms_client_request_id: Option<String>,
1766 }
1767 impl RequestBuilder {
1768 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
1769 pub fn timeout(mut self, timeout: i64) -> Self {
1770 self.timeout = Some(timeout);
1771 self
1772 }
1773 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
1774 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
1775 self.x_ms_lease_id = Some(x_ms_lease_id.into());
1776 self
1777 }
1778 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
1779 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
1780 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
1781 self
1782 }
1783 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1784 #[doc = ""]
1785 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1786 #[doc = "However, this function can provide more flexibility when required."]
1787 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1788 Box::pin({
1789 let this = self.clone();
1790 async move {
1791 let url = this.url()?;
1792 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1793 let bearer_token = this.client.bearer_token().await?;
1794 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1795 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
1796 if let Some(timeout) = &this.timeout {
1797 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
1798 }
1799 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
1800 req.insert_header("x-ms-lease-id", x_ms_lease_id);
1801 }
1802 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
1803 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
1804 }
1805 let req_body = azure_core::EMPTY_BODY;
1806 req.set_body(req_body);
1807 Ok(Response(this.client.send(&mut req).await?))
1808 }
1809 })
1810 }
1811 fn url(&self) -> azure_core::Result<azure_core::Url> {
1812 let mut url = self.client.endpoint().clone();
1813 url.set_path(&format!("/{}?restype=container", &self.container_name));
1814 Ok(url)
1815 }
1816 }
1817 }
1818 pub mod create {
1819 use super::models;
1820 #[cfg(not(target_arch = "wasm32"))]
1821 use futures::future::BoxFuture;
1822 #[cfg(target_arch = "wasm32")]
1823 use futures::future::LocalBoxFuture as BoxFuture;
1824 #[derive(Debug)]
1825 pub struct Response(azure_core::Response);
1826 impl Response {
1827 pub fn into_raw_response(self) -> azure_core::Response {
1828 self.0
1829 }
1830 pub fn as_raw_response(&self) -> &azure_core::Response {
1831 &self.0
1832 }
1833 pub fn headers(&self) -> Headers {
1834 Headers(self.0.headers())
1835 }
1836 }
1837 impl From<Response> for azure_core::Response {
1838 fn from(rsp: Response) -> Self {
1839 rsp.into_raw_response()
1840 }
1841 }
1842 impl AsRef<azure_core::Response> for Response {
1843 fn as_ref(&self) -> &azure_core::Response {
1844 self.as_raw_response()
1845 }
1846 }
1847 pub struct Headers<'a>(&'a azure_core::headers::Headers);
1848 impl<'a> Headers<'a> {
1849 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
1850 pub fn e_tag(&self) -> azure_core::Result<&str> {
1851 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
1852 }
1853 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
1854 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
1855 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
1856 }
1857 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
1858 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
1859 self.0
1860 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
1861 }
1862 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
1863 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
1864 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
1865 }
1866 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
1867 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
1868 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
1869 }
1870 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
1871 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
1872 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
1873 }
1874 }
1875 #[derive(Clone)]
1876 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1877 #[doc = r""]
1878 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1879 #[doc = r" parameters can be chained."]
1880 #[doc = r""]
1881 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1882 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1883 #[doc = r" executes the request and returns a `Result` with the parsed"]
1884 #[doc = r" response."]
1885 #[doc = r""]
1886 #[doc = r" In order to execute the request without polling the service"]
1887 #[doc = r" until the operation completes, use `.send().await` instead."]
1888 #[doc = r""]
1889 #[doc = r" If you need lower-level access to the raw response details"]
1890 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1891 #[doc = r" can finalize the request using the"]
1892 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1893 #[doc = r" that resolves to a lower-level [`Response`] value."]
1894 pub struct RequestBuilder {
1895 pub(crate) client: super::super::Client,
1896 pub(crate) container_name: String,
1897 pub(crate) timeout: Option<i64>,
1898 pub(crate) x_ms_meta: Option<String>,
1899 pub(crate) x_ms_blob_public_access: Option<String>,
1900 pub(crate) x_ms_client_request_id: Option<String>,
1901 pub(crate) x_ms_default_encryption_scope: Option<String>,
1902 pub(crate) x_ms_deny_encryption_scope_override: Option<bool>,
1903 }
1904 impl RequestBuilder {
1905 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
1906 pub fn timeout(mut self, timeout: i64) -> Self {
1907 self.timeout = Some(timeout);
1908 self
1909 }
1910 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
1911 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
1912 self.x_ms_meta = Some(x_ms_meta.into());
1913 self
1914 }
1915 #[doc = "Specifies whether data in the container may be accessed publicly and the level of access"]
1916 pub fn x_ms_blob_public_access(mut self, x_ms_blob_public_access: impl Into<String>) -> Self {
1917 self.x_ms_blob_public_access = Some(x_ms_blob_public_access.into());
1918 self
1919 }
1920 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
1921 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
1922 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
1923 self
1924 }
1925 #[doc = "Optional. Version 2019-07-07 and later. Specifies the default encryption scope to set on the container and use for all future writes."]
1926 pub fn x_ms_default_encryption_scope(mut self, x_ms_default_encryption_scope: impl Into<String>) -> Self {
1927 self.x_ms_default_encryption_scope = Some(x_ms_default_encryption_scope.into());
1928 self
1929 }
1930 #[doc = "Optional. Version 2019-07-07 and newer. If true, prevents any request from specifying a different encryption scope than the scope set on the container."]
1931 pub fn x_ms_deny_encryption_scope_override(mut self, x_ms_deny_encryption_scope_override: bool) -> Self {
1932 self.x_ms_deny_encryption_scope_override = Some(x_ms_deny_encryption_scope_override);
1933 self
1934 }
1935 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1936 #[doc = ""]
1937 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1938 #[doc = "However, this function can provide more flexibility when required."]
1939 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1940 Box::pin({
1941 let this = self.clone();
1942 async move {
1943 let url = this.url()?;
1944 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
1945 let bearer_token = this.client.bearer_token().await?;
1946 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1947 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
1948 if let Some(timeout) = &this.timeout {
1949 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
1950 }
1951 if let Some(x_ms_meta) = &this.x_ms_meta {
1952 req.insert_header("x-ms-meta", x_ms_meta);
1953 }
1954 if let Some(x_ms_blob_public_access) = &this.x_ms_blob_public_access {
1955 req.insert_header("x-ms-blob-public-access", x_ms_blob_public_access);
1956 }
1957 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
1958 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
1959 }
1960 if let Some(x_ms_default_encryption_scope) = &this.x_ms_default_encryption_scope {
1961 req.insert_header("x-ms-default-encryption-scope", x_ms_default_encryption_scope);
1962 }
1963 if let Some(x_ms_deny_encryption_scope_override) = &this.x_ms_deny_encryption_scope_override {
1964 req.insert_header(
1965 "x-ms-deny-encryption-scope-override",
1966 x_ms_deny_encryption_scope_override.to_string(),
1967 );
1968 }
1969 let req_body = azure_core::EMPTY_BODY;
1970 req.set_body(req_body);
1971 Ok(Response(this.client.send(&mut req).await?))
1972 }
1973 })
1974 }
1975 fn url(&self) -> azure_core::Result<azure_core::Url> {
1976 let mut url = self.client.endpoint().clone();
1977 url.set_path(&format!("/{}?restype=container", &self.container_name));
1978 Ok(url)
1979 }
1980 }
1981 }
1982 pub mod delete {
1983 use super::models;
1984 #[cfg(not(target_arch = "wasm32"))]
1985 use futures::future::BoxFuture;
1986 #[cfg(target_arch = "wasm32")]
1987 use futures::future::LocalBoxFuture as BoxFuture;
1988 #[derive(Debug)]
1989 pub struct Response(azure_core::Response);
1990 impl Response {
1991 pub fn into_raw_response(self) -> azure_core::Response {
1992 self.0
1993 }
1994 pub fn as_raw_response(&self) -> &azure_core::Response {
1995 &self.0
1996 }
1997 pub fn headers(&self) -> Headers {
1998 Headers(self.0.headers())
1999 }
2000 }
2001 impl From<Response> for azure_core::Response {
2002 fn from(rsp: Response) -> Self {
2003 rsp.into_raw_response()
2004 }
2005 }
2006 impl AsRef<azure_core::Response> for Response {
2007 fn as_ref(&self) -> &azure_core::Response {
2008 self.as_raw_response()
2009 }
2010 }
2011 pub struct Headers<'a>(&'a azure_core::headers::Headers);
2012 impl<'a> Headers<'a> {
2013 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
2014 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
2015 self.0
2016 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
2017 }
2018 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
2019 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
2020 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
2021 }
2022 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
2023 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
2024 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
2025 }
2026 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
2027 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
2028 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
2029 }
2030 }
2031 #[derive(Clone)]
2032 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2033 #[doc = r""]
2034 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2035 #[doc = r" parameters can be chained."]
2036 #[doc = r""]
2037 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2038 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2039 #[doc = r" executes the request and returns a `Result` with the parsed"]
2040 #[doc = r" response."]
2041 #[doc = r""]
2042 #[doc = r" In order to execute the request without polling the service"]
2043 #[doc = r" until the operation completes, use `.send().await` instead."]
2044 #[doc = r""]
2045 #[doc = r" If you need lower-level access to the raw response details"]
2046 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2047 #[doc = r" can finalize the request using the"]
2048 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2049 #[doc = r" that resolves to a lower-level [`Response`] value."]
2050 pub struct RequestBuilder {
2051 pub(crate) client: super::super::Client,
2052 pub(crate) container_name: String,
2053 pub(crate) timeout: Option<i64>,
2054 pub(crate) x_ms_lease_id: Option<String>,
2055 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
2056 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
2057 pub(crate) x_ms_client_request_id: Option<String>,
2058 }
2059 impl RequestBuilder {
2060 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
2061 pub fn timeout(mut self, timeout: i64) -> Self {
2062 self.timeout = Some(timeout);
2063 self
2064 }
2065 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
2066 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
2067 self.x_ms_lease_id = Some(x_ms_lease_id.into());
2068 self
2069 }
2070 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
2071 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
2072 self.if_modified_since = Some(if_modified_since.into());
2073 self
2074 }
2075 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
2076 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
2077 self.if_unmodified_since = Some(if_unmodified_since.into());
2078 self
2079 }
2080 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
2081 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
2082 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
2083 self
2084 }
2085 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2086 #[doc = ""]
2087 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2088 #[doc = "However, this function can provide more flexibility when required."]
2089 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2090 Box::pin({
2091 let this = self.clone();
2092 async move {
2093 let url = this.url()?;
2094 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
2095 let bearer_token = this.client.bearer_token().await?;
2096 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2097 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
2098 if let Some(timeout) = &this.timeout {
2099 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
2100 }
2101 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
2102 req.insert_header("x-ms-lease-id", x_ms_lease_id);
2103 }
2104 if let Some(if_modified_since) = &this.if_modified_since {
2105 req.insert_header("if-modified-since", if_modified_since.to_string());
2106 }
2107 if let Some(if_unmodified_since) = &this.if_unmodified_since {
2108 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
2109 }
2110 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
2111 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
2112 }
2113 let req_body = azure_core::EMPTY_BODY;
2114 req.set_body(req_body);
2115 Ok(Response(this.client.send(&mut req).await?))
2116 }
2117 })
2118 }
2119 fn url(&self) -> azure_core::Result<azure_core::Url> {
2120 let mut url = self.client.endpoint().clone();
2121 url.set_path(&format!("/{}?restype=container", &self.container_name));
2122 Ok(url)
2123 }
2124 }
2125 }
2126 pub mod set_metadata {
2127 use super::models;
2128 #[cfg(not(target_arch = "wasm32"))]
2129 use futures::future::BoxFuture;
2130 #[cfg(target_arch = "wasm32")]
2131 use futures::future::LocalBoxFuture as BoxFuture;
2132 #[derive(Debug)]
2133 pub struct Response(azure_core::Response);
2134 impl Response {
2135 pub fn into_raw_response(self) -> azure_core::Response {
2136 self.0
2137 }
2138 pub fn as_raw_response(&self) -> &azure_core::Response {
2139 &self.0
2140 }
2141 pub fn headers(&self) -> Headers {
2142 Headers(self.0.headers())
2143 }
2144 }
2145 impl From<Response> for azure_core::Response {
2146 fn from(rsp: Response) -> Self {
2147 rsp.into_raw_response()
2148 }
2149 }
2150 impl AsRef<azure_core::Response> for Response {
2151 fn as_ref(&self) -> &azure_core::Response {
2152 self.as_raw_response()
2153 }
2154 }
2155 pub struct Headers<'a>(&'a azure_core::headers::Headers);
2156 impl<'a> Headers<'a> {
2157 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
2158 pub fn e_tag(&self) -> azure_core::Result<&str> {
2159 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
2160 }
2161 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
2162 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
2163 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
2164 }
2165 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
2166 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
2167 self.0
2168 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
2169 }
2170 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
2171 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
2172 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
2173 }
2174 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
2175 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
2176 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
2177 }
2178 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
2179 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
2180 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
2181 }
2182 }
2183 #[derive(Clone)]
2184 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2185 #[doc = r""]
2186 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2187 #[doc = r" parameters can be chained."]
2188 #[doc = r""]
2189 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2190 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2191 #[doc = r" executes the request and returns a `Result` with the parsed"]
2192 #[doc = r" response."]
2193 #[doc = r""]
2194 #[doc = r" In order to execute the request without polling the service"]
2195 #[doc = r" until the operation completes, use `.send().await` instead."]
2196 #[doc = r""]
2197 #[doc = r" If you need lower-level access to the raw response details"]
2198 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2199 #[doc = r" can finalize the request using the"]
2200 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2201 #[doc = r" that resolves to a lower-level [`Response`] value."]
2202 pub struct RequestBuilder {
2203 pub(crate) client: super::super::Client,
2204 pub(crate) container_name: String,
2205 pub(crate) timeout: Option<i64>,
2206 pub(crate) x_ms_lease_id: Option<String>,
2207 pub(crate) x_ms_meta: Option<String>,
2208 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
2209 pub(crate) x_ms_client_request_id: Option<String>,
2210 }
2211 impl RequestBuilder {
2212 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
2213 pub fn timeout(mut self, timeout: i64) -> Self {
2214 self.timeout = Some(timeout);
2215 self
2216 }
2217 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
2218 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
2219 self.x_ms_lease_id = Some(x_ms_lease_id.into());
2220 self
2221 }
2222 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
2223 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
2224 self.x_ms_meta = Some(x_ms_meta.into());
2225 self
2226 }
2227 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
2228 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
2229 self.if_modified_since = Some(if_modified_since.into());
2230 self
2231 }
2232 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
2233 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
2234 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
2235 self
2236 }
2237 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2238 #[doc = ""]
2239 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2240 #[doc = "However, this function can provide more flexibility when required."]
2241 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2242 Box::pin({
2243 let this = self.clone();
2244 async move {
2245 let url = this.url()?;
2246 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
2247 let bearer_token = this.client.bearer_token().await?;
2248 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2249 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
2250 if let Some(timeout) = &this.timeout {
2251 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
2252 }
2253 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
2254 req.insert_header("x-ms-lease-id", x_ms_lease_id);
2255 }
2256 if let Some(x_ms_meta) = &this.x_ms_meta {
2257 req.insert_header("x-ms-meta", x_ms_meta);
2258 }
2259 if let Some(if_modified_since) = &this.if_modified_since {
2260 req.insert_header("if-modified-since", if_modified_since.to_string());
2261 }
2262 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
2263 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
2264 }
2265 let req_body = azure_core::EMPTY_BODY;
2266 req.set_body(req_body);
2267 Ok(Response(this.client.send(&mut req).await?))
2268 }
2269 })
2270 }
2271 fn url(&self) -> azure_core::Result<azure_core::Url> {
2272 let mut url = self.client.endpoint().clone();
2273 url.set_path(&format!("/{}?restype=container&comp=metadata", &self.container_name));
2274 Ok(url)
2275 }
2276 }
2277 }
2278 pub mod get_access_policy {
2279 use super::models;
2280 #[cfg(not(target_arch = "wasm32"))]
2281 use futures::future::BoxFuture;
2282 #[cfg(target_arch = "wasm32")]
2283 use futures::future::LocalBoxFuture as BoxFuture;
2284 #[derive(Debug)]
2285 pub struct Response(azure_core::Response);
2286 impl Response {
2287 pub async fn into_body(self) -> azure_core::Result<models::SignedIdentifiers> {
2288 let bytes = self.0.into_body().collect().await?;
2289 let body: models::SignedIdentifiers = azure_core::xml::read_xml(&bytes)?;
2290 Ok(body)
2291 }
2292 pub fn into_raw_response(self) -> azure_core::Response {
2293 self.0
2294 }
2295 pub fn as_raw_response(&self) -> &azure_core::Response {
2296 &self.0
2297 }
2298 pub fn headers(&self) -> Headers {
2299 Headers(self.0.headers())
2300 }
2301 }
2302 impl From<Response> for azure_core::Response {
2303 fn from(rsp: Response) -> Self {
2304 rsp.into_raw_response()
2305 }
2306 }
2307 impl AsRef<azure_core::Response> for Response {
2308 fn as_ref(&self) -> &azure_core::Response {
2309 self.as_raw_response()
2310 }
2311 }
2312 pub struct Headers<'a>(&'a azure_core::headers::Headers);
2313 impl<'a> Headers<'a> {
2314 #[doc = "Indicated whether data in the container may be accessed publicly and the level of access"]
2315 pub fn x_ms_blob_public_access(&self) -> azure_core::Result<&str> {
2316 self.0
2317 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-blob-public-access"))
2318 }
2319 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
2320 pub fn e_tag(&self) -> azure_core::Result<&str> {
2321 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
2322 }
2323 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
2324 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
2325 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
2326 }
2327 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
2328 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
2329 self.0
2330 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
2331 }
2332 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
2333 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
2334 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
2335 }
2336 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
2337 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
2338 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
2339 }
2340 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
2341 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
2342 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
2343 }
2344 }
2345 #[derive(Clone)]
2346 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2347 #[doc = r""]
2348 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2349 #[doc = r" parameters can be chained."]
2350 #[doc = r""]
2351 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2352 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2353 #[doc = r" executes the request and returns a `Result` with the parsed"]
2354 #[doc = r" response."]
2355 #[doc = r""]
2356 #[doc = r" In order to execute the request without polling the service"]
2357 #[doc = r" until the operation completes, use `.send().await` instead."]
2358 #[doc = r""]
2359 #[doc = r" If you need lower-level access to the raw response details"]
2360 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2361 #[doc = r" can finalize the request using the"]
2362 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2363 #[doc = r" that resolves to a lower-level [`Response`] value."]
2364 pub struct RequestBuilder {
2365 pub(crate) client: super::super::Client,
2366 pub(crate) container_name: String,
2367 pub(crate) timeout: Option<i64>,
2368 pub(crate) x_ms_lease_id: Option<String>,
2369 pub(crate) x_ms_client_request_id: Option<String>,
2370 }
2371 impl RequestBuilder {
2372 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
2373 pub fn timeout(mut self, timeout: i64) -> Self {
2374 self.timeout = Some(timeout);
2375 self
2376 }
2377 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
2378 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
2379 self.x_ms_lease_id = Some(x_ms_lease_id.into());
2380 self
2381 }
2382 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
2383 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
2384 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
2385 self
2386 }
2387 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2388 #[doc = ""]
2389 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2390 #[doc = "However, this function can provide more flexibility when required."]
2391 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2392 Box::pin({
2393 let this = self.clone();
2394 async move {
2395 let url = this.url()?;
2396 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
2397 let bearer_token = this.client.bearer_token().await?;
2398 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2399 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
2400 if let Some(timeout) = &this.timeout {
2401 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
2402 }
2403 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
2404 req.insert_header("x-ms-lease-id", x_ms_lease_id);
2405 }
2406 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
2407 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
2408 }
2409 let req_body = azure_core::EMPTY_BODY;
2410 req.set_body(req_body);
2411 Ok(Response(this.client.send(&mut req).await?))
2412 }
2413 })
2414 }
2415 fn url(&self) -> azure_core::Result<azure_core::Url> {
2416 let mut url = self.client.endpoint().clone();
2417 url.set_path(&format!("/{}?restype=container&comp=acl", &self.container_name));
2418 Ok(url)
2419 }
2420 }
2421 impl std::future::IntoFuture for RequestBuilder {
2422 type Output = azure_core::Result<models::SignedIdentifiers>;
2423 type IntoFuture = BoxFuture<'static, azure_core::Result<models::SignedIdentifiers>>;
2424 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2425 #[doc = ""]
2426 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2427 #[doc = ""]
2428 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2429 fn into_future(self) -> Self::IntoFuture {
2430 Box::pin(async move { self.send().await?.into_body().await })
2431 }
2432 }
2433 }
2434 pub mod set_access_policy {
2435 use super::models;
2436 #[cfg(not(target_arch = "wasm32"))]
2437 use futures::future::BoxFuture;
2438 #[cfg(target_arch = "wasm32")]
2439 use futures::future::LocalBoxFuture as BoxFuture;
2440 #[derive(Debug)]
2441 pub struct Response(azure_core::Response);
2442 impl Response {
2443 pub fn into_raw_response(self) -> azure_core::Response {
2444 self.0
2445 }
2446 pub fn as_raw_response(&self) -> &azure_core::Response {
2447 &self.0
2448 }
2449 pub fn headers(&self) -> Headers {
2450 Headers(self.0.headers())
2451 }
2452 }
2453 impl From<Response> for azure_core::Response {
2454 fn from(rsp: Response) -> Self {
2455 rsp.into_raw_response()
2456 }
2457 }
2458 impl AsRef<azure_core::Response> for Response {
2459 fn as_ref(&self) -> &azure_core::Response {
2460 self.as_raw_response()
2461 }
2462 }
2463 pub struct Headers<'a>(&'a azure_core::headers::Headers);
2464 impl<'a> Headers<'a> {
2465 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
2466 pub fn e_tag(&self) -> azure_core::Result<&str> {
2467 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
2468 }
2469 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
2470 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
2471 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
2472 }
2473 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
2474 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
2475 self.0
2476 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
2477 }
2478 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
2479 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
2480 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
2481 }
2482 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
2483 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
2484 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
2485 }
2486 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
2487 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
2488 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
2489 }
2490 }
2491 #[derive(Clone)]
2492 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2493 #[doc = r""]
2494 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2495 #[doc = r" parameters can be chained."]
2496 #[doc = r""]
2497 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2498 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2499 #[doc = r" executes the request and returns a `Result` with the parsed"]
2500 #[doc = r" response."]
2501 #[doc = r""]
2502 #[doc = r" In order to execute the request without polling the service"]
2503 #[doc = r" until the operation completes, use `.send().await` instead."]
2504 #[doc = r""]
2505 #[doc = r" If you need lower-level access to the raw response details"]
2506 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2507 #[doc = r" can finalize the request using the"]
2508 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2509 #[doc = r" that resolves to a lower-level [`Response`] value."]
2510 pub struct RequestBuilder {
2511 pub(crate) client: super::super::Client,
2512 pub(crate) container_name: String,
2513 pub(crate) container_acl: Option<models::SignedIdentifiers>,
2514 pub(crate) timeout: Option<i64>,
2515 pub(crate) x_ms_lease_id: Option<String>,
2516 pub(crate) x_ms_blob_public_access: Option<String>,
2517 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
2518 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
2519 pub(crate) x_ms_client_request_id: Option<String>,
2520 }
2521 impl RequestBuilder {
2522 #[doc = "the acls for the container"]
2523 pub fn container_acl(mut self, container_acl: impl Into<models::SignedIdentifiers>) -> Self {
2524 self.container_acl = Some(container_acl.into());
2525 self
2526 }
2527 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
2528 pub fn timeout(mut self, timeout: i64) -> Self {
2529 self.timeout = Some(timeout);
2530 self
2531 }
2532 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
2533 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
2534 self.x_ms_lease_id = Some(x_ms_lease_id.into());
2535 self
2536 }
2537 #[doc = "Specifies whether data in the container may be accessed publicly and the level of access"]
2538 pub fn x_ms_blob_public_access(mut self, x_ms_blob_public_access: impl Into<String>) -> Self {
2539 self.x_ms_blob_public_access = Some(x_ms_blob_public_access.into());
2540 self
2541 }
2542 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
2543 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
2544 self.if_modified_since = Some(if_modified_since.into());
2545 self
2546 }
2547 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
2548 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
2549 self.if_unmodified_since = Some(if_unmodified_since.into());
2550 self
2551 }
2552 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
2553 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
2554 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
2555 self
2556 }
2557 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2558 #[doc = ""]
2559 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2560 #[doc = "However, this function can provide more flexibility when required."]
2561 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2562 Box::pin({
2563 let this = self.clone();
2564 async move {
2565 let url = this.url()?;
2566 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
2567 let bearer_token = this.client.bearer_token().await?;
2568 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2569 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
2570 let req_body = if let Some(container_acl) = &this.container_acl {
2571 req.insert_header("content-type", "application/xml");
2572 azure_core::xml::to_xml(container_acl)?
2573 } else {
2574 azure_core::EMPTY_BODY
2575 };
2576 if let Some(timeout) = &this.timeout {
2577 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
2578 }
2579 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
2580 req.insert_header("x-ms-lease-id", x_ms_lease_id);
2581 }
2582 if let Some(x_ms_blob_public_access) = &this.x_ms_blob_public_access {
2583 req.insert_header("x-ms-blob-public-access", x_ms_blob_public_access);
2584 }
2585 if let Some(if_modified_since) = &this.if_modified_since {
2586 req.insert_header("if-modified-since", if_modified_since.to_string());
2587 }
2588 if let Some(if_unmodified_since) = &this.if_unmodified_since {
2589 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
2590 }
2591 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
2592 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
2593 }
2594 req.set_body(req_body);
2595 Ok(Response(this.client.send(&mut req).await?))
2596 }
2597 })
2598 }
2599 fn url(&self) -> azure_core::Result<azure_core::Url> {
2600 let mut url = self.client.endpoint().clone();
2601 url.set_path(&format!("/{}?restype=container&comp=acl", &self.container_name));
2602 Ok(url)
2603 }
2604 }
2605 }
2606 pub mod restore {
2607 use super::models;
2608 #[cfg(not(target_arch = "wasm32"))]
2609 use futures::future::BoxFuture;
2610 #[cfg(target_arch = "wasm32")]
2611 use futures::future::LocalBoxFuture as BoxFuture;
2612 #[derive(Debug)]
2613 pub struct Response(azure_core::Response);
2614 impl Response {
2615 pub fn into_raw_response(self) -> azure_core::Response {
2616 self.0
2617 }
2618 pub fn as_raw_response(&self) -> &azure_core::Response {
2619 &self.0
2620 }
2621 pub fn headers(&self) -> Headers {
2622 Headers(self.0.headers())
2623 }
2624 }
2625 impl From<Response> for azure_core::Response {
2626 fn from(rsp: Response) -> Self {
2627 rsp.into_raw_response()
2628 }
2629 }
2630 impl AsRef<azure_core::Response> for Response {
2631 fn as_ref(&self) -> &azure_core::Response {
2632 self.as_raw_response()
2633 }
2634 }
2635 pub struct Headers<'a>(&'a azure_core::headers::Headers);
2636 impl<'a> Headers<'a> {
2637 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
2638 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
2639 self.0
2640 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
2641 }
2642 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
2643 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
2644 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
2645 }
2646 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
2647 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
2648 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
2649 }
2650 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
2651 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
2652 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
2653 }
2654 }
2655 #[derive(Clone)]
2656 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2657 #[doc = r""]
2658 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2659 #[doc = r" parameters can be chained."]
2660 #[doc = r""]
2661 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2662 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2663 #[doc = r" executes the request and returns a `Result` with the parsed"]
2664 #[doc = r" response."]
2665 #[doc = r""]
2666 #[doc = r" In order to execute the request without polling the service"]
2667 #[doc = r" until the operation completes, use `.send().await` instead."]
2668 #[doc = r""]
2669 #[doc = r" If you need lower-level access to the raw response details"]
2670 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2671 #[doc = r" can finalize the request using the"]
2672 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2673 #[doc = r" that resolves to a lower-level [`Response`] value."]
2674 pub struct RequestBuilder {
2675 pub(crate) client: super::super::Client,
2676 pub(crate) container_name: String,
2677 pub(crate) timeout: Option<i64>,
2678 pub(crate) x_ms_client_request_id: Option<String>,
2679 pub(crate) x_ms_deleted_container_name: Option<String>,
2680 pub(crate) x_ms_deleted_container_version: Option<String>,
2681 }
2682 impl RequestBuilder {
2683 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
2684 pub fn timeout(mut self, timeout: i64) -> Self {
2685 self.timeout = Some(timeout);
2686 self
2687 }
2688 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
2689 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
2690 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
2691 self
2692 }
2693 #[doc = "Optional. Version 2019-12-12 and later. Specifies the name of the deleted container to restore."]
2694 pub fn x_ms_deleted_container_name(mut self, x_ms_deleted_container_name: impl Into<String>) -> Self {
2695 self.x_ms_deleted_container_name = Some(x_ms_deleted_container_name.into());
2696 self
2697 }
2698 #[doc = "Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore."]
2699 pub fn x_ms_deleted_container_version(mut self, x_ms_deleted_container_version: impl Into<String>) -> Self {
2700 self.x_ms_deleted_container_version = Some(x_ms_deleted_container_version.into());
2701 self
2702 }
2703 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2704 #[doc = ""]
2705 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2706 #[doc = "However, this function can provide more flexibility when required."]
2707 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2708 Box::pin({
2709 let this = self.clone();
2710 async move {
2711 let url = this.url()?;
2712 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
2713 let bearer_token = this.client.bearer_token().await?;
2714 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2715 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
2716 if let Some(timeout) = &this.timeout {
2717 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
2718 }
2719 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
2720 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
2721 }
2722 if let Some(x_ms_deleted_container_name) = &this.x_ms_deleted_container_name {
2723 req.insert_header("x-ms-deleted-container-name", x_ms_deleted_container_name);
2724 }
2725 if let Some(x_ms_deleted_container_version) = &this.x_ms_deleted_container_version {
2726 req.insert_header("x-ms-deleted-container-version", x_ms_deleted_container_version);
2727 }
2728 let req_body = azure_core::EMPTY_BODY;
2729 req.set_body(req_body);
2730 Ok(Response(this.client.send(&mut req).await?))
2731 }
2732 })
2733 }
2734 fn url(&self) -> azure_core::Result<azure_core::Url> {
2735 let mut url = self.client.endpoint().clone();
2736 url.set_path(&format!("/{}?restype=container&comp=undelete", &self.container_name));
2737 Ok(url)
2738 }
2739 }
2740 }
2741 pub mod rename {
2742 use super::models;
2743 #[cfg(not(target_arch = "wasm32"))]
2744 use futures::future::BoxFuture;
2745 #[cfg(target_arch = "wasm32")]
2746 use futures::future::LocalBoxFuture as BoxFuture;
2747 #[derive(Debug)]
2748 pub struct Response(azure_core::Response);
2749 impl Response {
2750 pub fn into_raw_response(self) -> azure_core::Response {
2751 self.0
2752 }
2753 pub fn as_raw_response(&self) -> &azure_core::Response {
2754 &self.0
2755 }
2756 pub fn headers(&self) -> Headers {
2757 Headers(self.0.headers())
2758 }
2759 }
2760 impl From<Response> for azure_core::Response {
2761 fn from(rsp: Response) -> Self {
2762 rsp.into_raw_response()
2763 }
2764 }
2765 impl AsRef<azure_core::Response> for Response {
2766 fn as_ref(&self) -> &azure_core::Response {
2767 self.as_raw_response()
2768 }
2769 }
2770 pub struct Headers<'a>(&'a azure_core::headers::Headers);
2771 impl<'a> Headers<'a> {
2772 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
2773 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
2774 self.0
2775 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
2776 }
2777 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
2778 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
2779 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
2780 }
2781 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
2782 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
2783 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
2784 }
2785 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
2786 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
2787 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
2788 }
2789 }
2790 #[derive(Clone)]
2791 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2792 #[doc = r""]
2793 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2794 #[doc = r" parameters can be chained."]
2795 #[doc = r""]
2796 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2797 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2798 #[doc = r" executes the request and returns a `Result` with the parsed"]
2799 #[doc = r" response."]
2800 #[doc = r""]
2801 #[doc = r" In order to execute the request without polling the service"]
2802 #[doc = r" until the operation completes, use `.send().await` instead."]
2803 #[doc = r""]
2804 #[doc = r" If you need lower-level access to the raw response details"]
2805 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2806 #[doc = r" can finalize the request using the"]
2807 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2808 #[doc = r" that resolves to a lower-level [`Response`] value."]
2809 pub struct RequestBuilder {
2810 pub(crate) client: super::super::Client,
2811 pub(crate) container_name: String,
2812 pub(crate) x_ms_source_container_name: String,
2813 pub(crate) timeout: Option<i64>,
2814 pub(crate) x_ms_client_request_id: Option<String>,
2815 pub(crate) x_ms_source_lease_id: Option<String>,
2816 }
2817 impl RequestBuilder {
2818 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
2819 pub fn timeout(mut self, timeout: i64) -> Self {
2820 self.timeout = Some(timeout);
2821 self
2822 }
2823 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
2824 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
2825 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
2826 self
2827 }
2828 #[doc = "A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match."]
2829 pub fn x_ms_source_lease_id(mut self, x_ms_source_lease_id: impl Into<String>) -> Self {
2830 self.x_ms_source_lease_id = Some(x_ms_source_lease_id.into());
2831 self
2832 }
2833 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2834 #[doc = ""]
2835 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2836 #[doc = "However, this function can provide more flexibility when required."]
2837 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2838 Box::pin({
2839 let this = self.clone();
2840 async move {
2841 let url = this.url()?;
2842 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
2843 let bearer_token = this.client.bearer_token().await?;
2844 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2845 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
2846 if let Some(timeout) = &this.timeout {
2847 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
2848 }
2849 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
2850 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
2851 }
2852 req.insert_header("x-ms-source-container-name", &this.x_ms_source_container_name);
2853 if let Some(x_ms_source_lease_id) = &this.x_ms_source_lease_id {
2854 req.insert_header("x-ms-source-lease-id", x_ms_source_lease_id);
2855 }
2856 let req_body = azure_core::EMPTY_BODY;
2857 req.set_body(req_body);
2858 Ok(Response(this.client.send(&mut req).await?))
2859 }
2860 })
2861 }
2862 fn url(&self) -> azure_core::Result<azure_core::Url> {
2863 let mut url = self.client.endpoint().clone();
2864 url.set_path(&format!("/{}?restype=container&comp=rename", &self.container_name));
2865 Ok(url)
2866 }
2867 }
2868 }
2869 pub mod submit_batch {
2870 use super::models;
2871 #[cfg(not(target_arch = "wasm32"))]
2872 use futures::future::BoxFuture;
2873 #[cfg(target_arch = "wasm32")]
2874 use futures::future::LocalBoxFuture as BoxFuture;
2875 #[derive(Debug)]
2876 pub struct Response(azure_core::Response);
2877 impl Response {
2878 pub async fn into_body(self) -> azure_core::Result<bytes::Bytes> {
2879 let bytes = self.0.into_body().collect().await?;
2880 let body = bytes;
2881 Ok(body)
2882 }
2883 pub fn into_raw_response(self) -> azure_core::Response {
2884 self.0
2885 }
2886 pub fn as_raw_response(&self) -> &azure_core::Response {
2887 &self.0
2888 }
2889 pub fn headers(&self) -> Headers {
2890 Headers(self.0.headers())
2891 }
2892 }
2893 impl From<Response> for azure_core::Response {
2894 fn from(rsp: Response) -> Self {
2895 rsp.into_raw_response()
2896 }
2897 }
2898 impl AsRef<azure_core::Response> for Response {
2899 fn as_ref(&self) -> &azure_core::Response {
2900 self.as_raw_response()
2901 }
2902 }
2903 pub struct Headers<'a>(&'a azure_core::headers::Headers);
2904 impl<'a> Headers<'a> {
2905 #[doc = "The media type of the body of the response. For batch requests, this is multipart/mixed; boundary=batchresponse_GUID"]
2906 pub fn content_type(&self) -> azure_core::Result<&str> {
2907 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-type"))
2908 }
2909 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
2910 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
2911 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
2912 }
2913 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
2914 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
2915 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
2916 }
2917 }
2918 #[derive(Clone)]
2919 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2920 #[doc = r""]
2921 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2922 #[doc = r" parameters can be chained."]
2923 #[doc = r""]
2924 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2925 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2926 #[doc = r" executes the request and returns a `Result` with the parsed"]
2927 #[doc = r" response."]
2928 #[doc = r""]
2929 #[doc = r" In order to execute the request without polling the service"]
2930 #[doc = r" until the operation completes, use `.send().await` instead."]
2931 #[doc = r""]
2932 #[doc = r" If you need lower-level access to the raw response details"]
2933 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2934 #[doc = r" can finalize the request using the"]
2935 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2936 #[doc = r" that resolves to a lower-level [`Response`] value."]
2937 pub struct RequestBuilder {
2938 pub(crate) client: super::super::Client,
2939 pub(crate) container_name: String,
2940 pub(crate) body: serde_json::Value,
2941 pub(crate) content_length: i64,
2942 pub(crate) content_type: String,
2943 pub(crate) timeout: Option<i64>,
2944 pub(crate) x_ms_client_request_id: Option<String>,
2945 }
2946 impl RequestBuilder {
2947 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
2948 pub fn timeout(mut self, timeout: i64) -> Self {
2949 self.timeout = Some(timeout);
2950 self
2951 }
2952 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
2953 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
2954 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
2955 self
2956 }
2957 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2958 #[doc = ""]
2959 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2960 #[doc = "However, this function can provide more flexibility when required."]
2961 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2962 Box::pin({
2963 let this = self.clone();
2964 async move {
2965 let url = this.url()?;
2966 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
2967 let bearer_token = this.client.bearer_token().await?;
2968 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2969 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
2970 let req_body = azure_core::to_json(&this.body)?;
2971 req.insert_header("content-length", this.content_length.to_string());
2972 req.insert_header("content-type", &this.content_type);
2973 if let Some(timeout) = &this.timeout {
2974 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
2975 }
2976 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
2977 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
2978 }
2979 req.set_body(req_body);
2980 Ok(Response(this.client.send(&mut req).await?))
2981 }
2982 })
2983 }
2984 fn url(&self) -> azure_core::Result<azure_core::Url> {
2985 let mut url = self.client.endpoint().clone();
2986 url.set_path(&format!("/{}?restype=container&comp=batch", &self.container_name));
2987 Ok(url)
2988 }
2989 }
2990 impl std::future::IntoFuture for RequestBuilder {
2991 type Output = azure_core::Result<bytes::Bytes>;
2992 type IntoFuture = BoxFuture<'static, azure_core::Result<bytes::Bytes>>;
2993 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2994 #[doc = ""]
2995 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2996 #[doc = ""]
2997 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2998 fn into_future(self) -> Self::IntoFuture {
2999 Box::pin(async move { self.send().await?.into_body().await })
3000 }
3001 }
3002 }
3003 pub mod filter_blobs {
3004 use super::models;
3005 #[cfg(not(target_arch = "wasm32"))]
3006 use futures::future::BoxFuture;
3007 #[cfg(target_arch = "wasm32")]
3008 use futures::future::LocalBoxFuture as BoxFuture;
3009 #[derive(Debug)]
3010 pub struct Response(azure_core::Response);
3011 impl Response {
3012 pub async fn into_body(self) -> azure_core::Result<models::FilterBlobSegment> {
3013 let bytes = self.0.into_body().collect().await?;
3014 let body: models::FilterBlobSegment = azure_core::xml::read_xml(&bytes)?;
3015 Ok(body)
3016 }
3017 pub fn into_raw_response(self) -> azure_core::Response {
3018 self.0
3019 }
3020 pub fn as_raw_response(&self) -> &azure_core::Response {
3021 &self.0
3022 }
3023 pub fn headers(&self) -> Headers {
3024 Headers(self.0.headers())
3025 }
3026 }
3027 impl From<Response> for azure_core::Response {
3028 fn from(rsp: Response) -> Self {
3029 rsp.into_raw_response()
3030 }
3031 }
3032 impl AsRef<azure_core::Response> for Response {
3033 fn as_ref(&self) -> &azure_core::Response {
3034 self.as_raw_response()
3035 }
3036 }
3037 pub struct Headers<'a>(&'a azure_core::headers::Headers);
3038 impl<'a> Headers<'a> {
3039 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
3040 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
3041 self.0
3042 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
3043 }
3044 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
3045 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
3046 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
3047 }
3048 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
3049 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
3050 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
3051 }
3052 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
3053 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
3054 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
3055 }
3056 }
3057 #[derive(Clone)]
3058 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3059 #[doc = r""]
3060 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3061 #[doc = r" parameters can be chained."]
3062 #[doc = r""]
3063 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3064 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3065 #[doc = r" executes the request and returns a `Result` with the parsed"]
3066 #[doc = r" response."]
3067 #[doc = r""]
3068 #[doc = r" In order to execute the request without polling the service"]
3069 #[doc = r" until the operation completes, use `.send().await` instead."]
3070 #[doc = r""]
3071 #[doc = r" If you need lower-level access to the raw response details"]
3072 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3073 #[doc = r" can finalize the request using the"]
3074 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3075 #[doc = r" that resolves to a lower-level [`Response`] value."]
3076 pub struct RequestBuilder {
3077 pub(crate) client: super::super::Client,
3078 pub(crate) container_name: String,
3079 pub(crate) timeout: Option<i64>,
3080 pub(crate) x_ms_client_request_id: Option<String>,
3081 pub(crate) where_: Option<String>,
3082 pub(crate) marker: Option<String>,
3083 pub(crate) maxresults: Option<i64>,
3084 pub(crate) include: Vec<String>,
3085 }
3086 impl RequestBuilder {
3087 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
3088 pub fn timeout(mut self, timeout: i64) -> Self {
3089 self.timeout = Some(timeout);
3090 self
3091 }
3092 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
3093 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
3094 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
3095 self
3096 }
3097 #[doc = "Filters the results to return only to return only blobs whose tags match the specified expression."]
3098 pub fn where_(mut self, where_: impl Into<String>) -> Self {
3099 self.where_ = Some(where_.into());
3100 self
3101 }
3102 #[doc = "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."]
3103 pub fn marker(mut self, marker: impl Into<String>) -> Self {
3104 self.marker = Some(marker.into());
3105 self
3106 }
3107 #[doc = "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. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000."]
3108 pub fn maxresults(mut self, maxresults: i64) -> Self {
3109 self.maxresults = Some(maxresults);
3110 self
3111 }
3112 #[doc = "Include this parameter to specify one or more datasets to include in the response."]
3113 pub fn include(mut self, include: Vec<String>) -> Self {
3114 self.include = include;
3115 self
3116 }
3117 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3118 #[doc = ""]
3119 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3120 #[doc = "However, this function can provide more flexibility when required."]
3121 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3122 Box::pin({
3123 let this = self.clone();
3124 async move {
3125 let url = this.url()?;
3126 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
3127 let bearer_token = this.client.bearer_token().await?;
3128 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3129 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
3130 if let Some(timeout) = &this.timeout {
3131 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
3132 }
3133 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
3134 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
3135 }
3136 if let Some(where_) = &this.where_ {
3137 req.url_mut().query_pairs_mut().append_pair("where", where_);
3138 }
3139 if let Some(marker) = &this.marker {
3140 req.url_mut().query_pairs_mut().append_pair("marker", marker);
3141 }
3142 if let Some(maxresults) = &this.maxresults {
3143 req.url_mut().query_pairs_mut().append_pair("maxresults", &maxresults.to_string());
3144 }
3145 let req_body = azure_core::EMPTY_BODY;
3146 req.set_body(req_body);
3147 Ok(Response(this.client.send(&mut req).await?))
3148 }
3149 })
3150 }
3151 fn url(&self) -> azure_core::Result<azure_core::Url> {
3152 let mut url = self.client.endpoint().clone();
3153 url.set_path(&format!("/{}?restype=container&comp=blobs", &self.container_name));
3154 Ok(url)
3155 }
3156 }
3157 impl std::future::IntoFuture for RequestBuilder {
3158 type Output = azure_core::Result<models::FilterBlobSegment>;
3159 type IntoFuture = BoxFuture<'static, azure_core::Result<models::FilterBlobSegment>>;
3160 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3161 #[doc = ""]
3162 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3163 #[doc = ""]
3164 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3165 fn into_future(self) -> Self::IntoFuture {
3166 Box::pin(async move { self.send().await?.into_body().await })
3167 }
3168 }
3169 }
3170 pub mod acquire_lease {
3171 use super::models;
3172 #[cfg(not(target_arch = "wasm32"))]
3173 use futures::future::BoxFuture;
3174 #[cfg(target_arch = "wasm32")]
3175 use futures::future::LocalBoxFuture as BoxFuture;
3176 #[derive(Debug)]
3177 pub struct Response(azure_core::Response);
3178 impl Response {
3179 pub fn into_raw_response(self) -> azure_core::Response {
3180 self.0
3181 }
3182 pub fn as_raw_response(&self) -> &azure_core::Response {
3183 &self.0
3184 }
3185 pub fn headers(&self) -> Headers {
3186 Headers(self.0.headers())
3187 }
3188 }
3189 impl From<Response> for azure_core::Response {
3190 fn from(rsp: Response) -> Self {
3191 rsp.into_raw_response()
3192 }
3193 }
3194 impl AsRef<azure_core::Response> for Response {
3195 fn as_ref(&self) -> &azure_core::Response {
3196 self.as_raw_response()
3197 }
3198 }
3199 pub struct Headers<'a>(&'a azure_core::headers::Headers);
3200 impl<'a> Headers<'a> {
3201 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
3202 pub fn e_tag(&self) -> azure_core::Result<&str> {
3203 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
3204 }
3205 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
3206 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
3207 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
3208 }
3209 #[doc = "Uniquely identifies a container's lease"]
3210 pub fn x_ms_lease_id(&self) -> azure_core::Result<&str> {
3211 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-id"))
3212 }
3213 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
3214 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
3215 self.0
3216 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
3217 }
3218 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
3219 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
3220 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
3221 }
3222 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
3223 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
3224 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
3225 }
3226 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
3227 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
3228 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
3229 }
3230 }
3231 #[derive(Clone)]
3232 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3233 #[doc = r""]
3234 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3235 #[doc = r" parameters can be chained."]
3236 #[doc = r""]
3237 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3238 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3239 #[doc = r" executes the request and returns a `Result` with the parsed"]
3240 #[doc = r" response."]
3241 #[doc = r""]
3242 #[doc = r" In order to execute the request without polling the service"]
3243 #[doc = r" until the operation completes, use `.send().await` instead."]
3244 #[doc = r""]
3245 #[doc = r" If you need lower-level access to the raw response details"]
3246 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3247 #[doc = r" can finalize the request using the"]
3248 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3249 #[doc = r" that resolves to a lower-level [`Response`] value."]
3250 pub struct RequestBuilder {
3251 pub(crate) client: super::super::Client,
3252 pub(crate) container_name: String,
3253 pub(crate) x_ms_lease_action: String,
3254 pub(crate) timeout: Option<i64>,
3255 pub(crate) x_ms_lease_duration: Option<i64>,
3256 pub(crate) x_ms_proposed_lease_id: Option<String>,
3257 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
3258 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
3259 pub(crate) x_ms_client_request_id: Option<String>,
3260 }
3261 impl RequestBuilder {
3262 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
3263 pub fn timeout(mut self, timeout: i64) -> Self {
3264 self.timeout = Some(timeout);
3265 self
3266 }
3267 #[doc = "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."]
3268 pub fn x_ms_lease_duration(mut self, x_ms_lease_duration: i64) -> Self {
3269 self.x_ms_lease_duration = Some(x_ms_lease_duration);
3270 self
3271 }
3272 #[doc = "Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats."]
3273 pub fn x_ms_proposed_lease_id(mut self, x_ms_proposed_lease_id: impl Into<String>) -> Self {
3274 self.x_ms_proposed_lease_id = Some(x_ms_proposed_lease_id.into());
3275 self
3276 }
3277 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
3278 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
3279 self.if_modified_since = Some(if_modified_since.into());
3280 self
3281 }
3282 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
3283 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
3284 self.if_unmodified_since = Some(if_unmodified_since.into());
3285 self
3286 }
3287 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
3288 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
3289 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
3290 self
3291 }
3292 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3293 #[doc = ""]
3294 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3295 #[doc = "However, this function can provide more flexibility when required."]
3296 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3297 Box::pin({
3298 let this = self.clone();
3299 async move {
3300 let url = this.url()?;
3301 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
3302 let bearer_token = this.client.bearer_token().await?;
3303 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3304 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
3305 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
3306 if let Some(timeout) = &this.timeout {
3307 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
3308 }
3309 if let Some(x_ms_lease_duration) = &this.x_ms_lease_duration {
3310 req.insert_header("x-ms-lease-duration", x_ms_lease_duration.to_string());
3311 }
3312 if let Some(x_ms_proposed_lease_id) = &this.x_ms_proposed_lease_id {
3313 req.insert_header("x-ms-proposed-lease-id", x_ms_proposed_lease_id);
3314 }
3315 if let Some(if_modified_since) = &this.if_modified_since {
3316 req.insert_header("if-modified-since", if_modified_since.to_string());
3317 }
3318 if let Some(if_unmodified_since) = &this.if_unmodified_since {
3319 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
3320 }
3321 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
3322 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
3323 }
3324 let req_body = azure_core::EMPTY_BODY;
3325 req.set_body(req_body);
3326 Ok(Response(this.client.send(&mut req).await?))
3327 }
3328 })
3329 }
3330 fn url(&self) -> azure_core::Result<azure_core::Url> {
3331 let mut url = self.client.endpoint().clone();
3332 url.set_path(&format!("/{}?comp=lease&restype=container&acquire", &self.container_name));
3333 Ok(url)
3334 }
3335 }
3336 }
3337 pub mod release_lease {
3338 use super::models;
3339 #[cfg(not(target_arch = "wasm32"))]
3340 use futures::future::BoxFuture;
3341 #[cfg(target_arch = "wasm32")]
3342 use futures::future::LocalBoxFuture as BoxFuture;
3343 #[derive(Debug)]
3344 pub struct Response(azure_core::Response);
3345 impl Response {
3346 pub fn into_raw_response(self) -> azure_core::Response {
3347 self.0
3348 }
3349 pub fn as_raw_response(&self) -> &azure_core::Response {
3350 &self.0
3351 }
3352 pub fn headers(&self) -> Headers {
3353 Headers(self.0.headers())
3354 }
3355 }
3356 impl From<Response> for azure_core::Response {
3357 fn from(rsp: Response) -> Self {
3358 rsp.into_raw_response()
3359 }
3360 }
3361 impl AsRef<azure_core::Response> for Response {
3362 fn as_ref(&self) -> &azure_core::Response {
3363 self.as_raw_response()
3364 }
3365 }
3366 pub struct Headers<'a>(&'a azure_core::headers::Headers);
3367 impl<'a> Headers<'a> {
3368 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
3369 pub fn e_tag(&self) -> azure_core::Result<&str> {
3370 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
3371 }
3372 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
3373 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
3374 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
3375 }
3376 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
3377 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
3378 self.0
3379 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
3380 }
3381 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
3382 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
3383 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
3384 }
3385 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
3386 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
3387 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
3388 }
3389 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
3390 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
3391 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
3392 }
3393 }
3394 #[derive(Clone)]
3395 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3396 #[doc = r""]
3397 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3398 #[doc = r" parameters can be chained."]
3399 #[doc = r""]
3400 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3401 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3402 #[doc = r" executes the request and returns a `Result` with the parsed"]
3403 #[doc = r" response."]
3404 #[doc = r""]
3405 #[doc = r" In order to execute the request without polling the service"]
3406 #[doc = r" until the operation completes, use `.send().await` instead."]
3407 #[doc = r""]
3408 #[doc = r" If you need lower-level access to the raw response details"]
3409 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3410 #[doc = r" can finalize the request using the"]
3411 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3412 #[doc = r" that resolves to a lower-level [`Response`] value."]
3413 pub struct RequestBuilder {
3414 pub(crate) client: super::super::Client,
3415 pub(crate) container_name: String,
3416 pub(crate) x_ms_lease_action: String,
3417 pub(crate) x_ms_lease_id: String,
3418 pub(crate) timeout: Option<i64>,
3419 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
3420 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
3421 pub(crate) x_ms_client_request_id: Option<String>,
3422 }
3423 impl RequestBuilder {
3424 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
3425 pub fn timeout(mut self, timeout: i64) -> Self {
3426 self.timeout = Some(timeout);
3427 self
3428 }
3429 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
3430 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
3431 self.if_modified_since = Some(if_modified_since.into());
3432 self
3433 }
3434 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
3435 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
3436 self.if_unmodified_since = Some(if_unmodified_since.into());
3437 self
3438 }
3439 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
3440 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
3441 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
3442 self
3443 }
3444 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3445 #[doc = ""]
3446 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3447 #[doc = "However, this function can provide more flexibility when required."]
3448 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3449 Box::pin({
3450 let this = self.clone();
3451 async move {
3452 let url = this.url()?;
3453 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
3454 let bearer_token = this.client.bearer_token().await?;
3455 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3456 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
3457 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
3458 if let Some(timeout) = &this.timeout {
3459 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
3460 }
3461 req.insert_header("x-ms-lease-id", &this.x_ms_lease_id);
3462 if let Some(if_modified_since) = &this.if_modified_since {
3463 req.insert_header("if-modified-since", if_modified_since.to_string());
3464 }
3465 if let Some(if_unmodified_since) = &this.if_unmodified_since {
3466 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
3467 }
3468 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
3469 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
3470 }
3471 let req_body = azure_core::EMPTY_BODY;
3472 req.set_body(req_body);
3473 Ok(Response(this.client.send(&mut req).await?))
3474 }
3475 })
3476 }
3477 fn url(&self) -> azure_core::Result<azure_core::Url> {
3478 let mut url = self.client.endpoint().clone();
3479 url.set_path(&format!("/{}?comp=lease&restype=container&release", &self.container_name));
3480 Ok(url)
3481 }
3482 }
3483 }
3484 pub mod renew_lease {
3485 use super::models;
3486 #[cfg(not(target_arch = "wasm32"))]
3487 use futures::future::BoxFuture;
3488 #[cfg(target_arch = "wasm32")]
3489 use futures::future::LocalBoxFuture as BoxFuture;
3490 #[derive(Debug)]
3491 pub struct Response(azure_core::Response);
3492 impl Response {
3493 pub fn into_raw_response(self) -> azure_core::Response {
3494 self.0
3495 }
3496 pub fn as_raw_response(&self) -> &azure_core::Response {
3497 &self.0
3498 }
3499 pub fn headers(&self) -> Headers {
3500 Headers(self.0.headers())
3501 }
3502 }
3503 impl From<Response> for azure_core::Response {
3504 fn from(rsp: Response) -> Self {
3505 rsp.into_raw_response()
3506 }
3507 }
3508 impl AsRef<azure_core::Response> for Response {
3509 fn as_ref(&self) -> &azure_core::Response {
3510 self.as_raw_response()
3511 }
3512 }
3513 pub struct Headers<'a>(&'a azure_core::headers::Headers);
3514 impl<'a> Headers<'a> {
3515 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
3516 pub fn e_tag(&self) -> azure_core::Result<&str> {
3517 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
3518 }
3519 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
3520 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
3521 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
3522 }
3523 #[doc = "Uniquely identifies a container's lease"]
3524 pub fn x_ms_lease_id(&self) -> azure_core::Result<&str> {
3525 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-id"))
3526 }
3527 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
3528 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
3529 self.0
3530 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
3531 }
3532 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
3533 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
3534 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
3535 }
3536 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
3537 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
3538 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
3539 }
3540 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
3541 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
3542 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
3543 }
3544 }
3545 #[derive(Clone)]
3546 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3547 #[doc = r""]
3548 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3549 #[doc = r" parameters can be chained."]
3550 #[doc = r""]
3551 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3552 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3553 #[doc = r" executes the request and returns a `Result` with the parsed"]
3554 #[doc = r" response."]
3555 #[doc = r""]
3556 #[doc = r" In order to execute the request without polling the service"]
3557 #[doc = r" until the operation completes, use `.send().await` instead."]
3558 #[doc = r""]
3559 #[doc = r" If you need lower-level access to the raw response details"]
3560 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3561 #[doc = r" can finalize the request using the"]
3562 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3563 #[doc = r" that resolves to a lower-level [`Response`] value."]
3564 pub struct RequestBuilder {
3565 pub(crate) client: super::super::Client,
3566 pub(crate) container_name: String,
3567 pub(crate) x_ms_lease_action: String,
3568 pub(crate) x_ms_lease_id: String,
3569 pub(crate) timeout: Option<i64>,
3570 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
3571 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
3572 pub(crate) x_ms_client_request_id: Option<String>,
3573 }
3574 impl RequestBuilder {
3575 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
3576 pub fn timeout(mut self, timeout: i64) -> Self {
3577 self.timeout = Some(timeout);
3578 self
3579 }
3580 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
3581 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
3582 self.if_modified_since = Some(if_modified_since.into());
3583 self
3584 }
3585 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
3586 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
3587 self.if_unmodified_since = Some(if_unmodified_since.into());
3588 self
3589 }
3590 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
3591 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
3592 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
3593 self
3594 }
3595 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3596 #[doc = ""]
3597 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3598 #[doc = "However, this function can provide more flexibility when required."]
3599 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3600 Box::pin({
3601 let this = self.clone();
3602 async move {
3603 let url = this.url()?;
3604 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
3605 let bearer_token = this.client.bearer_token().await?;
3606 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3607 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
3608 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
3609 if let Some(timeout) = &this.timeout {
3610 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
3611 }
3612 req.insert_header("x-ms-lease-id", &this.x_ms_lease_id);
3613 if let Some(if_modified_since) = &this.if_modified_since {
3614 req.insert_header("if-modified-since", if_modified_since.to_string());
3615 }
3616 if let Some(if_unmodified_since) = &this.if_unmodified_since {
3617 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
3618 }
3619 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
3620 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
3621 }
3622 let req_body = azure_core::EMPTY_BODY;
3623 req.set_body(req_body);
3624 Ok(Response(this.client.send(&mut req).await?))
3625 }
3626 })
3627 }
3628 fn url(&self) -> azure_core::Result<azure_core::Url> {
3629 let mut url = self.client.endpoint().clone();
3630 url.set_path(&format!("/{}?comp=lease&restype=container&renew", &self.container_name));
3631 Ok(url)
3632 }
3633 }
3634 }
3635 pub mod break_lease {
3636 use super::models;
3637 #[cfg(not(target_arch = "wasm32"))]
3638 use futures::future::BoxFuture;
3639 #[cfg(target_arch = "wasm32")]
3640 use futures::future::LocalBoxFuture as BoxFuture;
3641 #[derive(Debug)]
3642 pub struct Response(azure_core::Response);
3643 impl Response {
3644 pub fn into_raw_response(self) -> azure_core::Response {
3645 self.0
3646 }
3647 pub fn as_raw_response(&self) -> &azure_core::Response {
3648 &self.0
3649 }
3650 pub fn headers(&self) -> Headers {
3651 Headers(self.0.headers())
3652 }
3653 }
3654 impl From<Response> for azure_core::Response {
3655 fn from(rsp: Response) -> Self {
3656 rsp.into_raw_response()
3657 }
3658 }
3659 impl AsRef<azure_core::Response> for Response {
3660 fn as_ref(&self) -> &azure_core::Response {
3661 self.as_raw_response()
3662 }
3663 }
3664 pub struct Headers<'a>(&'a azure_core::headers::Headers);
3665 impl<'a> Headers<'a> {
3666 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
3667 pub fn e_tag(&self) -> azure_core::Result<&str> {
3668 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
3669 }
3670 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
3671 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
3672 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
3673 }
3674 #[doc = "Approximate time remaining in the lease period, in seconds."]
3675 pub fn x_ms_lease_time(&self) -> azure_core::Result<i32> {
3676 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-lease-time"))
3677 }
3678 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
3679 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
3680 self.0
3681 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
3682 }
3683 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
3684 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
3685 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
3686 }
3687 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
3688 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
3689 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
3690 }
3691 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
3692 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
3693 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
3694 }
3695 }
3696 #[derive(Clone)]
3697 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3698 #[doc = r""]
3699 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3700 #[doc = r" parameters can be chained."]
3701 #[doc = r""]
3702 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3703 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3704 #[doc = r" executes the request and returns a `Result` with the parsed"]
3705 #[doc = r" response."]
3706 #[doc = r""]
3707 #[doc = r" In order to execute the request without polling the service"]
3708 #[doc = r" until the operation completes, use `.send().await` instead."]
3709 #[doc = r""]
3710 #[doc = r" If you need lower-level access to the raw response details"]
3711 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3712 #[doc = r" can finalize the request using the"]
3713 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3714 #[doc = r" that resolves to a lower-level [`Response`] value."]
3715 pub struct RequestBuilder {
3716 pub(crate) client: super::super::Client,
3717 pub(crate) container_name: String,
3718 pub(crate) x_ms_lease_action: String,
3719 pub(crate) timeout: Option<i64>,
3720 pub(crate) x_ms_lease_break_period: Option<i64>,
3721 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
3722 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
3723 pub(crate) x_ms_client_request_id: Option<String>,
3724 }
3725 impl RequestBuilder {
3726 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
3727 pub fn timeout(mut self, timeout: i64) -> Self {
3728 self.timeout = Some(timeout);
3729 self
3730 }
3731 #[doc = "For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately."]
3732 pub fn x_ms_lease_break_period(mut self, x_ms_lease_break_period: i64) -> Self {
3733 self.x_ms_lease_break_period = Some(x_ms_lease_break_period);
3734 self
3735 }
3736 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
3737 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
3738 self.if_modified_since = Some(if_modified_since.into());
3739 self
3740 }
3741 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
3742 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
3743 self.if_unmodified_since = Some(if_unmodified_since.into());
3744 self
3745 }
3746 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
3747 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
3748 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
3749 self
3750 }
3751 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3752 #[doc = ""]
3753 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3754 #[doc = "However, this function can provide more flexibility when required."]
3755 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3756 Box::pin({
3757 let this = self.clone();
3758 async move {
3759 let url = this.url()?;
3760 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
3761 let bearer_token = this.client.bearer_token().await?;
3762 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3763 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
3764 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
3765 if let Some(timeout) = &this.timeout {
3766 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
3767 }
3768 if let Some(x_ms_lease_break_period) = &this.x_ms_lease_break_period {
3769 req.insert_header("x-ms-lease-break-period", x_ms_lease_break_period.to_string());
3770 }
3771 if let Some(if_modified_since) = &this.if_modified_since {
3772 req.insert_header("if-modified-since", if_modified_since.to_string());
3773 }
3774 if let Some(if_unmodified_since) = &this.if_unmodified_since {
3775 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
3776 }
3777 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
3778 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
3779 }
3780 let req_body = azure_core::EMPTY_BODY;
3781 req.set_body(req_body);
3782 Ok(Response(this.client.send(&mut req).await?))
3783 }
3784 })
3785 }
3786 fn url(&self) -> azure_core::Result<azure_core::Url> {
3787 let mut url = self.client.endpoint().clone();
3788 url.set_path(&format!("/{}?comp=lease&restype=container&break", &self.container_name));
3789 Ok(url)
3790 }
3791 }
3792 }
3793 pub mod change_lease {
3794 use super::models;
3795 #[cfg(not(target_arch = "wasm32"))]
3796 use futures::future::BoxFuture;
3797 #[cfg(target_arch = "wasm32")]
3798 use futures::future::LocalBoxFuture as BoxFuture;
3799 #[derive(Debug)]
3800 pub struct Response(azure_core::Response);
3801 impl Response {
3802 pub fn into_raw_response(self) -> azure_core::Response {
3803 self.0
3804 }
3805 pub fn as_raw_response(&self) -> &azure_core::Response {
3806 &self.0
3807 }
3808 pub fn headers(&self) -> Headers {
3809 Headers(self.0.headers())
3810 }
3811 }
3812 impl From<Response> for azure_core::Response {
3813 fn from(rsp: Response) -> Self {
3814 rsp.into_raw_response()
3815 }
3816 }
3817 impl AsRef<azure_core::Response> for Response {
3818 fn as_ref(&self) -> &azure_core::Response {
3819 self.as_raw_response()
3820 }
3821 }
3822 pub struct Headers<'a>(&'a azure_core::headers::Headers);
3823 impl<'a> Headers<'a> {
3824 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
3825 pub fn e_tag(&self) -> azure_core::Result<&str> {
3826 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
3827 }
3828 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
3829 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
3830 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
3831 }
3832 #[doc = "Uniquely identifies a container's lease"]
3833 pub fn x_ms_lease_id(&self) -> azure_core::Result<&str> {
3834 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-id"))
3835 }
3836 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
3837 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
3838 self.0
3839 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
3840 }
3841 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
3842 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
3843 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
3844 }
3845 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
3846 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
3847 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
3848 }
3849 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
3850 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
3851 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
3852 }
3853 }
3854 #[derive(Clone)]
3855 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3856 #[doc = r""]
3857 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3858 #[doc = r" parameters can be chained."]
3859 #[doc = r""]
3860 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3861 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3862 #[doc = r" executes the request and returns a `Result` with the parsed"]
3863 #[doc = r" response."]
3864 #[doc = r""]
3865 #[doc = r" In order to execute the request without polling the service"]
3866 #[doc = r" until the operation completes, use `.send().await` instead."]
3867 #[doc = r""]
3868 #[doc = r" If you need lower-level access to the raw response details"]
3869 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3870 #[doc = r" can finalize the request using the"]
3871 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3872 #[doc = r" that resolves to a lower-level [`Response`] value."]
3873 pub struct RequestBuilder {
3874 pub(crate) client: super::super::Client,
3875 pub(crate) container_name: String,
3876 pub(crate) x_ms_lease_action: String,
3877 pub(crate) x_ms_lease_id: String,
3878 pub(crate) x_ms_proposed_lease_id: String,
3879 pub(crate) timeout: Option<i64>,
3880 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
3881 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
3882 pub(crate) x_ms_client_request_id: Option<String>,
3883 }
3884 impl RequestBuilder {
3885 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
3886 pub fn timeout(mut self, timeout: i64) -> Self {
3887 self.timeout = Some(timeout);
3888 self
3889 }
3890 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
3891 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
3892 self.if_modified_since = Some(if_modified_since.into());
3893 self
3894 }
3895 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
3896 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
3897 self.if_unmodified_since = Some(if_unmodified_since.into());
3898 self
3899 }
3900 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
3901 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
3902 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
3903 self
3904 }
3905 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3906 #[doc = ""]
3907 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3908 #[doc = "However, this function can provide more flexibility when required."]
3909 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3910 Box::pin({
3911 let this = self.clone();
3912 async move {
3913 let url = this.url()?;
3914 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
3915 let bearer_token = this.client.bearer_token().await?;
3916 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3917 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
3918 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
3919 if let Some(timeout) = &this.timeout {
3920 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
3921 }
3922 req.insert_header("x-ms-lease-id", &this.x_ms_lease_id);
3923 req.insert_header("x-ms-proposed-lease-id", &this.x_ms_proposed_lease_id);
3924 if let Some(if_modified_since) = &this.if_modified_since {
3925 req.insert_header("if-modified-since", if_modified_since.to_string());
3926 }
3927 if let Some(if_unmodified_since) = &this.if_unmodified_since {
3928 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
3929 }
3930 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
3931 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
3932 }
3933 let req_body = azure_core::EMPTY_BODY;
3934 req.set_body(req_body);
3935 Ok(Response(this.client.send(&mut req).await?))
3936 }
3937 })
3938 }
3939 fn url(&self) -> azure_core::Result<azure_core::Url> {
3940 let mut url = self.client.endpoint().clone();
3941 url.set_path(&format!("/{}?comp=lease&restype=container&change", &self.container_name));
3942 Ok(url)
3943 }
3944 }
3945 }
3946 pub mod list_blob_flat_segment {
3947 use super::models;
3948 #[cfg(not(target_arch = "wasm32"))]
3949 use futures::future::BoxFuture;
3950 #[cfg(target_arch = "wasm32")]
3951 use futures::future::LocalBoxFuture as BoxFuture;
3952 #[derive(Debug)]
3953 pub struct Response(azure_core::Response);
3954 impl Response {
3955 pub async fn into_body(self) -> azure_core::Result<models::ListBlobsFlatSegmentResponse> {
3956 let bytes = self.0.into_body().collect().await?;
3957 let body: models::ListBlobsFlatSegmentResponse = azure_core::xml::read_xml(&bytes)?;
3958 Ok(body)
3959 }
3960 pub fn into_raw_response(self) -> azure_core::Response {
3961 self.0
3962 }
3963 pub fn as_raw_response(&self) -> &azure_core::Response {
3964 &self.0
3965 }
3966 pub fn headers(&self) -> Headers {
3967 Headers(self.0.headers())
3968 }
3969 }
3970 impl From<Response> for azure_core::Response {
3971 fn from(rsp: Response) -> Self {
3972 rsp.into_raw_response()
3973 }
3974 }
3975 impl AsRef<azure_core::Response> for Response {
3976 fn as_ref(&self) -> &azure_core::Response {
3977 self.as_raw_response()
3978 }
3979 }
3980 pub struct Headers<'a>(&'a azure_core::headers::Headers);
3981 impl<'a> Headers<'a> {
3982 #[doc = "The media type of the body of the response. For List Blobs this is 'application/xml'"]
3983 pub fn content_type(&self) -> azure_core::Result<&str> {
3984 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-type"))
3985 }
3986 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
3987 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
3988 self.0
3989 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
3990 }
3991 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
3992 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
3993 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
3994 }
3995 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
3996 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
3997 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
3998 }
3999 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
4000 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
4001 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
4002 }
4003 }
4004 #[derive(Clone)]
4005 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4006 #[doc = r""]
4007 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4008 #[doc = r" parameters can be chained."]
4009 #[doc = r""]
4010 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4011 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4012 #[doc = r" executes the request and returns a `Result` with the parsed"]
4013 #[doc = r" response."]
4014 #[doc = r""]
4015 #[doc = r" In order to execute the request without polling the service"]
4016 #[doc = r" until the operation completes, use `.send().await` instead."]
4017 #[doc = r""]
4018 #[doc = r" If you need lower-level access to the raw response details"]
4019 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4020 #[doc = r" can finalize the request using the"]
4021 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4022 #[doc = r" that resolves to a lower-level [`Response`] value."]
4023 pub struct RequestBuilder {
4024 pub(crate) client: super::super::Client,
4025 pub(crate) container_name: String,
4026 pub(crate) prefix: Option<String>,
4027 pub(crate) marker: Option<String>,
4028 pub(crate) maxresults: Option<i64>,
4029 pub(crate) include: Vec<String>,
4030 pub(crate) timeout: Option<i64>,
4031 pub(crate) x_ms_client_request_id: Option<String>,
4032 }
4033 impl RequestBuilder {
4034 #[doc = "Filters the results to return only containers whose name begins with the specified prefix."]
4035 pub fn prefix(mut self, prefix: impl Into<String>) -> Self {
4036 self.prefix = Some(prefix.into());
4037 self
4038 }
4039 #[doc = "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."]
4040 pub fn marker(mut self, marker: impl Into<String>) -> Self {
4041 self.marker = Some(marker.into());
4042 self
4043 }
4044 #[doc = "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. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000."]
4045 pub fn maxresults(mut self, maxresults: i64) -> Self {
4046 self.maxresults = Some(maxresults);
4047 self
4048 }
4049 #[doc = "Include this parameter to specify one or more datasets to include in the response."]
4050 pub fn include(mut self, include: Vec<String>) -> Self {
4051 self.include = include;
4052 self
4053 }
4054 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
4055 pub fn timeout(mut self, timeout: i64) -> Self {
4056 self.timeout = Some(timeout);
4057 self
4058 }
4059 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
4060 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
4061 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
4062 self
4063 }
4064 pub fn into_stream(self) -> azure_core::Pageable<models::ListBlobsFlatSegmentResponse, azure_core::error::Error> {
4065 let make_request = move |continuation: Option<String>| {
4066 let this = self.clone();
4067 async move {
4068 let mut url = this.url()?;
4069 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4070 let bearer_token = this.client.bearer_token().await?;
4071 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4072 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
4073 if let Some(prefix) = &this.prefix {
4074 req.url_mut().query_pairs_mut().append_pair("prefix", prefix);
4075 }
4076 if let Some(marker) = &this.marker {
4077 req.url_mut().query_pairs_mut().append_pair("marker", marker);
4078 }
4079 if let Some(maxresults) = &this.maxresults {
4080 req.url_mut().query_pairs_mut().append_pair("maxresults", &maxresults.to_string());
4081 }
4082 if let Some(timeout) = &this.timeout {
4083 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
4084 }
4085 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
4086 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
4087 }
4088 let req_body = azure_core::EMPTY_BODY;
4089 if let Some(value) = continuation.as_ref() {
4090 req.url_mut().query_pairs_mut().append_pair("marker", value);
4091 }
4092 req.set_body(req_body);
4093 let rsp = this.client.send(&mut req).await?;
4094 let rsp = match rsp.status() {
4095 azure_core::StatusCode::Ok => Ok(Response(rsp)),
4096 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
4097 status: status_code,
4098 error_code: None,
4099 })),
4100 };
4101 rsp?.into_body().await
4102 }
4103 };
4104 azure_core::Pageable::new(make_request)
4105 }
4106 fn url(&self) -> azure_core::Result<azure_core::Url> {
4107 let mut url = self.client.endpoint().clone();
4108 url.set_path(&format!("/{}?restype=container&comp=list&flat", &self.container_name));
4109 Ok(url)
4110 }
4111 }
4112 }
4113 pub mod list_blob_hierarchy_segment {
4114 use super::models;
4115 #[cfg(not(target_arch = "wasm32"))]
4116 use futures::future::BoxFuture;
4117 #[cfg(target_arch = "wasm32")]
4118 use futures::future::LocalBoxFuture as BoxFuture;
4119 #[derive(Debug)]
4120 pub struct Response(azure_core::Response);
4121 impl Response {
4122 pub async fn into_body(self) -> azure_core::Result<models::ListBlobsHierarchySegmentResponse> {
4123 let bytes = self.0.into_body().collect().await?;
4124 let body: models::ListBlobsHierarchySegmentResponse = azure_core::xml::read_xml(&bytes)?;
4125 Ok(body)
4126 }
4127 pub fn into_raw_response(self) -> azure_core::Response {
4128 self.0
4129 }
4130 pub fn as_raw_response(&self) -> &azure_core::Response {
4131 &self.0
4132 }
4133 pub fn headers(&self) -> Headers {
4134 Headers(self.0.headers())
4135 }
4136 }
4137 impl From<Response> for azure_core::Response {
4138 fn from(rsp: Response) -> Self {
4139 rsp.into_raw_response()
4140 }
4141 }
4142 impl AsRef<azure_core::Response> for Response {
4143 fn as_ref(&self) -> &azure_core::Response {
4144 self.as_raw_response()
4145 }
4146 }
4147 pub struct Headers<'a>(&'a azure_core::headers::Headers);
4148 impl<'a> Headers<'a> {
4149 #[doc = "The media type of the body of the response. For List Blobs this is 'application/xml'"]
4150 pub fn content_type(&self) -> azure_core::Result<&str> {
4151 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-type"))
4152 }
4153 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
4154 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
4155 self.0
4156 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
4157 }
4158 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
4159 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
4160 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
4161 }
4162 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
4163 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
4164 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
4165 }
4166 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
4167 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
4168 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
4169 }
4170 }
4171 #[derive(Clone)]
4172 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4173 #[doc = r""]
4174 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4175 #[doc = r" parameters can be chained."]
4176 #[doc = r""]
4177 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4178 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4179 #[doc = r" executes the request and returns a `Result` with the parsed"]
4180 #[doc = r" response."]
4181 #[doc = r""]
4182 #[doc = r" In order to execute the request without polling the service"]
4183 #[doc = r" until the operation completes, use `.send().await` instead."]
4184 #[doc = r""]
4185 #[doc = r" If you need lower-level access to the raw response details"]
4186 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4187 #[doc = r" can finalize the request using the"]
4188 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4189 #[doc = r" that resolves to a lower-level [`Response`] value."]
4190 pub struct RequestBuilder {
4191 pub(crate) client: super::super::Client,
4192 pub(crate) container_name: String,
4193 pub(crate) delimiter: String,
4194 pub(crate) prefix: Option<String>,
4195 pub(crate) marker: Option<String>,
4196 pub(crate) maxresults: Option<i64>,
4197 pub(crate) include: Vec<String>,
4198 pub(crate) timeout: Option<i64>,
4199 pub(crate) x_ms_client_request_id: Option<String>,
4200 }
4201 impl RequestBuilder {
4202 #[doc = "Filters the results to return only containers whose name begins with the specified prefix."]
4203 pub fn prefix(mut self, prefix: impl Into<String>) -> Self {
4204 self.prefix = Some(prefix.into());
4205 self
4206 }
4207 #[doc = "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."]
4208 pub fn marker(mut self, marker: impl Into<String>) -> Self {
4209 self.marker = Some(marker.into());
4210 self
4211 }
4212 #[doc = "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. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000."]
4213 pub fn maxresults(mut self, maxresults: i64) -> Self {
4214 self.maxresults = Some(maxresults);
4215 self
4216 }
4217 #[doc = "Include this parameter to specify one or more datasets to include in the response."]
4218 pub fn include(mut self, include: Vec<String>) -> Self {
4219 self.include = include;
4220 self
4221 }
4222 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
4223 pub fn timeout(mut self, timeout: i64) -> Self {
4224 self.timeout = Some(timeout);
4225 self
4226 }
4227 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
4228 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
4229 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
4230 self
4231 }
4232 pub fn into_stream(self) -> azure_core::Pageable<models::ListBlobsHierarchySegmentResponse, azure_core::error::Error> {
4233 let make_request = move |continuation: Option<String>| {
4234 let this = self.clone();
4235 async move {
4236 let mut url = this.url()?;
4237 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4238 let bearer_token = this.client.bearer_token().await?;
4239 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4240 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
4241 if let Some(prefix) = &this.prefix {
4242 req.url_mut().query_pairs_mut().append_pair("prefix", prefix);
4243 }
4244 let delimiter = &this.delimiter;
4245 req.url_mut().query_pairs_mut().append_pair("delimiter", delimiter);
4246 if let Some(marker) = &this.marker {
4247 req.url_mut().query_pairs_mut().append_pair("marker", marker);
4248 }
4249 if let Some(maxresults) = &this.maxresults {
4250 req.url_mut().query_pairs_mut().append_pair("maxresults", &maxresults.to_string());
4251 }
4252 if let Some(timeout) = &this.timeout {
4253 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
4254 }
4255 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
4256 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
4257 }
4258 let req_body = azure_core::EMPTY_BODY;
4259 if let Some(value) = continuation.as_ref() {
4260 req.url_mut().query_pairs_mut().append_pair("marker", value);
4261 }
4262 req.set_body(req_body);
4263 let rsp = this.client.send(&mut req).await?;
4264 let rsp = match rsp.status() {
4265 azure_core::StatusCode::Ok => Ok(Response(rsp)),
4266 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
4267 status: status_code,
4268 error_code: None,
4269 })),
4270 };
4271 rsp?.into_body().await
4272 }
4273 };
4274 azure_core::Pageable::new(make_request)
4275 }
4276 fn url(&self) -> azure_core::Result<azure_core::Url> {
4277 let mut url = self.client.endpoint().clone();
4278 url.set_path(&format!("/{}?restype=container&comp=list&hierarchy", &self.container_name));
4279 Ok(url)
4280 }
4281 }
4282 }
4283 pub mod get_account_info {
4284 use super::models;
4285 #[cfg(not(target_arch = "wasm32"))]
4286 use futures::future::BoxFuture;
4287 #[cfg(target_arch = "wasm32")]
4288 use futures::future::LocalBoxFuture as BoxFuture;
4289 #[derive(Debug)]
4290 pub struct Response(azure_core::Response);
4291 impl Response {
4292 pub fn into_raw_response(self) -> azure_core::Response {
4293 self.0
4294 }
4295 pub fn as_raw_response(&self) -> &azure_core::Response {
4296 &self.0
4297 }
4298 pub fn headers(&self) -> Headers {
4299 Headers(self.0.headers())
4300 }
4301 }
4302 impl From<Response> for azure_core::Response {
4303 fn from(rsp: Response) -> Self {
4304 rsp.into_raw_response()
4305 }
4306 }
4307 impl AsRef<azure_core::Response> for Response {
4308 fn as_ref(&self) -> &azure_core::Response {
4309 self.as_raw_response()
4310 }
4311 }
4312 pub struct Headers<'a>(&'a azure_core::headers::Headers);
4313 impl<'a> Headers<'a> {
4314 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
4315 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
4316 self.0
4317 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
4318 }
4319 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
4320 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
4321 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
4322 }
4323 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
4324 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
4325 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
4326 }
4327 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
4328 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
4329 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
4330 }
4331 #[doc = "Identifies the sku name of the account"]
4332 pub fn x_ms_sku_name(&self) -> azure_core::Result<&str> {
4333 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-sku-name"))
4334 }
4335 #[doc = "Identifies the account kind"]
4336 pub fn x_ms_account_kind(&self) -> azure_core::Result<&str> {
4337 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-account-kind"))
4338 }
4339 }
4340 #[derive(Clone)]
4341 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4342 #[doc = r""]
4343 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4344 #[doc = r" parameters can be chained."]
4345 #[doc = r""]
4346 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4347 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4348 #[doc = r" executes the request and returns a `Result` with the parsed"]
4349 #[doc = r" response."]
4350 #[doc = r""]
4351 #[doc = r" In order to execute the request without polling the service"]
4352 #[doc = r" until the operation completes, use `.send().await` instead."]
4353 #[doc = r""]
4354 #[doc = r" If you need lower-level access to the raw response details"]
4355 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4356 #[doc = r" can finalize the request using the"]
4357 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4358 #[doc = r" that resolves to a lower-level [`Response`] value."]
4359 pub struct RequestBuilder {
4360 pub(crate) client: super::super::Client,
4361 pub(crate) container_name: String,
4362 }
4363 impl RequestBuilder {
4364 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4365 #[doc = ""]
4366 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4367 #[doc = "However, this function can provide more flexibility when required."]
4368 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4369 Box::pin({
4370 let this = self.clone();
4371 async move {
4372 let url = this.url()?;
4373 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4374 let bearer_token = this.client.bearer_token().await?;
4375 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4376 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
4377 let req_body = azure_core::EMPTY_BODY;
4378 req.set_body(req_body);
4379 Ok(Response(this.client.send(&mut req).await?))
4380 }
4381 })
4382 }
4383 fn url(&self) -> azure_core::Result<azure_core::Url> {
4384 let mut url = self.client.endpoint().clone();
4385 url.set_path(&format!("/{}?restype=account&comp=properties", &self.container_name));
4386 Ok(url)
4387 }
4388 }
4389 }
4390}
4391pub mod blob {
4392 use super::models;
4393 #[cfg(not(target_arch = "wasm32"))]
4394 use futures::future::BoxFuture;
4395 #[cfg(target_arch = "wasm32")]
4396 use futures::future::LocalBoxFuture as BoxFuture;
4397 pub struct Client(pub(crate) super::Client);
4398 impl Client {
4399 #[doc = "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."]
4400 #[doc = ""]
4401 #[doc = "Arguments:"]
4402 #[doc = "* `container_name`: The container name."]
4403 #[doc = "* `blob`: The blob name."]
4404 pub fn download(&self, container_name: impl Into<String>, blob: impl Into<String>) -> download::RequestBuilder {
4405 download::RequestBuilder {
4406 client: self.0.clone(),
4407 container_name: container_name.into(),
4408 blob: blob.into(),
4409 snapshot: None,
4410 versionid: None,
4411 timeout: None,
4412 x_ms_range: None,
4413 x_ms_lease_id: None,
4414 x_ms_range_get_content_md5: None,
4415 x_ms_range_get_content_crc64: None,
4416 x_ms_encryption_key: None,
4417 x_ms_encryption_key_sha256: None,
4418 x_ms_encryption_algorithm: None,
4419 if_modified_since: None,
4420 if_unmodified_since: None,
4421 if_match: None,
4422 if_none_match: None,
4423 x_ms_if_tags: None,
4424 x_ms_client_request_id: None,
4425 }
4426 }
4427 #[doc = "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)."]
4428 #[doc = ""]
4429 #[doc = "Arguments:"]
4430 #[doc = "* `container_name`: The container name."]
4431 #[doc = "* `blob`: The blob name."]
4432 pub fn delete(&self, container_name: impl Into<String>, blob: impl Into<String>) -> delete::RequestBuilder {
4433 delete::RequestBuilder {
4434 client: self.0.clone(),
4435 container_name: container_name.into(),
4436 blob: blob.into(),
4437 snapshot: None,
4438 versionid: None,
4439 timeout: None,
4440 x_ms_lease_id: None,
4441 x_ms_delete_snapshots: None,
4442 if_modified_since: None,
4443 if_unmodified_since: None,
4444 if_match: None,
4445 if_none_match: None,
4446 x_ms_if_tags: None,
4447 x_ms_client_request_id: None,
4448 deletetype: None,
4449 }
4450 }
4451 #[doc = "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."]
4452 #[doc = ""]
4453 #[doc = "Arguments:"]
4454 #[doc = "* `container_name`: The container name."]
4455 #[doc = "* `blob`: The blob name."]
4456 pub fn get_properties(&self, container_name: impl Into<String>, blob: impl Into<String>) -> get_properties::RequestBuilder {
4457 get_properties::RequestBuilder {
4458 client: self.0.clone(),
4459 container_name: container_name.into(),
4460 blob: blob.into(),
4461 snapshot: None,
4462 versionid: None,
4463 timeout: None,
4464 x_ms_lease_id: None,
4465 x_ms_encryption_key: None,
4466 x_ms_encryption_key_sha256: None,
4467 x_ms_encryption_algorithm: None,
4468 if_modified_since: None,
4469 if_unmodified_since: None,
4470 if_match: None,
4471 if_none_match: None,
4472 x_ms_if_tags: None,
4473 x_ms_client_request_id: None,
4474 }
4475 }
4476 #[doc = "Undelete a blob that was previously soft deleted"]
4477 #[doc = ""]
4478 #[doc = "Arguments:"]
4479 #[doc = "* `container_name`: The container name."]
4480 #[doc = "* `blob`: The blob name."]
4481 pub fn undelete(&self, container_name: impl Into<String>, blob: impl Into<String>) -> undelete::RequestBuilder {
4482 undelete::RequestBuilder {
4483 client: self.0.clone(),
4484 container_name: container_name.into(),
4485 blob: blob.into(),
4486 timeout: None,
4487 x_ms_client_request_id: None,
4488 }
4489 }
4490 #[doc = "Sets the time a blob will expire and be deleted."]
4491 #[doc = ""]
4492 #[doc = "Arguments:"]
4493 #[doc = "* `container_name`: The container name."]
4494 #[doc = "* `blob`: The blob name."]
4495 #[doc = "* `x_ms_expiry_option`: Required. Indicates mode of the expiry time"]
4496 pub fn set_expiry(
4497 &self,
4498 container_name: impl Into<String>,
4499 blob: impl Into<String>,
4500 x_ms_expiry_option: impl Into<String>,
4501 ) -> set_expiry::RequestBuilder {
4502 set_expiry::RequestBuilder {
4503 client: self.0.clone(),
4504 container_name: container_name.into(),
4505 blob: blob.into(),
4506 x_ms_expiry_option: x_ms_expiry_option.into(),
4507 timeout: None,
4508 x_ms_client_request_id: None,
4509 x_ms_expiry_time: None,
4510 }
4511 }
4512 #[doc = "The Set HTTP Headers operation sets system properties on the blob"]
4513 #[doc = ""]
4514 #[doc = "Arguments:"]
4515 #[doc = "* `container_name`: The container name."]
4516 #[doc = "* `blob`: The blob name."]
4517 pub fn set_http_headers(&self, container_name: impl Into<String>, blob: impl Into<String>) -> set_http_headers::RequestBuilder {
4518 set_http_headers::RequestBuilder {
4519 client: self.0.clone(),
4520 container_name: container_name.into(),
4521 blob: blob.into(),
4522 timeout: None,
4523 x_ms_blob_cache_control: None,
4524 x_ms_blob_content_type: None,
4525 x_ms_blob_content_md5: None,
4526 x_ms_blob_content_encoding: None,
4527 x_ms_blob_content_language: None,
4528 x_ms_lease_id: None,
4529 if_modified_since: None,
4530 if_unmodified_since: None,
4531 if_match: None,
4532 if_none_match: None,
4533 x_ms_if_tags: None,
4534 x_ms_blob_content_disposition: None,
4535 x_ms_client_request_id: None,
4536 }
4537 }
4538 #[doc = "The Set Immutability Policy operation sets the immutability policy on the blob"]
4539 #[doc = ""]
4540 #[doc = "Arguments:"]
4541 #[doc = "* `container_name`: The container name."]
4542 #[doc = "* `blob`: The blob name."]
4543 pub fn set_immutability_policy(
4544 &self,
4545 container_name: impl Into<String>,
4546 blob: impl Into<String>,
4547 ) -> set_immutability_policy::RequestBuilder {
4548 set_immutability_policy::RequestBuilder {
4549 client: self.0.clone(),
4550 container_name: container_name.into(),
4551 blob: blob.into(),
4552 timeout: None,
4553 x_ms_client_request_id: None,
4554 if_unmodified_since: None,
4555 x_ms_immutability_policy_until_date: None,
4556 x_ms_immutability_policy_mode: None,
4557 }
4558 }
4559 #[doc = "The Delete Immutability Policy operation deletes the immutability policy on the blob"]
4560 #[doc = ""]
4561 #[doc = "Arguments:"]
4562 #[doc = "* `container_name`: The container name."]
4563 #[doc = "* `blob`: The blob name."]
4564 pub fn delete_immutability_policy(
4565 &self,
4566 container_name: impl Into<String>,
4567 blob: impl Into<String>,
4568 ) -> delete_immutability_policy::RequestBuilder {
4569 delete_immutability_policy::RequestBuilder {
4570 client: self.0.clone(),
4571 container_name: container_name.into(),
4572 blob: blob.into(),
4573 timeout: None,
4574 x_ms_client_request_id: None,
4575 }
4576 }
4577 #[doc = "The Set Legal Hold operation sets a legal hold on the blob."]
4578 #[doc = ""]
4579 #[doc = "Arguments:"]
4580 #[doc = "* `container_name`: The container name."]
4581 #[doc = "* `blob`: The blob name."]
4582 #[doc = "* `x_ms_legal_hold`: Specified if a legal hold should be set on the blob."]
4583 pub fn set_legal_hold(
4584 &self,
4585 container_name: impl Into<String>,
4586 blob: impl Into<String>,
4587 x_ms_legal_hold: bool,
4588 ) -> set_legal_hold::RequestBuilder {
4589 set_legal_hold::RequestBuilder {
4590 client: self.0.clone(),
4591 container_name: container_name.into(),
4592 blob: blob.into(),
4593 x_ms_legal_hold,
4594 timeout: None,
4595 x_ms_client_request_id: None,
4596 }
4597 }
4598 #[doc = "The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs"]
4599 #[doc = ""]
4600 #[doc = "Arguments:"]
4601 #[doc = "* `container_name`: The container name."]
4602 #[doc = "* `blob`: The blob name."]
4603 pub fn set_metadata(&self, container_name: impl Into<String>, blob: impl Into<String>) -> set_metadata::RequestBuilder {
4604 set_metadata::RequestBuilder {
4605 client: self.0.clone(),
4606 container_name: container_name.into(),
4607 blob: blob.into(),
4608 timeout: None,
4609 x_ms_meta: None,
4610 x_ms_lease_id: None,
4611 x_ms_encryption_key: None,
4612 x_ms_encryption_key_sha256: None,
4613 x_ms_encryption_algorithm: None,
4614 x_ms_encryption_scope: None,
4615 if_modified_since: None,
4616 if_unmodified_since: None,
4617 if_match: None,
4618 if_none_match: None,
4619 x_ms_if_tags: None,
4620 x_ms_client_request_id: None,
4621 }
4622 }
4623 #[doc = "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations"]
4624 #[doc = ""]
4625 #[doc = "Arguments:"]
4626 #[doc = "* `container_name`: The container name."]
4627 #[doc = "* `blob`: The blob name."]
4628 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
4629 pub fn acquire_lease(
4630 &self,
4631 container_name: impl Into<String>,
4632 blob: impl Into<String>,
4633 x_ms_lease_action: impl Into<String>,
4634 ) -> acquire_lease::RequestBuilder {
4635 acquire_lease::RequestBuilder {
4636 client: self.0.clone(),
4637 container_name: container_name.into(),
4638 blob: blob.into(),
4639 x_ms_lease_action: x_ms_lease_action.into(),
4640 timeout: None,
4641 x_ms_lease_duration: None,
4642 x_ms_proposed_lease_id: None,
4643 if_modified_since: None,
4644 if_unmodified_since: None,
4645 if_match: None,
4646 if_none_match: None,
4647 x_ms_if_tags: None,
4648 x_ms_client_request_id: None,
4649 }
4650 }
4651 #[doc = "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations"]
4652 #[doc = ""]
4653 #[doc = "Arguments:"]
4654 #[doc = "* `container_name`: The container name."]
4655 #[doc = "* `blob`: The blob name."]
4656 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
4657 #[doc = "* `x_ms_lease_id`: Specifies the current lease ID on the resource."]
4658 pub fn release_lease(
4659 &self,
4660 container_name: impl Into<String>,
4661 blob: impl Into<String>,
4662 x_ms_lease_action: impl Into<String>,
4663 x_ms_lease_id: impl Into<String>,
4664 ) -> release_lease::RequestBuilder {
4665 release_lease::RequestBuilder {
4666 client: self.0.clone(),
4667 container_name: container_name.into(),
4668 blob: blob.into(),
4669 x_ms_lease_action: x_ms_lease_action.into(),
4670 x_ms_lease_id: x_ms_lease_id.into(),
4671 timeout: None,
4672 if_modified_since: None,
4673 if_unmodified_since: None,
4674 if_match: None,
4675 if_none_match: None,
4676 x_ms_if_tags: None,
4677 x_ms_client_request_id: None,
4678 }
4679 }
4680 #[doc = "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations"]
4681 #[doc = ""]
4682 #[doc = "Arguments:"]
4683 #[doc = "* `container_name`: The container name."]
4684 #[doc = "* `blob`: The blob name."]
4685 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
4686 #[doc = "* `x_ms_lease_id`: Specifies the current lease ID on the resource."]
4687 pub fn renew_lease(
4688 &self,
4689 container_name: impl Into<String>,
4690 blob: impl Into<String>,
4691 x_ms_lease_action: impl Into<String>,
4692 x_ms_lease_id: impl Into<String>,
4693 ) -> renew_lease::RequestBuilder {
4694 renew_lease::RequestBuilder {
4695 client: self.0.clone(),
4696 container_name: container_name.into(),
4697 blob: blob.into(),
4698 x_ms_lease_action: x_ms_lease_action.into(),
4699 x_ms_lease_id: x_ms_lease_id.into(),
4700 timeout: None,
4701 if_modified_since: None,
4702 if_unmodified_since: None,
4703 if_match: None,
4704 if_none_match: None,
4705 x_ms_if_tags: None,
4706 x_ms_client_request_id: None,
4707 }
4708 }
4709 #[doc = "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations"]
4710 #[doc = ""]
4711 #[doc = "Arguments:"]
4712 #[doc = "* `container_name`: The container name."]
4713 #[doc = "* `blob`: The blob name."]
4714 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
4715 #[doc = "* `x_ms_lease_id`: Specifies the current lease ID on the resource."]
4716 #[doc = "* `x_ms_proposed_lease_id`: Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats."]
4717 pub fn change_lease(
4718 &self,
4719 container_name: impl Into<String>,
4720 blob: impl Into<String>,
4721 x_ms_lease_action: impl Into<String>,
4722 x_ms_lease_id: impl Into<String>,
4723 x_ms_proposed_lease_id: impl Into<String>,
4724 ) -> change_lease::RequestBuilder {
4725 change_lease::RequestBuilder {
4726 client: self.0.clone(),
4727 container_name: container_name.into(),
4728 blob: blob.into(),
4729 x_ms_lease_action: x_ms_lease_action.into(),
4730 x_ms_lease_id: x_ms_lease_id.into(),
4731 x_ms_proposed_lease_id: x_ms_proposed_lease_id.into(),
4732 timeout: None,
4733 if_modified_since: None,
4734 if_unmodified_since: None,
4735 if_match: None,
4736 if_none_match: None,
4737 x_ms_if_tags: None,
4738 x_ms_client_request_id: None,
4739 }
4740 }
4741 #[doc = "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations"]
4742 #[doc = ""]
4743 #[doc = "Arguments:"]
4744 #[doc = "* `container_name`: The container name."]
4745 #[doc = "* `blob`: The blob name."]
4746 #[doc = "* `x_ms_lease_action`: Describes what lease action to take."]
4747 pub fn break_lease(
4748 &self,
4749 container_name: impl Into<String>,
4750 blob: impl Into<String>,
4751 x_ms_lease_action: impl Into<String>,
4752 ) -> break_lease::RequestBuilder {
4753 break_lease::RequestBuilder {
4754 client: self.0.clone(),
4755 container_name: container_name.into(),
4756 blob: blob.into(),
4757 x_ms_lease_action: x_ms_lease_action.into(),
4758 timeout: None,
4759 x_ms_lease_break_period: None,
4760 if_modified_since: None,
4761 if_unmodified_since: None,
4762 if_match: None,
4763 if_none_match: None,
4764 x_ms_if_tags: None,
4765 x_ms_client_request_id: None,
4766 }
4767 }
4768 #[doc = "The Create Snapshot operation creates a read-only snapshot of a blob"]
4769 #[doc = ""]
4770 #[doc = "Arguments:"]
4771 #[doc = "* `container_name`: The container name."]
4772 #[doc = "* `blob`: The blob name."]
4773 pub fn create_snapshot(&self, container_name: impl Into<String>, blob: impl Into<String>) -> create_snapshot::RequestBuilder {
4774 create_snapshot::RequestBuilder {
4775 client: self.0.clone(),
4776 container_name: container_name.into(),
4777 blob: blob.into(),
4778 timeout: None,
4779 x_ms_meta: None,
4780 x_ms_encryption_key: None,
4781 x_ms_encryption_key_sha256: None,
4782 x_ms_encryption_algorithm: None,
4783 x_ms_encryption_scope: None,
4784 if_modified_since: None,
4785 if_unmodified_since: None,
4786 if_match: None,
4787 if_none_match: None,
4788 x_ms_if_tags: None,
4789 x_ms_lease_id: None,
4790 x_ms_client_request_id: None,
4791 }
4792 }
4793 #[doc = "The Start Copy From URL operation copies a blob or an internet resource to a new blob."]
4794 #[doc = ""]
4795 #[doc = "Arguments:"]
4796 #[doc = "* `container_name`: The container name."]
4797 #[doc = "* `blob`: The blob name."]
4798 #[doc = "* `x_ms_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."]
4799 pub fn start_copy_from_url(
4800 &self,
4801 container_name: impl Into<String>,
4802 blob: impl Into<String>,
4803 x_ms_copy_source: impl Into<String>,
4804 ) -> start_copy_from_url::RequestBuilder {
4805 start_copy_from_url::RequestBuilder {
4806 client: self.0.clone(),
4807 container_name: container_name.into(),
4808 blob: blob.into(),
4809 x_ms_copy_source: x_ms_copy_source.into(),
4810 timeout: None,
4811 x_ms_meta: None,
4812 x_ms_access_tier: None,
4813 x_ms_rehydrate_priority: None,
4814 x_ms_source_if_modified_since: None,
4815 x_ms_source_if_unmodified_since: None,
4816 x_ms_source_if_match: None,
4817 x_ms_source_if_none_match: None,
4818 x_ms_source_if_tags: None,
4819 if_modified_since: None,
4820 if_unmodified_since: None,
4821 if_match: None,
4822 if_none_match: None,
4823 x_ms_if_tags: None,
4824 x_ms_lease_id: None,
4825 x_ms_client_request_id: None,
4826 x_ms_tags: None,
4827 x_ms_seal_blob: None,
4828 x_ms_immutability_policy_until_date: None,
4829 x_ms_immutability_policy_mode: None,
4830 x_ms_legal_hold: None,
4831 }
4832 }
4833 #[doc = "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."]
4834 #[doc = ""]
4835 #[doc = "Arguments:"]
4836 #[doc = "* `container_name`: The container name."]
4837 #[doc = "* `blob`: The blob name."]
4838 #[doc = "* `x_ms_requires_sync`: This header indicates that this is a synchronous Copy Blob From URL instead of a Asynchronous Copy Blob."]
4839 #[doc = "* `x_ms_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."]
4840 pub fn copy_from_url(
4841 &self,
4842 container_name: impl Into<String>,
4843 blob: impl Into<String>,
4844 x_ms_requires_sync: impl Into<String>,
4845 x_ms_copy_source: impl Into<String>,
4846 ) -> copy_from_url::RequestBuilder {
4847 copy_from_url::RequestBuilder {
4848 client: self.0.clone(),
4849 container_name: container_name.into(),
4850 blob: blob.into(),
4851 x_ms_requires_sync: x_ms_requires_sync.into(),
4852 x_ms_copy_source: x_ms_copy_source.into(),
4853 timeout: None,
4854 x_ms_meta: None,
4855 x_ms_access_tier: None,
4856 x_ms_source_if_modified_since: None,
4857 x_ms_source_if_unmodified_since: None,
4858 x_ms_source_if_match: None,
4859 x_ms_source_if_none_match: None,
4860 if_modified_since: None,
4861 if_unmodified_since: None,
4862 if_match: None,
4863 if_none_match: None,
4864 x_ms_if_tags: None,
4865 x_ms_lease_id: None,
4866 x_ms_client_request_id: None,
4867 x_ms_source_content_md5: None,
4868 x_ms_tags: None,
4869 x_ms_immutability_policy_until_date: None,
4870 x_ms_immutability_policy_mode: None,
4871 x_ms_legal_hold: None,
4872 x_ms_copy_source_authorization: None,
4873 x_ms_encryption_scope: None,
4874 x_ms_copy_source_tag_option: None,
4875 }
4876 }
4877 #[doc = "The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata."]
4878 #[doc = ""]
4879 #[doc = "Arguments:"]
4880 #[doc = "* `container_name`: The container name."]
4881 #[doc = "* `blob`: The blob name."]
4882 #[doc = "* `x_ms_copy_action`: Copy action."]
4883 pub fn abort_copy_from_url(
4884 &self,
4885 container_name: impl Into<String>,
4886 blob: impl Into<String>,
4887 x_ms_copy_action: impl Into<String>,
4888 ) -> abort_copy_from_url::RequestBuilder {
4889 abort_copy_from_url::RequestBuilder {
4890 client: self.0.clone(),
4891 container_name: container_name.into(),
4892 blob: blob.into(),
4893 x_ms_copy_action: x_ms_copy_action.into(),
4894 timeout: None,
4895 x_ms_lease_id: None,
4896 x_ms_client_request_id: None,
4897 }
4898 }
4899 #[doc = "The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag."]
4900 #[doc = ""]
4901 #[doc = "Arguments:"]
4902 #[doc = "* `container_name`: The container name."]
4903 #[doc = "* `blob`: The blob name."]
4904 #[doc = "* `x_ms_access_tier`: Indicates the tier to be set on the blob."]
4905 pub fn set_tier(
4906 &self,
4907 container_name: impl Into<String>,
4908 blob: impl Into<String>,
4909 x_ms_access_tier: impl Into<String>,
4910 ) -> set_tier::RequestBuilder {
4911 set_tier::RequestBuilder {
4912 client: self.0.clone(),
4913 container_name: container_name.into(),
4914 blob: blob.into(),
4915 x_ms_access_tier: x_ms_access_tier.into(),
4916 snapshot: None,
4917 versionid: None,
4918 timeout: None,
4919 x_ms_rehydrate_priority: None,
4920 x_ms_client_request_id: None,
4921 x_ms_lease_id: None,
4922 x_ms_if_tags: None,
4923 }
4924 }
4925 #[doc = "Returns the sku name and account kind "]
4926 #[doc = ""]
4927 #[doc = "Arguments:"]
4928 #[doc = "* `container_name`: The container name."]
4929 #[doc = "* `blob`: The blob name."]
4930 pub fn get_account_info(&self, container_name: impl Into<String>, blob: impl Into<String>) -> get_account_info::RequestBuilder {
4931 get_account_info::RequestBuilder {
4932 client: self.0.clone(),
4933 container_name: container_name.into(),
4934 blob: blob.into(),
4935 }
4936 }
4937 #[doc = "The Query operation enables users to select/project on blob data by providing simple query expressions."]
4938 #[doc = ""]
4939 #[doc = "Arguments:"]
4940 #[doc = "* `container_name`: The container name."]
4941 #[doc = "* `blob`: The blob name."]
4942 pub fn query(&self, container_name: impl Into<String>, blob: impl Into<String>) -> query::RequestBuilder {
4943 query::RequestBuilder {
4944 client: self.0.clone(),
4945 container_name: container_name.into(),
4946 blob: blob.into(),
4947 query_request: None,
4948 snapshot: None,
4949 timeout: None,
4950 x_ms_lease_id: None,
4951 x_ms_encryption_key: None,
4952 x_ms_encryption_key_sha256: None,
4953 x_ms_encryption_algorithm: None,
4954 if_modified_since: None,
4955 if_unmodified_since: None,
4956 if_match: None,
4957 if_none_match: None,
4958 x_ms_if_tags: None,
4959 x_ms_client_request_id: None,
4960 }
4961 }
4962 #[doc = "The Get Tags operation enables users to get the tags associated with a blob."]
4963 #[doc = ""]
4964 #[doc = "Arguments:"]
4965 #[doc = "* `container_name`: The container name."]
4966 #[doc = "* `blob`: The blob name."]
4967 pub fn get_tags(&self, container_name: impl Into<String>, blob: impl Into<String>) -> get_tags::RequestBuilder {
4968 get_tags::RequestBuilder {
4969 client: self.0.clone(),
4970 container_name: container_name.into(),
4971 blob: blob.into(),
4972 timeout: None,
4973 x_ms_client_request_id: None,
4974 snapshot: None,
4975 versionid: None,
4976 x_ms_if_tags: None,
4977 x_ms_lease_id: None,
4978 }
4979 }
4980 #[doc = "The Set Tags operation enables users to set tags on a blob."]
4981 #[doc = ""]
4982 #[doc = "Arguments:"]
4983 #[doc = "* `container_name`: The container name."]
4984 #[doc = "* `blob`: The blob name."]
4985 pub fn set_tags(&self, container_name: impl Into<String>, blob: impl Into<String>) -> set_tags::RequestBuilder {
4986 set_tags::RequestBuilder {
4987 client: self.0.clone(),
4988 container_name: container_name.into(),
4989 blob: blob.into(),
4990 timeout: None,
4991 versionid: None,
4992 content_md5: None,
4993 x_ms_content_crc64: None,
4994 x_ms_client_request_id: None,
4995 x_ms_if_tags: None,
4996 x_ms_lease_id: None,
4997 tags: None,
4998 }
4999 }
5000 }
5001 pub mod download {
5002 use super::models;
5003 #[cfg(not(target_arch = "wasm32"))]
5004 use futures::future::BoxFuture;
5005 #[cfg(target_arch = "wasm32")]
5006 use futures::future::LocalBoxFuture as BoxFuture;
5007 #[derive(Debug)]
5008 pub struct Response(azure_core::Response);
5009 impl Response {
5010 pub async fn into_body(self) -> azure_core::Result<bytes::Bytes> {
5011 let bytes = self.0.into_body().collect().await?;
5012 let body = bytes;
5013 Ok(body)
5014 }
5015 pub fn into_raw_response(self) -> azure_core::Response {
5016 self.0
5017 }
5018 pub fn as_raw_response(&self) -> &azure_core::Response {
5019 &self.0
5020 }
5021 pub fn headers(&self) -> Headers {
5022 Headers(self.0.headers())
5023 }
5024 }
5025 impl From<Response> for azure_core::Response {
5026 fn from(rsp: Response) -> Self {
5027 rsp.into_raw_response()
5028 }
5029 }
5030 impl AsRef<azure_core::Response> for Response {
5031 fn as_ref(&self) -> &azure_core::Response {
5032 self.as_raw_response()
5033 }
5034 }
5035 pub struct Headers<'a>(&'a azure_core::headers::Headers);
5036 impl<'a> Headers<'a> {
5037 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
5038 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
5039 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
5040 }
5041 #[doc = "Returns the date and time the blob was created."]
5042 pub fn x_ms_creation_time(&self) -> azure_core::Result<::time::OffsetDateTime> {
5043 azure_core::date::parse_rfc1123(
5044 self.0
5045 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-creation-time"))?,
5046 )
5047 }
5048 pub fn x_ms_meta(&self) -> azure_core::Result<&str> {
5049 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-meta"))
5050 }
5051 #[doc = "Optional. Only valid when Object Replication is enabled for the storage container and on the destination blob of the replication."]
5052 pub fn x_ms_or_policy_id(&self) -> azure_core::Result<&str> {
5053 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-or-policy-id"))
5054 }
5055 #[doc = "Optional. Only valid when Object Replication is enabled for the storage container and on the source blob of the replication. When retrieving this header, it will return the header with the policy id and rule id (e.g. x-ms-or-policyid_ruleid), and the value will be the status of the replication (e.g. complete, failed)."]
5056 pub fn x_ms_or(&self) -> azure_core::Result<&str> {
5057 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-or"))
5058 }
5059 #[doc = "The number of bytes present in the response body."]
5060 pub fn content_length(&self) -> azure_core::Result<i64> {
5061 self.0.get_as(&azure_core::headers::HeaderName::from_static("content-length"))
5062 }
5063 #[doc = "The media type of the body of the response. For Download Blob this is 'application/octet-stream'"]
5064 pub fn content_type(&self) -> azure_core::Result<&str> {
5065 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-type"))
5066 }
5067 #[doc = "Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' request header."]
5068 pub fn content_range(&self) -> azure_core::Result<&str> {
5069 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-range"))
5070 }
5071 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
5072 pub fn e_tag(&self) -> azure_core::Result<&str> {
5073 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
5074 }
5075 #[doc = "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."]
5076 pub fn content_md5(&self) -> azure_core::Result<&str> {
5077 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
5078 }
5079 #[doc = "This header returns the value that was specified for the Content-Encoding request header"]
5080 pub fn content_encoding(&self) -> azure_core::Result<&str> {
5081 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-encoding"))
5082 }
5083 #[doc = "This header is returned if it was previously specified for the blob."]
5084 pub fn cache_control(&self) -> azure_core::Result<&str> {
5085 self.0.get_str(&azure_core::headers::HeaderName::from_static("cache-control"))
5086 }
5087 #[doc = "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."]
5088 pub fn content_disposition(&self) -> azure_core::Result<&str> {
5089 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-disposition"))
5090 }
5091 #[doc = "This header returns the value that was specified for the Content-Language request header."]
5092 pub fn content_language(&self) -> azure_core::Result<&str> {
5093 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-language"))
5094 }
5095 #[doc = "The current sequence number for a page blob. This header is not returned for block blobs or append blobs"]
5096 pub fn x_ms_blob_sequence_number(&self) -> azure_core::Result<i64> {
5097 self.0
5098 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sequence-number"))
5099 }
5100 #[doc = "The blob's type."]
5101 pub fn x_ms_blob_type(&self) -> azure_core::Result<&str> {
5102 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-blob-type"))
5103 }
5104 #[doc = "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."]
5105 pub fn x_ms_copy_completion_time(&self) -> azure_core::Result<::time::OffsetDateTime> {
5106 azure_core::date::parse_rfc1123(
5107 self.0
5108 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-completion-time"))?,
5109 )
5110 }
5111 #[doc = "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"]
5112 pub fn x_ms_copy_status_description(&self) -> azure_core::Result<&str> {
5113 self.0
5114 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-status-description"))
5115 }
5116 #[doc = "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."]
5117 pub fn x_ms_copy_id(&self) -> azure_core::Result<&str> {
5118 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-id"))
5119 }
5120 #[doc = "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"]
5121 pub fn x_ms_copy_progress(&self) -> azure_core::Result<&str> {
5122 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-progress"))
5123 }
5124 #[doc = "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."]
5125 pub fn x_ms_copy_source(&self) -> azure_core::Result<&str> {
5126 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-source"))
5127 }
5128 #[doc = "State of the copy operation identified by x-ms-copy-id."]
5129 pub fn x_ms_copy_status(&self) -> azure_core::Result<&str> {
5130 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-status"))
5131 }
5132 #[doc = "When a blob is leased, specifies whether the lease is of infinite or fixed duration."]
5133 pub fn x_ms_lease_duration(&self) -> azure_core::Result<&str> {
5134 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-duration"))
5135 }
5136 #[doc = "Lease state of the blob."]
5137 pub fn x_ms_lease_state(&self) -> azure_core::Result<&str> {
5138 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-state"))
5139 }
5140 #[doc = "The current lease status of the blob."]
5141 pub fn x_ms_lease_status(&self) -> azure_core::Result<&str> {
5142 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-status"))
5143 }
5144 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
5145 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
5146 self.0
5147 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
5148 }
5149 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
5150 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
5151 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
5152 }
5153 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
5154 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
5155 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
5156 }
5157 #[doc = "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."]
5158 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
5159 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
5160 }
5161 #[doc = "The value of this header indicates whether version of this blob is a current version, see also x-ms-version-id header."]
5162 pub fn x_ms_is_current_version(&self) -> azure_core::Result<bool> {
5163 self.0
5164 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-is-current-version"))
5165 }
5166 #[doc = "Indicates that the service supports requests for partial blob content."]
5167 pub fn accept_ranges(&self) -> azure_core::Result<&str> {
5168 self.0.get_str(&azure_core::headers::HeaderName::from_static("accept-ranges"))
5169 }
5170 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
5171 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
5172 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
5173 }
5174 #[doc = "The number of committed blocks present in the blob. This header is returned only for append blobs."]
5175 pub fn x_ms_blob_committed_block_count(&self) -> azure_core::Result<i32> {
5176 self.0
5177 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-committed-block-count"))
5178 }
5179 #[doc = "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)."]
5180 pub fn x_ms_server_encrypted(&self) -> azure_core::Result<bool> {
5181 self.0
5182 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-server-encrypted"))
5183 }
5184 #[doc = "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."]
5185 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
5186 self.0
5187 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
5188 }
5189 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
5190 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
5191 self.0
5192 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
5193 }
5194 #[doc = "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"]
5195 pub fn x_ms_blob_content_md5(&self) -> azure_core::Result<&str> {
5196 self.0
5197 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-blob-content-md5"))
5198 }
5199 #[doc = "The number of tags associated with the blob"]
5200 pub fn x_ms_tag_count(&self) -> azure_core::Result<i64> {
5201 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-tag-count"))
5202 }
5203 #[doc = "If this blob has been sealed"]
5204 pub fn x_ms_blob_sealed(&self) -> azure_core::Result<bool> {
5205 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sealed"))
5206 }
5207 #[doc = "UTC date/time value generated by the service that indicates the time at which the blob was last read or written to"]
5208 pub fn x_ms_last_access_time(&self) -> azure_core::Result<::time::OffsetDateTime> {
5209 azure_core::date::parse_rfc1123(
5210 self.0
5211 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-last-access-time"))?,
5212 )
5213 }
5214 #[doc = "UTC date/time value generated by the service that indicates the time at which the blob immutability policy will expire."]
5215 pub fn x_ms_immutability_policy_until_date(&self) -> azure_core::Result<::time::OffsetDateTime> {
5216 azure_core::date::parse_rfc1123(
5217 self.0
5218 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-immutability-policy-until-date"))?,
5219 )
5220 }
5221 #[doc = "Indicates immutability policy mode."]
5222 pub fn x_ms_immutability_policy_mode(&self) -> azure_core::Result<&str> {
5223 self.0
5224 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-immutability-policy-mode"))
5225 }
5226 #[doc = "Indicates if a legal hold is present on the blob."]
5227 pub fn x_ms_legal_hold(&self) -> azure_core::Result<bool> {
5228 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-legal-hold"))
5229 }
5230 #[doc = "If the request is to read a specified range and the x-ms-range-get-content-crc64 is set to true, then the request returns a crc64 for the range, as long as the range size is less than or equal to 4 MB. If both x-ms-range-get-content-crc64 & x-ms-range-get-content-md5 is specified in the same request, it will fail with 400(Bad Request)"]
5231 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
5232 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
5233 }
5234 }
5235 #[derive(Clone)]
5236 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5237 #[doc = r""]
5238 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5239 #[doc = r" parameters can be chained."]
5240 #[doc = r""]
5241 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5242 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
5243 #[doc = r" executes the request and returns a `Result` with the parsed"]
5244 #[doc = r" response."]
5245 #[doc = r""]
5246 #[doc = r" In order to execute the request without polling the service"]
5247 #[doc = r" until the operation completes, use `.send().await` instead."]
5248 #[doc = r""]
5249 #[doc = r" If you need lower-level access to the raw response details"]
5250 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5251 #[doc = r" can finalize the request using the"]
5252 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5253 #[doc = r" that resolves to a lower-level [`Response`] value."]
5254 pub struct RequestBuilder {
5255 pub(crate) client: super::super::Client,
5256 pub(crate) container_name: String,
5257 pub(crate) blob: String,
5258 pub(crate) snapshot: Option<String>,
5259 pub(crate) versionid: Option<String>,
5260 pub(crate) timeout: Option<i64>,
5261 pub(crate) x_ms_range: Option<String>,
5262 pub(crate) x_ms_lease_id: Option<String>,
5263 pub(crate) x_ms_range_get_content_md5: Option<bool>,
5264 pub(crate) x_ms_range_get_content_crc64: Option<bool>,
5265 pub(crate) x_ms_encryption_key: Option<String>,
5266 pub(crate) x_ms_encryption_key_sha256: Option<String>,
5267 pub(crate) x_ms_encryption_algorithm: Option<String>,
5268 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
5269 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
5270 pub(crate) if_match: Option<String>,
5271 pub(crate) if_none_match: Option<String>,
5272 pub(crate) x_ms_if_tags: Option<String>,
5273 pub(crate) x_ms_client_request_id: Option<String>,
5274 }
5275 impl RequestBuilder {
5276 #[doc = "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 <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob\">Creating a Snapshot of a Blob.</a>"]
5277 pub fn snapshot(mut self, snapshot: impl Into<String>) -> Self {
5278 self.snapshot = Some(snapshot.into());
5279 self
5280 }
5281 #[doc = "The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer."]
5282 pub fn versionid(mut self, versionid: impl Into<String>) -> Self {
5283 self.versionid = Some(versionid.into());
5284 self
5285 }
5286 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
5287 pub fn timeout(mut self, timeout: i64) -> Self {
5288 self.timeout = Some(timeout);
5289 self
5290 }
5291 #[doc = "Return only the bytes of the blob in the specified range."]
5292 pub fn x_ms_range(mut self, x_ms_range: impl Into<String>) -> Self {
5293 self.x_ms_range = Some(x_ms_range.into());
5294 self
5295 }
5296 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
5297 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
5298 self.x_ms_lease_id = Some(x_ms_lease_id.into());
5299 self
5300 }
5301 #[doc = "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."]
5302 pub fn x_ms_range_get_content_md5(mut self, x_ms_range_get_content_md5: bool) -> Self {
5303 self.x_ms_range_get_content_md5 = Some(x_ms_range_get_content_md5);
5304 self
5305 }
5306 #[doc = "When set to true and specified together with the Range, the service returns the CRC64 hash for the range, as long as the range is less than or equal to 4 MB in size."]
5307 pub fn x_ms_range_get_content_crc64(mut self, x_ms_range_get_content_crc64: bool) -> Self {
5308 self.x_ms_range_get_content_crc64 = Some(x_ms_range_get_content_crc64);
5309 self
5310 }
5311 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
5312 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
5313 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
5314 self
5315 }
5316 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
5317 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
5318 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
5319 self
5320 }
5321 #[doc = "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."]
5322 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
5323 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
5324 self
5325 }
5326 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
5327 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
5328 self.if_modified_since = Some(if_modified_since.into());
5329 self
5330 }
5331 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
5332 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
5333 self.if_unmodified_since = Some(if_unmodified_since.into());
5334 self
5335 }
5336 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
5337 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
5338 self.if_match = Some(if_match.into());
5339 self
5340 }
5341 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
5342 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
5343 self.if_none_match = Some(if_none_match.into());
5344 self
5345 }
5346 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
5347 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
5348 self.x_ms_if_tags = Some(x_ms_if_tags.into());
5349 self
5350 }
5351 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
5352 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
5353 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
5354 self
5355 }
5356 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5357 #[doc = ""]
5358 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5359 #[doc = "However, this function can provide more flexibility when required."]
5360 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5361 Box::pin({
5362 let this = self.clone();
5363 async move {
5364 let url = this.url()?;
5365 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
5366 let bearer_token = this.client.bearer_token().await?;
5367 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
5368 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
5369 if let Some(snapshot) = &this.snapshot {
5370 req.url_mut().query_pairs_mut().append_pair("snapshot", snapshot);
5371 }
5372 if let Some(versionid) = &this.versionid {
5373 req.url_mut().query_pairs_mut().append_pair("versionid", versionid);
5374 }
5375 if let Some(timeout) = &this.timeout {
5376 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
5377 }
5378 if let Some(x_ms_range) = &this.x_ms_range {
5379 req.insert_header("x-ms-range", x_ms_range);
5380 }
5381 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
5382 req.insert_header("x-ms-lease-id", x_ms_lease_id);
5383 }
5384 if let Some(x_ms_range_get_content_md5) = &this.x_ms_range_get_content_md5 {
5385 req.insert_header("x-ms-range-get-content-md5", x_ms_range_get_content_md5.to_string());
5386 }
5387 if let Some(x_ms_range_get_content_crc64) = &this.x_ms_range_get_content_crc64 {
5388 req.insert_header("x-ms-range-get-content-crc64", x_ms_range_get_content_crc64.to_string());
5389 }
5390 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
5391 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
5392 }
5393 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
5394 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
5395 }
5396 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
5397 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
5398 }
5399 if let Some(if_modified_since) = &this.if_modified_since {
5400 req.insert_header("if-modified-since", if_modified_since.to_string());
5401 }
5402 if let Some(if_unmodified_since) = &this.if_unmodified_since {
5403 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
5404 }
5405 if let Some(if_match) = &this.if_match {
5406 req.insert_header("if-match", if_match);
5407 }
5408 if let Some(if_none_match) = &this.if_none_match {
5409 req.insert_header("if-none-match", if_none_match);
5410 }
5411 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
5412 req.insert_header("x-ms-if-tags", x_ms_if_tags);
5413 }
5414 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
5415 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
5416 }
5417 let req_body = azure_core::EMPTY_BODY;
5418 req.set_body(req_body);
5419 Ok(Response(this.client.send(&mut req).await?))
5420 }
5421 })
5422 }
5423 fn url(&self) -> azure_core::Result<azure_core::Url> {
5424 let mut url = self.client.endpoint().clone();
5425 url.set_path(&format!("/{}/{}", &self.container_name, &self.blob));
5426 Ok(url)
5427 }
5428 }
5429 impl std::future::IntoFuture for RequestBuilder {
5430 type Output = azure_core::Result<bytes::Bytes>;
5431 type IntoFuture = BoxFuture<'static, azure_core::Result<bytes::Bytes>>;
5432 #[doc = "Returns a future that sends the request and returns the parsed response body."]
5433 #[doc = ""]
5434 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
5435 #[doc = ""]
5436 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
5437 fn into_future(self) -> Self::IntoFuture {
5438 Box::pin(async move { self.send().await?.into_body().await })
5439 }
5440 }
5441 }
5442 pub mod delete {
5443 use super::models;
5444 #[cfg(not(target_arch = "wasm32"))]
5445 use futures::future::BoxFuture;
5446 #[cfg(target_arch = "wasm32")]
5447 use futures::future::LocalBoxFuture as BoxFuture;
5448 #[derive(Debug)]
5449 pub struct Response(azure_core::Response);
5450 impl Response {
5451 pub fn into_raw_response(self) -> azure_core::Response {
5452 self.0
5453 }
5454 pub fn as_raw_response(&self) -> &azure_core::Response {
5455 &self.0
5456 }
5457 pub fn headers(&self) -> Headers {
5458 Headers(self.0.headers())
5459 }
5460 }
5461 impl From<Response> for azure_core::Response {
5462 fn from(rsp: Response) -> Self {
5463 rsp.into_raw_response()
5464 }
5465 }
5466 impl AsRef<azure_core::Response> for Response {
5467 fn as_ref(&self) -> &azure_core::Response {
5468 self.as_raw_response()
5469 }
5470 }
5471 pub struct Headers<'a>(&'a azure_core::headers::Headers);
5472 impl<'a> Headers<'a> {
5473 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
5474 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
5475 self.0
5476 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
5477 }
5478 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
5479 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
5480 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
5481 }
5482 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
5483 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
5484 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
5485 }
5486 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
5487 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
5488 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
5489 }
5490 }
5491 #[derive(Clone)]
5492 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5493 #[doc = r""]
5494 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5495 #[doc = r" parameters can be chained."]
5496 #[doc = r""]
5497 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5498 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
5499 #[doc = r" executes the request and returns a `Result` with the parsed"]
5500 #[doc = r" response."]
5501 #[doc = r""]
5502 #[doc = r" In order to execute the request without polling the service"]
5503 #[doc = r" until the operation completes, use `.send().await` instead."]
5504 #[doc = r""]
5505 #[doc = r" If you need lower-level access to the raw response details"]
5506 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5507 #[doc = r" can finalize the request using the"]
5508 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5509 #[doc = r" that resolves to a lower-level [`Response`] value."]
5510 pub struct RequestBuilder {
5511 pub(crate) client: super::super::Client,
5512 pub(crate) container_name: String,
5513 pub(crate) blob: String,
5514 pub(crate) snapshot: Option<String>,
5515 pub(crate) versionid: Option<String>,
5516 pub(crate) timeout: Option<i64>,
5517 pub(crate) x_ms_lease_id: Option<String>,
5518 pub(crate) x_ms_delete_snapshots: Option<String>,
5519 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
5520 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
5521 pub(crate) if_match: Option<String>,
5522 pub(crate) if_none_match: Option<String>,
5523 pub(crate) x_ms_if_tags: Option<String>,
5524 pub(crate) x_ms_client_request_id: Option<String>,
5525 pub(crate) deletetype: Option<String>,
5526 }
5527 impl RequestBuilder {
5528 #[doc = "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 <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob\">Creating a Snapshot of a Blob.</a>"]
5529 pub fn snapshot(mut self, snapshot: impl Into<String>) -> Self {
5530 self.snapshot = Some(snapshot.into());
5531 self
5532 }
5533 #[doc = "The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer."]
5534 pub fn versionid(mut self, versionid: impl Into<String>) -> Self {
5535 self.versionid = Some(versionid.into());
5536 self
5537 }
5538 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
5539 pub fn timeout(mut self, timeout: i64) -> Self {
5540 self.timeout = Some(timeout);
5541 self
5542 }
5543 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
5544 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
5545 self.x_ms_lease_id = Some(x_ms_lease_id.into());
5546 self
5547 }
5548 #[doc = "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"]
5549 pub fn x_ms_delete_snapshots(mut self, x_ms_delete_snapshots: impl Into<String>) -> Self {
5550 self.x_ms_delete_snapshots = Some(x_ms_delete_snapshots.into());
5551 self
5552 }
5553 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
5554 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
5555 self.if_modified_since = Some(if_modified_since.into());
5556 self
5557 }
5558 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
5559 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
5560 self.if_unmodified_since = Some(if_unmodified_since.into());
5561 self
5562 }
5563 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
5564 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
5565 self.if_match = Some(if_match.into());
5566 self
5567 }
5568 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
5569 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
5570 self.if_none_match = Some(if_none_match.into());
5571 self
5572 }
5573 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
5574 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
5575 self.x_ms_if_tags = Some(x_ms_if_tags.into());
5576 self
5577 }
5578 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
5579 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
5580 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
5581 self
5582 }
5583 #[doc = "Optional. Only possible value is 'permanent', which specifies to permanently delete a blob if blob soft delete is enabled."]
5584 pub fn deletetype(mut self, deletetype: impl Into<String>) -> Self {
5585 self.deletetype = Some(deletetype.into());
5586 self
5587 }
5588 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5589 #[doc = ""]
5590 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5591 #[doc = "However, this function can provide more flexibility when required."]
5592 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5593 Box::pin({
5594 let this = self.clone();
5595 async move {
5596 let url = this.url()?;
5597 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
5598 let bearer_token = this.client.bearer_token().await?;
5599 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
5600 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
5601 if let Some(snapshot) = &this.snapshot {
5602 req.url_mut().query_pairs_mut().append_pair("snapshot", snapshot);
5603 }
5604 if let Some(versionid) = &this.versionid {
5605 req.url_mut().query_pairs_mut().append_pair("versionid", versionid);
5606 }
5607 if let Some(timeout) = &this.timeout {
5608 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
5609 }
5610 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
5611 req.insert_header("x-ms-lease-id", x_ms_lease_id);
5612 }
5613 if let Some(x_ms_delete_snapshots) = &this.x_ms_delete_snapshots {
5614 req.insert_header("x-ms-delete-snapshots", x_ms_delete_snapshots);
5615 }
5616 if let Some(if_modified_since) = &this.if_modified_since {
5617 req.insert_header("if-modified-since", if_modified_since.to_string());
5618 }
5619 if let Some(if_unmodified_since) = &this.if_unmodified_since {
5620 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
5621 }
5622 if let Some(if_match) = &this.if_match {
5623 req.insert_header("if-match", if_match);
5624 }
5625 if let Some(if_none_match) = &this.if_none_match {
5626 req.insert_header("if-none-match", if_none_match);
5627 }
5628 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
5629 req.insert_header("x-ms-if-tags", x_ms_if_tags);
5630 }
5631 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
5632 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
5633 }
5634 if let Some(deletetype) = &this.deletetype {
5635 req.url_mut().query_pairs_mut().append_pair("deletetype", deletetype);
5636 }
5637 let req_body = azure_core::EMPTY_BODY;
5638 req.set_body(req_body);
5639 Ok(Response(this.client.send(&mut req).await?))
5640 }
5641 })
5642 }
5643 fn url(&self) -> azure_core::Result<azure_core::Url> {
5644 let mut url = self.client.endpoint().clone();
5645 url.set_path(&format!("/{}/{}", &self.container_name, &self.blob));
5646 Ok(url)
5647 }
5648 }
5649 }
5650 pub mod get_properties {
5651 use super::models;
5652 #[cfg(not(target_arch = "wasm32"))]
5653 use futures::future::BoxFuture;
5654 #[cfg(target_arch = "wasm32")]
5655 use futures::future::LocalBoxFuture as BoxFuture;
5656 #[derive(Debug)]
5657 pub struct Response(azure_core::Response);
5658 impl Response {
5659 pub fn into_raw_response(self) -> azure_core::Response {
5660 self.0
5661 }
5662 pub fn as_raw_response(&self) -> &azure_core::Response {
5663 &self.0
5664 }
5665 pub fn headers(&self) -> Headers {
5666 Headers(self.0.headers())
5667 }
5668 }
5669 impl From<Response> for azure_core::Response {
5670 fn from(rsp: Response) -> Self {
5671 rsp.into_raw_response()
5672 }
5673 }
5674 impl AsRef<azure_core::Response> for Response {
5675 fn as_ref(&self) -> &azure_core::Response {
5676 self.as_raw_response()
5677 }
5678 }
5679 pub struct Headers<'a>(&'a azure_core::headers::Headers);
5680 impl<'a> Headers<'a> {
5681 #[doc = "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
5682 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
5683 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
5684 }
5685 #[doc = "Returns the date and time the blob was created."]
5686 pub fn x_ms_creation_time(&self) -> azure_core::Result<::time::OffsetDateTime> {
5687 azure_core::date::parse_rfc1123(
5688 self.0
5689 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-creation-time"))?,
5690 )
5691 }
5692 pub fn x_ms_meta(&self) -> azure_core::Result<&str> {
5693 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-meta"))
5694 }
5695 #[doc = "Optional. Only valid when Object Replication is enabled for the storage container and on the destination blob of the replication."]
5696 pub fn x_ms_or_policy_id(&self) -> azure_core::Result<&str> {
5697 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-or-policy-id"))
5698 }
5699 #[doc = "Optional. Only valid when Object Replication is enabled for the storage container and on the source blob of the replication. When retrieving this header, it will return the header with the policy id and rule id (e.g. x-ms-or-policyid_ruleid), and the value will be the status of the replication (e.g. complete, failed)."]
5700 pub fn x_ms_or(&self) -> azure_core::Result<&str> {
5701 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-or"))
5702 }
5703 #[doc = "The blob's type."]
5704 pub fn x_ms_blob_type(&self) -> azure_core::Result<&str> {
5705 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-blob-type"))
5706 }
5707 #[doc = "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."]
5708 pub fn x_ms_copy_completion_time(&self) -> azure_core::Result<::time::OffsetDateTime> {
5709 azure_core::date::parse_rfc1123(
5710 self.0
5711 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-completion-time"))?,
5712 )
5713 }
5714 #[doc = "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"]
5715 pub fn x_ms_copy_status_description(&self) -> azure_core::Result<&str> {
5716 self.0
5717 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-status-description"))
5718 }
5719 #[doc = "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."]
5720 pub fn x_ms_copy_id(&self) -> azure_core::Result<&str> {
5721 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-id"))
5722 }
5723 #[doc = "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"]
5724 pub fn x_ms_copy_progress(&self) -> azure_core::Result<&str> {
5725 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-progress"))
5726 }
5727 #[doc = "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."]
5728 pub fn x_ms_copy_source(&self) -> azure_core::Result<&str> {
5729 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-source"))
5730 }
5731 #[doc = "State of the copy operation identified by x-ms-copy-id."]
5732 pub fn x_ms_copy_status(&self) -> azure_core::Result<&str> {
5733 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-status"))
5734 }
5735 #[doc = "Included if the blob is incremental copy blob."]
5736 pub fn x_ms_incremental_copy(&self) -> azure_core::Result<bool> {
5737 self.0
5738 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-incremental-copy"))
5739 }
5740 #[doc = "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."]
5741 pub fn x_ms_copy_destination_snapshot(&self) -> azure_core::Result<&str> {
5742 self.0
5743 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-destination-snapshot"))
5744 }
5745 #[doc = "When a blob is leased, specifies whether the lease is of infinite or fixed duration."]
5746 pub fn x_ms_lease_duration(&self) -> azure_core::Result<&str> {
5747 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-duration"))
5748 }
5749 #[doc = "Lease state of the blob."]
5750 pub fn x_ms_lease_state(&self) -> azure_core::Result<&str> {
5751 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-state"))
5752 }
5753 #[doc = "The current lease status of the blob."]
5754 pub fn x_ms_lease_status(&self) -> azure_core::Result<&str> {
5755 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-status"))
5756 }
5757 #[doc = "The number of bytes present in the response body."]
5758 pub fn content_length(&self) -> azure_core::Result<i64> {
5759 self.0.get_as(&azure_core::headers::HeaderName::from_static("content-length"))
5760 }
5761 #[doc = "The content type specified for the blob. The default content type is 'application/octet-stream'"]
5762 pub fn content_type(&self) -> azure_core::Result<&str> {
5763 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-type"))
5764 }
5765 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
5766 pub fn e_tag(&self) -> azure_core::Result<&str> {
5767 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
5768 }
5769 #[doc = "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."]
5770 pub fn content_md5(&self) -> azure_core::Result<&str> {
5771 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
5772 }
5773 #[doc = "This header returns the value that was specified for the Content-Encoding request header"]
5774 pub fn content_encoding(&self) -> azure_core::Result<&str> {
5775 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-encoding"))
5776 }
5777 #[doc = "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."]
5778 pub fn content_disposition(&self) -> azure_core::Result<&str> {
5779 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-disposition"))
5780 }
5781 #[doc = "This header returns the value that was specified for the Content-Language request header."]
5782 pub fn content_language(&self) -> azure_core::Result<&str> {
5783 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-language"))
5784 }
5785 #[doc = "This header is returned if it was previously specified for the blob."]
5786 pub fn cache_control(&self) -> azure_core::Result<&str> {
5787 self.0.get_str(&azure_core::headers::HeaderName::from_static("cache-control"))
5788 }
5789 #[doc = "The current sequence number for a page blob. This header is not returned for block blobs or append blobs"]
5790 pub fn x_ms_blob_sequence_number(&self) -> azure_core::Result<i64> {
5791 self.0
5792 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sequence-number"))
5793 }
5794 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
5795 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
5796 self.0
5797 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
5798 }
5799 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
5800 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
5801 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
5802 }
5803 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
5804 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
5805 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
5806 }
5807 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
5808 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
5809 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
5810 }
5811 #[doc = "Indicates that the service supports requests for partial blob content."]
5812 pub fn accept_ranges(&self) -> azure_core::Result<&str> {
5813 self.0.get_str(&azure_core::headers::HeaderName::from_static("accept-ranges"))
5814 }
5815 #[doc = "The number of committed blocks present in the blob. This header is returned only for append blobs."]
5816 pub fn x_ms_blob_committed_block_count(&self) -> azure_core::Result<i32> {
5817 self.0
5818 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-committed-block-count"))
5819 }
5820 #[doc = "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)."]
5821 pub fn x_ms_server_encrypted(&self) -> azure_core::Result<bool> {
5822 self.0
5823 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-server-encrypted"))
5824 }
5825 #[doc = "The SHA-256 hash of the encryption key used to encrypt the metadata. This header is only returned when the metadata was encrypted with a customer-provided key."]
5826 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
5827 self.0
5828 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
5829 }
5830 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
5831 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
5832 self.0
5833 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
5834 }
5835 #[doc = "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://docs.microsoft.com/en-us/azure/virtual-machines/windows/premium-storage#features. For blob storage LRS accounts, valid values are Hot/Cool/Archive."]
5836 pub fn x_ms_access_tier(&self) -> azure_core::Result<&str> {
5837 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-access-tier"))
5838 }
5839 #[doc = "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."]
5840 pub fn x_ms_access_tier_inferred(&self) -> azure_core::Result<bool> {
5841 self.0
5842 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-access-tier-inferred"))
5843 }
5844 #[doc = "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."]
5845 pub fn x_ms_archive_status(&self) -> azure_core::Result<&str> {
5846 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-archive-status"))
5847 }
5848 #[doc = "The time the tier was changed on the object. This is only returned if the tier on the block blob was ever set."]
5849 pub fn x_ms_access_tier_change_time(&self) -> azure_core::Result<::time::OffsetDateTime> {
5850 azure_core::date::parse_rfc1123(
5851 self.0
5852 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-access-tier-change-time"))?,
5853 )
5854 }
5855 #[doc = "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."]
5856 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
5857 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
5858 }
5859 #[doc = "The value of this header indicates whether version of this blob is a current version, see also x-ms-version-id header."]
5860 pub fn x_ms_is_current_version(&self) -> azure_core::Result<bool> {
5861 self.0
5862 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-is-current-version"))
5863 }
5864 #[doc = "The number of tags associated with the blob"]
5865 pub fn x_ms_tag_count(&self) -> azure_core::Result<i64> {
5866 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-tag-count"))
5867 }
5868 #[doc = "The time this blob will expire."]
5869 pub fn x_ms_expiry_time(&self) -> azure_core::Result<::time::OffsetDateTime> {
5870 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-expiry-time"))?)
5871 }
5872 #[doc = "If this blob has been sealed"]
5873 pub fn x_ms_blob_sealed(&self) -> azure_core::Result<bool> {
5874 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sealed"))
5875 }
5876 #[doc = "If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard."]
5877 pub fn x_ms_rehydrate_priority(&self) -> azure_core::Result<&str> {
5878 self.0
5879 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-rehydrate-priority"))
5880 }
5881 #[doc = "UTC date/time value generated by the service that indicates the time at which the blob was last read or written to"]
5882 pub fn x_ms_last_access_time(&self) -> azure_core::Result<::time::OffsetDateTime> {
5883 azure_core::date::parse_rfc1123(
5884 self.0
5885 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-last-access-time"))?,
5886 )
5887 }
5888 #[doc = "UTC date/time value generated by the service that indicates the time at which the blob immutability policy will expire."]
5889 pub fn x_ms_immutability_policy_until_date(&self) -> azure_core::Result<::time::OffsetDateTime> {
5890 azure_core::date::parse_rfc1123(
5891 self.0
5892 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-immutability-policy-until-date"))?,
5893 )
5894 }
5895 #[doc = "Indicates immutability policy mode."]
5896 pub fn x_ms_immutability_policy_mode(&self) -> azure_core::Result<&str> {
5897 self.0
5898 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-immutability-policy-mode"))
5899 }
5900 #[doc = "Indicates if a legal hold is present on the blob."]
5901 pub fn x_ms_legal_hold(&self) -> azure_core::Result<bool> {
5902 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-legal-hold"))
5903 }
5904 }
5905 #[derive(Clone)]
5906 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5907 #[doc = r""]
5908 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5909 #[doc = r" parameters can be chained."]
5910 #[doc = r""]
5911 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5912 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
5913 #[doc = r" executes the request and returns a `Result` with the parsed"]
5914 #[doc = r" response."]
5915 #[doc = r""]
5916 #[doc = r" In order to execute the request without polling the service"]
5917 #[doc = r" until the operation completes, use `.send().await` instead."]
5918 #[doc = r""]
5919 #[doc = r" If you need lower-level access to the raw response details"]
5920 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5921 #[doc = r" can finalize the request using the"]
5922 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5923 #[doc = r" that resolves to a lower-level [`Response`] value."]
5924 pub struct RequestBuilder {
5925 pub(crate) client: super::super::Client,
5926 pub(crate) container_name: String,
5927 pub(crate) blob: String,
5928 pub(crate) snapshot: Option<String>,
5929 pub(crate) versionid: Option<String>,
5930 pub(crate) timeout: Option<i64>,
5931 pub(crate) x_ms_lease_id: Option<String>,
5932 pub(crate) x_ms_encryption_key: Option<String>,
5933 pub(crate) x_ms_encryption_key_sha256: Option<String>,
5934 pub(crate) x_ms_encryption_algorithm: Option<String>,
5935 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
5936 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
5937 pub(crate) if_match: Option<String>,
5938 pub(crate) if_none_match: Option<String>,
5939 pub(crate) x_ms_if_tags: Option<String>,
5940 pub(crate) x_ms_client_request_id: Option<String>,
5941 }
5942 impl RequestBuilder {
5943 #[doc = "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 <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob\">Creating a Snapshot of a Blob.</a>"]
5944 pub fn snapshot(mut self, snapshot: impl Into<String>) -> Self {
5945 self.snapshot = Some(snapshot.into());
5946 self
5947 }
5948 #[doc = "The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer."]
5949 pub fn versionid(mut self, versionid: impl Into<String>) -> Self {
5950 self.versionid = Some(versionid.into());
5951 self
5952 }
5953 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
5954 pub fn timeout(mut self, timeout: i64) -> Self {
5955 self.timeout = Some(timeout);
5956 self
5957 }
5958 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
5959 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
5960 self.x_ms_lease_id = Some(x_ms_lease_id.into());
5961 self
5962 }
5963 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
5964 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
5965 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
5966 self
5967 }
5968 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
5969 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
5970 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
5971 self
5972 }
5973 #[doc = "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."]
5974 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
5975 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
5976 self
5977 }
5978 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
5979 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
5980 self.if_modified_since = Some(if_modified_since.into());
5981 self
5982 }
5983 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
5984 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
5985 self.if_unmodified_since = Some(if_unmodified_since.into());
5986 self
5987 }
5988 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
5989 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
5990 self.if_match = Some(if_match.into());
5991 self
5992 }
5993 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
5994 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
5995 self.if_none_match = Some(if_none_match.into());
5996 self
5997 }
5998 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
5999 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
6000 self.x_ms_if_tags = Some(x_ms_if_tags.into());
6001 self
6002 }
6003 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
6004 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
6005 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
6006 self
6007 }
6008 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6009 #[doc = ""]
6010 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6011 #[doc = "However, this function can provide more flexibility when required."]
6012 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6013 Box::pin({
6014 let this = self.clone();
6015 async move {
6016 let url = this.url()?;
6017 let mut req = azure_core::Request::new(url, azure_core::Method::Head);
6018 let bearer_token = this.client.bearer_token().await?;
6019 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
6020 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
6021 if let Some(snapshot) = &this.snapshot {
6022 req.url_mut().query_pairs_mut().append_pair("snapshot", snapshot);
6023 }
6024 if let Some(versionid) = &this.versionid {
6025 req.url_mut().query_pairs_mut().append_pair("versionid", versionid);
6026 }
6027 if let Some(timeout) = &this.timeout {
6028 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
6029 }
6030 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
6031 req.insert_header("x-ms-lease-id", x_ms_lease_id);
6032 }
6033 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
6034 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
6035 }
6036 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
6037 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
6038 }
6039 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
6040 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
6041 }
6042 if let Some(if_modified_since) = &this.if_modified_since {
6043 req.insert_header("if-modified-since", if_modified_since.to_string());
6044 }
6045 if let Some(if_unmodified_since) = &this.if_unmodified_since {
6046 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
6047 }
6048 if let Some(if_match) = &this.if_match {
6049 req.insert_header("if-match", if_match);
6050 }
6051 if let Some(if_none_match) = &this.if_none_match {
6052 req.insert_header("if-none-match", if_none_match);
6053 }
6054 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
6055 req.insert_header("x-ms-if-tags", x_ms_if_tags);
6056 }
6057 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
6058 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
6059 }
6060 let req_body = azure_core::EMPTY_BODY;
6061 req.set_body(req_body);
6062 Ok(Response(this.client.send(&mut req).await?))
6063 }
6064 })
6065 }
6066 fn url(&self) -> azure_core::Result<azure_core::Url> {
6067 let mut url = self.client.endpoint().clone();
6068 url.set_path(&format!("/{}/{}", &self.container_name, &self.blob));
6069 Ok(url)
6070 }
6071 }
6072 }
6073 pub mod undelete {
6074 use super::models;
6075 #[cfg(not(target_arch = "wasm32"))]
6076 use futures::future::BoxFuture;
6077 #[cfg(target_arch = "wasm32")]
6078 use futures::future::LocalBoxFuture as BoxFuture;
6079 #[derive(Debug)]
6080 pub struct Response(azure_core::Response);
6081 impl Response {
6082 pub fn into_raw_response(self) -> azure_core::Response {
6083 self.0
6084 }
6085 pub fn as_raw_response(&self) -> &azure_core::Response {
6086 &self.0
6087 }
6088 pub fn headers(&self) -> Headers {
6089 Headers(self.0.headers())
6090 }
6091 }
6092 impl From<Response> for azure_core::Response {
6093 fn from(rsp: Response) -> Self {
6094 rsp.into_raw_response()
6095 }
6096 }
6097 impl AsRef<azure_core::Response> for Response {
6098 fn as_ref(&self) -> &azure_core::Response {
6099 self.as_raw_response()
6100 }
6101 }
6102 pub struct Headers<'a>(&'a azure_core::headers::Headers);
6103 impl<'a> Headers<'a> {
6104 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
6105 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
6106 self.0
6107 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
6108 }
6109 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
6110 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
6111 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
6112 }
6113 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
6114 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
6115 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
6116 }
6117 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated."]
6118 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
6119 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
6120 }
6121 }
6122 #[derive(Clone)]
6123 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6124 #[doc = r""]
6125 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6126 #[doc = r" parameters can be chained."]
6127 #[doc = r""]
6128 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6129 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
6130 #[doc = r" executes the request and returns a `Result` with the parsed"]
6131 #[doc = r" response."]
6132 #[doc = r""]
6133 #[doc = r" In order to execute the request without polling the service"]
6134 #[doc = r" until the operation completes, use `.send().await` instead."]
6135 #[doc = r""]
6136 #[doc = r" If you need lower-level access to the raw response details"]
6137 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6138 #[doc = r" can finalize the request using the"]
6139 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6140 #[doc = r" that resolves to a lower-level [`Response`] value."]
6141 pub struct RequestBuilder {
6142 pub(crate) client: super::super::Client,
6143 pub(crate) container_name: String,
6144 pub(crate) blob: String,
6145 pub(crate) timeout: Option<i64>,
6146 pub(crate) x_ms_client_request_id: Option<String>,
6147 }
6148 impl RequestBuilder {
6149 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
6150 pub fn timeout(mut self, timeout: i64) -> Self {
6151 self.timeout = Some(timeout);
6152 self
6153 }
6154 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
6155 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
6156 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
6157 self
6158 }
6159 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6160 #[doc = ""]
6161 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6162 #[doc = "However, this function can provide more flexibility when required."]
6163 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6164 Box::pin({
6165 let this = self.clone();
6166 async move {
6167 let url = this.url()?;
6168 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
6169 let bearer_token = this.client.bearer_token().await?;
6170 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
6171 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
6172 if let Some(timeout) = &this.timeout {
6173 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
6174 }
6175 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
6176 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
6177 }
6178 let req_body = azure_core::EMPTY_BODY;
6179 req.set_body(req_body);
6180 Ok(Response(this.client.send(&mut req).await?))
6181 }
6182 })
6183 }
6184 fn url(&self) -> azure_core::Result<azure_core::Url> {
6185 let mut url = self.client.endpoint().clone();
6186 url.set_path(&format!("/{}/{}?comp=undelete", &self.container_name, &self.blob));
6187 Ok(url)
6188 }
6189 }
6190 }
6191 pub mod set_expiry {
6192 use super::models;
6193 #[cfg(not(target_arch = "wasm32"))]
6194 use futures::future::BoxFuture;
6195 #[cfg(target_arch = "wasm32")]
6196 use futures::future::LocalBoxFuture as BoxFuture;
6197 #[derive(Debug)]
6198 pub struct Response(azure_core::Response);
6199 impl Response {
6200 pub fn into_raw_response(self) -> azure_core::Response {
6201 self.0
6202 }
6203 pub fn as_raw_response(&self) -> &azure_core::Response {
6204 &self.0
6205 }
6206 pub fn headers(&self) -> Headers {
6207 Headers(self.0.headers())
6208 }
6209 }
6210 impl From<Response> for azure_core::Response {
6211 fn from(rsp: Response) -> Self {
6212 rsp.into_raw_response()
6213 }
6214 }
6215 impl AsRef<azure_core::Response> for Response {
6216 fn as_ref(&self) -> &azure_core::Response {
6217 self.as_raw_response()
6218 }
6219 }
6220 pub struct Headers<'a>(&'a azure_core::headers::Headers);
6221 impl<'a> Headers<'a> {
6222 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
6223 pub fn e_tag(&self) -> azure_core::Result<&str> {
6224 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
6225 }
6226 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
6227 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
6228 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
6229 }
6230 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
6231 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
6232 self.0
6233 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
6234 }
6235 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
6236 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
6237 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
6238 }
6239 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
6240 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
6241 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
6242 }
6243 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated."]
6244 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
6245 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
6246 }
6247 }
6248 #[derive(Clone)]
6249 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6250 #[doc = r""]
6251 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6252 #[doc = r" parameters can be chained."]
6253 #[doc = r""]
6254 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6255 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
6256 #[doc = r" executes the request and returns a `Result` with the parsed"]
6257 #[doc = r" response."]
6258 #[doc = r""]
6259 #[doc = r" In order to execute the request without polling the service"]
6260 #[doc = r" until the operation completes, use `.send().await` instead."]
6261 #[doc = r""]
6262 #[doc = r" If you need lower-level access to the raw response details"]
6263 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6264 #[doc = r" can finalize the request using the"]
6265 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6266 #[doc = r" that resolves to a lower-level [`Response`] value."]
6267 pub struct RequestBuilder {
6268 pub(crate) client: super::super::Client,
6269 pub(crate) container_name: String,
6270 pub(crate) blob: String,
6271 pub(crate) x_ms_expiry_option: String,
6272 pub(crate) timeout: Option<i64>,
6273 pub(crate) x_ms_client_request_id: Option<String>,
6274 pub(crate) x_ms_expiry_time: Option<String>,
6275 }
6276 impl RequestBuilder {
6277 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
6278 pub fn timeout(mut self, timeout: i64) -> Self {
6279 self.timeout = Some(timeout);
6280 self
6281 }
6282 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
6283 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
6284 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
6285 self
6286 }
6287 #[doc = "The time to set the blob to expiry"]
6288 pub fn x_ms_expiry_time(mut self, x_ms_expiry_time: impl Into<String>) -> Self {
6289 self.x_ms_expiry_time = Some(x_ms_expiry_time.into());
6290 self
6291 }
6292 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6293 #[doc = ""]
6294 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6295 #[doc = "However, this function can provide more flexibility when required."]
6296 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6297 Box::pin({
6298 let this = self.clone();
6299 async move {
6300 let url = this.url()?;
6301 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
6302 let bearer_token = this.client.bearer_token().await?;
6303 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
6304 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
6305 if let Some(timeout) = &this.timeout {
6306 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
6307 }
6308 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
6309 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
6310 }
6311 req.insert_header("x-ms-expiry-option", &this.x_ms_expiry_option);
6312 if let Some(x_ms_expiry_time) = &this.x_ms_expiry_time {
6313 req.insert_header("x-ms-expiry-time", x_ms_expiry_time);
6314 }
6315 let req_body = azure_core::EMPTY_BODY;
6316 req.set_body(req_body);
6317 Ok(Response(this.client.send(&mut req).await?))
6318 }
6319 })
6320 }
6321 fn url(&self) -> azure_core::Result<azure_core::Url> {
6322 let mut url = self.client.endpoint().clone();
6323 url.set_path(&format!("/{}/{}?comp=expiry", &self.container_name, &self.blob));
6324 Ok(url)
6325 }
6326 }
6327 }
6328 pub mod set_http_headers {
6329 use super::models;
6330 #[cfg(not(target_arch = "wasm32"))]
6331 use futures::future::BoxFuture;
6332 #[cfg(target_arch = "wasm32")]
6333 use futures::future::LocalBoxFuture as BoxFuture;
6334 #[derive(Debug)]
6335 pub struct Response(azure_core::Response);
6336 impl Response {
6337 pub fn into_raw_response(self) -> azure_core::Response {
6338 self.0
6339 }
6340 pub fn as_raw_response(&self) -> &azure_core::Response {
6341 &self.0
6342 }
6343 pub fn headers(&self) -> Headers {
6344 Headers(self.0.headers())
6345 }
6346 }
6347 impl From<Response> for azure_core::Response {
6348 fn from(rsp: Response) -> Self {
6349 rsp.into_raw_response()
6350 }
6351 }
6352 impl AsRef<azure_core::Response> for Response {
6353 fn as_ref(&self) -> &azure_core::Response {
6354 self.as_raw_response()
6355 }
6356 }
6357 pub struct Headers<'a>(&'a azure_core::headers::Headers);
6358 impl<'a> Headers<'a> {
6359 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
6360 pub fn e_tag(&self) -> azure_core::Result<&str> {
6361 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
6362 }
6363 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
6364 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
6365 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
6366 }
6367 #[doc = "The current sequence number for a page blob. This header is not returned for block blobs or append blobs"]
6368 pub fn x_ms_blob_sequence_number(&self) -> azure_core::Result<i64> {
6369 self.0
6370 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sequence-number"))
6371 }
6372 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
6373 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
6374 self.0
6375 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
6376 }
6377 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
6378 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
6379 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
6380 }
6381 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
6382 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
6383 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
6384 }
6385 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
6386 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
6387 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
6388 }
6389 }
6390 #[derive(Clone)]
6391 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6392 #[doc = r""]
6393 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6394 #[doc = r" parameters can be chained."]
6395 #[doc = r""]
6396 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6397 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
6398 #[doc = r" executes the request and returns a `Result` with the parsed"]
6399 #[doc = r" response."]
6400 #[doc = r""]
6401 #[doc = r" In order to execute the request without polling the service"]
6402 #[doc = r" until the operation completes, use `.send().await` instead."]
6403 #[doc = r""]
6404 #[doc = r" If you need lower-level access to the raw response details"]
6405 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6406 #[doc = r" can finalize the request using the"]
6407 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6408 #[doc = r" that resolves to a lower-level [`Response`] value."]
6409 pub struct RequestBuilder {
6410 pub(crate) client: super::super::Client,
6411 pub(crate) container_name: String,
6412 pub(crate) blob: String,
6413 pub(crate) timeout: Option<i64>,
6414 pub(crate) x_ms_blob_cache_control: Option<String>,
6415 pub(crate) x_ms_blob_content_type: Option<String>,
6416 pub(crate) x_ms_blob_content_md5: Option<String>,
6417 pub(crate) x_ms_blob_content_encoding: Option<String>,
6418 pub(crate) x_ms_blob_content_language: Option<String>,
6419 pub(crate) x_ms_lease_id: Option<String>,
6420 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
6421 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
6422 pub(crate) if_match: Option<String>,
6423 pub(crate) if_none_match: Option<String>,
6424 pub(crate) x_ms_if_tags: Option<String>,
6425 pub(crate) x_ms_blob_content_disposition: Option<String>,
6426 pub(crate) x_ms_client_request_id: Option<String>,
6427 }
6428 impl RequestBuilder {
6429 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
6430 pub fn timeout(mut self, timeout: i64) -> Self {
6431 self.timeout = Some(timeout);
6432 self
6433 }
6434 #[doc = "Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request."]
6435 pub fn x_ms_blob_cache_control(mut self, x_ms_blob_cache_control: impl Into<String>) -> Self {
6436 self.x_ms_blob_cache_control = Some(x_ms_blob_cache_control.into());
6437 self
6438 }
6439 #[doc = "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request."]
6440 pub fn x_ms_blob_content_type(mut self, x_ms_blob_content_type: impl Into<String>) -> Self {
6441 self.x_ms_blob_content_type = Some(x_ms_blob_content_type.into());
6442 self
6443 }
6444 #[doc = "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."]
6445 pub fn x_ms_blob_content_md5(mut self, x_ms_blob_content_md5: impl Into<String>) -> Self {
6446 self.x_ms_blob_content_md5 = Some(x_ms_blob_content_md5.into());
6447 self
6448 }
6449 #[doc = "Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request."]
6450 pub fn x_ms_blob_content_encoding(mut self, x_ms_blob_content_encoding: impl Into<String>) -> Self {
6451 self.x_ms_blob_content_encoding = Some(x_ms_blob_content_encoding.into());
6452 self
6453 }
6454 #[doc = "Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request."]
6455 pub fn x_ms_blob_content_language(mut self, x_ms_blob_content_language: impl Into<String>) -> Self {
6456 self.x_ms_blob_content_language = Some(x_ms_blob_content_language.into());
6457 self
6458 }
6459 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
6460 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
6461 self.x_ms_lease_id = Some(x_ms_lease_id.into());
6462 self
6463 }
6464 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
6465 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
6466 self.if_modified_since = Some(if_modified_since.into());
6467 self
6468 }
6469 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
6470 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
6471 self.if_unmodified_since = Some(if_unmodified_since.into());
6472 self
6473 }
6474 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
6475 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
6476 self.if_match = Some(if_match.into());
6477 self
6478 }
6479 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
6480 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
6481 self.if_none_match = Some(if_none_match.into());
6482 self
6483 }
6484 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
6485 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
6486 self.x_ms_if_tags = Some(x_ms_if_tags.into());
6487 self
6488 }
6489 #[doc = "Optional. Sets the blob's Content-Disposition header."]
6490 pub fn x_ms_blob_content_disposition(mut self, x_ms_blob_content_disposition: impl Into<String>) -> Self {
6491 self.x_ms_blob_content_disposition = Some(x_ms_blob_content_disposition.into());
6492 self
6493 }
6494 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
6495 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
6496 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
6497 self
6498 }
6499 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6500 #[doc = ""]
6501 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6502 #[doc = "However, this function can provide more flexibility when required."]
6503 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6504 Box::pin({
6505 let this = self.clone();
6506 async move {
6507 let url = this.url()?;
6508 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
6509 let bearer_token = this.client.bearer_token().await?;
6510 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
6511 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
6512 if let Some(timeout) = &this.timeout {
6513 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
6514 }
6515 if let Some(x_ms_blob_cache_control) = &this.x_ms_blob_cache_control {
6516 req.insert_header("x-ms-blob-cache-control", x_ms_blob_cache_control);
6517 }
6518 if let Some(x_ms_blob_content_type) = &this.x_ms_blob_content_type {
6519 req.insert_header("x-ms-blob-content-type", x_ms_blob_content_type);
6520 }
6521 if let Some(x_ms_blob_content_md5) = &this.x_ms_blob_content_md5 {
6522 req.insert_header("x-ms-blob-content-md5", x_ms_blob_content_md5);
6523 }
6524 if let Some(x_ms_blob_content_encoding) = &this.x_ms_blob_content_encoding {
6525 req.insert_header("x-ms-blob-content-encoding", x_ms_blob_content_encoding);
6526 }
6527 if let Some(x_ms_blob_content_language) = &this.x_ms_blob_content_language {
6528 req.insert_header("x-ms-blob-content-language", x_ms_blob_content_language);
6529 }
6530 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
6531 req.insert_header("x-ms-lease-id", x_ms_lease_id);
6532 }
6533 if let Some(if_modified_since) = &this.if_modified_since {
6534 req.insert_header("if-modified-since", if_modified_since.to_string());
6535 }
6536 if let Some(if_unmodified_since) = &this.if_unmodified_since {
6537 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
6538 }
6539 if let Some(if_match) = &this.if_match {
6540 req.insert_header("if-match", if_match);
6541 }
6542 if let Some(if_none_match) = &this.if_none_match {
6543 req.insert_header("if-none-match", if_none_match);
6544 }
6545 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
6546 req.insert_header("x-ms-if-tags", x_ms_if_tags);
6547 }
6548 if let Some(x_ms_blob_content_disposition) = &this.x_ms_blob_content_disposition {
6549 req.insert_header("x-ms-blob-content-disposition", x_ms_blob_content_disposition);
6550 }
6551 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
6552 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
6553 }
6554 let req_body = azure_core::EMPTY_BODY;
6555 req.set_body(req_body);
6556 Ok(Response(this.client.send(&mut req).await?))
6557 }
6558 })
6559 }
6560 fn url(&self) -> azure_core::Result<azure_core::Url> {
6561 let mut url = self.client.endpoint().clone();
6562 url.set_path(&format!("/{}/{}?comp=properties&SetHTTPHeaders", &self.container_name, &self.blob));
6563 Ok(url)
6564 }
6565 }
6566 }
6567 pub mod set_immutability_policy {
6568 use super::models;
6569 #[cfg(not(target_arch = "wasm32"))]
6570 use futures::future::BoxFuture;
6571 #[cfg(target_arch = "wasm32")]
6572 use futures::future::LocalBoxFuture as BoxFuture;
6573 #[derive(Debug)]
6574 pub struct Response(azure_core::Response);
6575 impl Response {
6576 pub fn into_raw_response(self) -> azure_core::Response {
6577 self.0
6578 }
6579 pub fn as_raw_response(&self) -> &azure_core::Response {
6580 &self.0
6581 }
6582 pub fn headers(&self) -> Headers {
6583 Headers(self.0.headers())
6584 }
6585 }
6586 impl From<Response> for azure_core::Response {
6587 fn from(rsp: Response) -> Self {
6588 rsp.into_raw_response()
6589 }
6590 }
6591 impl AsRef<azure_core::Response> for Response {
6592 fn as_ref(&self) -> &azure_core::Response {
6593 self.as_raw_response()
6594 }
6595 }
6596 pub struct Headers<'a>(&'a azure_core::headers::Headers);
6597 impl<'a> Headers<'a> {
6598 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
6599 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
6600 self.0
6601 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
6602 }
6603 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
6604 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
6605 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
6606 }
6607 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
6608 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
6609 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
6610 }
6611 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
6612 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
6613 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
6614 }
6615 #[doc = "Indicates the time the immutability policy will expire."]
6616 pub fn x_ms_immutability_policy_until_date(&self) -> azure_core::Result<::time::OffsetDateTime> {
6617 azure_core::date::parse_rfc1123(
6618 self.0
6619 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-immutability-policy-until-date"))?,
6620 )
6621 }
6622 #[doc = "Indicates immutability policy mode."]
6623 pub fn x_ms_immutability_policy_mode(&self) -> azure_core::Result<&str> {
6624 self.0
6625 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-immutability-policy-mode"))
6626 }
6627 }
6628 #[derive(Clone)]
6629 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6630 #[doc = r""]
6631 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6632 #[doc = r" parameters can be chained."]
6633 #[doc = r""]
6634 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6635 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
6636 #[doc = r" executes the request and returns a `Result` with the parsed"]
6637 #[doc = r" response."]
6638 #[doc = r""]
6639 #[doc = r" In order to execute the request without polling the service"]
6640 #[doc = r" until the operation completes, use `.send().await` instead."]
6641 #[doc = r""]
6642 #[doc = r" If you need lower-level access to the raw response details"]
6643 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6644 #[doc = r" can finalize the request using the"]
6645 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6646 #[doc = r" that resolves to a lower-level [`Response`] value."]
6647 pub struct RequestBuilder {
6648 pub(crate) client: super::super::Client,
6649 pub(crate) container_name: String,
6650 pub(crate) blob: String,
6651 pub(crate) timeout: Option<i64>,
6652 pub(crate) x_ms_client_request_id: Option<String>,
6653 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
6654 pub(crate) x_ms_immutability_policy_until_date: Option<::time::OffsetDateTime>,
6655 pub(crate) x_ms_immutability_policy_mode: Option<String>,
6656 }
6657 impl RequestBuilder {
6658 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
6659 pub fn timeout(mut self, timeout: i64) -> Self {
6660 self.timeout = Some(timeout);
6661 self
6662 }
6663 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
6664 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
6665 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
6666 self
6667 }
6668 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
6669 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
6670 self.if_unmodified_since = Some(if_unmodified_since.into());
6671 self
6672 }
6673 #[doc = "Specifies the date time when the blobs immutability policy is set to expire."]
6674 pub fn x_ms_immutability_policy_until_date(
6675 mut self,
6676 x_ms_immutability_policy_until_date: impl Into<::time::OffsetDateTime>,
6677 ) -> Self {
6678 self.x_ms_immutability_policy_until_date = Some(x_ms_immutability_policy_until_date.into());
6679 self
6680 }
6681 #[doc = "Specifies the immutability policy mode to set on the blob."]
6682 pub fn x_ms_immutability_policy_mode(mut self, x_ms_immutability_policy_mode: impl Into<String>) -> Self {
6683 self.x_ms_immutability_policy_mode = Some(x_ms_immutability_policy_mode.into());
6684 self
6685 }
6686 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6687 #[doc = ""]
6688 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6689 #[doc = "However, this function can provide more flexibility when required."]
6690 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6691 Box::pin({
6692 let this = self.clone();
6693 async move {
6694 let url = this.url()?;
6695 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
6696 let bearer_token = this.client.bearer_token().await?;
6697 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
6698 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
6699 if let Some(timeout) = &this.timeout {
6700 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
6701 }
6702 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
6703 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
6704 }
6705 if let Some(if_unmodified_since) = &this.if_unmodified_since {
6706 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
6707 }
6708 if let Some(x_ms_immutability_policy_until_date) = &this.x_ms_immutability_policy_until_date {
6709 req.insert_header(
6710 "x-ms-immutability-policy-until-date",
6711 x_ms_immutability_policy_until_date.to_string(),
6712 );
6713 }
6714 if let Some(x_ms_immutability_policy_mode) = &this.x_ms_immutability_policy_mode {
6715 req.insert_header("x-ms-immutability-policy-mode", x_ms_immutability_policy_mode);
6716 }
6717 let req_body = azure_core::EMPTY_BODY;
6718 req.set_body(req_body);
6719 Ok(Response(this.client.send(&mut req).await?))
6720 }
6721 })
6722 }
6723 fn url(&self) -> azure_core::Result<azure_core::Url> {
6724 let mut url = self.client.endpoint().clone();
6725 url.set_path(&format!("/{}/{}?comp=immutabilityPolicies", &self.container_name, &self.blob));
6726 Ok(url)
6727 }
6728 }
6729 }
6730 pub mod delete_immutability_policy {
6731 use super::models;
6732 #[cfg(not(target_arch = "wasm32"))]
6733 use futures::future::BoxFuture;
6734 #[cfg(target_arch = "wasm32")]
6735 use futures::future::LocalBoxFuture as BoxFuture;
6736 #[derive(Debug)]
6737 pub struct Response(azure_core::Response);
6738 impl Response {
6739 pub fn into_raw_response(self) -> azure_core::Response {
6740 self.0
6741 }
6742 pub fn as_raw_response(&self) -> &azure_core::Response {
6743 &self.0
6744 }
6745 pub fn headers(&self) -> Headers {
6746 Headers(self.0.headers())
6747 }
6748 }
6749 impl From<Response> for azure_core::Response {
6750 fn from(rsp: Response) -> Self {
6751 rsp.into_raw_response()
6752 }
6753 }
6754 impl AsRef<azure_core::Response> for Response {
6755 fn as_ref(&self) -> &azure_core::Response {
6756 self.as_raw_response()
6757 }
6758 }
6759 pub struct Headers<'a>(&'a azure_core::headers::Headers);
6760 impl<'a> Headers<'a> {
6761 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
6762 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
6763 self.0
6764 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
6765 }
6766 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
6767 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
6768 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
6769 }
6770 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
6771 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
6772 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
6773 }
6774 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
6775 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
6776 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
6777 }
6778 }
6779 #[derive(Clone)]
6780 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6781 #[doc = r""]
6782 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6783 #[doc = r" parameters can be chained."]
6784 #[doc = r""]
6785 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6786 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
6787 #[doc = r" executes the request and returns a `Result` with the parsed"]
6788 #[doc = r" response."]
6789 #[doc = r""]
6790 #[doc = r" In order to execute the request without polling the service"]
6791 #[doc = r" until the operation completes, use `.send().await` instead."]
6792 #[doc = r""]
6793 #[doc = r" If you need lower-level access to the raw response details"]
6794 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6795 #[doc = r" can finalize the request using the"]
6796 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6797 #[doc = r" that resolves to a lower-level [`Response`] value."]
6798 pub struct RequestBuilder {
6799 pub(crate) client: super::super::Client,
6800 pub(crate) container_name: String,
6801 pub(crate) blob: String,
6802 pub(crate) timeout: Option<i64>,
6803 pub(crate) x_ms_client_request_id: Option<String>,
6804 }
6805 impl RequestBuilder {
6806 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
6807 pub fn timeout(mut self, timeout: i64) -> Self {
6808 self.timeout = Some(timeout);
6809 self
6810 }
6811 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
6812 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
6813 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
6814 self
6815 }
6816 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6817 #[doc = ""]
6818 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6819 #[doc = "However, this function can provide more flexibility when required."]
6820 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6821 Box::pin({
6822 let this = self.clone();
6823 async move {
6824 let url = this.url()?;
6825 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
6826 let bearer_token = this.client.bearer_token().await?;
6827 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
6828 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
6829 if let Some(timeout) = &this.timeout {
6830 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
6831 }
6832 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
6833 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
6834 }
6835 let req_body = azure_core::EMPTY_BODY;
6836 req.set_body(req_body);
6837 Ok(Response(this.client.send(&mut req).await?))
6838 }
6839 })
6840 }
6841 fn url(&self) -> azure_core::Result<azure_core::Url> {
6842 let mut url = self.client.endpoint().clone();
6843 url.set_path(&format!("/{}/{}?comp=immutabilityPolicies", &self.container_name, &self.blob));
6844 Ok(url)
6845 }
6846 }
6847 }
6848 pub mod set_legal_hold {
6849 use super::models;
6850 #[cfg(not(target_arch = "wasm32"))]
6851 use futures::future::BoxFuture;
6852 #[cfg(target_arch = "wasm32")]
6853 use futures::future::LocalBoxFuture as BoxFuture;
6854 #[derive(Debug)]
6855 pub struct Response(azure_core::Response);
6856 impl Response {
6857 pub fn into_raw_response(self) -> azure_core::Response {
6858 self.0
6859 }
6860 pub fn as_raw_response(&self) -> &azure_core::Response {
6861 &self.0
6862 }
6863 pub fn headers(&self) -> Headers {
6864 Headers(self.0.headers())
6865 }
6866 }
6867 impl From<Response> for azure_core::Response {
6868 fn from(rsp: Response) -> Self {
6869 rsp.into_raw_response()
6870 }
6871 }
6872 impl AsRef<azure_core::Response> for Response {
6873 fn as_ref(&self) -> &azure_core::Response {
6874 self.as_raw_response()
6875 }
6876 }
6877 pub struct Headers<'a>(&'a azure_core::headers::Headers);
6878 impl<'a> Headers<'a> {
6879 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
6880 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
6881 self.0
6882 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
6883 }
6884 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
6885 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
6886 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
6887 }
6888 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
6889 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
6890 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
6891 }
6892 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
6893 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
6894 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
6895 }
6896 #[doc = "Indicates if the blob has a legal hold."]
6897 pub fn x_ms_legal_hold(&self) -> azure_core::Result<bool> {
6898 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-legal-hold"))
6899 }
6900 }
6901 #[derive(Clone)]
6902 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6903 #[doc = r""]
6904 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6905 #[doc = r" parameters can be chained."]
6906 #[doc = r""]
6907 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6908 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
6909 #[doc = r" executes the request and returns a `Result` with the parsed"]
6910 #[doc = r" response."]
6911 #[doc = r""]
6912 #[doc = r" In order to execute the request without polling the service"]
6913 #[doc = r" until the operation completes, use `.send().await` instead."]
6914 #[doc = r""]
6915 #[doc = r" If you need lower-level access to the raw response details"]
6916 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6917 #[doc = r" can finalize the request using the"]
6918 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6919 #[doc = r" that resolves to a lower-level [`Response`] value."]
6920 pub struct RequestBuilder {
6921 pub(crate) client: super::super::Client,
6922 pub(crate) container_name: String,
6923 pub(crate) blob: String,
6924 pub(crate) x_ms_legal_hold: bool,
6925 pub(crate) timeout: Option<i64>,
6926 pub(crate) x_ms_client_request_id: Option<String>,
6927 }
6928 impl RequestBuilder {
6929 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
6930 pub fn timeout(mut self, timeout: i64) -> Self {
6931 self.timeout = Some(timeout);
6932 self
6933 }
6934 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
6935 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
6936 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
6937 self
6938 }
6939 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6940 #[doc = ""]
6941 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6942 #[doc = "However, this function can provide more flexibility when required."]
6943 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6944 Box::pin({
6945 let this = self.clone();
6946 async move {
6947 let url = this.url()?;
6948 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
6949 let bearer_token = this.client.bearer_token().await?;
6950 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
6951 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
6952 if let Some(timeout) = &this.timeout {
6953 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
6954 }
6955 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
6956 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
6957 }
6958 req.insert_header("x-ms-legal-hold", this.x_ms_legal_hold.to_string());
6959 let req_body = azure_core::EMPTY_BODY;
6960 req.set_body(req_body);
6961 Ok(Response(this.client.send(&mut req).await?))
6962 }
6963 })
6964 }
6965 fn url(&self) -> azure_core::Result<azure_core::Url> {
6966 let mut url = self.client.endpoint().clone();
6967 url.set_path(&format!("/{}/{}?comp=legalhold", &self.container_name, &self.blob));
6968 Ok(url)
6969 }
6970 }
6971 }
6972 pub mod set_metadata {
6973 use super::models;
6974 #[cfg(not(target_arch = "wasm32"))]
6975 use futures::future::BoxFuture;
6976 #[cfg(target_arch = "wasm32")]
6977 use futures::future::LocalBoxFuture as BoxFuture;
6978 #[derive(Debug)]
6979 pub struct Response(azure_core::Response);
6980 impl Response {
6981 pub fn into_raw_response(self) -> azure_core::Response {
6982 self.0
6983 }
6984 pub fn as_raw_response(&self) -> &azure_core::Response {
6985 &self.0
6986 }
6987 pub fn headers(&self) -> Headers {
6988 Headers(self.0.headers())
6989 }
6990 }
6991 impl From<Response> for azure_core::Response {
6992 fn from(rsp: Response) -> Self {
6993 rsp.into_raw_response()
6994 }
6995 }
6996 impl AsRef<azure_core::Response> for Response {
6997 fn as_ref(&self) -> &azure_core::Response {
6998 self.as_raw_response()
6999 }
7000 }
7001 pub struct Headers<'a>(&'a azure_core::headers::Headers);
7002 impl<'a> Headers<'a> {
7003 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
7004 pub fn e_tag(&self) -> azure_core::Result<&str> {
7005 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
7006 }
7007 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
7008 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
7009 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
7010 }
7011 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
7012 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
7013 self.0
7014 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
7015 }
7016 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
7017 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
7018 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
7019 }
7020 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
7021 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
7022 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
7023 }
7024 #[doc = "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."]
7025 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
7026 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
7027 }
7028 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
7029 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
7030 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
7031 }
7032 #[doc = "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."]
7033 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
7034 self.0
7035 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
7036 }
7037 #[doc = "The SHA-256 hash of the encryption key used to encrypt the metadata. This header is only returned when the metadata was encrypted with a customer-provided key."]
7038 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
7039 self.0
7040 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
7041 }
7042 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
7043 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
7044 self.0
7045 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
7046 }
7047 }
7048 #[derive(Clone)]
7049 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7050 #[doc = r""]
7051 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7052 #[doc = r" parameters can be chained."]
7053 #[doc = r""]
7054 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7055 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
7056 #[doc = r" executes the request and returns a `Result` with the parsed"]
7057 #[doc = r" response."]
7058 #[doc = r""]
7059 #[doc = r" In order to execute the request without polling the service"]
7060 #[doc = r" until the operation completes, use `.send().await` instead."]
7061 #[doc = r""]
7062 #[doc = r" If you need lower-level access to the raw response details"]
7063 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7064 #[doc = r" can finalize the request using the"]
7065 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7066 #[doc = r" that resolves to a lower-level [`Response`] value."]
7067 pub struct RequestBuilder {
7068 pub(crate) client: super::super::Client,
7069 pub(crate) container_name: String,
7070 pub(crate) blob: String,
7071 pub(crate) timeout: Option<i64>,
7072 pub(crate) x_ms_meta: Option<String>,
7073 pub(crate) x_ms_lease_id: Option<String>,
7074 pub(crate) x_ms_encryption_key: Option<String>,
7075 pub(crate) x_ms_encryption_key_sha256: Option<String>,
7076 pub(crate) x_ms_encryption_algorithm: Option<String>,
7077 pub(crate) x_ms_encryption_scope: Option<String>,
7078 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
7079 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
7080 pub(crate) if_match: Option<String>,
7081 pub(crate) if_none_match: Option<String>,
7082 pub(crate) x_ms_if_tags: Option<String>,
7083 pub(crate) x_ms_client_request_id: Option<String>,
7084 }
7085 impl RequestBuilder {
7086 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
7087 pub fn timeout(mut self, timeout: i64) -> Self {
7088 self.timeout = Some(timeout);
7089 self
7090 }
7091 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
7092 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
7093 self.x_ms_meta = Some(x_ms_meta.into());
7094 self
7095 }
7096 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
7097 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
7098 self.x_ms_lease_id = Some(x_ms_lease_id.into());
7099 self
7100 }
7101 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
7102 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
7103 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
7104 self
7105 }
7106 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
7107 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
7108 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
7109 self
7110 }
7111 #[doc = "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."]
7112 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
7113 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
7114 self
7115 }
7116 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
7117 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
7118 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
7119 self
7120 }
7121 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
7122 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
7123 self.if_modified_since = Some(if_modified_since.into());
7124 self
7125 }
7126 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
7127 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
7128 self.if_unmodified_since = Some(if_unmodified_since.into());
7129 self
7130 }
7131 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
7132 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
7133 self.if_match = Some(if_match.into());
7134 self
7135 }
7136 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
7137 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
7138 self.if_none_match = Some(if_none_match.into());
7139 self
7140 }
7141 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
7142 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
7143 self.x_ms_if_tags = Some(x_ms_if_tags.into());
7144 self
7145 }
7146 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
7147 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
7148 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
7149 self
7150 }
7151 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7152 #[doc = ""]
7153 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7154 #[doc = "However, this function can provide more flexibility when required."]
7155 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7156 Box::pin({
7157 let this = self.clone();
7158 async move {
7159 let url = this.url()?;
7160 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
7161 let bearer_token = this.client.bearer_token().await?;
7162 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
7163 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
7164 if let Some(timeout) = &this.timeout {
7165 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
7166 }
7167 if let Some(x_ms_meta) = &this.x_ms_meta {
7168 req.insert_header("x-ms-meta", x_ms_meta);
7169 }
7170 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
7171 req.insert_header("x-ms-lease-id", x_ms_lease_id);
7172 }
7173 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
7174 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
7175 }
7176 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
7177 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
7178 }
7179 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
7180 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
7181 }
7182 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
7183 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
7184 }
7185 if let Some(if_modified_since) = &this.if_modified_since {
7186 req.insert_header("if-modified-since", if_modified_since.to_string());
7187 }
7188 if let Some(if_unmodified_since) = &this.if_unmodified_since {
7189 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
7190 }
7191 if let Some(if_match) = &this.if_match {
7192 req.insert_header("if-match", if_match);
7193 }
7194 if let Some(if_none_match) = &this.if_none_match {
7195 req.insert_header("if-none-match", if_none_match);
7196 }
7197 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
7198 req.insert_header("x-ms-if-tags", x_ms_if_tags);
7199 }
7200 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
7201 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
7202 }
7203 let req_body = azure_core::EMPTY_BODY;
7204 req.set_body(req_body);
7205 Ok(Response(this.client.send(&mut req).await?))
7206 }
7207 })
7208 }
7209 fn url(&self) -> azure_core::Result<azure_core::Url> {
7210 let mut url = self.client.endpoint().clone();
7211 url.set_path(&format!("/{}/{}?comp=metadata", &self.container_name, &self.blob));
7212 Ok(url)
7213 }
7214 }
7215 }
7216 pub mod acquire_lease {
7217 use super::models;
7218 #[cfg(not(target_arch = "wasm32"))]
7219 use futures::future::BoxFuture;
7220 #[cfg(target_arch = "wasm32")]
7221 use futures::future::LocalBoxFuture as BoxFuture;
7222 #[derive(Debug)]
7223 pub struct Response(azure_core::Response);
7224 impl Response {
7225 pub fn into_raw_response(self) -> azure_core::Response {
7226 self.0
7227 }
7228 pub fn as_raw_response(&self) -> &azure_core::Response {
7229 &self.0
7230 }
7231 pub fn headers(&self) -> Headers {
7232 Headers(self.0.headers())
7233 }
7234 }
7235 impl From<Response> for azure_core::Response {
7236 fn from(rsp: Response) -> Self {
7237 rsp.into_raw_response()
7238 }
7239 }
7240 impl AsRef<azure_core::Response> for Response {
7241 fn as_ref(&self) -> &azure_core::Response {
7242 self.as_raw_response()
7243 }
7244 }
7245 pub struct Headers<'a>(&'a azure_core::headers::Headers);
7246 impl<'a> Headers<'a> {
7247 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
7248 pub fn e_tag(&self) -> azure_core::Result<&str> {
7249 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
7250 }
7251 #[doc = "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
7252 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
7253 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
7254 }
7255 #[doc = "Uniquely identifies a blobs' lease"]
7256 pub fn x_ms_lease_id(&self) -> azure_core::Result<&str> {
7257 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-id"))
7258 }
7259 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
7260 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
7261 self.0
7262 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
7263 }
7264 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
7265 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
7266 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
7267 }
7268 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
7269 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
7270 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
7271 }
7272 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
7273 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
7274 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
7275 }
7276 }
7277 #[derive(Clone)]
7278 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7279 #[doc = r""]
7280 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7281 #[doc = r" parameters can be chained."]
7282 #[doc = r""]
7283 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7284 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
7285 #[doc = r" executes the request and returns a `Result` with the parsed"]
7286 #[doc = r" response."]
7287 #[doc = r""]
7288 #[doc = r" In order to execute the request without polling the service"]
7289 #[doc = r" until the operation completes, use `.send().await` instead."]
7290 #[doc = r""]
7291 #[doc = r" If you need lower-level access to the raw response details"]
7292 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7293 #[doc = r" can finalize the request using the"]
7294 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7295 #[doc = r" that resolves to a lower-level [`Response`] value."]
7296 pub struct RequestBuilder {
7297 pub(crate) client: super::super::Client,
7298 pub(crate) container_name: String,
7299 pub(crate) blob: String,
7300 pub(crate) x_ms_lease_action: String,
7301 pub(crate) timeout: Option<i64>,
7302 pub(crate) x_ms_lease_duration: Option<i64>,
7303 pub(crate) x_ms_proposed_lease_id: Option<String>,
7304 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
7305 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
7306 pub(crate) if_match: Option<String>,
7307 pub(crate) if_none_match: Option<String>,
7308 pub(crate) x_ms_if_tags: Option<String>,
7309 pub(crate) x_ms_client_request_id: Option<String>,
7310 }
7311 impl RequestBuilder {
7312 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
7313 pub fn timeout(mut self, timeout: i64) -> Self {
7314 self.timeout = Some(timeout);
7315 self
7316 }
7317 #[doc = "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."]
7318 pub fn x_ms_lease_duration(mut self, x_ms_lease_duration: i64) -> Self {
7319 self.x_ms_lease_duration = Some(x_ms_lease_duration);
7320 self
7321 }
7322 #[doc = "Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats."]
7323 pub fn x_ms_proposed_lease_id(mut self, x_ms_proposed_lease_id: impl Into<String>) -> Self {
7324 self.x_ms_proposed_lease_id = Some(x_ms_proposed_lease_id.into());
7325 self
7326 }
7327 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
7328 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
7329 self.if_modified_since = Some(if_modified_since.into());
7330 self
7331 }
7332 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
7333 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
7334 self.if_unmodified_since = Some(if_unmodified_since.into());
7335 self
7336 }
7337 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
7338 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
7339 self.if_match = Some(if_match.into());
7340 self
7341 }
7342 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
7343 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
7344 self.if_none_match = Some(if_none_match.into());
7345 self
7346 }
7347 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
7348 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
7349 self.x_ms_if_tags = Some(x_ms_if_tags.into());
7350 self
7351 }
7352 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
7353 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
7354 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
7355 self
7356 }
7357 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7358 #[doc = ""]
7359 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7360 #[doc = "However, this function can provide more flexibility when required."]
7361 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7362 Box::pin({
7363 let this = self.clone();
7364 async move {
7365 let url = this.url()?;
7366 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
7367 let bearer_token = this.client.bearer_token().await?;
7368 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
7369 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
7370 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
7371 if let Some(timeout) = &this.timeout {
7372 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
7373 }
7374 if let Some(x_ms_lease_duration) = &this.x_ms_lease_duration {
7375 req.insert_header("x-ms-lease-duration", x_ms_lease_duration.to_string());
7376 }
7377 if let Some(x_ms_proposed_lease_id) = &this.x_ms_proposed_lease_id {
7378 req.insert_header("x-ms-proposed-lease-id", x_ms_proposed_lease_id);
7379 }
7380 if let Some(if_modified_since) = &this.if_modified_since {
7381 req.insert_header("if-modified-since", if_modified_since.to_string());
7382 }
7383 if let Some(if_unmodified_since) = &this.if_unmodified_since {
7384 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
7385 }
7386 if let Some(if_match) = &this.if_match {
7387 req.insert_header("if-match", if_match);
7388 }
7389 if let Some(if_none_match) = &this.if_none_match {
7390 req.insert_header("if-none-match", if_none_match);
7391 }
7392 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
7393 req.insert_header("x-ms-if-tags", x_ms_if_tags);
7394 }
7395 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
7396 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
7397 }
7398 let req_body = azure_core::EMPTY_BODY;
7399 req.set_body(req_body);
7400 Ok(Response(this.client.send(&mut req).await?))
7401 }
7402 })
7403 }
7404 fn url(&self) -> azure_core::Result<azure_core::Url> {
7405 let mut url = self.client.endpoint().clone();
7406 url.set_path(&format!("/{}/{}?comp=lease&acquire", &self.container_name, &self.blob));
7407 Ok(url)
7408 }
7409 }
7410 }
7411 pub mod release_lease {
7412 use super::models;
7413 #[cfg(not(target_arch = "wasm32"))]
7414 use futures::future::BoxFuture;
7415 #[cfg(target_arch = "wasm32")]
7416 use futures::future::LocalBoxFuture as BoxFuture;
7417 #[derive(Debug)]
7418 pub struct Response(azure_core::Response);
7419 impl Response {
7420 pub fn into_raw_response(self) -> azure_core::Response {
7421 self.0
7422 }
7423 pub fn as_raw_response(&self) -> &azure_core::Response {
7424 &self.0
7425 }
7426 pub fn headers(&self) -> Headers {
7427 Headers(self.0.headers())
7428 }
7429 }
7430 impl From<Response> for azure_core::Response {
7431 fn from(rsp: Response) -> Self {
7432 rsp.into_raw_response()
7433 }
7434 }
7435 impl AsRef<azure_core::Response> for Response {
7436 fn as_ref(&self) -> &azure_core::Response {
7437 self.as_raw_response()
7438 }
7439 }
7440 pub struct Headers<'a>(&'a azure_core::headers::Headers);
7441 impl<'a> Headers<'a> {
7442 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
7443 pub fn e_tag(&self) -> azure_core::Result<&str> {
7444 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
7445 }
7446 #[doc = "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
7447 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
7448 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
7449 }
7450 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
7451 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
7452 self.0
7453 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
7454 }
7455 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
7456 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
7457 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
7458 }
7459 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
7460 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
7461 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
7462 }
7463 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
7464 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
7465 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
7466 }
7467 }
7468 #[derive(Clone)]
7469 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7470 #[doc = r""]
7471 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7472 #[doc = r" parameters can be chained."]
7473 #[doc = r""]
7474 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7475 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
7476 #[doc = r" executes the request and returns a `Result` with the parsed"]
7477 #[doc = r" response."]
7478 #[doc = r""]
7479 #[doc = r" In order to execute the request without polling the service"]
7480 #[doc = r" until the operation completes, use `.send().await` instead."]
7481 #[doc = r""]
7482 #[doc = r" If you need lower-level access to the raw response details"]
7483 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7484 #[doc = r" can finalize the request using the"]
7485 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7486 #[doc = r" that resolves to a lower-level [`Response`] value."]
7487 pub struct RequestBuilder {
7488 pub(crate) client: super::super::Client,
7489 pub(crate) container_name: String,
7490 pub(crate) blob: String,
7491 pub(crate) x_ms_lease_action: String,
7492 pub(crate) x_ms_lease_id: String,
7493 pub(crate) timeout: Option<i64>,
7494 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
7495 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
7496 pub(crate) if_match: Option<String>,
7497 pub(crate) if_none_match: Option<String>,
7498 pub(crate) x_ms_if_tags: Option<String>,
7499 pub(crate) x_ms_client_request_id: Option<String>,
7500 }
7501 impl RequestBuilder {
7502 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
7503 pub fn timeout(mut self, timeout: i64) -> Self {
7504 self.timeout = Some(timeout);
7505 self
7506 }
7507 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
7508 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
7509 self.if_modified_since = Some(if_modified_since.into());
7510 self
7511 }
7512 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
7513 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
7514 self.if_unmodified_since = Some(if_unmodified_since.into());
7515 self
7516 }
7517 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
7518 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
7519 self.if_match = Some(if_match.into());
7520 self
7521 }
7522 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
7523 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
7524 self.if_none_match = Some(if_none_match.into());
7525 self
7526 }
7527 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
7528 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
7529 self.x_ms_if_tags = Some(x_ms_if_tags.into());
7530 self
7531 }
7532 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
7533 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
7534 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
7535 self
7536 }
7537 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7538 #[doc = ""]
7539 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7540 #[doc = "However, this function can provide more flexibility when required."]
7541 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7542 Box::pin({
7543 let this = self.clone();
7544 async move {
7545 let url = this.url()?;
7546 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
7547 let bearer_token = this.client.bearer_token().await?;
7548 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
7549 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
7550 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
7551 if let Some(timeout) = &this.timeout {
7552 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
7553 }
7554 req.insert_header("x-ms-lease-id", &this.x_ms_lease_id);
7555 if let Some(if_modified_since) = &this.if_modified_since {
7556 req.insert_header("if-modified-since", if_modified_since.to_string());
7557 }
7558 if let Some(if_unmodified_since) = &this.if_unmodified_since {
7559 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
7560 }
7561 if let Some(if_match) = &this.if_match {
7562 req.insert_header("if-match", if_match);
7563 }
7564 if let Some(if_none_match) = &this.if_none_match {
7565 req.insert_header("if-none-match", if_none_match);
7566 }
7567 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
7568 req.insert_header("x-ms-if-tags", x_ms_if_tags);
7569 }
7570 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
7571 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
7572 }
7573 let req_body = azure_core::EMPTY_BODY;
7574 req.set_body(req_body);
7575 Ok(Response(this.client.send(&mut req).await?))
7576 }
7577 })
7578 }
7579 fn url(&self) -> azure_core::Result<azure_core::Url> {
7580 let mut url = self.client.endpoint().clone();
7581 url.set_path(&format!("/{}/{}?comp=lease&release", &self.container_name, &self.blob));
7582 Ok(url)
7583 }
7584 }
7585 }
7586 pub mod renew_lease {
7587 use super::models;
7588 #[cfg(not(target_arch = "wasm32"))]
7589 use futures::future::BoxFuture;
7590 #[cfg(target_arch = "wasm32")]
7591 use futures::future::LocalBoxFuture as BoxFuture;
7592 #[derive(Debug)]
7593 pub struct Response(azure_core::Response);
7594 impl Response {
7595 pub fn into_raw_response(self) -> azure_core::Response {
7596 self.0
7597 }
7598 pub fn as_raw_response(&self) -> &azure_core::Response {
7599 &self.0
7600 }
7601 pub fn headers(&self) -> Headers {
7602 Headers(self.0.headers())
7603 }
7604 }
7605 impl From<Response> for azure_core::Response {
7606 fn from(rsp: Response) -> Self {
7607 rsp.into_raw_response()
7608 }
7609 }
7610 impl AsRef<azure_core::Response> for Response {
7611 fn as_ref(&self) -> &azure_core::Response {
7612 self.as_raw_response()
7613 }
7614 }
7615 pub struct Headers<'a>(&'a azure_core::headers::Headers);
7616 impl<'a> Headers<'a> {
7617 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
7618 pub fn e_tag(&self) -> azure_core::Result<&str> {
7619 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
7620 }
7621 #[doc = "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
7622 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
7623 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
7624 }
7625 #[doc = "Uniquely identifies a blobs' lease"]
7626 pub fn x_ms_lease_id(&self) -> azure_core::Result<&str> {
7627 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-id"))
7628 }
7629 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
7630 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
7631 self.0
7632 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
7633 }
7634 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
7635 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
7636 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
7637 }
7638 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
7639 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
7640 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
7641 }
7642 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
7643 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
7644 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
7645 }
7646 }
7647 #[derive(Clone)]
7648 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7649 #[doc = r""]
7650 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7651 #[doc = r" parameters can be chained."]
7652 #[doc = r""]
7653 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7654 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
7655 #[doc = r" executes the request and returns a `Result` with the parsed"]
7656 #[doc = r" response."]
7657 #[doc = r""]
7658 #[doc = r" In order to execute the request without polling the service"]
7659 #[doc = r" until the operation completes, use `.send().await` instead."]
7660 #[doc = r""]
7661 #[doc = r" If you need lower-level access to the raw response details"]
7662 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7663 #[doc = r" can finalize the request using the"]
7664 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7665 #[doc = r" that resolves to a lower-level [`Response`] value."]
7666 pub struct RequestBuilder {
7667 pub(crate) client: super::super::Client,
7668 pub(crate) container_name: String,
7669 pub(crate) blob: String,
7670 pub(crate) x_ms_lease_action: String,
7671 pub(crate) x_ms_lease_id: String,
7672 pub(crate) timeout: Option<i64>,
7673 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
7674 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
7675 pub(crate) if_match: Option<String>,
7676 pub(crate) if_none_match: Option<String>,
7677 pub(crate) x_ms_if_tags: Option<String>,
7678 pub(crate) x_ms_client_request_id: Option<String>,
7679 }
7680 impl RequestBuilder {
7681 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
7682 pub fn timeout(mut self, timeout: i64) -> Self {
7683 self.timeout = Some(timeout);
7684 self
7685 }
7686 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
7687 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
7688 self.if_modified_since = Some(if_modified_since.into());
7689 self
7690 }
7691 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
7692 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
7693 self.if_unmodified_since = Some(if_unmodified_since.into());
7694 self
7695 }
7696 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
7697 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
7698 self.if_match = Some(if_match.into());
7699 self
7700 }
7701 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
7702 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
7703 self.if_none_match = Some(if_none_match.into());
7704 self
7705 }
7706 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
7707 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
7708 self.x_ms_if_tags = Some(x_ms_if_tags.into());
7709 self
7710 }
7711 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
7712 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
7713 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
7714 self
7715 }
7716 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7717 #[doc = ""]
7718 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7719 #[doc = "However, this function can provide more flexibility when required."]
7720 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7721 Box::pin({
7722 let this = self.clone();
7723 async move {
7724 let url = this.url()?;
7725 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
7726 let bearer_token = this.client.bearer_token().await?;
7727 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
7728 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
7729 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
7730 if let Some(timeout) = &this.timeout {
7731 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
7732 }
7733 req.insert_header("x-ms-lease-id", &this.x_ms_lease_id);
7734 if let Some(if_modified_since) = &this.if_modified_since {
7735 req.insert_header("if-modified-since", if_modified_since.to_string());
7736 }
7737 if let Some(if_unmodified_since) = &this.if_unmodified_since {
7738 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
7739 }
7740 if let Some(if_match) = &this.if_match {
7741 req.insert_header("if-match", if_match);
7742 }
7743 if let Some(if_none_match) = &this.if_none_match {
7744 req.insert_header("if-none-match", if_none_match);
7745 }
7746 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
7747 req.insert_header("x-ms-if-tags", x_ms_if_tags);
7748 }
7749 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
7750 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
7751 }
7752 let req_body = azure_core::EMPTY_BODY;
7753 req.set_body(req_body);
7754 Ok(Response(this.client.send(&mut req).await?))
7755 }
7756 })
7757 }
7758 fn url(&self) -> azure_core::Result<azure_core::Url> {
7759 let mut url = self.client.endpoint().clone();
7760 url.set_path(&format!("/{}/{}?comp=lease&renew", &self.container_name, &self.blob));
7761 Ok(url)
7762 }
7763 }
7764 }
7765 pub mod change_lease {
7766 use super::models;
7767 #[cfg(not(target_arch = "wasm32"))]
7768 use futures::future::BoxFuture;
7769 #[cfg(target_arch = "wasm32")]
7770 use futures::future::LocalBoxFuture as BoxFuture;
7771 #[derive(Debug)]
7772 pub struct Response(azure_core::Response);
7773 impl Response {
7774 pub fn into_raw_response(self) -> azure_core::Response {
7775 self.0
7776 }
7777 pub fn as_raw_response(&self) -> &azure_core::Response {
7778 &self.0
7779 }
7780 pub fn headers(&self) -> Headers {
7781 Headers(self.0.headers())
7782 }
7783 }
7784 impl From<Response> for azure_core::Response {
7785 fn from(rsp: Response) -> Self {
7786 rsp.into_raw_response()
7787 }
7788 }
7789 impl AsRef<azure_core::Response> for Response {
7790 fn as_ref(&self) -> &azure_core::Response {
7791 self.as_raw_response()
7792 }
7793 }
7794 pub struct Headers<'a>(&'a azure_core::headers::Headers);
7795 impl<'a> Headers<'a> {
7796 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
7797 pub fn e_tag(&self) -> azure_core::Result<&str> {
7798 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
7799 }
7800 #[doc = "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
7801 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
7802 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
7803 }
7804 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
7805 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
7806 self.0
7807 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
7808 }
7809 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
7810 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
7811 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
7812 }
7813 #[doc = "Uniquely identifies a blobs' lease"]
7814 pub fn x_ms_lease_id(&self) -> azure_core::Result<&str> {
7815 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-id"))
7816 }
7817 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
7818 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
7819 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
7820 }
7821 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
7822 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
7823 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
7824 }
7825 }
7826 #[derive(Clone)]
7827 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7828 #[doc = r""]
7829 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7830 #[doc = r" parameters can be chained."]
7831 #[doc = r""]
7832 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7833 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
7834 #[doc = r" executes the request and returns a `Result` with the parsed"]
7835 #[doc = r" response."]
7836 #[doc = r""]
7837 #[doc = r" In order to execute the request without polling the service"]
7838 #[doc = r" until the operation completes, use `.send().await` instead."]
7839 #[doc = r""]
7840 #[doc = r" If you need lower-level access to the raw response details"]
7841 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7842 #[doc = r" can finalize the request using the"]
7843 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7844 #[doc = r" that resolves to a lower-level [`Response`] value."]
7845 pub struct RequestBuilder {
7846 pub(crate) client: super::super::Client,
7847 pub(crate) container_name: String,
7848 pub(crate) blob: String,
7849 pub(crate) x_ms_lease_action: String,
7850 pub(crate) x_ms_lease_id: String,
7851 pub(crate) x_ms_proposed_lease_id: String,
7852 pub(crate) timeout: Option<i64>,
7853 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
7854 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
7855 pub(crate) if_match: Option<String>,
7856 pub(crate) if_none_match: Option<String>,
7857 pub(crate) x_ms_if_tags: Option<String>,
7858 pub(crate) x_ms_client_request_id: Option<String>,
7859 }
7860 impl RequestBuilder {
7861 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
7862 pub fn timeout(mut self, timeout: i64) -> Self {
7863 self.timeout = Some(timeout);
7864 self
7865 }
7866 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
7867 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
7868 self.if_modified_since = Some(if_modified_since.into());
7869 self
7870 }
7871 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
7872 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
7873 self.if_unmodified_since = Some(if_unmodified_since.into());
7874 self
7875 }
7876 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
7877 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
7878 self.if_match = Some(if_match.into());
7879 self
7880 }
7881 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
7882 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
7883 self.if_none_match = Some(if_none_match.into());
7884 self
7885 }
7886 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
7887 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
7888 self.x_ms_if_tags = Some(x_ms_if_tags.into());
7889 self
7890 }
7891 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
7892 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
7893 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
7894 self
7895 }
7896 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7897 #[doc = ""]
7898 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7899 #[doc = "However, this function can provide more flexibility when required."]
7900 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7901 Box::pin({
7902 let this = self.clone();
7903 async move {
7904 let url = this.url()?;
7905 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
7906 let bearer_token = this.client.bearer_token().await?;
7907 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
7908 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
7909 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
7910 if let Some(timeout) = &this.timeout {
7911 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
7912 }
7913 req.insert_header("x-ms-lease-id", &this.x_ms_lease_id);
7914 req.insert_header("x-ms-proposed-lease-id", &this.x_ms_proposed_lease_id);
7915 if let Some(if_modified_since) = &this.if_modified_since {
7916 req.insert_header("if-modified-since", if_modified_since.to_string());
7917 }
7918 if let Some(if_unmodified_since) = &this.if_unmodified_since {
7919 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
7920 }
7921 if let Some(if_match) = &this.if_match {
7922 req.insert_header("if-match", if_match);
7923 }
7924 if let Some(if_none_match) = &this.if_none_match {
7925 req.insert_header("if-none-match", if_none_match);
7926 }
7927 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
7928 req.insert_header("x-ms-if-tags", x_ms_if_tags);
7929 }
7930 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
7931 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
7932 }
7933 let req_body = azure_core::EMPTY_BODY;
7934 req.set_body(req_body);
7935 Ok(Response(this.client.send(&mut req).await?))
7936 }
7937 })
7938 }
7939 fn url(&self) -> azure_core::Result<azure_core::Url> {
7940 let mut url = self.client.endpoint().clone();
7941 url.set_path(&format!("/{}/{}?comp=lease&change", &self.container_name, &self.blob));
7942 Ok(url)
7943 }
7944 }
7945 }
7946 pub mod break_lease {
7947 use super::models;
7948 #[cfg(not(target_arch = "wasm32"))]
7949 use futures::future::BoxFuture;
7950 #[cfg(target_arch = "wasm32")]
7951 use futures::future::LocalBoxFuture as BoxFuture;
7952 #[derive(Debug)]
7953 pub struct Response(azure_core::Response);
7954 impl Response {
7955 pub fn into_raw_response(self) -> azure_core::Response {
7956 self.0
7957 }
7958 pub fn as_raw_response(&self) -> &azure_core::Response {
7959 &self.0
7960 }
7961 pub fn headers(&self) -> Headers {
7962 Headers(self.0.headers())
7963 }
7964 }
7965 impl From<Response> for azure_core::Response {
7966 fn from(rsp: Response) -> Self {
7967 rsp.into_raw_response()
7968 }
7969 }
7970 impl AsRef<azure_core::Response> for Response {
7971 fn as_ref(&self) -> &azure_core::Response {
7972 self.as_raw_response()
7973 }
7974 }
7975 pub struct Headers<'a>(&'a azure_core::headers::Headers);
7976 impl<'a> Headers<'a> {
7977 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
7978 pub fn e_tag(&self) -> azure_core::Result<&str> {
7979 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
7980 }
7981 #[doc = "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
7982 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
7983 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
7984 }
7985 #[doc = "Approximate time remaining in the lease period, in seconds."]
7986 pub fn x_ms_lease_time(&self) -> azure_core::Result<i32> {
7987 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-lease-time"))
7988 }
7989 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
7990 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
7991 self.0
7992 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
7993 }
7994 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
7995 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
7996 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
7997 }
7998 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
7999 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
8000 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
8001 }
8002 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
8003 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
8004 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
8005 }
8006 }
8007 #[derive(Clone)]
8008 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
8009 #[doc = r""]
8010 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
8011 #[doc = r" parameters can be chained."]
8012 #[doc = r""]
8013 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
8014 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
8015 #[doc = r" executes the request and returns a `Result` with the parsed"]
8016 #[doc = r" response."]
8017 #[doc = r""]
8018 #[doc = r" In order to execute the request without polling the service"]
8019 #[doc = r" until the operation completes, use `.send().await` instead."]
8020 #[doc = r""]
8021 #[doc = r" If you need lower-level access to the raw response details"]
8022 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
8023 #[doc = r" can finalize the request using the"]
8024 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
8025 #[doc = r" that resolves to a lower-level [`Response`] value."]
8026 pub struct RequestBuilder {
8027 pub(crate) client: super::super::Client,
8028 pub(crate) container_name: String,
8029 pub(crate) blob: String,
8030 pub(crate) x_ms_lease_action: String,
8031 pub(crate) timeout: Option<i64>,
8032 pub(crate) x_ms_lease_break_period: Option<i64>,
8033 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
8034 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
8035 pub(crate) if_match: Option<String>,
8036 pub(crate) if_none_match: Option<String>,
8037 pub(crate) x_ms_if_tags: Option<String>,
8038 pub(crate) x_ms_client_request_id: Option<String>,
8039 }
8040 impl RequestBuilder {
8041 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
8042 pub fn timeout(mut self, timeout: i64) -> Self {
8043 self.timeout = Some(timeout);
8044 self
8045 }
8046 #[doc = "For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately."]
8047 pub fn x_ms_lease_break_period(mut self, x_ms_lease_break_period: i64) -> Self {
8048 self.x_ms_lease_break_period = Some(x_ms_lease_break_period);
8049 self
8050 }
8051 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
8052 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
8053 self.if_modified_since = Some(if_modified_since.into());
8054 self
8055 }
8056 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
8057 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
8058 self.if_unmodified_since = Some(if_unmodified_since.into());
8059 self
8060 }
8061 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
8062 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
8063 self.if_match = Some(if_match.into());
8064 self
8065 }
8066 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
8067 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
8068 self.if_none_match = Some(if_none_match.into());
8069 self
8070 }
8071 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
8072 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
8073 self.x_ms_if_tags = Some(x_ms_if_tags.into());
8074 self
8075 }
8076 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
8077 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
8078 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
8079 self
8080 }
8081 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8082 #[doc = ""]
8083 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8084 #[doc = "However, this function can provide more flexibility when required."]
8085 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8086 Box::pin({
8087 let this = self.clone();
8088 async move {
8089 let url = this.url()?;
8090 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
8091 let bearer_token = this.client.bearer_token().await?;
8092 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
8093 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
8094 req.insert_header("x-ms-lease-action", &this.x_ms_lease_action);
8095 if let Some(timeout) = &this.timeout {
8096 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
8097 }
8098 if let Some(x_ms_lease_break_period) = &this.x_ms_lease_break_period {
8099 req.insert_header("x-ms-lease-break-period", x_ms_lease_break_period.to_string());
8100 }
8101 if let Some(if_modified_since) = &this.if_modified_since {
8102 req.insert_header("if-modified-since", if_modified_since.to_string());
8103 }
8104 if let Some(if_unmodified_since) = &this.if_unmodified_since {
8105 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
8106 }
8107 if let Some(if_match) = &this.if_match {
8108 req.insert_header("if-match", if_match);
8109 }
8110 if let Some(if_none_match) = &this.if_none_match {
8111 req.insert_header("if-none-match", if_none_match);
8112 }
8113 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
8114 req.insert_header("x-ms-if-tags", x_ms_if_tags);
8115 }
8116 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
8117 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
8118 }
8119 let req_body = azure_core::EMPTY_BODY;
8120 req.set_body(req_body);
8121 Ok(Response(this.client.send(&mut req).await?))
8122 }
8123 })
8124 }
8125 fn url(&self) -> azure_core::Result<azure_core::Url> {
8126 let mut url = self.client.endpoint().clone();
8127 url.set_path(&format!("/{}/{}?comp=lease&break", &self.container_name, &self.blob));
8128 Ok(url)
8129 }
8130 }
8131 }
8132 pub mod create_snapshot {
8133 use super::models;
8134 #[cfg(not(target_arch = "wasm32"))]
8135 use futures::future::BoxFuture;
8136 #[cfg(target_arch = "wasm32")]
8137 use futures::future::LocalBoxFuture as BoxFuture;
8138 #[derive(Debug)]
8139 pub struct Response(azure_core::Response);
8140 impl Response {
8141 pub fn into_raw_response(self) -> azure_core::Response {
8142 self.0
8143 }
8144 pub fn as_raw_response(&self) -> &azure_core::Response {
8145 &self.0
8146 }
8147 pub fn headers(&self) -> Headers {
8148 Headers(self.0.headers())
8149 }
8150 }
8151 impl From<Response> for azure_core::Response {
8152 fn from(rsp: Response) -> Self {
8153 rsp.into_raw_response()
8154 }
8155 }
8156 impl AsRef<azure_core::Response> for Response {
8157 fn as_ref(&self) -> &azure_core::Response {
8158 self.as_raw_response()
8159 }
8160 }
8161 pub struct Headers<'a>(&'a azure_core::headers::Headers);
8162 impl<'a> Headers<'a> {
8163 #[doc = "Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests to access the snapshot"]
8164 pub fn x_ms_snapshot(&self) -> azure_core::Result<&str> {
8165 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-snapshot"))
8166 }
8167 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
8168 pub fn e_tag(&self) -> azure_core::Result<&str> {
8169 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
8170 }
8171 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
8172 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
8173 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
8174 }
8175 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
8176 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
8177 self.0
8178 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
8179 }
8180 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
8181 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
8182 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
8183 }
8184 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
8185 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
8186 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
8187 }
8188 #[doc = "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."]
8189 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
8190 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
8191 }
8192 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
8193 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
8194 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
8195 }
8196 #[doc = "True if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise. For a snapshot request, this header is set to true when metadata was provided in the request and encrypted with a customer-provided key."]
8197 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
8198 self.0
8199 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
8200 }
8201 }
8202 #[derive(Clone)]
8203 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
8204 #[doc = r""]
8205 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
8206 #[doc = r" parameters can be chained."]
8207 #[doc = r""]
8208 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
8209 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
8210 #[doc = r" executes the request and returns a `Result` with the parsed"]
8211 #[doc = r" response."]
8212 #[doc = r""]
8213 #[doc = r" In order to execute the request without polling the service"]
8214 #[doc = r" until the operation completes, use `.send().await` instead."]
8215 #[doc = r""]
8216 #[doc = r" If you need lower-level access to the raw response details"]
8217 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
8218 #[doc = r" can finalize the request using the"]
8219 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
8220 #[doc = r" that resolves to a lower-level [`Response`] value."]
8221 pub struct RequestBuilder {
8222 pub(crate) client: super::super::Client,
8223 pub(crate) container_name: String,
8224 pub(crate) blob: String,
8225 pub(crate) timeout: Option<i64>,
8226 pub(crate) x_ms_meta: Option<String>,
8227 pub(crate) x_ms_encryption_key: Option<String>,
8228 pub(crate) x_ms_encryption_key_sha256: Option<String>,
8229 pub(crate) x_ms_encryption_algorithm: Option<String>,
8230 pub(crate) x_ms_encryption_scope: Option<String>,
8231 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
8232 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
8233 pub(crate) if_match: Option<String>,
8234 pub(crate) if_none_match: Option<String>,
8235 pub(crate) x_ms_if_tags: Option<String>,
8236 pub(crate) x_ms_lease_id: Option<String>,
8237 pub(crate) x_ms_client_request_id: Option<String>,
8238 }
8239 impl RequestBuilder {
8240 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
8241 pub fn timeout(mut self, timeout: i64) -> Self {
8242 self.timeout = Some(timeout);
8243 self
8244 }
8245 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
8246 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
8247 self.x_ms_meta = Some(x_ms_meta.into());
8248 self
8249 }
8250 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
8251 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
8252 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
8253 self
8254 }
8255 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
8256 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
8257 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
8258 self
8259 }
8260 #[doc = "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."]
8261 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
8262 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
8263 self
8264 }
8265 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
8266 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
8267 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
8268 self
8269 }
8270 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
8271 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
8272 self.if_modified_since = Some(if_modified_since.into());
8273 self
8274 }
8275 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
8276 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
8277 self.if_unmodified_since = Some(if_unmodified_since.into());
8278 self
8279 }
8280 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
8281 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
8282 self.if_match = Some(if_match.into());
8283 self
8284 }
8285 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
8286 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
8287 self.if_none_match = Some(if_none_match.into());
8288 self
8289 }
8290 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
8291 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
8292 self.x_ms_if_tags = Some(x_ms_if_tags.into());
8293 self
8294 }
8295 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
8296 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
8297 self.x_ms_lease_id = Some(x_ms_lease_id.into());
8298 self
8299 }
8300 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
8301 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
8302 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
8303 self
8304 }
8305 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8306 #[doc = ""]
8307 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8308 #[doc = "However, this function can provide more flexibility when required."]
8309 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8310 Box::pin({
8311 let this = self.clone();
8312 async move {
8313 let url = this.url()?;
8314 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
8315 let bearer_token = this.client.bearer_token().await?;
8316 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
8317 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
8318 if let Some(timeout) = &this.timeout {
8319 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
8320 }
8321 if let Some(x_ms_meta) = &this.x_ms_meta {
8322 req.insert_header("x-ms-meta", x_ms_meta);
8323 }
8324 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
8325 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
8326 }
8327 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
8328 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
8329 }
8330 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
8331 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
8332 }
8333 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
8334 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
8335 }
8336 if let Some(if_modified_since) = &this.if_modified_since {
8337 req.insert_header("if-modified-since", if_modified_since.to_string());
8338 }
8339 if let Some(if_unmodified_since) = &this.if_unmodified_since {
8340 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
8341 }
8342 if let Some(if_match) = &this.if_match {
8343 req.insert_header("if-match", if_match);
8344 }
8345 if let Some(if_none_match) = &this.if_none_match {
8346 req.insert_header("if-none-match", if_none_match);
8347 }
8348 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
8349 req.insert_header("x-ms-if-tags", x_ms_if_tags);
8350 }
8351 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
8352 req.insert_header("x-ms-lease-id", x_ms_lease_id);
8353 }
8354 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
8355 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
8356 }
8357 let req_body = azure_core::EMPTY_BODY;
8358 req.set_body(req_body);
8359 Ok(Response(this.client.send(&mut req).await?))
8360 }
8361 })
8362 }
8363 fn url(&self) -> azure_core::Result<azure_core::Url> {
8364 let mut url = self.client.endpoint().clone();
8365 url.set_path(&format!("/{}/{}?comp=snapshot", &self.container_name, &self.blob));
8366 Ok(url)
8367 }
8368 }
8369 }
8370 pub mod start_copy_from_url {
8371 use super::models;
8372 #[cfg(not(target_arch = "wasm32"))]
8373 use futures::future::BoxFuture;
8374 #[cfg(target_arch = "wasm32")]
8375 use futures::future::LocalBoxFuture as BoxFuture;
8376 #[derive(Debug)]
8377 pub struct Response(azure_core::Response);
8378 impl Response {
8379 pub fn into_raw_response(self) -> azure_core::Response {
8380 self.0
8381 }
8382 pub fn as_raw_response(&self) -> &azure_core::Response {
8383 &self.0
8384 }
8385 pub fn headers(&self) -> Headers {
8386 Headers(self.0.headers())
8387 }
8388 }
8389 impl From<Response> for azure_core::Response {
8390 fn from(rsp: Response) -> Self {
8391 rsp.into_raw_response()
8392 }
8393 }
8394 impl AsRef<azure_core::Response> for Response {
8395 fn as_ref(&self) -> &azure_core::Response {
8396 self.as_raw_response()
8397 }
8398 }
8399 pub struct Headers<'a>(&'a azure_core::headers::Headers);
8400 impl<'a> Headers<'a> {
8401 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
8402 pub fn e_tag(&self) -> azure_core::Result<&str> {
8403 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
8404 }
8405 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
8406 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
8407 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
8408 }
8409 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
8410 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
8411 self.0
8412 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
8413 }
8414 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
8415 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
8416 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
8417 }
8418 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
8419 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
8420 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
8421 }
8422 #[doc = "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."]
8423 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
8424 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
8425 }
8426 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
8427 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
8428 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
8429 }
8430 #[doc = "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."]
8431 pub fn x_ms_copy_id(&self) -> azure_core::Result<&str> {
8432 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-id"))
8433 }
8434 #[doc = "State of the copy operation identified by x-ms-copy-id."]
8435 pub fn x_ms_copy_status(&self) -> azure_core::Result<&str> {
8436 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-status"))
8437 }
8438 }
8439 #[derive(Clone)]
8440 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
8441 #[doc = r""]
8442 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
8443 #[doc = r" parameters can be chained."]
8444 #[doc = r""]
8445 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
8446 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
8447 #[doc = r" executes the request and returns a `Result` with the parsed"]
8448 #[doc = r" response."]
8449 #[doc = r""]
8450 #[doc = r" In order to execute the request without polling the service"]
8451 #[doc = r" until the operation completes, use `.send().await` instead."]
8452 #[doc = r""]
8453 #[doc = r" If you need lower-level access to the raw response details"]
8454 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
8455 #[doc = r" can finalize the request using the"]
8456 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
8457 #[doc = r" that resolves to a lower-level [`Response`] value."]
8458 pub struct RequestBuilder {
8459 pub(crate) client: super::super::Client,
8460 pub(crate) container_name: String,
8461 pub(crate) blob: String,
8462 pub(crate) x_ms_copy_source: String,
8463 pub(crate) timeout: Option<i64>,
8464 pub(crate) x_ms_meta: Option<String>,
8465 pub(crate) x_ms_access_tier: Option<String>,
8466 pub(crate) x_ms_rehydrate_priority: Option<String>,
8467 pub(crate) x_ms_source_if_modified_since: Option<::time::OffsetDateTime>,
8468 pub(crate) x_ms_source_if_unmodified_since: Option<::time::OffsetDateTime>,
8469 pub(crate) x_ms_source_if_match: Option<String>,
8470 pub(crate) x_ms_source_if_none_match: Option<String>,
8471 pub(crate) x_ms_source_if_tags: Option<String>,
8472 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
8473 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
8474 pub(crate) if_match: Option<String>,
8475 pub(crate) if_none_match: Option<String>,
8476 pub(crate) x_ms_if_tags: Option<String>,
8477 pub(crate) x_ms_lease_id: Option<String>,
8478 pub(crate) x_ms_client_request_id: Option<String>,
8479 pub(crate) x_ms_tags: Option<String>,
8480 pub(crate) x_ms_seal_blob: Option<bool>,
8481 pub(crate) x_ms_immutability_policy_until_date: Option<::time::OffsetDateTime>,
8482 pub(crate) x_ms_immutability_policy_mode: Option<String>,
8483 pub(crate) x_ms_legal_hold: Option<bool>,
8484 }
8485 impl RequestBuilder {
8486 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
8487 pub fn timeout(mut self, timeout: i64) -> Self {
8488 self.timeout = Some(timeout);
8489 self
8490 }
8491 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
8492 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
8493 self.x_ms_meta = Some(x_ms_meta.into());
8494 self
8495 }
8496 #[doc = "Optional. Indicates the tier to be set on the blob."]
8497 pub fn x_ms_access_tier(mut self, x_ms_access_tier: impl Into<String>) -> Self {
8498 self.x_ms_access_tier = Some(x_ms_access_tier.into());
8499 self
8500 }
8501 #[doc = "Optional: Indicates the priority with which to rehydrate an archived blob."]
8502 pub fn x_ms_rehydrate_priority(mut self, x_ms_rehydrate_priority: impl Into<String>) -> Self {
8503 self.x_ms_rehydrate_priority = Some(x_ms_rehydrate_priority.into());
8504 self
8505 }
8506 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
8507 pub fn x_ms_source_if_modified_since(mut self, x_ms_source_if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
8508 self.x_ms_source_if_modified_since = Some(x_ms_source_if_modified_since.into());
8509 self
8510 }
8511 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
8512 pub fn x_ms_source_if_unmodified_since(mut self, x_ms_source_if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
8513 self.x_ms_source_if_unmodified_since = Some(x_ms_source_if_unmodified_since.into());
8514 self
8515 }
8516 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
8517 pub fn x_ms_source_if_match(mut self, x_ms_source_if_match: impl Into<String>) -> Self {
8518 self.x_ms_source_if_match = Some(x_ms_source_if_match.into());
8519 self
8520 }
8521 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
8522 pub fn x_ms_source_if_none_match(mut self, x_ms_source_if_none_match: impl Into<String>) -> Self {
8523 self.x_ms_source_if_none_match = Some(x_ms_source_if_none_match.into());
8524 self
8525 }
8526 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
8527 pub fn x_ms_source_if_tags(mut self, x_ms_source_if_tags: impl Into<String>) -> Self {
8528 self.x_ms_source_if_tags = Some(x_ms_source_if_tags.into());
8529 self
8530 }
8531 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
8532 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
8533 self.if_modified_since = Some(if_modified_since.into());
8534 self
8535 }
8536 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
8537 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
8538 self.if_unmodified_since = Some(if_unmodified_since.into());
8539 self
8540 }
8541 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
8542 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
8543 self.if_match = Some(if_match.into());
8544 self
8545 }
8546 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
8547 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
8548 self.if_none_match = Some(if_none_match.into());
8549 self
8550 }
8551 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
8552 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
8553 self.x_ms_if_tags = Some(x_ms_if_tags.into());
8554 self
8555 }
8556 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
8557 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
8558 self.x_ms_lease_id = Some(x_ms_lease_id.into());
8559 self
8560 }
8561 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
8562 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
8563 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
8564 self
8565 }
8566 #[doc = "Optional. Used to set blob tags in various blob operations."]
8567 pub fn x_ms_tags(mut self, x_ms_tags: impl Into<String>) -> Self {
8568 self.x_ms_tags = Some(x_ms_tags.into());
8569 self
8570 }
8571 #[doc = "Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer."]
8572 pub fn x_ms_seal_blob(mut self, x_ms_seal_blob: bool) -> Self {
8573 self.x_ms_seal_blob = Some(x_ms_seal_blob);
8574 self
8575 }
8576 #[doc = "Specifies the date time when the blobs immutability policy is set to expire."]
8577 pub fn x_ms_immutability_policy_until_date(
8578 mut self,
8579 x_ms_immutability_policy_until_date: impl Into<::time::OffsetDateTime>,
8580 ) -> Self {
8581 self.x_ms_immutability_policy_until_date = Some(x_ms_immutability_policy_until_date.into());
8582 self
8583 }
8584 #[doc = "Specifies the immutability policy mode to set on the blob."]
8585 pub fn x_ms_immutability_policy_mode(mut self, x_ms_immutability_policy_mode: impl Into<String>) -> Self {
8586 self.x_ms_immutability_policy_mode = Some(x_ms_immutability_policy_mode.into());
8587 self
8588 }
8589 #[doc = "Specified if a legal hold should be set on the blob."]
8590 pub fn x_ms_legal_hold(mut self, x_ms_legal_hold: bool) -> Self {
8591 self.x_ms_legal_hold = Some(x_ms_legal_hold);
8592 self
8593 }
8594 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8595 #[doc = ""]
8596 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8597 #[doc = "However, this function can provide more flexibility when required."]
8598 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8599 Box::pin({
8600 let this = self.clone();
8601 async move {
8602 let url = this.url()?;
8603 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
8604 let bearer_token = this.client.bearer_token().await?;
8605 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
8606 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
8607 if let Some(timeout) = &this.timeout {
8608 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
8609 }
8610 if let Some(x_ms_meta) = &this.x_ms_meta {
8611 req.insert_header("x-ms-meta", x_ms_meta);
8612 }
8613 if let Some(x_ms_access_tier) = &this.x_ms_access_tier {
8614 req.insert_header("x-ms-access-tier", x_ms_access_tier);
8615 }
8616 if let Some(x_ms_rehydrate_priority) = &this.x_ms_rehydrate_priority {
8617 req.insert_header("x-ms-rehydrate-priority", x_ms_rehydrate_priority);
8618 }
8619 if let Some(x_ms_source_if_modified_since) = &this.x_ms_source_if_modified_since {
8620 req.insert_header("x-ms-source-if-modified-since", x_ms_source_if_modified_since.to_string());
8621 }
8622 if let Some(x_ms_source_if_unmodified_since) = &this.x_ms_source_if_unmodified_since {
8623 req.insert_header("x-ms-source-if-unmodified-since", x_ms_source_if_unmodified_since.to_string());
8624 }
8625 if let Some(x_ms_source_if_match) = &this.x_ms_source_if_match {
8626 req.insert_header("x-ms-source-if-match", x_ms_source_if_match);
8627 }
8628 if let Some(x_ms_source_if_none_match) = &this.x_ms_source_if_none_match {
8629 req.insert_header("x-ms-source-if-none-match", x_ms_source_if_none_match);
8630 }
8631 if let Some(x_ms_source_if_tags) = &this.x_ms_source_if_tags {
8632 req.insert_header("x-ms-source-if-tags", x_ms_source_if_tags);
8633 }
8634 if let Some(if_modified_since) = &this.if_modified_since {
8635 req.insert_header("if-modified-since", if_modified_since.to_string());
8636 }
8637 if let Some(if_unmodified_since) = &this.if_unmodified_since {
8638 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
8639 }
8640 if let Some(if_match) = &this.if_match {
8641 req.insert_header("if-match", if_match);
8642 }
8643 if let Some(if_none_match) = &this.if_none_match {
8644 req.insert_header("if-none-match", if_none_match);
8645 }
8646 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
8647 req.insert_header("x-ms-if-tags", x_ms_if_tags);
8648 }
8649 req.insert_header("x-ms-copy-source", &this.x_ms_copy_source);
8650 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
8651 req.insert_header("x-ms-lease-id", x_ms_lease_id);
8652 }
8653 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
8654 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
8655 }
8656 if let Some(x_ms_tags) = &this.x_ms_tags {
8657 req.insert_header("x-ms-tags", x_ms_tags);
8658 }
8659 if let Some(x_ms_seal_blob) = &this.x_ms_seal_blob {
8660 req.insert_header("x-ms-seal-blob", x_ms_seal_blob.to_string());
8661 }
8662 if let Some(x_ms_immutability_policy_until_date) = &this.x_ms_immutability_policy_until_date {
8663 req.insert_header(
8664 "x-ms-immutability-policy-until-date",
8665 x_ms_immutability_policy_until_date.to_string(),
8666 );
8667 }
8668 if let Some(x_ms_immutability_policy_mode) = &this.x_ms_immutability_policy_mode {
8669 req.insert_header("x-ms-immutability-policy-mode", x_ms_immutability_policy_mode);
8670 }
8671 if let Some(x_ms_legal_hold) = &this.x_ms_legal_hold {
8672 req.insert_header("x-ms-legal-hold", x_ms_legal_hold.to_string());
8673 }
8674 let req_body = azure_core::EMPTY_BODY;
8675 req.set_body(req_body);
8676 Ok(Response(this.client.send(&mut req).await?))
8677 }
8678 })
8679 }
8680 fn url(&self) -> azure_core::Result<azure_core::Url> {
8681 let mut url = self.client.endpoint().clone();
8682 url.set_path(&format!("/{}/{}?comp=copy", &self.container_name, &self.blob));
8683 Ok(url)
8684 }
8685 }
8686 }
8687 pub mod copy_from_url {
8688 use super::models;
8689 #[cfg(not(target_arch = "wasm32"))]
8690 use futures::future::BoxFuture;
8691 #[cfg(target_arch = "wasm32")]
8692 use futures::future::LocalBoxFuture as BoxFuture;
8693 #[derive(Debug)]
8694 pub struct Response(azure_core::Response);
8695 impl Response {
8696 pub fn into_raw_response(self) -> azure_core::Response {
8697 self.0
8698 }
8699 pub fn as_raw_response(&self) -> &azure_core::Response {
8700 &self.0
8701 }
8702 pub fn headers(&self) -> Headers {
8703 Headers(self.0.headers())
8704 }
8705 }
8706 impl From<Response> for azure_core::Response {
8707 fn from(rsp: Response) -> Self {
8708 rsp.into_raw_response()
8709 }
8710 }
8711 impl AsRef<azure_core::Response> for Response {
8712 fn as_ref(&self) -> &azure_core::Response {
8713 self.as_raw_response()
8714 }
8715 }
8716 pub struct Headers<'a>(&'a azure_core::headers::Headers);
8717 impl<'a> Headers<'a> {
8718 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
8719 pub fn e_tag(&self) -> azure_core::Result<&str> {
8720 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
8721 }
8722 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
8723 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
8724 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
8725 }
8726 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
8727 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
8728 self.0
8729 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
8730 }
8731 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
8732 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
8733 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
8734 }
8735 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
8736 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
8737 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
8738 }
8739 #[doc = "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."]
8740 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
8741 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
8742 }
8743 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
8744 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
8745 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
8746 }
8747 #[doc = "String identifier for this copy operation."]
8748 pub fn x_ms_copy_id(&self) -> azure_core::Result<&str> {
8749 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-id"))
8750 }
8751 #[doc = "State of the copy operation identified by x-ms-copy-id."]
8752 pub fn x_ms_copy_status(&self) -> azure_core::Result<&str> {
8753 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-status"))
8754 }
8755 #[doc = "This response header is returned so that the client can check for the integrity of the copied content. This header is only returned if the source content MD5 was specified."]
8756 pub fn content_md5(&self) -> azure_core::Result<&str> {
8757 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
8758 }
8759 #[doc = "This response header is returned so that the client can check for the integrity of the copied content."]
8760 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
8761 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
8762 }
8763 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
8764 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
8765 self.0
8766 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
8767 }
8768 }
8769 #[derive(Clone)]
8770 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
8771 #[doc = r""]
8772 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
8773 #[doc = r" parameters can be chained."]
8774 #[doc = r""]
8775 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
8776 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
8777 #[doc = r" executes the request and returns a `Result` with the parsed"]
8778 #[doc = r" response."]
8779 #[doc = r""]
8780 #[doc = r" In order to execute the request without polling the service"]
8781 #[doc = r" until the operation completes, use `.send().await` instead."]
8782 #[doc = r""]
8783 #[doc = r" If you need lower-level access to the raw response details"]
8784 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
8785 #[doc = r" can finalize the request using the"]
8786 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
8787 #[doc = r" that resolves to a lower-level [`Response`] value."]
8788 pub struct RequestBuilder {
8789 pub(crate) client: super::super::Client,
8790 pub(crate) container_name: String,
8791 pub(crate) blob: String,
8792 pub(crate) x_ms_requires_sync: String,
8793 pub(crate) x_ms_copy_source: String,
8794 pub(crate) timeout: Option<i64>,
8795 pub(crate) x_ms_meta: Option<String>,
8796 pub(crate) x_ms_access_tier: Option<String>,
8797 pub(crate) x_ms_source_if_modified_since: Option<::time::OffsetDateTime>,
8798 pub(crate) x_ms_source_if_unmodified_since: Option<::time::OffsetDateTime>,
8799 pub(crate) x_ms_source_if_match: Option<String>,
8800 pub(crate) x_ms_source_if_none_match: Option<String>,
8801 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
8802 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
8803 pub(crate) if_match: Option<String>,
8804 pub(crate) if_none_match: Option<String>,
8805 pub(crate) x_ms_if_tags: Option<String>,
8806 pub(crate) x_ms_lease_id: Option<String>,
8807 pub(crate) x_ms_client_request_id: Option<String>,
8808 pub(crate) x_ms_source_content_md5: Option<String>,
8809 pub(crate) x_ms_tags: Option<String>,
8810 pub(crate) x_ms_immutability_policy_until_date: Option<::time::OffsetDateTime>,
8811 pub(crate) x_ms_immutability_policy_mode: Option<String>,
8812 pub(crate) x_ms_legal_hold: Option<bool>,
8813 pub(crate) x_ms_copy_source_authorization: Option<String>,
8814 pub(crate) x_ms_encryption_scope: Option<String>,
8815 pub(crate) x_ms_copy_source_tag_option: Option<String>,
8816 }
8817 impl RequestBuilder {
8818 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
8819 pub fn timeout(mut self, timeout: i64) -> Self {
8820 self.timeout = Some(timeout);
8821 self
8822 }
8823 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
8824 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
8825 self.x_ms_meta = Some(x_ms_meta.into());
8826 self
8827 }
8828 #[doc = "Optional. Indicates the tier to be set on the blob."]
8829 pub fn x_ms_access_tier(mut self, x_ms_access_tier: impl Into<String>) -> Self {
8830 self.x_ms_access_tier = Some(x_ms_access_tier.into());
8831 self
8832 }
8833 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
8834 pub fn x_ms_source_if_modified_since(mut self, x_ms_source_if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
8835 self.x_ms_source_if_modified_since = Some(x_ms_source_if_modified_since.into());
8836 self
8837 }
8838 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
8839 pub fn x_ms_source_if_unmodified_since(mut self, x_ms_source_if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
8840 self.x_ms_source_if_unmodified_since = Some(x_ms_source_if_unmodified_since.into());
8841 self
8842 }
8843 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
8844 pub fn x_ms_source_if_match(mut self, x_ms_source_if_match: impl Into<String>) -> Self {
8845 self.x_ms_source_if_match = Some(x_ms_source_if_match.into());
8846 self
8847 }
8848 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
8849 pub fn x_ms_source_if_none_match(mut self, x_ms_source_if_none_match: impl Into<String>) -> Self {
8850 self.x_ms_source_if_none_match = Some(x_ms_source_if_none_match.into());
8851 self
8852 }
8853 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
8854 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
8855 self.if_modified_since = Some(if_modified_since.into());
8856 self
8857 }
8858 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
8859 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
8860 self.if_unmodified_since = Some(if_unmodified_since.into());
8861 self
8862 }
8863 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
8864 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
8865 self.if_match = Some(if_match.into());
8866 self
8867 }
8868 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
8869 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
8870 self.if_none_match = Some(if_none_match.into());
8871 self
8872 }
8873 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
8874 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
8875 self.x_ms_if_tags = Some(x_ms_if_tags.into());
8876 self
8877 }
8878 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
8879 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
8880 self.x_ms_lease_id = Some(x_ms_lease_id.into());
8881 self
8882 }
8883 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
8884 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
8885 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
8886 self
8887 }
8888 #[doc = "Specify the md5 calculated for the range of bytes that must be read from the copy source."]
8889 pub fn x_ms_source_content_md5(mut self, x_ms_source_content_md5: impl Into<String>) -> Self {
8890 self.x_ms_source_content_md5 = Some(x_ms_source_content_md5.into());
8891 self
8892 }
8893 #[doc = "Optional. Used to set blob tags in various blob operations."]
8894 pub fn x_ms_tags(mut self, x_ms_tags: impl Into<String>) -> Self {
8895 self.x_ms_tags = Some(x_ms_tags.into());
8896 self
8897 }
8898 #[doc = "Specifies the date time when the blobs immutability policy is set to expire."]
8899 pub fn x_ms_immutability_policy_until_date(
8900 mut self,
8901 x_ms_immutability_policy_until_date: impl Into<::time::OffsetDateTime>,
8902 ) -> Self {
8903 self.x_ms_immutability_policy_until_date = Some(x_ms_immutability_policy_until_date.into());
8904 self
8905 }
8906 #[doc = "Specifies the immutability policy mode to set on the blob."]
8907 pub fn x_ms_immutability_policy_mode(mut self, x_ms_immutability_policy_mode: impl Into<String>) -> Self {
8908 self.x_ms_immutability_policy_mode = Some(x_ms_immutability_policy_mode.into());
8909 self
8910 }
8911 #[doc = "Specified if a legal hold should be set on the blob."]
8912 pub fn x_ms_legal_hold(mut self, x_ms_legal_hold: bool) -> Self {
8913 self.x_ms_legal_hold = Some(x_ms_legal_hold);
8914 self
8915 }
8916 #[doc = "Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source."]
8917 pub fn x_ms_copy_source_authorization(mut self, x_ms_copy_source_authorization: impl Into<String>) -> Self {
8918 self.x_ms_copy_source_authorization = Some(x_ms_copy_source_authorization.into());
8919 self
8920 }
8921 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
8922 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
8923 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
8924 self
8925 }
8926 #[doc = "Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags."]
8927 pub fn x_ms_copy_source_tag_option(mut self, x_ms_copy_source_tag_option: impl Into<String>) -> Self {
8928 self.x_ms_copy_source_tag_option = Some(x_ms_copy_source_tag_option.into());
8929 self
8930 }
8931 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8932 #[doc = ""]
8933 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8934 #[doc = "However, this function can provide more flexibility when required."]
8935 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8936 Box::pin({
8937 let this = self.clone();
8938 async move {
8939 let url = this.url()?;
8940 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
8941 let bearer_token = this.client.bearer_token().await?;
8942 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
8943 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
8944 req.insert_header("x-ms-requires-sync", &this.x_ms_requires_sync);
8945 if let Some(timeout) = &this.timeout {
8946 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
8947 }
8948 if let Some(x_ms_meta) = &this.x_ms_meta {
8949 req.insert_header("x-ms-meta", x_ms_meta);
8950 }
8951 if let Some(x_ms_access_tier) = &this.x_ms_access_tier {
8952 req.insert_header("x-ms-access-tier", x_ms_access_tier);
8953 }
8954 if let Some(x_ms_source_if_modified_since) = &this.x_ms_source_if_modified_since {
8955 req.insert_header("x-ms-source-if-modified-since", x_ms_source_if_modified_since.to_string());
8956 }
8957 if let Some(x_ms_source_if_unmodified_since) = &this.x_ms_source_if_unmodified_since {
8958 req.insert_header("x-ms-source-if-unmodified-since", x_ms_source_if_unmodified_since.to_string());
8959 }
8960 if let Some(x_ms_source_if_match) = &this.x_ms_source_if_match {
8961 req.insert_header("x-ms-source-if-match", x_ms_source_if_match);
8962 }
8963 if let Some(x_ms_source_if_none_match) = &this.x_ms_source_if_none_match {
8964 req.insert_header("x-ms-source-if-none-match", x_ms_source_if_none_match);
8965 }
8966 if let Some(if_modified_since) = &this.if_modified_since {
8967 req.insert_header("if-modified-since", if_modified_since.to_string());
8968 }
8969 if let Some(if_unmodified_since) = &this.if_unmodified_since {
8970 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
8971 }
8972 if let Some(if_match) = &this.if_match {
8973 req.insert_header("if-match", if_match);
8974 }
8975 if let Some(if_none_match) = &this.if_none_match {
8976 req.insert_header("if-none-match", if_none_match);
8977 }
8978 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
8979 req.insert_header("x-ms-if-tags", x_ms_if_tags);
8980 }
8981 req.insert_header("x-ms-copy-source", &this.x_ms_copy_source);
8982 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
8983 req.insert_header("x-ms-lease-id", x_ms_lease_id);
8984 }
8985 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
8986 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
8987 }
8988 if let Some(x_ms_source_content_md5) = &this.x_ms_source_content_md5 {
8989 req.insert_header("x-ms-source-content-md5", x_ms_source_content_md5);
8990 }
8991 if let Some(x_ms_tags) = &this.x_ms_tags {
8992 req.insert_header("x-ms-tags", x_ms_tags);
8993 }
8994 if let Some(x_ms_immutability_policy_until_date) = &this.x_ms_immutability_policy_until_date {
8995 req.insert_header(
8996 "x-ms-immutability-policy-until-date",
8997 x_ms_immutability_policy_until_date.to_string(),
8998 );
8999 }
9000 if let Some(x_ms_immutability_policy_mode) = &this.x_ms_immutability_policy_mode {
9001 req.insert_header("x-ms-immutability-policy-mode", x_ms_immutability_policy_mode);
9002 }
9003 if let Some(x_ms_legal_hold) = &this.x_ms_legal_hold {
9004 req.insert_header("x-ms-legal-hold", x_ms_legal_hold.to_string());
9005 }
9006 if let Some(x_ms_copy_source_authorization) = &this.x_ms_copy_source_authorization {
9007 req.insert_header("x-ms-copy-source-authorization", x_ms_copy_source_authorization);
9008 }
9009 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
9010 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
9011 }
9012 if let Some(x_ms_copy_source_tag_option) = &this.x_ms_copy_source_tag_option {
9013 req.insert_header("x-ms-copy-source-tag-option", x_ms_copy_source_tag_option);
9014 }
9015 let req_body = azure_core::EMPTY_BODY;
9016 req.set_body(req_body);
9017 Ok(Response(this.client.send(&mut req).await?))
9018 }
9019 })
9020 }
9021 fn url(&self) -> azure_core::Result<azure_core::Url> {
9022 let mut url = self.client.endpoint().clone();
9023 url.set_path(&format!("/{}/{}?comp=copy&sync", &self.container_name, &self.blob));
9024 Ok(url)
9025 }
9026 }
9027 }
9028 pub mod abort_copy_from_url {
9029 use super::models;
9030 #[cfg(not(target_arch = "wasm32"))]
9031 use futures::future::BoxFuture;
9032 #[cfg(target_arch = "wasm32")]
9033 use futures::future::LocalBoxFuture as BoxFuture;
9034 #[derive(Debug)]
9035 pub struct Response(azure_core::Response);
9036 impl Response {
9037 pub fn into_raw_response(self) -> azure_core::Response {
9038 self.0
9039 }
9040 pub fn as_raw_response(&self) -> &azure_core::Response {
9041 &self.0
9042 }
9043 pub fn headers(&self) -> Headers {
9044 Headers(self.0.headers())
9045 }
9046 }
9047 impl From<Response> for azure_core::Response {
9048 fn from(rsp: Response) -> Self {
9049 rsp.into_raw_response()
9050 }
9051 }
9052 impl AsRef<azure_core::Response> for Response {
9053 fn as_ref(&self) -> &azure_core::Response {
9054 self.as_raw_response()
9055 }
9056 }
9057 pub struct Headers<'a>(&'a azure_core::headers::Headers);
9058 impl<'a> Headers<'a> {
9059 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
9060 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
9061 self.0
9062 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
9063 }
9064 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
9065 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
9066 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
9067 }
9068 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
9069 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
9070 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
9071 }
9072 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
9073 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
9074 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
9075 }
9076 }
9077 #[derive(Clone)]
9078 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9079 #[doc = r""]
9080 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9081 #[doc = r" parameters can be chained."]
9082 #[doc = r""]
9083 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9084 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
9085 #[doc = r" executes the request and returns a `Result` with the parsed"]
9086 #[doc = r" response."]
9087 #[doc = r""]
9088 #[doc = r" In order to execute the request without polling the service"]
9089 #[doc = r" until the operation completes, use `.send().await` instead."]
9090 #[doc = r""]
9091 #[doc = r" If you need lower-level access to the raw response details"]
9092 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9093 #[doc = r" can finalize the request using the"]
9094 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9095 #[doc = r" that resolves to a lower-level [`Response`] value."]
9096 pub struct RequestBuilder {
9097 pub(crate) client: super::super::Client,
9098 pub(crate) container_name: String,
9099 pub(crate) blob: String,
9100 pub(crate) x_ms_copy_action: String,
9101 pub(crate) timeout: Option<i64>,
9102 pub(crate) x_ms_lease_id: Option<String>,
9103 pub(crate) x_ms_client_request_id: Option<String>,
9104 }
9105 impl RequestBuilder {
9106 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
9107 pub fn timeout(mut self, timeout: i64) -> Self {
9108 self.timeout = Some(timeout);
9109 self
9110 }
9111 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
9112 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
9113 self.x_ms_lease_id = Some(x_ms_lease_id.into());
9114 self
9115 }
9116 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
9117 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
9118 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
9119 self
9120 }
9121 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9122 #[doc = ""]
9123 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9124 #[doc = "However, this function can provide more flexibility when required."]
9125 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9126 Box::pin({
9127 let this = self.clone();
9128 async move {
9129 let url = this.url()?;
9130 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
9131 let bearer_token = this.client.bearer_token().await?;
9132 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
9133 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
9134 req.insert_header("x-ms-copy-action", &this.x_ms_copy_action);
9135 if let Some(timeout) = &this.timeout {
9136 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
9137 }
9138 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
9139 req.insert_header("x-ms-lease-id", x_ms_lease_id);
9140 }
9141 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
9142 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
9143 }
9144 let req_body = azure_core::EMPTY_BODY;
9145 req.set_body(req_body);
9146 Ok(Response(this.client.send(&mut req).await?))
9147 }
9148 })
9149 }
9150 fn url(&self) -> azure_core::Result<azure_core::Url> {
9151 let mut url = self.client.endpoint().clone();
9152 url.set_path(&format!("/{}/{}?comp=copy©id", &self.container_name, &self.blob));
9153 Ok(url)
9154 }
9155 }
9156 }
9157 pub mod set_tier {
9158 use super::models;
9159 #[cfg(not(target_arch = "wasm32"))]
9160 use futures::future::BoxFuture;
9161 #[cfg(target_arch = "wasm32")]
9162 use futures::future::LocalBoxFuture as BoxFuture;
9163 #[derive(Debug)]
9164 pub struct Response(azure_core::Response);
9165 impl Response {
9166 pub fn into_raw_response(self) -> azure_core::Response {
9167 self.0
9168 }
9169 pub fn as_raw_response(&self) -> &azure_core::Response {
9170 &self.0
9171 }
9172 pub fn headers(&self) -> Headers {
9173 Headers(self.0.headers())
9174 }
9175 }
9176 impl From<Response> for azure_core::Response {
9177 fn from(rsp: Response) -> Self {
9178 rsp.into_raw_response()
9179 }
9180 }
9181 impl AsRef<azure_core::Response> for Response {
9182 fn as_ref(&self) -> &azure_core::Response {
9183 self.as_raw_response()
9184 }
9185 }
9186 pub struct Headers<'a>(&'a azure_core::headers::Headers);
9187 impl<'a> Headers<'a> {
9188 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
9189 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
9190 self.0
9191 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
9192 }
9193 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
9194 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
9195 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
9196 }
9197 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and newer."]
9198 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
9199 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
9200 }
9201 }
9202 #[derive(Clone)]
9203 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9204 #[doc = r""]
9205 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9206 #[doc = r" parameters can be chained."]
9207 #[doc = r""]
9208 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9209 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
9210 #[doc = r" executes the request and returns a `Result` with the parsed"]
9211 #[doc = r" response."]
9212 #[doc = r""]
9213 #[doc = r" In order to execute the request without polling the service"]
9214 #[doc = r" until the operation completes, use `.send().await` instead."]
9215 #[doc = r""]
9216 #[doc = r" If you need lower-level access to the raw response details"]
9217 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9218 #[doc = r" can finalize the request using the"]
9219 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9220 #[doc = r" that resolves to a lower-level [`Response`] value."]
9221 pub struct RequestBuilder {
9222 pub(crate) client: super::super::Client,
9223 pub(crate) container_name: String,
9224 pub(crate) blob: String,
9225 pub(crate) x_ms_access_tier: String,
9226 pub(crate) snapshot: Option<String>,
9227 pub(crate) versionid: Option<String>,
9228 pub(crate) timeout: Option<i64>,
9229 pub(crate) x_ms_rehydrate_priority: Option<String>,
9230 pub(crate) x_ms_client_request_id: Option<String>,
9231 pub(crate) x_ms_lease_id: Option<String>,
9232 pub(crate) x_ms_if_tags: Option<String>,
9233 }
9234 impl RequestBuilder {
9235 #[doc = "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 <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob\">Creating a Snapshot of a Blob.</a>"]
9236 pub fn snapshot(mut self, snapshot: impl Into<String>) -> Self {
9237 self.snapshot = Some(snapshot.into());
9238 self
9239 }
9240 #[doc = "The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer."]
9241 pub fn versionid(mut self, versionid: impl Into<String>) -> Self {
9242 self.versionid = Some(versionid.into());
9243 self
9244 }
9245 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
9246 pub fn timeout(mut self, timeout: i64) -> Self {
9247 self.timeout = Some(timeout);
9248 self
9249 }
9250 #[doc = "Optional: Indicates the priority with which to rehydrate an archived blob."]
9251 pub fn x_ms_rehydrate_priority(mut self, x_ms_rehydrate_priority: impl Into<String>) -> Self {
9252 self.x_ms_rehydrate_priority = Some(x_ms_rehydrate_priority.into());
9253 self
9254 }
9255 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
9256 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
9257 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
9258 self
9259 }
9260 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
9261 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
9262 self.x_ms_lease_id = Some(x_ms_lease_id.into());
9263 self
9264 }
9265 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
9266 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
9267 self.x_ms_if_tags = Some(x_ms_if_tags.into());
9268 self
9269 }
9270 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9271 #[doc = ""]
9272 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9273 #[doc = "However, this function can provide more flexibility when required."]
9274 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9275 Box::pin({
9276 let this = self.clone();
9277 async move {
9278 let url = this.url()?;
9279 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
9280 let bearer_token = this.client.bearer_token().await?;
9281 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
9282 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
9283 if let Some(snapshot) = &this.snapshot {
9284 req.url_mut().query_pairs_mut().append_pair("snapshot", snapshot);
9285 }
9286 if let Some(versionid) = &this.versionid {
9287 req.url_mut().query_pairs_mut().append_pair("versionid", versionid);
9288 }
9289 if let Some(timeout) = &this.timeout {
9290 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
9291 }
9292 req.insert_header("x-ms-access-tier", &this.x_ms_access_tier);
9293 if let Some(x_ms_rehydrate_priority) = &this.x_ms_rehydrate_priority {
9294 req.insert_header("x-ms-rehydrate-priority", x_ms_rehydrate_priority);
9295 }
9296 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
9297 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
9298 }
9299 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
9300 req.insert_header("x-ms-lease-id", x_ms_lease_id);
9301 }
9302 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
9303 req.insert_header("x-ms-if-tags", x_ms_if_tags);
9304 }
9305 let req_body = azure_core::EMPTY_BODY;
9306 req.set_body(req_body);
9307 Ok(Response(this.client.send(&mut req).await?))
9308 }
9309 })
9310 }
9311 fn url(&self) -> azure_core::Result<azure_core::Url> {
9312 let mut url = self.client.endpoint().clone();
9313 url.set_path(&format!("/{}/{}?comp=tier", &self.container_name, &self.blob));
9314 Ok(url)
9315 }
9316 }
9317 }
9318 pub mod get_account_info {
9319 use super::models;
9320 #[cfg(not(target_arch = "wasm32"))]
9321 use futures::future::BoxFuture;
9322 #[cfg(target_arch = "wasm32")]
9323 use futures::future::LocalBoxFuture as BoxFuture;
9324 #[derive(Debug)]
9325 pub struct Response(azure_core::Response);
9326 impl Response {
9327 pub fn into_raw_response(self) -> azure_core::Response {
9328 self.0
9329 }
9330 pub fn as_raw_response(&self) -> &azure_core::Response {
9331 &self.0
9332 }
9333 pub fn headers(&self) -> Headers {
9334 Headers(self.0.headers())
9335 }
9336 }
9337 impl From<Response> for azure_core::Response {
9338 fn from(rsp: Response) -> Self {
9339 rsp.into_raw_response()
9340 }
9341 }
9342 impl AsRef<azure_core::Response> for Response {
9343 fn as_ref(&self) -> &azure_core::Response {
9344 self.as_raw_response()
9345 }
9346 }
9347 pub struct Headers<'a>(&'a azure_core::headers::Headers);
9348 impl<'a> Headers<'a> {
9349 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
9350 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
9351 self.0
9352 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
9353 }
9354 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
9355 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
9356 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
9357 }
9358 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
9359 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
9360 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
9361 }
9362 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
9363 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
9364 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
9365 }
9366 #[doc = "Identifies the sku name of the account"]
9367 pub fn x_ms_sku_name(&self) -> azure_core::Result<&str> {
9368 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-sku-name"))
9369 }
9370 #[doc = "Identifies the account kind"]
9371 pub fn x_ms_account_kind(&self) -> azure_core::Result<&str> {
9372 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-account-kind"))
9373 }
9374 }
9375 #[derive(Clone)]
9376 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9377 #[doc = r""]
9378 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9379 #[doc = r" parameters can be chained."]
9380 #[doc = r""]
9381 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9382 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
9383 #[doc = r" executes the request and returns a `Result` with the parsed"]
9384 #[doc = r" response."]
9385 #[doc = r""]
9386 #[doc = r" In order to execute the request without polling the service"]
9387 #[doc = r" until the operation completes, use `.send().await` instead."]
9388 #[doc = r""]
9389 #[doc = r" If you need lower-level access to the raw response details"]
9390 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9391 #[doc = r" can finalize the request using the"]
9392 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9393 #[doc = r" that resolves to a lower-level [`Response`] value."]
9394 pub struct RequestBuilder {
9395 pub(crate) client: super::super::Client,
9396 pub(crate) container_name: String,
9397 pub(crate) blob: String,
9398 }
9399 impl RequestBuilder {
9400 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9401 #[doc = ""]
9402 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9403 #[doc = "However, this function can provide more flexibility when required."]
9404 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9405 Box::pin({
9406 let this = self.clone();
9407 async move {
9408 let url = this.url()?;
9409 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
9410 let bearer_token = this.client.bearer_token().await?;
9411 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
9412 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
9413 let req_body = azure_core::EMPTY_BODY;
9414 req.set_body(req_body);
9415 Ok(Response(this.client.send(&mut req).await?))
9416 }
9417 })
9418 }
9419 fn url(&self) -> azure_core::Result<azure_core::Url> {
9420 let mut url = self.client.endpoint().clone();
9421 url.set_path(&format!("/{}/{}?restype=account&comp=properties", &self.container_name, &self.blob));
9422 Ok(url)
9423 }
9424 }
9425 }
9426 pub mod query {
9427 use super::models;
9428 #[cfg(not(target_arch = "wasm32"))]
9429 use futures::future::BoxFuture;
9430 #[cfg(target_arch = "wasm32")]
9431 use futures::future::LocalBoxFuture as BoxFuture;
9432 #[derive(Debug)]
9433 pub struct Response(azure_core::Response);
9434 impl Response {
9435 pub async fn into_body(self) -> azure_core::Result<bytes::Bytes> {
9436 let bytes = self.0.into_body().collect().await?;
9437 let body = bytes;
9438 Ok(body)
9439 }
9440 pub fn into_raw_response(self) -> azure_core::Response {
9441 self.0
9442 }
9443 pub fn as_raw_response(&self) -> &azure_core::Response {
9444 &self.0
9445 }
9446 pub fn headers(&self) -> Headers {
9447 Headers(self.0.headers())
9448 }
9449 }
9450 impl From<Response> for azure_core::Response {
9451 fn from(rsp: Response) -> Self {
9452 rsp.into_raw_response()
9453 }
9454 }
9455 impl AsRef<azure_core::Response> for Response {
9456 fn as_ref(&self) -> &azure_core::Response {
9457 self.as_raw_response()
9458 }
9459 }
9460 pub struct Headers<'a>(&'a azure_core::headers::Headers);
9461 impl<'a> Headers<'a> {
9462 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
9463 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
9464 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
9465 }
9466 pub fn x_ms_meta(&self) -> azure_core::Result<&str> {
9467 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-meta"))
9468 }
9469 #[doc = "The number of bytes present in the response body."]
9470 pub fn content_length(&self) -> azure_core::Result<i64> {
9471 self.0.get_as(&azure_core::headers::HeaderName::from_static("content-length"))
9472 }
9473 #[doc = "The media type of the body of the response. For Download Blob this is 'application/octet-stream'"]
9474 pub fn content_type(&self) -> azure_core::Result<&str> {
9475 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-type"))
9476 }
9477 #[doc = "Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' request header."]
9478 pub fn content_range(&self) -> azure_core::Result<&str> {
9479 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-range"))
9480 }
9481 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
9482 pub fn e_tag(&self) -> azure_core::Result<&str> {
9483 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
9484 }
9485 #[doc = "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."]
9486 pub fn content_md5(&self) -> azure_core::Result<&str> {
9487 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
9488 }
9489 #[doc = "This header returns the value that was specified for the Content-Encoding request header"]
9490 pub fn content_encoding(&self) -> azure_core::Result<&str> {
9491 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-encoding"))
9492 }
9493 #[doc = "This header is returned if it was previously specified for the blob."]
9494 pub fn cache_control(&self) -> azure_core::Result<&str> {
9495 self.0.get_str(&azure_core::headers::HeaderName::from_static("cache-control"))
9496 }
9497 #[doc = "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."]
9498 pub fn content_disposition(&self) -> azure_core::Result<&str> {
9499 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-disposition"))
9500 }
9501 #[doc = "This header returns the value that was specified for the Content-Language request header."]
9502 pub fn content_language(&self) -> azure_core::Result<&str> {
9503 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-language"))
9504 }
9505 #[doc = "The current sequence number for a page blob. This header is not returned for block blobs or append blobs"]
9506 pub fn x_ms_blob_sequence_number(&self) -> azure_core::Result<i64> {
9507 self.0
9508 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sequence-number"))
9509 }
9510 #[doc = "The blob's type."]
9511 pub fn x_ms_blob_type(&self) -> azure_core::Result<&str> {
9512 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-blob-type"))
9513 }
9514 #[doc = "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."]
9515 pub fn x_ms_copy_completion_time(&self) -> azure_core::Result<::time::OffsetDateTime> {
9516 azure_core::date::parse_rfc1123(
9517 self.0
9518 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-completion-time"))?,
9519 )
9520 }
9521 #[doc = "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"]
9522 pub fn x_ms_copy_status_description(&self) -> azure_core::Result<&str> {
9523 self.0
9524 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-status-description"))
9525 }
9526 #[doc = "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."]
9527 pub fn x_ms_copy_id(&self) -> azure_core::Result<&str> {
9528 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-id"))
9529 }
9530 #[doc = "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"]
9531 pub fn x_ms_copy_progress(&self) -> azure_core::Result<&str> {
9532 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-progress"))
9533 }
9534 #[doc = "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."]
9535 pub fn x_ms_copy_source(&self) -> azure_core::Result<&str> {
9536 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-source"))
9537 }
9538 #[doc = "State of the copy operation identified by x-ms-copy-id."]
9539 pub fn x_ms_copy_status(&self) -> azure_core::Result<&str> {
9540 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-status"))
9541 }
9542 #[doc = "When a blob is leased, specifies whether the lease is of infinite or fixed duration."]
9543 pub fn x_ms_lease_duration(&self) -> azure_core::Result<&str> {
9544 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-duration"))
9545 }
9546 #[doc = "Lease state of the blob."]
9547 pub fn x_ms_lease_state(&self) -> azure_core::Result<&str> {
9548 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-state"))
9549 }
9550 #[doc = "The current lease status of the blob."]
9551 pub fn x_ms_lease_status(&self) -> azure_core::Result<&str> {
9552 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-lease-status"))
9553 }
9554 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
9555 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
9556 self.0
9557 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
9558 }
9559 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
9560 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
9561 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
9562 }
9563 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
9564 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
9565 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
9566 }
9567 #[doc = "Indicates that the service supports requests for partial blob content."]
9568 pub fn accept_ranges(&self) -> azure_core::Result<&str> {
9569 self.0.get_str(&azure_core::headers::HeaderName::from_static("accept-ranges"))
9570 }
9571 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
9572 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
9573 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
9574 }
9575 #[doc = "The number of committed blocks present in the blob. This header is returned only for append blobs."]
9576 pub fn x_ms_blob_committed_block_count(&self) -> azure_core::Result<i32> {
9577 self.0
9578 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-committed-block-count"))
9579 }
9580 #[doc = "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)."]
9581 pub fn x_ms_server_encrypted(&self) -> azure_core::Result<bool> {
9582 self.0
9583 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-server-encrypted"))
9584 }
9585 #[doc = "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."]
9586 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
9587 self.0
9588 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
9589 }
9590 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
9591 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
9592 self.0
9593 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
9594 }
9595 #[doc = "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"]
9596 pub fn x_ms_blob_content_md5(&self) -> azure_core::Result<&str> {
9597 self.0
9598 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-blob-content-md5"))
9599 }
9600 #[doc = "If the request is to read a specified range and the x-ms-range-get-content-crc64 is set to true, then the request returns a crc64 for the range, as long as the range size is less than or equal to 4 MB. If both x-ms-range-get-content-crc64 and x-ms-range-get-content-md5 is specified in the same request, it will fail with 400(Bad Request)"]
9601 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
9602 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
9603 }
9604 }
9605 #[derive(Clone)]
9606 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9607 #[doc = r""]
9608 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9609 #[doc = r" parameters can be chained."]
9610 #[doc = r""]
9611 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9612 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
9613 #[doc = r" executes the request and returns a `Result` with the parsed"]
9614 #[doc = r" response."]
9615 #[doc = r""]
9616 #[doc = r" In order to execute the request without polling the service"]
9617 #[doc = r" until the operation completes, use `.send().await` instead."]
9618 #[doc = r""]
9619 #[doc = r" If you need lower-level access to the raw response details"]
9620 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9621 #[doc = r" can finalize the request using the"]
9622 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9623 #[doc = r" that resolves to a lower-level [`Response`] value."]
9624 pub struct RequestBuilder {
9625 pub(crate) client: super::super::Client,
9626 pub(crate) container_name: String,
9627 pub(crate) blob: String,
9628 pub(crate) query_request: Option<models::QueryRequest>,
9629 pub(crate) snapshot: Option<String>,
9630 pub(crate) timeout: Option<i64>,
9631 pub(crate) x_ms_lease_id: Option<String>,
9632 pub(crate) x_ms_encryption_key: Option<String>,
9633 pub(crate) x_ms_encryption_key_sha256: Option<String>,
9634 pub(crate) x_ms_encryption_algorithm: Option<String>,
9635 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
9636 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
9637 pub(crate) if_match: Option<String>,
9638 pub(crate) if_none_match: Option<String>,
9639 pub(crate) x_ms_if_tags: Option<String>,
9640 pub(crate) x_ms_client_request_id: Option<String>,
9641 }
9642 impl RequestBuilder {
9643 #[doc = "the query request"]
9644 pub fn query_request(mut self, query_request: impl Into<models::QueryRequest>) -> Self {
9645 self.query_request = Some(query_request.into());
9646 self
9647 }
9648 #[doc = "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 <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob\">Creating a Snapshot of a Blob.</a>"]
9649 pub fn snapshot(mut self, snapshot: impl Into<String>) -> Self {
9650 self.snapshot = Some(snapshot.into());
9651 self
9652 }
9653 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
9654 pub fn timeout(mut self, timeout: i64) -> Self {
9655 self.timeout = Some(timeout);
9656 self
9657 }
9658 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
9659 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
9660 self.x_ms_lease_id = Some(x_ms_lease_id.into());
9661 self
9662 }
9663 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
9664 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
9665 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
9666 self
9667 }
9668 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
9669 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
9670 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
9671 self
9672 }
9673 #[doc = "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."]
9674 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
9675 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
9676 self
9677 }
9678 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
9679 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
9680 self.if_modified_since = Some(if_modified_since.into());
9681 self
9682 }
9683 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
9684 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
9685 self.if_unmodified_since = Some(if_unmodified_since.into());
9686 self
9687 }
9688 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
9689 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
9690 self.if_match = Some(if_match.into());
9691 self
9692 }
9693 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
9694 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
9695 self.if_none_match = Some(if_none_match.into());
9696 self
9697 }
9698 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
9699 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
9700 self.x_ms_if_tags = Some(x_ms_if_tags.into());
9701 self
9702 }
9703 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
9704 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
9705 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
9706 self
9707 }
9708 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9709 #[doc = ""]
9710 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9711 #[doc = "However, this function can provide more flexibility when required."]
9712 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9713 Box::pin({
9714 let this = self.clone();
9715 async move {
9716 let url = this.url()?;
9717 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
9718 let bearer_token = this.client.bearer_token().await?;
9719 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
9720 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
9721 let req_body = if let Some(query_request) = &this.query_request {
9722 req.insert_header("content-type", "application/xml");
9723 azure_core::xml::to_xml(query_request)?
9724 } else {
9725 azure_core::EMPTY_BODY
9726 };
9727 if let Some(snapshot) = &this.snapshot {
9728 req.url_mut().query_pairs_mut().append_pair("snapshot", snapshot);
9729 }
9730 if let Some(timeout) = &this.timeout {
9731 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
9732 }
9733 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
9734 req.insert_header("x-ms-lease-id", x_ms_lease_id);
9735 }
9736 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
9737 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
9738 }
9739 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
9740 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
9741 }
9742 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
9743 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
9744 }
9745 if let Some(if_modified_since) = &this.if_modified_since {
9746 req.insert_header("if-modified-since", if_modified_since.to_string());
9747 }
9748 if let Some(if_unmodified_since) = &this.if_unmodified_since {
9749 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
9750 }
9751 if let Some(if_match) = &this.if_match {
9752 req.insert_header("if-match", if_match);
9753 }
9754 if let Some(if_none_match) = &this.if_none_match {
9755 req.insert_header("if-none-match", if_none_match);
9756 }
9757 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
9758 req.insert_header("x-ms-if-tags", x_ms_if_tags);
9759 }
9760 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
9761 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
9762 }
9763 req.set_body(req_body);
9764 Ok(Response(this.client.send(&mut req).await?))
9765 }
9766 })
9767 }
9768 fn url(&self) -> azure_core::Result<azure_core::Url> {
9769 let mut url = self.client.endpoint().clone();
9770 url.set_path(&format!("/{}/{}?comp=query", &self.container_name, &self.blob));
9771 Ok(url)
9772 }
9773 }
9774 impl std::future::IntoFuture for RequestBuilder {
9775 type Output = azure_core::Result<bytes::Bytes>;
9776 type IntoFuture = BoxFuture<'static, azure_core::Result<bytes::Bytes>>;
9777 #[doc = "Returns a future that sends the request and returns the parsed response body."]
9778 #[doc = ""]
9779 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
9780 #[doc = ""]
9781 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
9782 fn into_future(self) -> Self::IntoFuture {
9783 Box::pin(async move { self.send().await?.into_body().await })
9784 }
9785 }
9786 }
9787 pub mod get_tags {
9788 use super::models;
9789 #[cfg(not(target_arch = "wasm32"))]
9790 use futures::future::BoxFuture;
9791 #[cfg(target_arch = "wasm32")]
9792 use futures::future::LocalBoxFuture as BoxFuture;
9793 #[derive(Debug)]
9794 pub struct Response(azure_core::Response);
9795 impl Response {
9796 pub async fn into_body(self) -> azure_core::Result<models::BlobTags> {
9797 let bytes = self.0.into_body().collect().await?;
9798 let body: models::BlobTags = azure_core::xml::read_xml(&bytes)?;
9799 Ok(body)
9800 }
9801 pub fn into_raw_response(self) -> azure_core::Response {
9802 self.0
9803 }
9804 pub fn as_raw_response(&self) -> &azure_core::Response {
9805 &self.0
9806 }
9807 pub fn headers(&self) -> Headers {
9808 Headers(self.0.headers())
9809 }
9810 }
9811 impl From<Response> for azure_core::Response {
9812 fn from(rsp: Response) -> Self {
9813 rsp.into_raw_response()
9814 }
9815 }
9816 impl AsRef<azure_core::Response> for Response {
9817 fn as_ref(&self) -> &azure_core::Response {
9818 self.as_raw_response()
9819 }
9820 }
9821 pub struct Headers<'a>(&'a azure_core::headers::Headers);
9822 impl<'a> Headers<'a> {
9823 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
9824 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
9825 self.0
9826 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
9827 }
9828 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
9829 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
9830 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
9831 }
9832 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
9833 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
9834 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
9835 }
9836 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
9837 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
9838 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
9839 }
9840 }
9841 #[derive(Clone)]
9842 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9843 #[doc = r""]
9844 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9845 #[doc = r" parameters can be chained."]
9846 #[doc = r""]
9847 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9848 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
9849 #[doc = r" executes the request and returns a `Result` with the parsed"]
9850 #[doc = r" response."]
9851 #[doc = r""]
9852 #[doc = r" In order to execute the request without polling the service"]
9853 #[doc = r" until the operation completes, use `.send().await` instead."]
9854 #[doc = r""]
9855 #[doc = r" If you need lower-level access to the raw response details"]
9856 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9857 #[doc = r" can finalize the request using the"]
9858 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9859 #[doc = r" that resolves to a lower-level [`Response`] value."]
9860 pub struct RequestBuilder {
9861 pub(crate) client: super::super::Client,
9862 pub(crate) container_name: String,
9863 pub(crate) blob: String,
9864 pub(crate) timeout: Option<i64>,
9865 pub(crate) x_ms_client_request_id: Option<String>,
9866 pub(crate) snapshot: Option<String>,
9867 pub(crate) versionid: Option<String>,
9868 pub(crate) x_ms_if_tags: Option<String>,
9869 pub(crate) x_ms_lease_id: Option<String>,
9870 }
9871 impl RequestBuilder {
9872 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
9873 pub fn timeout(mut self, timeout: i64) -> Self {
9874 self.timeout = Some(timeout);
9875 self
9876 }
9877 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
9878 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
9879 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
9880 self
9881 }
9882 #[doc = "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 <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob\">Creating a Snapshot of a Blob.</a>"]
9883 pub fn snapshot(mut self, snapshot: impl Into<String>) -> Self {
9884 self.snapshot = Some(snapshot.into());
9885 self
9886 }
9887 #[doc = "The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer."]
9888 pub fn versionid(mut self, versionid: impl Into<String>) -> Self {
9889 self.versionid = Some(versionid.into());
9890 self
9891 }
9892 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
9893 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
9894 self.x_ms_if_tags = Some(x_ms_if_tags.into());
9895 self
9896 }
9897 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
9898 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
9899 self.x_ms_lease_id = Some(x_ms_lease_id.into());
9900 self
9901 }
9902 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9903 #[doc = ""]
9904 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9905 #[doc = "However, this function can provide more flexibility when required."]
9906 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9907 Box::pin({
9908 let this = self.clone();
9909 async move {
9910 let url = this.url()?;
9911 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
9912 let bearer_token = this.client.bearer_token().await?;
9913 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
9914 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
9915 if let Some(timeout) = &this.timeout {
9916 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
9917 }
9918 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
9919 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
9920 }
9921 if let Some(snapshot) = &this.snapshot {
9922 req.url_mut().query_pairs_mut().append_pair("snapshot", snapshot);
9923 }
9924 if let Some(versionid) = &this.versionid {
9925 req.url_mut().query_pairs_mut().append_pair("versionid", versionid);
9926 }
9927 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
9928 req.insert_header("x-ms-if-tags", x_ms_if_tags);
9929 }
9930 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
9931 req.insert_header("x-ms-lease-id", x_ms_lease_id);
9932 }
9933 let req_body = azure_core::EMPTY_BODY;
9934 req.set_body(req_body);
9935 Ok(Response(this.client.send(&mut req).await?))
9936 }
9937 })
9938 }
9939 fn url(&self) -> azure_core::Result<azure_core::Url> {
9940 let mut url = self.client.endpoint().clone();
9941 url.set_path(&format!("/{}/{}?comp=tags", &self.container_name, &self.blob));
9942 Ok(url)
9943 }
9944 }
9945 impl std::future::IntoFuture for RequestBuilder {
9946 type Output = azure_core::Result<models::BlobTags>;
9947 type IntoFuture = BoxFuture<'static, azure_core::Result<models::BlobTags>>;
9948 #[doc = "Returns a future that sends the request and returns the parsed response body."]
9949 #[doc = ""]
9950 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
9951 #[doc = ""]
9952 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
9953 fn into_future(self) -> Self::IntoFuture {
9954 Box::pin(async move { self.send().await?.into_body().await })
9955 }
9956 }
9957 }
9958 pub mod set_tags {
9959 use super::models;
9960 #[cfg(not(target_arch = "wasm32"))]
9961 use futures::future::BoxFuture;
9962 #[cfg(target_arch = "wasm32")]
9963 use futures::future::LocalBoxFuture as BoxFuture;
9964 #[derive(Debug)]
9965 pub struct Response(azure_core::Response);
9966 impl Response {
9967 pub fn into_raw_response(self) -> azure_core::Response {
9968 self.0
9969 }
9970 pub fn as_raw_response(&self) -> &azure_core::Response {
9971 &self.0
9972 }
9973 pub fn headers(&self) -> Headers {
9974 Headers(self.0.headers())
9975 }
9976 }
9977 impl From<Response> for azure_core::Response {
9978 fn from(rsp: Response) -> Self {
9979 rsp.into_raw_response()
9980 }
9981 }
9982 impl AsRef<azure_core::Response> for Response {
9983 fn as_ref(&self) -> &azure_core::Response {
9984 self.as_raw_response()
9985 }
9986 }
9987 pub struct Headers<'a>(&'a azure_core::headers::Headers);
9988 impl<'a> Headers<'a> {
9989 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
9990 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
9991 self.0
9992 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
9993 }
9994 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
9995 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
9996 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
9997 }
9998 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
9999 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
10000 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
10001 }
10002 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
10003 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
10004 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
10005 }
10006 }
10007 #[derive(Clone)]
10008 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
10009 #[doc = r""]
10010 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
10011 #[doc = r" parameters can be chained."]
10012 #[doc = r""]
10013 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
10014 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
10015 #[doc = r" executes the request and returns a `Result` with the parsed"]
10016 #[doc = r" response."]
10017 #[doc = r""]
10018 #[doc = r" In order to execute the request without polling the service"]
10019 #[doc = r" until the operation completes, use `.send().await` instead."]
10020 #[doc = r""]
10021 #[doc = r" If you need lower-level access to the raw response details"]
10022 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
10023 #[doc = r" can finalize the request using the"]
10024 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
10025 #[doc = r" that resolves to a lower-level [`Response`] value."]
10026 pub struct RequestBuilder {
10027 pub(crate) client: super::super::Client,
10028 pub(crate) container_name: String,
10029 pub(crate) blob: String,
10030 pub(crate) timeout: Option<i64>,
10031 pub(crate) versionid: Option<String>,
10032 pub(crate) content_md5: Option<String>,
10033 pub(crate) x_ms_content_crc64: Option<String>,
10034 pub(crate) x_ms_client_request_id: Option<String>,
10035 pub(crate) x_ms_if_tags: Option<String>,
10036 pub(crate) x_ms_lease_id: Option<String>,
10037 pub(crate) tags: Option<models::BlobTags>,
10038 }
10039 impl RequestBuilder {
10040 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
10041 pub fn timeout(mut self, timeout: i64) -> Self {
10042 self.timeout = Some(timeout);
10043 self
10044 }
10045 #[doc = "The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer."]
10046 pub fn versionid(mut self, versionid: impl Into<String>) -> Self {
10047 self.versionid = Some(versionid.into());
10048 self
10049 }
10050 #[doc = "Specify the transactional md5 for the body, to be validated by the service."]
10051 pub fn content_md5(mut self, content_md5: impl Into<String>) -> Self {
10052 self.content_md5 = Some(content_md5.into());
10053 self
10054 }
10055 #[doc = "Specify the transactional crc64 for the body, to be validated by the service."]
10056 pub fn x_ms_content_crc64(mut self, x_ms_content_crc64: impl Into<String>) -> Self {
10057 self.x_ms_content_crc64 = Some(x_ms_content_crc64.into());
10058 self
10059 }
10060 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
10061 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
10062 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
10063 self
10064 }
10065 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
10066 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
10067 self.x_ms_if_tags = Some(x_ms_if_tags.into());
10068 self
10069 }
10070 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
10071 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
10072 self.x_ms_lease_id = Some(x_ms_lease_id.into());
10073 self
10074 }
10075 #[doc = "Blob tags"]
10076 pub fn tags(mut self, tags: impl Into<models::BlobTags>) -> Self {
10077 self.tags = Some(tags.into());
10078 self
10079 }
10080 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
10081 #[doc = ""]
10082 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
10083 #[doc = "However, this function can provide more flexibility when required."]
10084 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
10085 Box::pin({
10086 let this = self.clone();
10087 async move {
10088 let url = this.url()?;
10089 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
10090 let bearer_token = this.client.bearer_token().await?;
10091 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
10092 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
10093 if let Some(timeout) = &this.timeout {
10094 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
10095 }
10096 if let Some(versionid) = &this.versionid {
10097 req.url_mut().query_pairs_mut().append_pair("versionid", versionid);
10098 }
10099 if let Some(content_md5) = &this.content_md5 {
10100 req.insert_header("content-md5", content_md5);
10101 }
10102 if let Some(x_ms_content_crc64) = &this.x_ms_content_crc64 {
10103 req.insert_header("x-ms-content-crc64", x_ms_content_crc64);
10104 }
10105 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
10106 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
10107 }
10108 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
10109 req.insert_header("x-ms-if-tags", x_ms_if_tags);
10110 }
10111 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
10112 req.insert_header("x-ms-lease-id", x_ms_lease_id);
10113 }
10114 let req_body = if let Some(tags) = &this.tags {
10115 req.insert_header("content-type", "application/xml");
10116 azure_core::xml::to_xml(tags)?
10117 } else {
10118 azure_core::EMPTY_BODY
10119 };
10120 req.set_body(req_body);
10121 Ok(Response(this.client.send(&mut req).await?))
10122 }
10123 })
10124 }
10125 fn url(&self) -> azure_core::Result<azure_core::Url> {
10126 let mut url = self.client.endpoint().clone();
10127 url.set_path(&format!("/{}/{}?comp=tags", &self.container_name, &self.blob));
10128 Ok(url)
10129 }
10130 }
10131 }
10132}
10133pub mod page_blob {
10134 use super::models;
10135 #[cfg(not(target_arch = "wasm32"))]
10136 use futures::future::BoxFuture;
10137 #[cfg(target_arch = "wasm32")]
10138 use futures::future::LocalBoxFuture as BoxFuture;
10139 pub struct Client(pub(crate) super::Client);
10140 impl Client {
10141 #[doc = "The Create operation creates a new page blob."]
10142 #[doc = ""]
10143 #[doc = "Arguments:"]
10144 #[doc = "* `container_name`: The container name."]
10145 #[doc = "* `blob`: The blob name."]
10146 #[doc = "* `x_ms_blob_type`: Specifies the type of blob to create: block blob, page blob, or append blob."]
10147 #[doc = "* `content_length`: The length of the request."]
10148 #[doc = "* `x_ms_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."]
10149 pub fn create(
10150 &self,
10151 container_name: impl Into<String>,
10152 blob: impl Into<String>,
10153 x_ms_blob_type: impl Into<String>,
10154 content_length: i64,
10155 x_ms_blob_content_length: i64,
10156 ) -> create::RequestBuilder {
10157 create::RequestBuilder {
10158 client: self.0.clone(),
10159 container_name: container_name.into(),
10160 blob: blob.into(),
10161 x_ms_blob_type: x_ms_blob_type.into(),
10162 content_length,
10163 x_ms_blob_content_length,
10164 timeout: None,
10165 x_ms_access_tier: None,
10166 x_ms_blob_content_type: None,
10167 x_ms_blob_content_encoding: None,
10168 x_ms_blob_content_language: None,
10169 x_ms_blob_content_md5: None,
10170 x_ms_blob_cache_control: None,
10171 x_ms_meta: None,
10172 x_ms_lease_id: None,
10173 x_ms_blob_content_disposition: None,
10174 x_ms_encryption_key: None,
10175 x_ms_encryption_key_sha256: None,
10176 x_ms_encryption_algorithm: None,
10177 x_ms_encryption_scope: None,
10178 if_modified_since: None,
10179 if_unmodified_since: None,
10180 if_match: None,
10181 if_none_match: None,
10182 x_ms_if_tags: None,
10183 x_ms_blob_sequence_number: None,
10184 x_ms_client_request_id: None,
10185 x_ms_tags: None,
10186 x_ms_immutability_policy_until_date: None,
10187 x_ms_immutability_policy_mode: None,
10188 x_ms_legal_hold: None,
10189 }
10190 }
10191 #[doc = "The Upload Pages operation writes a range of pages to a page blob"]
10192 #[doc = ""]
10193 #[doc = "Arguments:"]
10194 #[doc = "* `container_name`: The container name."]
10195 #[doc = "* `blob`: The blob name."]
10196 #[doc = "* `x_ms_page_write`: 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."]
10197 #[doc = "* `body`: Initial data"]
10198 #[doc = "* `content_length`: The length of the request."]
10199 pub fn upload_pages(
10200 &self,
10201 container_name: impl Into<String>,
10202 blob: impl Into<String>,
10203 x_ms_page_write: impl Into<String>,
10204 body: impl Into<serde_json::Value>,
10205 content_length: i64,
10206 ) -> upload_pages::RequestBuilder {
10207 upload_pages::RequestBuilder {
10208 client: self.0.clone(),
10209 container_name: container_name.into(),
10210 blob: blob.into(),
10211 x_ms_page_write: x_ms_page_write.into(),
10212 body: body.into(),
10213 content_length,
10214 content_md5: None,
10215 x_ms_content_crc64: None,
10216 timeout: None,
10217 x_ms_range: None,
10218 x_ms_lease_id: None,
10219 x_ms_encryption_key: None,
10220 x_ms_encryption_key_sha256: None,
10221 x_ms_encryption_algorithm: None,
10222 x_ms_encryption_scope: None,
10223 x_ms_if_sequence_number_le: None,
10224 x_ms_if_sequence_number_lt: None,
10225 x_ms_if_sequence_number_eq: None,
10226 if_modified_since: None,
10227 if_unmodified_since: None,
10228 if_match: None,
10229 if_none_match: None,
10230 x_ms_if_tags: None,
10231 x_ms_client_request_id: None,
10232 }
10233 }
10234 #[doc = "The Clear Pages operation clears a set of pages from a page blob"]
10235 #[doc = ""]
10236 #[doc = "Arguments:"]
10237 #[doc = "* `container_name`: The container name."]
10238 #[doc = "* `blob`: The blob name."]
10239 #[doc = "* `x_ms_page_write`: 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."]
10240 #[doc = "* `content_length`: The length of the request."]
10241 pub fn clear_pages(
10242 &self,
10243 container_name: impl Into<String>,
10244 blob: impl Into<String>,
10245 x_ms_page_write: impl Into<String>,
10246 content_length: i64,
10247 ) -> clear_pages::RequestBuilder {
10248 clear_pages::RequestBuilder {
10249 client: self.0.clone(),
10250 container_name: container_name.into(),
10251 blob: blob.into(),
10252 x_ms_page_write: x_ms_page_write.into(),
10253 content_length,
10254 timeout: None,
10255 x_ms_range: None,
10256 x_ms_lease_id: None,
10257 x_ms_encryption_key: None,
10258 x_ms_encryption_key_sha256: None,
10259 x_ms_encryption_algorithm: None,
10260 x_ms_encryption_scope: None,
10261 x_ms_if_sequence_number_le: None,
10262 x_ms_if_sequence_number_lt: None,
10263 x_ms_if_sequence_number_eq: None,
10264 if_modified_since: None,
10265 if_unmodified_since: None,
10266 if_match: None,
10267 if_none_match: None,
10268 x_ms_if_tags: None,
10269 x_ms_client_request_id: None,
10270 }
10271 }
10272 #[doc = "The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL"]
10273 #[doc = ""]
10274 #[doc = "Arguments:"]
10275 #[doc = "* `container_name`: The container name."]
10276 #[doc = "* `blob`: The blob name."]
10277 #[doc = "* `x_ms_page_write`: 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."]
10278 #[doc = "* `x_ms_copy_source`: Specify a URL to the copy source."]
10279 #[doc = "* `x_ms_source_range`: 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."]
10280 #[doc = "* `content_length`: The length of the request."]
10281 #[doc = "* `x_ms_range`: The range of bytes to which the source range would be written. The range should be 512 aligned and range-end is required."]
10282 pub fn upload_pages_from_url(
10283 &self,
10284 container_name: impl Into<String>,
10285 blob: impl Into<String>,
10286 x_ms_page_write: impl Into<String>,
10287 x_ms_copy_source: impl Into<String>,
10288 x_ms_source_range: impl Into<String>,
10289 content_length: i64,
10290 x_ms_range: impl Into<String>,
10291 ) -> upload_pages_from_url::RequestBuilder {
10292 upload_pages_from_url::RequestBuilder {
10293 client: self.0.clone(),
10294 container_name: container_name.into(),
10295 blob: blob.into(),
10296 x_ms_page_write: x_ms_page_write.into(),
10297 x_ms_copy_source: x_ms_copy_source.into(),
10298 x_ms_source_range: x_ms_source_range.into(),
10299 content_length,
10300 x_ms_range: x_ms_range.into(),
10301 x_ms_source_content_md5: None,
10302 x_ms_source_content_crc64: None,
10303 timeout: None,
10304 x_ms_encryption_key: None,
10305 x_ms_encryption_key_sha256: None,
10306 x_ms_encryption_algorithm: None,
10307 x_ms_encryption_scope: None,
10308 x_ms_lease_id: None,
10309 x_ms_if_sequence_number_le: None,
10310 x_ms_if_sequence_number_lt: None,
10311 x_ms_if_sequence_number_eq: None,
10312 if_modified_since: None,
10313 if_unmodified_since: None,
10314 if_match: None,
10315 if_none_match: None,
10316 x_ms_if_tags: None,
10317 x_ms_source_if_modified_since: None,
10318 x_ms_source_if_unmodified_since: None,
10319 x_ms_source_if_match: None,
10320 x_ms_source_if_none_match: None,
10321 x_ms_client_request_id: None,
10322 x_ms_copy_source_authorization: None,
10323 }
10324 }
10325 #[doc = "The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a page blob"]
10326 #[doc = ""]
10327 #[doc = "Arguments:"]
10328 #[doc = "* `container_name`: The container name."]
10329 #[doc = "* `blob`: The blob name."]
10330 pub fn get_page_ranges(&self, container_name: impl Into<String>, blob: impl Into<String>) -> get_page_ranges::RequestBuilder {
10331 get_page_ranges::RequestBuilder {
10332 client: self.0.clone(),
10333 container_name: container_name.into(),
10334 blob: blob.into(),
10335 snapshot: None,
10336 timeout: None,
10337 x_ms_range: None,
10338 x_ms_lease_id: None,
10339 if_modified_since: None,
10340 if_unmodified_since: None,
10341 if_match: None,
10342 if_none_match: None,
10343 x_ms_if_tags: None,
10344 x_ms_client_request_id: None,
10345 marker: None,
10346 maxresults: None,
10347 }
10348 }
10349 #[doc = "The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were changed between target blob and previous snapshot."]
10350 #[doc = ""]
10351 #[doc = "Arguments:"]
10352 #[doc = "* `container_name`: The container name."]
10353 #[doc = "* `blob`: The blob name."]
10354 pub fn get_page_ranges_diff(
10355 &self,
10356 container_name: impl Into<String>,
10357 blob: impl Into<String>,
10358 ) -> get_page_ranges_diff::RequestBuilder {
10359 get_page_ranges_diff::RequestBuilder {
10360 client: self.0.clone(),
10361 container_name: container_name.into(),
10362 blob: blob.into(),
10363 snapshot: None,
10364 timeout: None,
10365 prevsnapshot: None,
10366 x_ms_previous_snapshot_url: None,
10367 x_ms_range: None,
10368 x_ms_lease_id: None,
10369 if_modified_since: None,
10370 if_unmodified_since: None,
10371 if_match: None,
10372 if_none_match: None,
10373 x_ms_if_tags: None,
10374 x_ms_client_request_id: None,
10375 marker: None,
10376 maxresults: None,
10377 }
10378 }
10379 #[doc = "Resize the Blob"]
10380 #[doc = ""]
10381 #[doc = "Arguments:"]
10382 #[doc = "* `container_name`: The container name."]
10383 #[doc = "* `blob`: The blob name."]
10384 #[doc = "* `x_ms_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."]
10385 pub fn resize(
10386 &self,
10387 container_name: impl Into<String>,
10388 blob: impl Into<String>,
10389 x_ms_blob_content_length: i64,
10390 ) -> resize::RequestBuilder {
10391 resize::RequestBuilder {
10392 client: self.0.clone(),
10393 container_name: container_name.into(),
10394 blob: blob.into(),
10395 x_ms_blob_content_length,
10396 timeout: None,
10397 x_ms_lease_id: None,
10398 x_ms_encryption_key: None,
10399 x_ms_encryption_key_sha256: None,
10400 x_ms_encryption_algorithm: None,
10401 x_ms_encryption_scope: None,
10402 if_modified_since: None,
10403 if_unmodified_since: None,
10404 if_match: None,
10405 if_none_match: None,
10406 x_ms_if_tags: None,
10407 x_ms_client_request_id: None,
10408 }
10409 }
10410 #[doc = "Update the sequence number of the blob"]
10411 #[doc = ""]
10412 #[doc = "Arguments:"]
10413 #[doc = "* `container_name`: The container name."]
10414 #[doc = "* `blob`: The blob name."]
10415 #[doc = "* `x_ms_sequence_number_action`: Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number"]
10416 pub fn update_sequence_number(
10417 &self,
10418 container_name: impl Into<String>,
10419 blob: impl Into<String>,
10420 x_ms_sequence_number_action: impl Into<String>,
10421 ) -> update_sequence_number::RequestBuilder {
10422 update_sequence_number::RequestBuilder {
10423 client: self.0.clone(),
10424 container_name: container_name.into(),
10425 blob: blob.into(),
10426 x_ms_sequence_number_action: x_ms_sequence_number_action.into(),
10427 timeout: None,
10428 x_ms_lease_id: None,
10429 if_modified_since: None,
10430 if_unmodified_since: None,
10431 if_match: None,
10432 if_none_match: None,
10433 x_ms_if_tags: None,
10434 x_ms_blob_sequence_number: None,
10435 x_ms_client_request_id: None,
10436 }
10437 }
10438 #[doc = "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."]
10439 #[doc = ""]
10440 #[doc = "Arguments:"]
10441 #[doc = "* `container_name`: The container name."]
10442 #[doc = "* `blob`: The blob name."]
10443 #[doc = "* `x_ms_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."]
10444 pub fn copy_incremental(
10445 &self,
10446 container_name: impl Into<String>,
10447 blob: impl Into<String>,
10448 x_ms_copy_source: impl Into<String>,
10449 ) -> copy_incremental::RequestBuilder {
10450 copy_incremental::RequestBuilder {
10451 client: self.0.clone(),
10452 container_name: container_name.into(),
10453 blob: blob.into(),
10454 x_ms_copy_source: x_ms_copy_source.into(),
10455 timeout: None,
10456 if_modified_since: None,
10457 if_unmodified_since: None,
10458 if_match: None,
10459 if_none_match: None,
10460 x_ms_if_tags: None,
10461 x_ms_client_request_id: None,
10462 }
10463 }
10464 }
10465 pub mod create {
10466 use super::models;
10467 #[cfg(not(target_arch = "wasm32"))]
10468 use futures::future::BoxFuture;
10469 #[cfg(target_arch = "wasm32")]
10470 use futures::future::LocalBoxFuture as BoxFuture;
10471 #[derive(Debug)]
10472 pub struct Response(azure_core::Response);
10473 impl Response {
10474 pub fn into_raw_response(self) -> azure_core::Response {
10475 self.0
10476 }
10477 pub fn as_raw_response(&self) -> &azure_core::Response {
10478 &self.0
10479 }
10480 pub fn headers(&self) -> Headers {
10481 Headers(self.0.headers())
10482 }
10483 }
10484 impl From<Response> for azure_core::Response {
10485 fn from(rsp: Response) -> Self {
10486 rsp.into_raw_response()
10487 }
10488 }
10489 impl AsRef<azure_core::Response> for Response {
10490 fn as_ref(&self) -> &azure_core::Response {
10491 self.as_raw_response()
10492 }
10493 }
10494 pub struct Headers<'a>(&'a azure_core::headers::Headers);
10495 impl<'a> Headers<'a> {
10496 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
10497 pub fn e_tag(&self) -> azure_core::Result<&str> {
10498 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
10499 }
10500 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
10501 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
10502 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
10503 }
10504 #[doc = "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."]
10505 pub fn content_md5(&self) -> azure_core::Result<&str> {
10506 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
10507 }
10508 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
10509 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
10510 self.0
10511 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
10512 }
10513 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
10514 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
10515 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
10516 }
10517 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
10518 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
10519 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
10520 }
10521 #[doc = "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."]
10522 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
10523 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
10524 }
10525 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
10526 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
10527 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
10528 }
10529 #[doc = "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."]
10530 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
10531 self.0
10532 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
10533 }
10534 #[doc = "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."]
10535 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
10536 self.0
10537 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
10538 }
10539 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
10540 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
10541 self.0
10542 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
10543 }
10544 }
10545 #[derive(Clone)]
10546 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
10547 #[doc = r""]
10548 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
10549 #[doc = r" parameters can be chained."]
10550 #[doc = r""]
10551 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
10552 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
10553 #[doc = r" executes the request and returns a `Result` with the parsed"]
10554 #[doc = r" response."]
10555 #[doc = r""]
10556 #[doc = r" In order to execute the request without polling the service"]
10557 #[doc = r" until the operation completes, use `.send().await` instead."]
10558 #[doc = r""]
10559 #[doc = r" If you need lower-level access to the raw response details"]
10560 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
10561 #[doc = r" can finalize the request using the"]
10562 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
10563 #[doc = r" that resolves to a lower-level [`Response`] value."]
10564 pub struct RequestBuilder {
10565 pub(crate) client: super::super::Client,
10566 pub(crate) container_name: String,
10567 pub(crate) blob: String,
10568 pub(crate) x_ms_blob_type: String,
10569 pub(crate) content_length: i64,
10570 pub(crate) x_ms_blob_content_length: i64,
10571 pub(crate) timeout: Option<i64>,
10572 pub(crate) x_ms_access_tier: Option<String>,
10573 pub(crate) x_ms_blob_content_type: Option<String>,
10574 pub(crate) x_ms_blob_content_encoding: Option<String>,
10575 pub(crate) x_ms_blob_content_language: Option<String>,
10576 pub(crate) x_ms_blob_content_md5: Option<String>,
10577 pub(crate) x_ms_blob_cache_control: Option<String>,
10578 pub(crate) x_ms_meta: Option<String>,
10579 pub(crate) x_ms_lease_id: Option<String>,
10580 pub(crate) x_ms_blob_content_disposition: Option<String>,
10581 pub(crate) x_ms_encryption_key: Option<String>,
10582 pub(crate) x_ms_encryption_key_sha256: Option<String>,
10583 pub(crate) x_ms_encryption_algorithm: Option<String>,
10584 pub(crate) x_ms_encryption_scope: Option<String>,
10585 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
10586 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
10587 pub(crate) if_match: Option<String>,
10588 pub(crate) if_none_match: Option<String>,
10589 pub(crate) x_ms_if_tags: Option<String>,
10590 pub(crate) x_ms_blob_sequence_number: Option<i64>,
10591 pub(crate) x_ms_client_request_id: Option<String>,
10592 pub(crate) x_ms_tags: Option<String>,
10593 pub(crate) x_ms_immutability_policy_until_date: Option<::time::OffsetDateTime>,
10594 pub(crate) x_ms_immutability_policy_mode: Option<String>,
10595 pub(crate) x_ms_legal_hold: Option<bool>,
10596 }
10597 impl RequestBuilder {
10598 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
10599 pub fn timeout(mut self, timeout: i64) -> Self {
10600 self.timeout = Some(timeout);
10601 self
10602 }
10603 #[doc = "Optional. Indicates the tier to be set on the page blob."]
10604 pub fn x_ms_access_tier(mut self, x_ms_access_tier: impl Into<String>) -> Self {
10605 self.x_ms_access_tier = Some(x_ms_access_tier.into());
10606 self
10607 }
10608 #[doc = "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request."]
10609 pub fn x_ms_blob_content_type(mut self, x_ms_blob_content_type: impl Into<String>) -> Self {
10610 self.x_ms_blob_content_type = Some(x_ms_blob_content_type.into());
10611 self
10612 }
10613 #[doc = "Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request."]
10614 pub fn x_ms_blob_content_encoding(mut self, x_ms_blob_content_encoding: impl Into<String>) -> Self {
10615 self.x_ms_blob_content_encoding = Some(x_ms_blob_content_encoding.into());
10616 self
10617 }
10618 #[doc = "Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request."]
10619 pub fn x_ms_blob_content_language(mut self, x_ms_blob_content_language: impl Into<String>) -> Self {
10620 self.x_ms_blob_content_language = Some(x_ms_blob_content_language.into());
10621 self
10622 }
10623 #[doc = "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."]
10624 pub fn x_ms_blob_content_md5(mut self, x_ms_blob_content_md5: impl Into<String>) -> Self {
10625 self.x_ms_blob_content_md5 = Some(x_ms_blob_content_md5.into());
10626 self
10627 }
10628 #[doc = "Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request."]
10629 pub fn x_ms_blob_cache_control(mut self, x_ms_blob_cache_control: impl Into<String>) -> Self {
10630 self.x_ms_blob_cache_control = Some(x_ms_blob_cache_control.into());
10631 self
10632 }
10633 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
10634 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
10635 self.x_ms_meta = Some(x_ms_meta.into());
10636 self
10637 }
10638 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
10639 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
10640 self.x_ms_lease_id = Some(x_ms_lease_id.into());
10641 self
10642 }
10643 #[doc = "Optional. Sets the blob's Content-Disposition header."]
10644 pub fn x_ms_blob_content_disposition(mut self, x_ms_blob_content_disposition: impl Into<String>) -> Self {
10645 self.x_ms_blob_content_disposition = Some(x_ms_blob_content_disposition.into());
10646 self
10647 }
10648 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
10649 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
10650 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
10651 self
10652 }
10653 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
10654 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
10655 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
10656 self
10657 }
10658 #[doc = "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."]
10659 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
10660 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
10661 self
10662 }
10663 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
10664 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
10665 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
10666 self
10667 }
10668 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
10669 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
10670 self.if_modified_since = Some(if_modified_since.into());
10671 self
10672 }
10673 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
10674 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
10675 self.if_unmodified_since = Some(if_unmodified_since.into());
10676 self
10677 }
10678 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
10679 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
10680 self.if_match = Some(if_match.into());
10681 self
10682 }
10683 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
10684 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
10685 self.if_none_match = Some(if_none_match.into());
10686 self
10687 }
10688 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
10689 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
10690 self.x_ms_if_tags = Some(x_ms_if_tags.into());
10691 self
10692 }
10693 #[doc = "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."]
10694 pub fn x_ms_blob_sequence_number(mut self, x_ms_blob_sequence_number: i64) -> Self {
10695 self.x_ms_blob_sequence_number = Some(x_ms_blob_sequence_number);
10696 self
10697 }
10698 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
10699 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
10700 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
10701 self
10702 }
10703 #[doc = "Optional. Used to set blob tags in various blob operations."]
10704 pub fn x_ms_tags(mut self, x_ms_tags: impl Into<String>) -> Self {
10705 self.x_ms_tags = Some(x_ms_tags.into());
10706 self
10707 }
10708 #[doc = "Specifies the date time when the blobs immutability policy is set to expire."]
10709 pub fn x_ms_immutability_policy_until_date(
10710 mut self,
10711 x_ms_immutability_policy_until_date: impl Into<::time::OffsetDateTime>,
10712 ) -> Self {
10713 self.x_ms_immutability_policy_until_date = Some(x_ms_immutability_policy_until_date.into());
10714 self
10715 }
10716 #[doc = "Specifies the immutability policy mode to set on the blob."]
10717 pub fn x_ms_immutability_policy_mode(mut self, x_ms_immutability_policy_mode: impl Into<String>) -> Self {
10718 self.x_ms_immutability_policy_mode = Some(x_ms_immutability_policy_mode.into());
10719 self
10720 }
10721 #[doc = "Specified if a legal hold should be set on the blob."]
10722 pub fn x_ms_legal_hold(mut self, x_ms_legal_hold: bool) -> Self {
10723 self.x_ms_legal_hold = Some(x_ms_legal_hold);
10724 self
10725 }
10726 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
10727 #[doc = ""]
10728 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
10729 #[doc = "However, this function can provide more flexibility when required."]
10730 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
10731 Box::pin({
10732 let this = self.clone();
10733 async move {
10734 let url = this.url()?;
10735 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
10736 let bearer_token = this.client.bearer_token().await?;
10737 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
10738 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
10739 req.insert_header("x-ms-blob-type", &this.x_ms_blob_type);
10740 if let Some(timeout) = &this.timeout {
10741 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
10742 }
10743 req.insert_header("content-length", this.content_length.to_string());
10744 if let Some(x_ms_access_tier) = &this.x_ms_access_tier {
10745 req.insert_header("x-ms-access-tier", x_ms_access_tier);
10746 }
10747 if let Some(x_ms_blob_content_type) = &this.x_ms_blob_content_type {
10748 req.insert_header("x-ms-blob-content-type", x_ms_blob_content_type);
10749 }
10750 if let Some(x_ms_blob_content_encoding) = &this.x_ms_blob_content_encoding {
10751 req.insert_header("x-ms-blob-content-encoding", x_ms_blob_content_encoding);
10752 }
10753 if let Some(x_ms_blob_content_language) = &this.x_ms_blob_content_language {
10754 req.insert_header("x-ms-blob-content-language", x_ms_blob_content_language);
10755 }
10756 if let Some(x_ms_blob_content_md5) = &this.x_ms_blob_content_md5 {
10757 req.insert_header("x-ms-blob-content-md5", x_ms_blob_content_md5);
10758 }
10759 if let Some(x_ms_blob_cache_control) = &this.x_ms_blob_cache_control {
10760 req.insert_header("x-ms-blob-cache-control", x_ms_blob_cache_control);
10761 }
10762 if let Some(x_ms_meta) = &this.x_ms_meta {
10763 req.insert_header("x-ms-meta", x_ms_meta);
10764 }
10765 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
10766 req.insert_header("x-ms-lease-id", x_ms_lease_id);
10767 }
10768 if let Some(x_ms_blob_content_disposition) = &this.x_ms_blob_content_disposition {
10769 req.insert_header("x-ms-blob-content-disposition", x_ms_blob_content_disposition);
10770 }
10771 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
10772 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
10773 }
10774 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
10775 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
10776 }
10777 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
10778 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
10779 }
10780 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
10781 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
10782 }
10783 if let Some(if_modified_since) = &this.if_modified_since {
10784 req.insert_header("if-modified-since", if_modified_since.to_string());
10785 }
10786 if let Some(if_unmodified_since) = &this.if_unmodified_since {
10787 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
10788 }
10789 if let Some(if_match) = &this.if_match {
10790 req.insert_header("if-match", if_match);
10791 }
10792 if let Some(if_none_match) = &this.if_none_match {
10793 req.insert_header("if-none-match", if_none_match);
10794 }
10795 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
10796 req.insert_header("x-ms-if-tags", x_ms_if_tags);
10797 }
10798 req.insert_header("x-ms-blob-content-length", this.x_ms_blob_content_length.to_string());
10799 if let Some(x_ms_blob_sequence_number) = &this.x_ms_blob_sequence_number {
10800 req.insert_header("x-ms-blob-sequence-number", x_ms_blob_sequence_number.to_string());
10801 }
10802 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
10803 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
10804 }
10805 if let Some(x_ms_tags) = &this.x_ms_tags {
10806 req.insert_header("x-ms-tags", x_ms_tags);
10807 }
10808 if let Some(x_ms_immutability_policy_until_date) = &this.x_ms_immutability_policy_until_date {
10809 req.insert_header(
10810 "x-ms-immutability-policy-until-date",
10811 x_ms_immutability_policy_until_date.to_string(),
10812 );
10813 }
10814 if let Some(x_ms_immutability_policy_mode) = &this.x_ms_immutability_policy_mode {
10815 req.insert_header("x-ms-immutability-policy-mode", x_ms_immutability_policy_mode);
10816 }
10817 if let Some(x_ms_legal_hold) = &this.x_ms_legal_hold {
10818 req.insert_header("x-ms-legal-hold", x_ms_legal_hold.to_string());
10819 }
10820 let req_body = azure_core::EMPTY_BODY;
10821 req.set_body(req_body);
10822 Ok(Response(this.client.send(&mut req).await?))
10823 }
10824 })
10825 }
10826 fn url(&self) -> azure_core::Result<azure_core::Url> {
10827 let mut url = self.client.endpoint().clone();
10828 url.set_path(&format!("/{}/{}?PageBlob", &self.container_name, &self.blob));
10829 Ok(url)
10830 }
10831 }
10832 }
10833 pub mod upload_pages {
10834 use super::models;
10835 #[cfg(not(target_arch = "wasm32"))]
10836 use futures::future::BoxFuture;
10837 #[cfg(target_arch = "wasm32")]
10838 use futures::future::LocalBoxFuture as BoxFuture;
10839 #[derive(Debug)]
10840 pub struct Response(azure_core::Response);
10841 impl Response {
10842 pub fn into_raw_response(self) -> azure_core::Response {
10843 self.0
10844 }
10845 pub fn as_raw_response(&self) -> &azure_core::Response {
10846 &self.0
10847 }
10848 pub fn headers(&self) -> Headers {
10849 Headers(self.0.headers())
10850 }
10851 }
10852 impl From<Response> for azure_core::Response {
10853 fn from(rsp: Response) -> Self {
10854 rsp.into_raw_response()
10855 }
10856 }
10857 impl AsRef<azure_core::Response> for Response {
10858 fn as_ref(&self) -> &azure_core::Response {
10859 self.as_raw_response()
10860 }
10861 }
10862 pub struct Headers<'a>(&'a azure_core::headers::Headers);
10863 impl<'a> Headers<'a> {
10864 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
10865 pub fn e_tag(&self) -> azure_core::Result<&str> {
10866 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
10867 }
10868 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
10869 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
10870 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
10871 }
10872 #[doc = "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."]
10873 pub fn content_md5(&self) -> azure_core::Result<&str> {
10874 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
10875 }
10876 #[doc = "This header is returned so that the client can check for message content integrity. The value of this header is computed by the Blob service; it is not necessarily the same value specified in the request headers."]
10877 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
10878 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
10879 }
10880 #[doc = "The current sequence number for the page blob."]
10881 pub fn x_ms_blob_sequence_number(&self) -> azure_core::Result<i64> {
10882 self.0
10883 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sequence-number"))
10884 }
10885 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
10886 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
10887 self.0
10888 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
10889 }
10890 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
10891 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
10892 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
10893 }
10894 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
10895 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
10896 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
10897 }
10898 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
10899 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
10900 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
10901 }
10902 #[doc = "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."]
10903 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
10904 self.0
10905 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
10906 }
10907 #[doc = "The SHA-256 hash of the encryption key used to encrypt the pages. This header is only returned when the pages were encrypted with a customer-provided key."]
10908 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
10909 self.0
10910 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
10911 }
10912 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
10913 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
10914 self.0
10915 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
10916 }
10917 }
10918 #[derive(Clone)]
10919 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
10920 #[doc = r""]
10921 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
10922 #[doc = r" parameters can be chained."]
10923 #[doc = r""]
10924 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
10925 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
10926 #[doc = r" executes the request and returns a `Result` with the parsed"]
10927 #[doc = r" response."]
10928 #[doc = r""]
10929 #[doc = r" In order to execute the request without polling the service"]
10930 #[doc = r" until the operation completes, use `.send().await` instead."]
10931 #[doc = r""]
10932 #[doc = r" If you need lower-level access to the raw response details"]
10933 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
10934 #[doc = r" can finalize the request using the"]
10935 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
10936 #[doc = r" that resolves to a lower-level [`Response`] value."]
10937 pub struct RequestBuilder {
10938 pub(crate) client: super::super::Client,
10939 pub(crate) container_name: String,
10940 pub(crate) blob: String,
10941 pub(crate) x_ms_page_write: String,
10942 pub(crate) body: serde_json::Value,
10943 pub(crate) content_length: i64,
10944 pub(crate) content_md5: Option<String>,
10945 pub(crate) x_ms_content_crc64: Option<String>,
10946 pub(crate) timeout: Option<i64>,
10947 pub(crate) x_ms_range: Option<String>,
10948 pub(crate) x_ms_lease_id: Option<String>,
10949 pub(crate) x_ms_encryption_key: Option<String>,
10950 pub(crate) x_ms_encryption_key_sha256: Option<String>,
10951 pub(crate) x_ms_encryption_algorithm: Option<String>,
10952 pub(crate) x_ms_encryption_scope: Option<String>,
10953 pub(crate) x_ms_if_sequence_number_le: Option<i64>,
10954 pub(crate) x_ms_if_sequence_number_lt: Option<i64>,
10955 pub(crate) x_ms_if_sequence_number_eq: Option<i64>,
10956 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
10957 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
10958 pub(crate) if_match: Option<String>,
10959 pub(crate) if_none_match: Option<String>,
10960 pub(crate) x_ms_if_tags: Option<String>,
10961 pub(crate) x_ms_client_request_id: Option<String>,
10962 }
10963 impl RequestBuilder {
10964 #[doc = "Specify the transactional md5 for the body, to be validated by the service."]
10965 pub fn content_md5(mut self, content_md5: impl Into<String>) -> Self {
10966 self.content_md5 = Some(content_md5.into());
10967 self
10968 }
10969 #[doc = "Specify the transactional crc64 for the body, to be validated by the service."]
10970 pub fn x_ms_content_crc64(mut self, x_ms_content_crc64: impl Into<String>) -> Self {
10971 self.x_ms_content_crc64 = Some(x_ms_content_crc64.into());
10972 self
10973 }
10974 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
10975 pub fn timeout(mut self, timeout: i64) -> Self {
10976 self.timeout = Some(timeout);
10977 self
10978 }
10979 #[doc = "Return only the bytes of the blob in the specified range."]
10980 pub fn x_ms_range(mut self, x_ms_range: impl Into<String>) -> Self {
10981 self.x_ms_range = Some(x_ms_range.into());
10982 self
10983 }
10984 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
10985 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
10986 self.x_ms_lease_id = Some(x_ms_lease_id.into());
10987 self
10988 }
10989 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
10990 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
10991 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
10992 self
10993 }
10994 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
10995 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
10996 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
10997 self
10998 }
10999 #[doc = "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."]
11000 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
11001 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
11002 self
11003 }
11004 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
11005 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
11006 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
11007 self
11008 }
11009 #[doc = "Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified."]
11010 pub fn x_ms_if_sequence_number_le(mut self, x_ms_if_sequence_number_le: i64) -> Self {
11011 self.x_ms_if_sequence_number_le = Some(x_ms_if_sequence_number_le);
11012 self
11013 }
11014 #[doc = "Specify this header value to operate only on a blob if it has a sequence number less than the specified."]
11015 pub fn x_ms_if_sequence_number_lt(mut self, x_ms_if_sequence_number_lt: i64) -> Self {
11016 self.x_ms_if_sequence_number_lt = Some(x_ms_if_sequence_number_lt);
11017 self
11018 }
11019 #[doc = "Specify this header value to operate only on a blob if it has the specified sequence number."]
11020 pub fn x_ms_if_sequence_number_eq(mut self, x_ms_if_sequence_number_eq: i64) -> Self {
11021 self.x_ms_if_sequence_number_eq = Some(x_ms_if_sequence_number_eq);
11022 self
11023 }
11024 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
11025 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
11026 self.if_modified_since = Some(if_modified_since.into());
11027 self
11028 }
11029 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
11030 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
11031 self.if_unmodified_since = Some(if_unmodified_since.into());
11032 self
11033 }
11034 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
11035 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
11036 self.if_match = Some(if_match.into());
11037 self
11038 }
11039 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
11040 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
11041 self.if_none_match = Some(if_none_match.into());
11042 self
11043 }
11044 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
11045 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
11046 self.x_ms_if_tags = Some(x_ms_if_tags.into());
11047 self
11048 }
11049 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
11050 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
11051 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
11052 self
11053 }
11054 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11055 #[doc = ""]
11056 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11057 #[doc = "However, this function can provide more flexibility when required."]
11058 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11059 Box::pin({
11060 let this = self.clone();
11061 async move {
11062 let url = this.url()?;
11063 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
11064 let bearer_token = this.client.bearer_token().await?;
11065 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
11066 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
11067 req.insert_header("x-ms-page-write", &this.x_ms_page_write);
11068 req.insert_header("content-type", "application/octet-stream");
11069 let req_body = azure_core::to_json(&this.body)?;
11070 req.insert_header("content-length", this.content_length.to_string());
11071 if let Some(content_md5) = &this.content_md5 {
11072 req.insert_header("content-md5", content_md5);
11073 }
11074 if let Some(x_ms_content_crc64) = &this.x_ms_content_crc64 {
11075 req.insert_header("x-ms-content-crc64", x_ms_content_crc64);
11076 }
11077 if let Some(timeout) = &this.timeout {
11078 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
11079 }
11080 if let Some(x_ms_range) = &this.x_ms_range {
11081 req.insert_header("x-ms-range", x_ms_range);
11082 }
11083 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
11084 req.insert_header("x-ms-lease-id", x_ms_lease_id);
11085 }
11086 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
11087 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
11088 }
11089 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
11090 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
11091 }
11092 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
11093 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
11094 }
11095 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
11096 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
11097 }
11098 if let Some(x_ms_if_sequence_number_le) = &this.x_ms_if_sequence_number_le {
11099 req.insert_header("x-ms-if-sequence-number-le", x_ms_if_sequence_number_le.to_string());
11100 }
11101 if let Some(x_ms_if_sequence_number_lt) = &this.x_ms_if_sequence_number_lt {
11102 req.insert_header("x-ms-if-sequence-number-lt", x_ms_if_sequence_number_lt.to_string());
11103 }
11104 if let Some(x_ms_if_sequence_number_eq) = &this.x_ms_if_sequence_number_eq {
11105 req.insert_header("x-ms-if-sequence-number-eq", x_ms_if_sequence_number_eq.to_string());
11106 }
11107 if let Some(if_modified_since) = &this.if_modified_since {
11108 req.insert_header("if-modified-since", if_modified_since.to_string());
11109 }
11110 if let Some(if_unmodified_since) = &this.if_unmodified_since {
11111 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
11112 }
11113 if let Some(if_match) = &this.if_match {
11114 req.insert_header("if-match", if_match);
11115 }
11116 if let Some(if_none_match) = &this.if_none_match {
11117 req.insert_header("if-none-match", if_none_match);
11118 }
11119 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
11120 req.insert_header("x-ms-if-tags", x_ms_if_tags);
11121 }
11122 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
11123 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
11124 }
11125 req.set_body(req_body);
11126 Ok(Response(this.client.send(&mut req).await?))
11127 }
11128 })
11129 }
11130 fn url(&self) -> azure_core::Result<azure_core::Url> {
11131 let mut url = self.client.endpoint().clone();
11132 url.set_path(&format!("/{}/{}?comp=page&update", &self.container_name, &self.blob));
11133 Ok(url)
11134 }
11135 }
11136 }
11137 pub mod clear_pages {
11138 use super::models;
11139 #[cfg(not(target_arch = "wasm32"))]
11140 use futures::future::BoxFuture;
11141 #[cfg(target_arch = "wasm32")]
11142 use futures::future::LocalBoxFuture as BoxFuture;
11143 #[derive(Debug)]
11144 pub struct Response(azure_core::Response);
11145 impl Response {
11146 pub fn into_raw_response(self) -> azure_core::Response {
11147 self.0
11148 }
11149 pub fn as_raw_response(&self) -> &azure_core::Response {
11150 &self.0
11151 }
11152 pub fn headers(&self) -> Headers {
11153 Headers(self.0.headers())
11154 }
11155 }
11156 impl From<Response> for azure_core::Response {
11157 fn from(rsp: Response) -> Self {
11158 rsp.into_raw_response()
11159 }
11160 }
11161 impl AsRef<azure_core::Response> for Response {
11162 fn as_ref(&self) -> &azure_core::Response {
11163 self.as_raw_response()
11164 }
11165 }
11166 pub struct Headers<'a>(&'a azure_core::headers::Headers);
11167 impl<'a> Headers<'a> {
11168 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
11169 pub fn e_tag(&self) -> azure_core::Result<&str> {
11170 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
11171 }
11172 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
11173 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
11174 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
11175 }
11176 #[doc = "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."]
11177 pub fn content_md5(&self) -> azure_core::Result<&str> {
11178 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
11179 }
11180 #[doc = "This header is returned so that the client can check for message content integrity. The value of this header is computed by the Blob service; it is not necessarily the same value specified in the request headers."]
11181 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
11182 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
11183 }
11184 #[doc = "The current sequence number for the page blob."]
11185 pub fn x_ms_blob_sequence_number(&self) -> azure_core::Result<i64> {
11186 self.0
11187 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sequence-number"))
11188 }
11189 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
11190 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
11191 self.0
11192 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
11193 }
11194 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
11195 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
11196 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
11197 }
11198 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
11199 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
11200 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
11201 }
11202 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
11203 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
11204 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
11205 }
11206 }
11207 #[derive(Clone)]
11208 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
11209 #[doc = r""]
11210 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
11211 #[doc = r" parameters can be chained."]
11212 #[doc = r""]
11213 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
11214 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
11215 #[doc = r" executes the request and returns a `Result` with the parsed"]
11216 #[doc = r" response."]
11217 #[doc = r""]
11218 #[doc = r" In order to execute the request without polling the service"]
11219 #[doc = r" until the operation completes, use `.send().await` instead."]
11220 #[doc = r""]
11221 #[doc = r" If you need lower-level access to the raw response details"]
11222 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11223 #[doc = r" can finalize the request using the"]
11224 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11225 #[doc = r" that resolves to a lower-level [`Response`] value."]
11226 pub struct RequestBuilder {
11227 pub(crate) client: super::super::Client,
11228 pub(crate) container_name: String,
11229 pub(crate) blob: String,
11230 pub(crate) x_ms_page_write: String,
11231 pub(crate) content_length: i64,
11232 pub(crate) timeout: Option<i64>,
11233 pub(crate) x_ms_range: Option<String>,
11234 pub(crate) x_ms_lease_id: Option<String>,
11235 pub(crate) x_ms_encryption_key: Option<String>,
11236 pub(crate) x_ms_encryption_key_sha256: Option<String>,
11237 pub(crate) x_ms_encryption_algorithm: Option<String>,
11238 pub(crate) x_ms_encryption_scope: Option<String>,
11239 pub(crate) x_ms_if_sequence_number_le: Option<i64>,
11240 pub(crate) x_ms_if_sequence_number_lt: Option<i64>,
11241 pub(crate) x_ms_if_sequence_number_eq: Option<i64>,
11242 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
11243 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
11244 pub(crate) if_match: Option<String>,
11245 pub(crate) if_none_match: Option<String>,
11246 pub(crate) x_ms_if_tags: Option<String>,
11247 pub(crate) x_ms_client_request_id: Option<String>,
11248 }
11249 impl RequestBuilder {
11250 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
11251 pub fn timeout(mut self, timeout: i64) -> Self {
11252 self.timeout = Some(timeout);
11253 self
11254 }
11255 #[doc = "Return only the bytes of the blob in the specified range."]
11256 pub fn x_ms_range(mut self, x_ms_range: impl Into<String>) -> Self {
11257 self.x_ms_range = Some(x_ms_range.into());
11258 self
11259 }
11260 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
11261 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
11262 self.x_ms_lease_id = Some(x_ms_lease_id.into());
11263 self
11264 }
11265 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
11266 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
11267 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
11268 self
11269 }
11270 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
11271 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
11272 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
11273 self
11274 }
11275 #[doc = "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."]
11276 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
11277 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
11278 self
11279 }
11280 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
11281 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
11282 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
11283 self
11284 }
11285 #[doc = "Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified."]
11286 pub fn x_ms_if_sequence_number_le(mut self, x_ms_if_sequence_number_le: i64) -> Self {
11287 self.x_ms_if_sequence_number_le = Some(x_ms_if_sequence_number_le);
11288 self
11289 }
11290 #[doc = "Specify this header value to operate only on a blob if it has a sequence number less than the specified."]
11291 pub fn x_ms_if_sequence_number_lt(mut self, x_ms_if_sequence_number_lt: i64) -> Self {
11292 self.x_ms_if_sequence_number_lt = Some(x_ms_if_sequence_number_lt);
11293 self
11294 }
11295 #[doc = "Specify this header value to operate only on a blob if it has the specified sequence number."]
11296 pub fn x_ms_if_sequence_number_eq(mut self, x_ms_if_sequence_number_eq: i64) -> Self {
11297 self.x_ms_if_sequence_number_eq = Some(x_ms_if_sequence_number_eq);
11298 self
11299 }
11300 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
11301 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
11302 self.if_modified_since = Some(if_modified_since.into());
11303 self
11304 }
11305 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
11306 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
11307 self.if_unmodified_since = Some(if_unmodified_since.into());
11308 self
11309 }
11310 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
11311 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
11312 self.if_match = Some(if_match.into());
11313 self
11314 }
11315 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
11316 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
11317 self.if_none_match = Some(if_none_match.into());
11318 self
11319 }
11320 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
11321 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
11322 self.x_ms_if_tags = Some(x_ms_if_tags.into());
11323 self
11324 }
11325 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
11326 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
11327 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
11328 self
11329 }
11330 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11331 #[doc = ""]
11332 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11333 #[doc = "However, this function can provide more flexibility when required."]
11334 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11335 Box::pin({
11336 let this = self.clone();
11337 async move {
11338 let url = this.url()?;
11339 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
11340 let bearer_token = this.client.bearer_token().await?;
11341 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
11342 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
11343 req.insert_header("x-ms-page-write", &this.x_ms_page_write);
11344 req.insert_header("content-length", this.content_length.to_string());
11345 if let Some(timeout) = &this.timeout {
11346 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
11347 }
11348 if let Some(x_ms_range) = &this.x_ms_range {
11349 req.insert_header("x-ms-range", x_ms_range);
11350 }
11351 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
11352 req.insert_header("x-ms-lease-id", x_ms_lease_id);
11353 }
11354 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
11355 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
11356 }
11357 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
11358 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
11359 }
11360 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
11361 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
11362 }
11363 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
11364 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
11365 }
11366 if let Some(x_ms_if_sequence_number_le) = &this.x_ms_if_sequence_number_le {
11367 req.insert_header("x-ms-if-sequence-number-le", x_ms_if_sequence_number_le.to_string());
11368 }
11369 if let Some(x_ms_if_sequence_number_lt) = &this.x_ms_if_sequence_number_lt {
11370 req.insert_header("x-ms-if-sequence-number-lt", x_ms_if_sequence_number_lt.to_string());
11371 }
11372 if let Some(x_ms_if_sequence_number_eq) = &this.x_ms_if_sequence_number_eq {
11373 req.insert_header("x-ms-if-sequence-number-eq", x_ms_if_sequence_number_eq.to_string());
11374 }
11375 if let Some(if_modified_since) = &this.if_modified_since {
11376 req.insert_header("if-modified-since", if_modified_since.to_string());
11377 }
11378 if let Some(if_unmodified_since) = &this.if_unmodified_since {
11379 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
11380 }
11381 if let Some(if_match) = &this.if_match {
11382 req.insert_header("if-match", if_match);
11383 }
11384 if let Some(if_none_match) = &this.if_none_match {
11385 req.insert_header("if-none-match", if_none_match);
11386 }
11387 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
11388 req.insert_header("x-ms-if-tags", x_ms_if_tags);
11389 }
11390 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
11391 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
11392 }
11393 let req_body = azure_core::EMPTY_BODY;
11394 req.set_body(req_body);
11395 Ok(Response(this.client.send(&mut req).await?))
11396 }
11397 })
11398 }
11399 fn url(&self) -> azure_core::Result<azure_core::Url> {
11400 let mut url = self.client.endpoint().clone();
11401 url.set_path(&format!("/{}/{}?comp=page&clear", &self.container_name, &self.blob));
11402 Ok(url)
11403 }
11404 }
11405 }
11406 pub mod upload_pages_from_url {
11407 use super::models;
11408 #[cfg(not(target_arch = "wasm32"))]
11409 use futures::future::BoxFuture;
11410 #[cfg(target_arch = "wasm32")]
11411 use futures::future::LocalBoxFuture as BoxFuture;
11412 #[derive(Debug)]
11413 pub struct Response(azure_core::Response);
11414 impl Response {
11415 pub fn into_raw_response(self) -> azure_core::Response {
11416 self.0
11417 }
11418 pub fn as_raw_response(&self) -> &azure_core::Response {
11419 &self.0
11420 }
11421 pub fn headers(&self) -> Headers {
11422 Headers(self.0.headers())
11423 }
11424 }
11425 impl From<Response> for azure_core::Response {
11426 fn from(rsp: Response) -> Self {
11427 rsp.into_raw_response()
11428 }
11429 }
11430 impl AsRef<azure_core::Response> for Response {
11431 fn as_ref(&self) -> &azure_core::Response {
11432 self.as_raw_response()
11433 }
11434 }
11435 pub struct Headers<'a>(&'a azure_core::headers::Headers);
11436 impl<'a> Headers<'a> {
11437 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
11438 pub fn e_tag(&self) -> azure_core::Result<&str> {
11439 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
11440 }
11441 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
11442 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
11443 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
11444 }
11445 #[doc = "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."]
11446 pub fn content_md5(&self) -> azure_core::Result<&str> {
11447 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
11448 }
11449 #[doc = "This header is returned so that the client can check for message content integrity. The value of this header is computed by the Blob service; it is not necessarily the same value specified in the request headers."]
11450 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
11451 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
11452 }
11453 #[doc = "The current sequence number for the page blob."]
11454 pub fn x_ms_blob_sequence_number(&self) -> azure_core::Result<i64> {
11455 self.0
11456 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sequence-number"))
11457 }
11458 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
11459 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
11460 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
11461 }
11462 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
11463 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
11464 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
11465 }
11466 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
11467 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
11468 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
11469 }
11470 #[doc = "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."]
11471 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
11472 self.0
11473 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
11474 }
11475 #[doc = "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."]
11476 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
11477 self.0
11478 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
11479 }
11480 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
11481 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
11482 self.0
11483 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
11484 }
11485 }
11486 #[derive(Clone)]
11487 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
11488 #[doc = r""]
11489 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
11490 #[doc = r" parameters can be chained."]
11491 #[doc = r""]
11492 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
11493 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
11494 #[doc = r" executes the request and returns a `Result` with the parsed"]
11495 #[doc = r" response."]
11496 #[doc = r""]
11497 #[doc = r" In order to execute the request without polling the service"]
11498 #[doc = r" until the operation completes, use `.send().await` instead."]
11499 #[doc = r""]
11500 #[doc = r" If you need lower-level access to the raw response details"]
11501 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11502 #[doc = r" can finalize the request using the"]
11503 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11504 #[doc = r" that resolves to a lower-level [`Response`] value."]
11505 pub struct RequestBuilder {
11506 pub(crate) client: super::super::Client,
11507 pub(crate) container_name: String,
11508 pub(crate) blob: String,
11509 pub(crate) x_ms_page_write: String,
11510 pub(crate) x_ms_copy_source: String,
11511 pub(crate) x_ms_source_range: String,
11512 pub(crate) content_length: i64,
11513 pub(crate) x_ms_range: String,
11514 pub(crate) x_ms_source_content_md5: Option<String>,
11515 pub(crate) x_ms_source_content_crc64: Option<String>,
11516 pub(crate) timeout: Option<i64>,
11517 pub(crate) x_ms_encryption_key: Option<String>,
11518 pub(crate) x_ms_encryption_key_sha256: Option<String>,
11519 pub(crate) x_ms_encryption_algorithm: Option<String>,
11520 pub(crate) x_ms_encryption_scope: Option<String>,
11521 pub(crate) x_ms_lease_id: Option<String>,
11522 pub(crate) x_ms_if_sequence_number_le: Option<i64>,
11523 pub(crate) x_ms_if_sequence_number_lt: Option<i64>,
11524 pub(crate) x_ms_if_sequence_number_eq: Option<i64>,
11525 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
11526 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
11527 pub(crate) if_match: Option<String>,
11528 pub(crate) if_none_match: Option<String>,
11529 pub(crate) x_ms_if_tags: Option<String>,
11530 pub(crate) x_ms_source_if_modified_since: Option<::time::OffsetDateTime>,
11531 pub(crate) x_ms_source_if_unmodified_since: Option<::time::OffsetDateTime>,
11532 pub(crate) x_ms_source_if_match: Option<String>,
11533 pub(crate) x_ms_source_if_none_match: Option<String>,
11534 pub(crate) x_ms_client_request_id: Option<String>,
11535 pub(crate) x_ms_copy_source_authorization: Option<String>,
11536 }
11537 impl RequestBuilder {
11538 #[doc = "Specify the md5 calculated for the range of bytes that must be read from the copy source."]
11539 pub fn x_ms_source_content_md5(mut self, x_ms_source_content_md5: impl Into<String>) -> Self {
11540 self.x_ms_source_content_md5 = Some(x_ms_source_content_md5.into());
11541 self
11542 }
11543 #[doc = "Specify the crc64 calculated for the range of bytes that must be read from the copy source."]
11544 pub fn x_ms_source_content_crc64(mut self, x_ms_source_content_crc64: impl Into<String>) -> Self {
11545 self.x_ms_source_content_crc64 = Some(x_ms_source_content_crc64.into());
11546 self
11547 }
11548 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
11549 pub fn timeout(mut self, timeout: i64) -> Self {
11550 self.timeout = Some(timeout);
11551 self
11552 }
11553 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
11554 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
11555 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
11556 self
11557 }
11558 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
11559 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
11560 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
11561 self
11562 }
11563 #[doc = "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."]
11564 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
11565 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
11566 self
11567 }
11568 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
11569 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
11570 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
11571 self
11572 }
11573 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
11574 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
11575 self.x_ms_lease_id = Some(x_ms_lease_id.into());
11576 self
11577 }
11578 #[doc = "Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified."]
11579 pub fn x_ms_if_sequence_number_le(mut self, x_ms_if_sequence_number_le: i64) -> Self {
11580 self.x_ms_if_sequence_number_le = Some(x_ms_if_sequence_number_le);
11581 self
11582 }
11583 #[doc = "Specify this header value to operate only on a blob if it has a sequence number less than the specified."]
11584 pub fn x_ms_if_sequence_number_lt(mut self, x_ms_if_sequence_number_lt: i64) -> Self {
11585 self.x_ms_if_sequence_number_lt = Some(x_ms_if_sequence_number_lt);
11586 self
11587 }
11588 #[doc = "Specify this header value to operate only on a blob if it has the specified sequence number."]
11589 pub fn x_ms_if_sequence_number_eq(mut self, x_ms_if_sequence_number_eq: i64) -> Self {
11590 self.x_ms_if_sequence_number_eq = Some(x_ms_if_sequence_number_eq);
11591 self
11592 }
11593 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
11594 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
11595 self.if_modified_since = Some(if_modified_since.into());
11596 self
11597 }
11598 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
11599 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
11600 self.if_unmodified_since = Some(if_unmodified_since.into());
11601 self
11602 }
11603 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
11604 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
11605 self.if_match = Some(if_match.into());
11606 self
11607 }
11608 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
11609 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
11610 self.if_none_match = Some(if_none_match.into());
11611 self
11612 }
11613 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
11614 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
11615 self.x_ms_if_tags = Some(x_ms_if_tags.into());
11616 self
11617 }
11618 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
11619 pub fn x_ms_source_if_modified_since(mut self, x_ms_source_if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
11620 self.x_ms_source_if_modified_since = Some(x_ms_source_if_modified_since.into());
11621 self
11622 }
11623 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
11624 pub fn x_ms_source_if_unmodified_since(mut self, x_ms_source_if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
11625 self.x_ms_source_if_unmodified_since = Some(x_ms_source_if_unmodified_since.into());
11626 self
11627 }
11628 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
11629 pub fn x_ms_source_if_match(mut self, x_ms_source_if_match: impl Into<String>) -> Self {
11630 self.x_ms_source_if_match = Some(x_ms_source_if_match.into());
11631 self
11632 }
11633 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
11634 pub fn x_ms_source_if_none_match(mut self, x_ms_source_if_none_match: impl Into<String>) -> Self {
11635 self.x_ms_source_if_none_match = Some(x_ms_source_if_none_match.into());
11636 self
11637 }
11638 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
11639 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
11640 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
11641 self
11642 }
11643 #[doc = "Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source."]
11644 pub fn x_ms_copy_source_authorization(mut self, x_ms_copy_source_authorization: impl Into<String>) -> Self {
11645 self.x_ms_copy_source_authorization = Some(x_ms_copy_source_authorization.into());
11646 self
11647 }
11648 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11649 #[doc = ""]
11650 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11651 #[doc = "However, this function can provide more flexibility when required."]
11652 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11653 Box::pin({
11654 let this = self.clone();
11655 async move {
11656 let url = this.url()?;
11657 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
11658 let bearer_token = this.client.bearer_token().await?;
11659 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
11660 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
11661 req.insert_header("x-ms-page-write", &this.x_ms_page_write);
11662 req.insert_header("x-ms-copy-source", &this.x_ms_copy_source);
11663 req.insert_header("x-ms-source-range", &this.x_ms_source_range);
11664 if let Some(x_ms_source_content_md5) = &this.x_ms_source_content_md5 {
11665 req.insert_header("x-ms-source-content-md5", x_ms_source_content_md5);
11666 }
11667 if let Some(x_ms_source_content_crc64) = &this.x_ms_source_content_crc64 {
11668 req.insert_header("x-ms-source-content-crc64", x_ms_source_content_crc64);
11669 }
11670 req.insert_header("content-length", this.content_length.to_string());
11671 if let Some(timeout) = &this.timeout {
11672 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
11673 }
11674 req.insert_header("x-ms-range", &this.x_ms_range);
11675 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
11676 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
11677 }
11678 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
11679 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
11680 }
11681 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
11682 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
11683 }
11684 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
11685 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
11686 }
11687 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
11688 req.insert_header("x-ms-lease-id", x_ms_lease_id);
11689 }
11690 if let Some(x_ms_if_sequence_number_le) = &this.x_ms_if_sequence_number_le {
11691 req.insert_header("x-ms-if-sequence-number-le", x_ms_if_sequence_number_le.to_string());
11692 }
11693 if let Some(x_ms_if_sequence_number_lt) = &this.x_ms_if_sequence_number_lt {
11694 req.insert_header("x-ms-if-sequence-number-lt", x_ms_if_sequence_number_lt.to_string());
11695 }
11696 if let Some(x_ms_if_sequence_number_eq) = &this.x_ms_if_sequence_number_eq {
11697 req.insert_header("x-ms-if-sequence-number-eq", x_ms_if_sequence_number_eq.to_string());
11698 }
11699 if let Some(if_modified_since) = &this.if_modified_since {
11700 req.insert_header("if-modified-since", if_modified_since.to_string());
11701 }
11702 if let Some(if_unmodified_since) = &this.if_unmodified_since {
11703 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
11704 }
11705 if let Some(if_match) = &this.if_match {
11706 req.insert_header("if-match", if_match);
11707 }
11708 if let Some(if_none_match) = &this.if_none_match {
11709 req.insert_header("if-none-match", if_none_match);
11710 }
11711 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
11712 req.insert_header("x-ms-if-tags", x_ms_if_tags);
11713 }
11714 if let Some(x_ms_source_if_modified_since) = &this.x_ms_source_if_modified_since {
11715 req.insert_header("x-ms-source-if-modified-since", x_ms_source_if_modified_since.to_string());
11716 }
11717 if let Some(x_ms_source_if_unmodified_since) = &this.x_ms_source_if_unmodified_since {
11718 req.insert_header("x-ms-source-if-unmodified-since", x_ms_source_if_unmodified_since.to_string());
11719 }
11720 if let Some(x_ms_source_if_match) = &this.x_ms_source_if_match {
11721 req.insert_header("x-ms-source-if-match", x_ms_source_if_match);
11722 }
11723 if let Some(x_ms_source_if_none_match) = &this.x_ms_source_if_none_match {
11724 req.insert_header("x-ms-source-if-none-match", x_ms_source_if_none_match);
11725 }
11726 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
11727 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
11728 }
11729 if let Some(x_ms_copy_source_authorization) = &this.x_ms_copy_source_authorization {
11730 req.insert_header("x-ms-copy-source-authorization", x_ms_copy_source_authorization);
11731 }
11732 let req_body = azure_core::EMPTY_BODY;
11733 req.set_body(req_body);
11734 Ok(Response(this.client.send(&mut req).await?))
11735 }
11736 })
11737 }
11738 fn url(&self) -> azure_core::Result<azure_core::Url> {
11739 let mut url = self.client.endpoint().clone();
11740 url.set_path(&format!("/{}/{}?comp=page&update&fromUrl", &self.container_name, &self.blob));
11741 Ok(url)
11742 }
11743 }
11744 }
11745 pub mod get_page_ranges {
11746 use super::models;
11747 #[cfg(not(target_arch = "wasm32"))]
11748 use futures::future::BoxFuture;
11749 #[cfg(target_arch = "wasm32")]
11750 use futures::future::LocalBoxFuture as BoxFuture;
11751 #[derive(Debug)]
11752 pub struct Response(azure_core::Response);
11753 impl Response {
11754 pub async fn into_body(self) -> azure_core::Result<models::PageList> {
11755 let bytes = self.0.into_body().collect().await?;
11756 let body: models::PageList = azure_core::xml::read_xml(&bytes)?;
11757 Ok(body)
11758 }
11759 pub fn into_raw_response(self) -> azure_core::Response {
11760 self.0
11761 }
11762 pub fn as_raw_response(&self) -> &azure_core::Response {
11763 &self.0
11764 }
11765 pub fn headers(&self) -> Headers {
11766 Headers(self.0.headers())
11767 }
11768 }
11769 impl From<Response> for azure_core::Response {
11770 fn from(rsp: Response) -> Self {
11771 rsp.into_raw_response()
11772 }
11773 }
11774 impl AsRef<azure_core::Response> for Response {
11775 fn as_ref(&self) -> &azure_core::Response {
11776 self.as_raw_response()
11777 }
11778 }
11779 pub struct Headers<'a>(&'a azure_core::headers::Headers);
11780 impl<'a> Headers<'a> {
11781 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
11782 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
11783 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
11784 }
11785 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
11786 pub fn e_tag(&self) -> azure_core::Result<&str> {
11787 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
11788 }
11789 #[doc = "The size of the blob in bytes."]
11790 pub fn x_ms_blob_content_length(&self) -> azure_core::Result<i64> {
11791 self.0
11792 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-content-length"))
11793 }
11794 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
11795 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
11796 self.0
11797 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
11798 }
11799 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
11800 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
11801 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
11802 }
11803 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
11804 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
11805 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
11806 }
11807 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
11808 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
11809 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
11810 }
11811 }
11812 #[derive(Clone)]
11813 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
11814 #[doc = r""]
11815 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
11816 #[doc = r" parameters can be chained."]
11817 #[doc = r""]
11818 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
11819 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
11820 #[doc = r" executes the request and returns a `Result` with the parsed"]
11821 #[doc = r" response."]
11822 #[doc = r""]
11823 #[doc = r" In order to execute the request without polling the service"]
11824 #[doc = r" until the operation completes, use `.send().await` instead."]
11825 #[doc = r""]
11826 #[doc = r" If you need lower-level access to the raw response details"]
11827 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11828 #[doc = r" can finalize the request using the"]
11829 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11830 #[doc = r" that resolves to a lower-level [`Response`] value."]
11831 pub struct RequestBuilder {
11832 pub(crate) client: super::super::Client,
11833 pub(crate) container_name: String,
11834 pub(crate) blob: String,
11835 pub(crate) snapshot: Option<String>,
11836 pub(crate) timeout: Option<i64>,
11837 pub(crate) x_ms_range: Option<String>,
11838 pub(crate) x_ms_lease_id: Option<String>,
11839 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
11840 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
11841 pub(crate) if_match: Option<String>,
11842 pub(crate) if_none_match: Option<String>,
11843 pub(crate) x_ms_if_tags: Option<String>,
11844 pub(crate) x_ms_client_request_id: Option<String>,
11845 pub(crate) marker: Option<String>,
11846 pub(crate) maxresults: Option<i64>,
11847 }
11848 impl RequestBuilder {
11849 #[doc = "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 <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob\">Creating a Snapshot of a Blob.</a>"]
11850 pub fn snapshot(mut self, snapshot: impl Into<String>) -> Self {
11851 self.snapshot = Some(snapshot.into());
11852 self
11853 }
11854 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
11855 pub fn timeout(mut self, timeout: i64) -> Self {
11856 self.timeout = Some(timeout);
11857 self
11858 }
11859 #[doc = "Return only the bytes of the blob in the specified range."]
11860 pub fn x_ms_range(mut self, x_ms_range: impl Into<String>) -> Self {
11861 self.x_ms_range = Some(x_ms_range.into());
11862 self
11863 }
11864 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
11865 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
11866 self.x_ms_lease_id = Some(x_ms_lease_id.into());
11867 self
11868 }
11869 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
11870 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
11871 self.if_modified_since = Some(if_modified_since.into());
11872 self
11873 }
11874 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
11875 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
11876 self.if_unmodified_since = Some(if_unmodified_since.into());
11877 self
11878 }
11879 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
11880 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
11881 self.if_match = Some(if_match.into());
11882 self
11883 }
11884 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
11885 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
11886 self.if_none_match = Some(if_none_match.into());
11887 self
11888 }
11889 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
11890 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
11891 self.x_ms_if_tags = Some(x_ms_if_tags.into());
11892 self
11893 }
11894 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
11895 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
11896 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
11897 self
11898 }
11899 #[doc = "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."]
11900 pub fn marker(mut self, marker: impl Into<String>) -> Self {
11901 self.marker = Some(marker.into());
11902 self
11903 }
11904 #[doc = "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. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000."]
11905 pub fn maxresults(mut self, maxresults: i64) -> Self {
11906 self.maxresults = Some(maxresults);
11907 self
11908 }
11909 pub fn into_stream(self) -> azure_core::Pageable<models::PageList, azure_core::error::Error> {
11910 let make_request = move |continuation: Option<String>| {
11911 let this = self.clone();
11912 async move {
11913 let mut url = this.url()?;
11914 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
11915 let bearer_token = this.client.bearer_token().await?;
11916 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
11917 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
11918 if let Some(snapshot) = &this.snapshot {
11919 req.url_mut().query_pairs_mut().append_pair("snapshot", snapshot);
11920 }
11921 if let Some(timeout) = &this.timeout {
11922 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
11923 }
11924 if let Some(x_ms_range) = &this.x_ms_range {
11925 req.insert_header("x-ms-range", x_ms_range);
11926 }
11927 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
11928 req.insert_header("x-ms-lease-id", x_ms_lease_id);
11929 }
11930 if let Some(if_modified_since) = &this.if_modified_since {
11931 req.insert_header("if-modified-since", if_modified_since.to_string());
11932 }
11933 if let Some(if_unmodified_since) = &this.if_unmodified_since {
11934 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
11935 }
11936 if let Some(if_match) = &this.if_match {
11937 req.insert_header("if-match", if_match);
11938 }
11939 if let Some(if_none_match) = &this.if_none_match {
11940 req.insert_header("if-none-match", if_none_match);
11941 }
11942 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
11943 req.insert_header("x-ms-if-tags", x_ms_if_tags);
11944 }
11945 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
11946 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
11947 }
11948 if let Some(marker) = &this.marker {
11949 req.url_mut().query_pairs_mut().append_pair("marker", marker);
11950 }
11951 if let Some(maxresults) = &this.maxresults {
11952 req.url_mut().query_pairs_mut().append_pair("maxresults", &maxresults.to_string());
11953 }
11954 let req_body = azure_core::EMPTY_BODY;
11955 if let Some(value) = continuation.as_ref() {
11956 req.url_mut().query_pairs_mut().append_pair("marker", value);
11957 }
11958 req.set_body(req_body);
11959 let rsp = this.client.send(&mut req).await?;
11960 let rsp = match rsp.status() {
11961 azure_core::StatusCode::Ok => Ok(Response(rsp)),
11962 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
11963 status: status_code,
11964 error_code: None,
11965 })),
11966 };
11967 rsp?.into_body().await
11968 }
11969 };
11970 azure_core::Pageable::new(make_request)
11971 }
11972 fn url(&self) -> azure_core::Result<azure_core::Url> {
11973 let mut url = self.client.endpoint().clone();
11974 url.set_path(&format!("/{}/{}?comp=pagelist", &self.container_name, &self.blob));
11975 Ok(url)
11976 }
11977 }
11978 }
11979 pub mod get_page_ranges_diff {
11980 use super::models;
11981 #[cfg(not(target_arch = "wasm32"))]
11982 use futures::future::BoxFuture;
11983 #[cfg(target_arch = "wasm32")]
11984 use futures::future::LocalBoxFuture as BoxFuture;
11985 #[derive(Debug)]
11986 pub struct Response(azure_core::Response);
11987 impl Response {
11988 pub async fn into_body(self) -> azure_core::Result<models::PageList> {
11989 let bytes = self.0.into_body().collect().await?;
11990 let body: models::PageList = azure_core::xml::read_xml(&bytes)?;
11991 Ok(body)
11992 }
11993 pub fn into_raw_response(self) -> azure_core::Response {
11994 self.0
11995 }
11996 pub fn as_raw_response(&self) -> &azure_core::Response {
11997 &self.0
11998 }
11999 pub fn headers(&self) -> Headers {
12000 Headers(self.0.headers())
12001 }
12002 }
12003 impl From<Response> for azure_core::Response {
12004 fn from(rsp: Response) -> Self {
12005 rsp.into_raw_response()
12006 }
12007 }
12008 impl AsRef<azure_core::Response> for Response {
12009 fn as_ref(&self) -> &azure_core::Response {
12010 self.as_raw_response()
12011 }
12012 }
12013 pub struct Headers<'a>(&'a azure_core::headers::Headers);
12014 impl<'a> Headers<'a> {
12015 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
12016 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
12017 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
12018 }
12019 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
12020 pub fn e_tag(&self) -> azure_core::Result<&str> {
12021 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
12022 }
12023 #[doc = "The size of the blob in bytes."]
12024 pub fn x_ms_blob_content_length(&self) -> azure_core::Result<i64> {
12025 self.0
12026 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-content-length"))
12027 }
12028 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
12029 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
12030 self.0
12031 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
12032 }
12033 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
12034 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
12035 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
12036 }
12037 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
12038 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
12039 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
12040 }
12041 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
12042 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
12043 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
12044 }
12045 }
12046 #[derive(Clone)]
12047 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12048 #[doc = r""]
12049 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12050 #[doc = r" parameters can be chained."]
12051 #[doc = r""]
12052 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12053 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
12054 #[doc = r" executes the request and returns a `Result` with the parsed"]
12055 #[doc = r" response."]
12056 #[doc = r""]
12057 #[doc = r" In order to execute the request without polling the service"]
12058 #[doc = r" until the operation completes, use `.send().await` instead."]
12059 #[doc = r""]
12060 #[doc = r" If you need lower-level access to the raw response details"]
12061 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12062 #[doc = r" can finalize the request using the"]
12063 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12064 #[doc = r" that resolves to a lower-level [`Response`] value."]
12065 pub struct RequestBuilder {
12066 pub(crate) client: super::super::Client,
12067 pub(crate) container_name: String,
12068 pub(crate) blob: String,
12069 pub(crate) snapshot: Option<String>,
12070 pub(crate) timeout: Option<i64>,
12071 pub(crate) prevsnapshot: Option<String>,
12072 pub(crate) x_ms_previous_snapshot_url: Option<String>,
12073 pub(crate) x_ms_range: Option<String>,
12074 pub(crate) x_ms_lease_id: Option<String>,
12075 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
12076 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
12077 pub(crate) if_match: Option<String>,
12078 pub(crate) if_none_match: Option<String>,
12079 pub(crate) x_ms_if_tags: Option<String>,
12080 pub(crate) x_ms_client_request_id: Option<String>,
12081 pub(crate) marker: Option<String>,
12082 pub(crate) maxresults: Option<i64>,
12083 }
12084 impl RequestBuilder {
12085 #[doc = "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 <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob\">Creating a Snapshot of a Blob.</a>"]
12086 pub fn snapshot(mut self, snapshot: impl Into<String>) -> Self {
12087 self.snapshot = Some(snapshot.into());
12088 self
12089 }
12090 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
12091 pub fn timeout(mut self, timeout: i64) -> Self {
12092 self.timeout = Some(timeout);
12093 self
12094 }
12095 #[doc = "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."]
12096 pub fn prevsnapshot(mut self, prevsnapshot: impl Into<String>) -> Self {
12097 self.prevsnapshot = Some(prevsnapshot.into());
12098 self
12099 }
12100 #[doc = "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."]
12101 pub fn x_ms_previous_snapshot_url(mut self, x_ms_previous_snapshot_url: impl Into<String>) -> Self {
12102 self.x_ms_previous_snapshot_url = Some(x_ms_previous_snapshot_url.into());
12103 self
12104 }
12105 #[doc = "Return only the bytes of the blob in the specified range."]
12106 pub fn x_ms_range(mut self, x_ms_range: impl Into<String>) -> Self {
12107 self.x_ms_range = Some(x_ms_range.into());
12108 self
12109 }
12110 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
12111 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
12112 self.x_ms_lease_id = Some(x_ms_lease_id.into());
12113 self
12114 }
12115 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
12116 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
12117 self.if_modified_since = Some(if_modified_since.into());
12118 self
12119 }
12120 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
12121 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
12122 self.if_unmodified_since = Some(if_unmodified_since.into());
12123 self
12124 }
12125 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
12126 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
12127 self.if_match = Some(if_match.into());
12128 self
12129 }
12130 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
12131 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
12132 self.if_none_match = Some(if_none_match.into());
12133 self
12134 }
12135 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
12136 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
12137 self.x_ms_if_tags = Some(x_ms_if_tags.into());
12138 self
12139 }
12140 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
12141 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
12142 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
12143 self
12144 }
12145 #[doc = "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."]
12146 pub fn marker(mut self, marker: impl Into<String>) -> Self {
12147 self.marker = Some(marker.into());
12148 self
12149 }
12150 #[doc = "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. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000."]
12151 pub fn maxresults(mut self, maxresults: i64) -> Self {
12152 self.maxresults = Some(maxresults);
12153 self
12154 }
12155 pub fn into_stream(self) -> azure_core::Pageable<models::PageList, azure_core::error::Error> {
12156 let make_request = move |continuation: Option<String>| {
12157 let this = self.clone();
12158 async move {
12159 let mut url = this.url()?;
12160 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
12161 let bearer_token = this.client.bearer_token().await?;
12162 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
12163 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
12164 if let Some(snapshot) = &this.snapshot {
12165 req.url_mut().query_pairs_mut().append_pair("snapshot", snapshot);
12166 }
12167 if let Some(timeout) = &this.timeout {
12168 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
12169 }
12170 if let Some(prevsnapshot) = &this.prevsnapshot {
12171 req.url_mut().query_pairs_mut().append_pair("prevsnapshot", prevsnapshot);
12172 }
12173 if let Some(x_ms_previous_snapshot_url) = &this.x_ms_previous_snapshot_url {
12174 req.insert_header("x-ms-previous-snapshot-url", x_ms_previous_snapshot_url);
12175 }
12176 if let Some(x_ms_range) = &this.x_ms_range {
12177 req.insert_header("x-ms-range", x_ms_range);
12178 }
12179 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
12180 req.insert_header("x-ms-lease-id", x_ms_lease_id);
12181 }
12182 if let Some(if_modified_since) = &this.if_modified_since {
12183 req.insert_header("if-modified-since", if_modified_since.to_string());
12184 }
12185 if let Some(if_unmodified_since) = &this.if_unmodified_since {
12186 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
12187 }
12188 if let Some(if_match) = &this.if_match {
12189 req.insert_header("if-match", if_match);
12190 }
12191 if let Some(if_none_match) = &this.if_none_match {
12192 req.insert_header("if-none-match", if_none_match);
12193 }
12194 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
12195 req.insert_header("x-ms-if-tags", x_ms_if_tags);
12196 }
12197 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
12198 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
12199 }
12200 if let Some(marker) = &this.marker {
12201 req.url_mut().query_pairs_mut().append_pair("marker", marker);
12202 }
12203 if let Some(maxresults) = &this.maxresults {
12204 req.url_mut().query_pairs_mut().append_pair("maxresults", &maxresults.to_string());
12205 }
12206 let req_body = azure_core::EMPTY_BODY;
12207 if let Some(value) = continuation.as_ref() {
12208 req.url_mut().query_pairs_mut().append_pair("marker", value);
12209 }
12210 req.set_body(req_body);
12211 let rsp = this.client.send(&mut req).await?;
12212 let rsp = match rsp.status() {
12213 azure_core::StatusCode::Ok => Ok(Response(rsp)),
12214 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
12215 status: status_code,
12216 error_code: None,
12217 })),
12218 };
12219 rsp?.into_body().await
12220 }
12221 };
12222 azure_core::Pageable::new(make_request)
12223 }
12224 fn url(&self) -> azure_core::Result<azure_core::Url> {
12225 let mut url = self.client.endpoint().clone();
12226 url.set_path(&format!("/{}/{}?comp=pagelist&diff", &self.container_name, &self.blob));
12227 Ok(url)
12228 }
12229 }
12230 }
12231 pub mod resize {
12232 use super::models;
12233 #[cfg(not(target_arch = "wasm32"))]
12234 use futures::future::BoxFuture;
12235 #[cfg(target_arch = "wasm32")]
12236 use futures::future::LocalBoxFuture as BoxFuture;
12237 #[derive(Debug)]
12238 pub struct Response(azure_core::Response);
12239 impl Response {
12240 pub fn into_raw_response(self) -> azure_core::Response {
12241 self.0
12242 }
12243 pub fn as_raw_response(&self) -> &azure_core::Response {
12244 &self.0
12245 }
12246 pub fn headers(&self) -> Headers {
12247 Headers(self.0.headers())
12248 }
12249 }
12250 impl From<Response> for azure_core::Response {
12251 fn from(rsp: Response) -> Self {
12252 rsp.into_raw_response()
12253 }
12254 }
12255 impl AsRef<azure_core::Response> for Response {
12256 fn as_ref(&self) -> &azure_core::Response {
12257 self.as_raw_response()
12258 }
12259 }
12260 pub struct Headers<'a>(&'a azure_core::headers::Headers);
12261 impl<'a> Headers<'a> {
12262 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
12263 pub fn e_tag(&self) -> azure_core::Result<&str> {
12264 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
12265 }
12266 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
12267 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
12268 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
12269 }
12270 #[doc = "The current sequence number for a page blob. This header is not returned for block blobs or append blobs"]
12271 pub fn x_ms_blob_sequence_number(&self) -> azure_core::Result<i64> {
12272 self.0
12273 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sequence-number"))
12274 }
12275 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
12276 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
12277 self.0
12278 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
12279 }
12280 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
12281 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
12282 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
12283 }
12284 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
12285 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
12286 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
12287 }
12288 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
12289 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
12290 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
12291 }
12292 }
12293 #[derive(Clone)]
12294 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12295 #[doc = r""]
12296 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12297 #[doc = r" parameters can be chained."]
12298 #[doc = r""]
12299 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12300 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
12301 #[doc = r" executes the request and returns a `Result` with the parsed"]
12302 #[doc = r" response."]
12303 #[doc = r""]
12304 #[doc = r" In order to execute the request without polling the service"]
12305 #[doc = r" until the operation completes, use `.send().await` instead."]
12306 #[doc = r""]
12307 #[doc = r" If you need lower-level access to the raw response details"]
12308 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12309 #[doc = r" can finalize the request using the"]
12310 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12311 #[doc = r" that resolves to a lower-level [`Response`] value."]
12312 pub struct RequestBuilder {
12313 pub(crate) client: super::super::Client,
12314 pub(crate) container_name: String,
12315 pub(crate) blob: String,
12316 pub(crate) x_ms_blob_content_length: i64,
12317 pub(crate) timeout: Option<i64>,
12318 pub(crate) x_ms_lease_id: Option<String>,
12319 pub(crate) x_ms_encryption_key: Option<String>,
12320 pub(crate) x_ms_encryption_key_sha256: Option<String>,
12321 pub(crate) x_ms_encryption_algorithm: Option<String>,
12322 pub(crate) x_ms_encryption_scope: Option<String>,
12323 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
12324 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
12325 pub(crate) if_match: Option<String>,
12326 pub(crate) if_none_match: Option<String>,
12327 pub(crate) x_ms_if_tags: Option<String>,
12328 pub(crate) x_ms_client_request_id: Option<String>,
12329 }
12330 impl RequestBuilder {
12331 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
12332 pub fn timeout(mut self, timeout: i64) -> Self {
12333 self.timeout = Some(timeout);
12334 self
12335 }
12336 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
12337 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
12338 self.x_ms_lease_id = Some(x_ms_lease_id.into());
12339 self
12340 }
12341 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
12342 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
12343 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
12344 self
12345 }
12346 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
12347 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
12348 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
12349 self
12350 }
12351 #[doc = "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."]
12352 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
12353 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
12354 self
12355 }
12356 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
12357 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
12358 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
12359 self
12360 }
12361 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
12362 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
12363 self.if_modified_since = Some(if_modified_since.into());
12364 self
12365 }
12366 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
12367 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
12368 self.if_unmodified_since = Some(if_unmodified_since.into());
12369 self
12370 }
12371 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
12372 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
12373 self.if_match = Some(if_match.into());
12374 self
12375 }
12376 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
12377 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
12378 self.if_none_match = Some(if_none_match.into());
12379 self
12380 }
12381 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
12382 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
12383 self.x_ms_if_tags = Some(x_ms_if_tags.into());
12384 self
12385 }
12386 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
12387 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
12388 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
12389 self
12390 }
12391 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
12392 #[doc = ""]
12393 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
12394 #[doc = "However, this function can provide more flexibility when required."]
12395 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
12396 Box::pin({
12397 let this = self.clone();
12398 async move {
12399 let url = this.url()?;
12400 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
12401 let bearer_token = this.client.bearer_token().await?;
12402 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
12403 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
12404 if let Some(timeout) = &this.timeout {
12405 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
12406 }
12407 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
12408 req.insert_header("x-ms-lease-id", x_ms_lease_id);
12409 }
12410 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
12411 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
12412 }
12413 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
12414 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
12415 }
12416 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
12417 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
12418 }
12419 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
12420 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
12421 }
12422 if let Some(if_modified_since) = &this.if_modified_since {
12423 req.insert_header("if-modified-since", if_modified_since.to_string());
12424 }
12425 if let Some(if_unmodified_since) = &this.if_unmodified_since {
12426 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
12427 }
12428 if let Some(if_match) = &this.if_match {
12429 req.insert_header("if-match", if_match);
12430 }
12431 if let Some(if_none_match) = &this.if_none_match {
12432 req.insert_header("if-none-match", if_none_match);
12433 }
12434 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
12435 req.insert_header("x-ms-if-tags", x_ms_if_tags);
12436 }
12437 req.insert_header("x-ms-blob-content-length", this.x_ms_blob_content_length.to_string());
12438 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
12439 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
12440 }
12441 let req_body = azure_core::EMPTY_BODY;
12442 req.set_body(req_body);
12443 Ok(Response(this.client.send(&mut req).await?))
12444 }
12445 })
12446 }
12447 fn url(&self) -> azure_core::Result<azure_core::Url> {
12448 let mut url = self.client.endpoint().clone();
12449 url.set_path(&format!("/{}/{}?comp=properties&Resize", &self.container_name, &self.blob));
12450 Ok(url)
12451 }
12452 }
12453 }
12454 pub mod update_sequence_number {
12455 use super::models;
12456 #[cfg(not(target_arch = "wasm32"))]
12457 use futures::future::BoxFuture;
12458 #[cfg(target_arch = "wasm32")]
12459 use futures::future::LocalBoxFuture as BoxFuture;
12460 #[derive(Debug)]
12461 pub struct Response(azure_core::Response);
12462 impl Response {
12463 pub fn into_raw_response(self) -> azure_core::Response {
12464 self.0
12465 }
12466 pub fn as_raw_response(&self) -> &azure_core::Response {
12467 &self.0
12468 }
12469 pub fn headers(&self) -> Headers {
12470 Headers(self.0.headers())
12471 }
12472 }
12473 impl From<Response> for azure_core::Response {
12474 fn from(rsp: Response) -> Self {
12475 rsp.into_raw_response()
12476 }
12477 }
12478 impl AsRef<azure_core::Response> for Response {
12479 fn as_ref(&self) -> &azure_core::Response {
12480 self.as_raw_response()
12481 }
12482 }
12483 pub struct Headers<'a>(&'a azure_core::headers::Headers);
12484 impl<'a> Headers<'a> {
12485 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
12486 pub fn e_tag(&self) -> azure_core::Result<&str> {
12487 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
12488 }
12489 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
12490 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
12491 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
12492 }
12493 #[doc = "The current sequence number for a page blob. This header is not returned for block blobs or append blobs"]
12494 pub fn x_ms_blob_sequence_number(&self) -> azure_core::Result<i64> {
12495 self.0
12496 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sequence-number"))
12497 }
12498 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
12499 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
12500 self.0
12501 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
12502 }
12503 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
12504 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
12505 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
12506 }
12507 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
12508 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
12509 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
12510 }
12511 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
12512 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
12513 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
12514 }
12515 }
12516 #[derive(Clone)]
12517 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12518 #[doc = r""]
12519 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12520 #[doc = r" parameters can be chained."]
12521 #[doc = r""]
12522 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12523 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
12524 #[doc = r" executes the request and returns a `Result` with the parsed"]
12525 #[doc = r" response."]
12526 #[doc = r""]
12527 #[doc = r" In order to execute the request without polling the service"]
12528 #[doc = r" until the operation completes, use `.send().await` instead."]
12529 #[doc = r""]
12530 #[doc = r" If you need lower-level access to the raw response details"]
12531 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12532 #[doc = r" can finalize the request using the"]
12533 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12534 #[doc = r" that resolves to a lower-level [`Response`] value."]
12535 pub struct RequestBuilder {
12536 pub(crate) client: super::super::Client,
12537 pub(crate) container_name: String,
12538 pub(crate) blob: String,
12539 pub(crate) x_ms_sequence_number_action: String,
12540 pub(crate) timeout: Option<i64>,
12541 pub(crate) x_ms_lease_id: Option<String>,
12542 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
12543 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
12544 pub(crate) if_match: Option<String>,
12545 pub(crate) if_none_match: Option<String>,
12546 pub(crate) x_ms_if_tags: Option<String>,
12547 pub(crate) x_ms_blob_sequence_number: Option<i64>,
12548 pub(crate) x_ms_client_request_id: Option<String>,
12549 }
12550 impl RequestBuilder {
12551 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
12552 pub fn timeout(mut self, timeout: i64) -> Self {
12553 self.timeout = Some(timeout);
12554 self
12555 }
12556 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
12557 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
12558 self.x_ms_lease_id = Some(x_ms_lease_id.into());
12559 self
12560 }
12561 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
12562 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
12563 self.if_modified_since = Some(if_modified_since.into());
12564 self
12565 }
12566 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
12567 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
12568 self.if_unmodified_since = Some(if_unmodified_since.into());
12569 self
12570 }
12571 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
12572 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
12573 self.if_match = Some(if_match.into());
12574 self
12575 }
12576 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
12577 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
12578 self.if_none_match = Some(if_none_match.into());
12579 self
12580 }
12581 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
12582 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
12583 self.x_ms_if_tags = Some(x_ms_if_tags.into());
12584 self
12585 }
12586 #[doc = "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."]
12587 pub fn x_ms_blob_sequence_number(mut self, x_ms_blob_sequence_number: i64) -> Self {
12588 self.x_ms_blob_sequence_number = Some(x_ms_blob_sequence_number);
12589 self
12590 }
12591 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
12592 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
12593 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
12594 self
12595 }
12596 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
12597 #[doc = ""]
12598 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
12599 #[doc = "However, this function can provide more flexibility when required."]
12600 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
12601 Box::pin({
12602 let this = self.clone();
12603 async move {
12604 let url = this.url()?;
12605 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
12606 let bearer_token = this.client.bearer_token().await?;
12607 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
12608 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
12609 if let Some(timeout) = &this.timeout {
12610 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
12611 }
12612 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
12613 req.insert_header("x-ms-lease-id", x_ms_lease_id);
12614 }
12615 if let Some(if_modified_since) = &this.if_modified_since {
12616 req.insert_header("if-modified-since", if_modified_since.to_string());
12617 }
12618 if let Some(if_unmodified_since) = &this.if_unmodified_since {
12619 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
12620 }
12621 if let Some(if_match) = &this.if_match {
12622 req.insert_header("if-match", if_match);
12623 }
12624 if let Some(if_none_match) = &this.if_none_match {
12625 req.insert_header("if-none-match", if_none_match);
12626 }
12627 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
12628 req.insert_header("x-ms-if-tags", x_ms_if_tags);
12629 }
12630 req.insert_header("x-ms-sequence-number-action", &this.x_ms_sequence_number_action);
12631 if let Some(x_ms_blob_sequence_number) = &this.x_ms_blob_sequence_number {
12632 req.insert_header("x-ms-blob-sequence-number", x_ms_blob_sequence_number.to_string());
12633 }
12634 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
12635 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
12636 }
12637 let req_body = azure_core::EMPTY_BODY;
12638 req.set_body(req_body);
12639 Ok(Response(this.client.send(&mut req).await?))
12640 }
12641 })
12642 }
12643 fn url(&self) -> azure_core::Result<azure_core::Url> {
12644 let mut url = self.client.endpoint().clone();
12645 url.set_path(&format!(
12646 "/{}/{}?comp=properties&UpdateSequenceNumber",
12647 &self.container_name, &self.blob
12648 ));
12649 Ok(url)
12650 }
12651 }
12652 }
12653 pub mod copy_incremental {
12654 use super::models;
12655 #[cfg(not(target_arch = "wasm32"))]
12656 use futures::future::BoxFuture;
12657 #[cfg(target_arch = "wasm32")]
12658 use futures::future::LocalBoxFuture as BoxFuture;
12659 #[derive(Debug)]
12660 pub struct Response(azure_core::Response);
12661 impl Response {
12662 pub fn into_raw_response(self) -> azure_core::Response {
12663 self.0
12664 }
12665 pub fn as_raw_response(&self) -> &azure_core::Response {
12666 &self.0
12667 }
12668 pub fn headers(&self) -> Headers {
12669 Headers(self.0.headers())
12670 }
12671 }
12672 impl From<Response> for azure_core::Response {
12673 fn from(rsp: Response) -> Self {
12674 rsp.into_raw_response()
12675 }
12676 }
12677 impl AsRef<azure_core::Response> for Response {
12678 fn as_ref(&self) -> &azure_core::Response {
12679 self.as_raw_response()
12680 }
12681 }
12682 pub struct Headers<'a>(&'a azure_core::headers::Headers);
12683 impl<'a> Headers<'a> {
12684 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
12685 pub fn e_tag(&self) -> azure_core::Result<&str> {
12686 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
12687 }
12688 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
12689 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
12690 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
12691 }
12692 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
12693 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
12694 self.0
12695 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
12696 }
12697 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
12698 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
12699 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
12700 }
12701 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
12702 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
12703 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
12704 }
12705 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
12706 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
12707 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
12708 }
12709 #[doc = "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."]
12710 pub fn x_ms_copy_id(&self) -> azure_core::Result<&str> {
12711 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-id"))
12712 }
12713 #[doc = "State of the copy operation identified by x-ms-copy-id."]
12714 pub fn x_ms_copy_status(&self) -> azure_core::Result<&str> {
12715 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-copy-status"))
12716 }
12717 }
12718 #[derive(Clone)]
12719 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12720 #[doc = r""]
12721 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12722 #[doc = r" parameters can be chained."]
12723 #[doc = r""]
12724 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12725 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
12726 #[doc = r" executes the request and returns a `Result` with the parsed"]
12727 #[doc = r" response."]
12728 #[doc = r""]
12729 #[doc = r" In order to execute the request without polling the service"]
12730 #[doc = r" until the operation completes, use `.send().await` instead."]
12731 #[doc = r""]
12732 #[doc = r" If you need lower-level access to the raw response details"]
12733 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12734 #[doc = r" can finalize the request using the"]
12735 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12736 #[doc = r" that resolves to a lower-level [`Response`] value."]
12737 pub struct RequestBuilder {
12738 pub(crate) client: super::super::Client,
12739 pub(crate) container_name: String,
12740 pub(crate) blob: String,
12741 pub(crate) x_ms_copy_source: String,
12742 pub(crate) timeout: Option<i64>,
12743 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
12744 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
12745 pub(crate) if_match: Option<String>,
12746 pub(crate) if_none_match: Option<String>,
12747 pub(crate) x_ms_if_tags: Option<String>,
12748 pub(crate) x_ms_client_request_id: Option<String>,
12749 }
12750 impl RequestBuilder {
12751 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
12752 pub fn timeout(mut self, timeout: i64) -> Self {
12753 self.timeout = Some(timeout);
12754 self
12755 }
12756 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
12757 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
12758 self.if_modified_since = Some(if_modified_since.into());
12759 self
12760 }
12761 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
12762 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
12763 self.if_unmodified_since = Some(if_unmodified_since.into());
12764 self
12765 }
12766 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
12767 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
12768 self.if_match = Some(if_match.into());
12769 self
12770 }
12771 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
12772 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
12773 self.if_none_match = Some(if_none_match.into());
12774 self
12775 }
12776 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
12777 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
12778 self.x_ms_if_tags = Some(x_ms_if_tags.into());
12779 self
12780 }
12781 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
12782 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
12783 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
12784 self
12785 }
12786 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
12787 #[doc = ""]
12788 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
12789 #[doc = "However, this function can provide more flexibility when required."]
12790 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
12791 Box::pin({
12792 let this = self.clone();
12793 async move {
12794 let url = this.url()?;
12795 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
12796 let bearer_token = this.client.bearer_token().await?;
12797 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
12798 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
12799 if let Some(timeout) = &this.timeout {
12800 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
12801 }
12802 if let Some(if_modified_since) = &this.if_modified_since {
12803 req.insert_header("if-modified-since", if_modified_since.to_string());
12804 }
12805 if let Some(if_unmodified_since) = &this.if_unmodified_since {
12806 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
12807 }
12808 if let Some(if_match) = &this.if_match {
12809 req.insert_header("if-match", if_match);
12810 }
12811 if let Some(if_none_match) = &this.if_none_match {
12812 req.insert_header("if-none-match", if_none_match);
12813 }
12814 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
12815 req.insert_header("x-ms-if-tags", x_ms_if_tags);
12816 }
12817 req.insert_header("x-ms-copy-source", &this.x_ms_copy_source);
12818 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
12819 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
12820 }
12821 let req_body = azure_core::EMPTY_BODY;
12822 req.set_body(req_body);
12823 Ok(Response(this.client.send(&mut req).await?))
12824 }
12825 })
12826 }
12827 fn url(&self) -> azure_core::Result<azure_core::Url> {
12828 let mut url = self.client.endpoint().clone();
12829 url.set_path(&format!("/{}/{}?comp=incrementalcopy", &self.container_name, &self.blob));
12830 Ok(url)
12831 }
12832 }
12833 }
12834}
12835pub mod append_blob {
12836 use super::models;
12837 #[cfg(not(target_arch = "wasm32"))]
12838 use futures::future::BoxFuture;
12839 #[cfg(target_arch = "wasm32")]
12840 use futures::future::LocalBoxFuture as BoxFuture;
12841 pub struct Client(pub(crate) super::Client);
12842 impl Client {
12843 #[doc = "The Create Append Blob operation creates a new append blob."]
12844 #[doc = ""]
12845 #[doc = "Arguments:"]
12846 #[doc = "* `container_name`: The container name."]
12847 #[doc = "* `blob`: The blob name."]
12848 #[doc = "* `x_ms_blob_type`: Specifies the type of blob to create: block blob, page blob, or append blob."]
12849 #[doc = "* `content_length`: The length of the request."]
12850 pub fn create(
12851 &self,
12852 container_name: impl Into<String>,
12853 blob: impl Into<String>,
12854 x_ms_blob_type: impl Into<String>,
12855 content_length: i64,
12856 ) -> create::RequestBuilder {
12857 create::RequestBuilder {
12858 client: self.0.clone(),
12859 container_name: container_name.into(),
12860 blob: blob.into(),
12861 x_ms_blob_type: x_ms_blob_type.into(),
12862 content_length,
12863 timeout: None,
12864 x_ms_blob_content_type: None,
12865 x_ms_blob_content_encoding: None,
12866 x_ms_blob_content_language: None,
12867 x_ms_blob_content_md5: None,
12868 x_ms_blob_cache_control: None,
12869 x_ms_meta: None,
12870 x_ms_lease_id: None,
12871 x_ms_blob_content_disposition: None,
12872 x_ms_encryption_key: None,
12873 x_ms_encryption_key_sha256: None,
12874 x_ms_encryption_algorithm: None,
12875 x_ms_encryption_scope: None,
12876 if_modified_since: None,
12877 if_unmodified_since: None,
12878 if_match: None,
12879 if_none_match: None,
12880 x_ms_if_tags: None,
12881 x_ms_client_request_id: None,
12882 x_ms_tags: None,
12883 x_ms_immutability_policy_until_date: None,
12884 x_ms_immutability_policy_mode: None,
12885 x_ms_legal_hold: None,
12886 }
12887 }
12888 #[doc = "The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later."]
12889 #[doc = ""]
12890 #[doc = "Arguments:"]
12891 #[doc = "* `container_name`: The container name."]
12892 #[doc = "* `blob`: The blob name."]
12893 #[doc = "* `body`: Initial data"]
12894 #[doc = "* `content_length`: The length of the request."]
12895 pub fn append_block(
12896 &self,
12897 container_name: impl Into<String>,
12898 blob: impl Into<String>,
12899 body: impl Into<serde_json::Value>,
12900 content_length: i64,
12901 ) -> append_block::RequestBuilder {
12902 append_block::RequestBuilder {
12903 client: self.0.clone(),
12904 container_name: container_name.into(),
12905 blob: blob.into(),
12906 body: body.into(),
12907 content_length,
12908 timeout: None,
12909 content_md5: None,
12910 x_ms_content_crc64: None,
12911 x_ms_lease_id: None,
12912 x_ms_blob_condition_maxsize: None,
12913 x_ms_blob_condition_appendpos: None,
12914 x_ms_encryption_key: None,
12915 x_ms_encryption_key_sha256: None,
12916 x_ms_encryption_algorithm: None,
12917 x_ms_encryption_scope: None,
12918 if_modified_since: None,
12919 if_unmodified_since: None,
12920 if_match: None,
12921 if_none_match: None,
12922 x_ms_if_tags: None,
12923 x_ms_client_request_id: None,
12924 }
12925 }
12926 #[doc = "The Append Block operation commits a new block of data to the end of an existing append blob where the contents are read from a source url. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later."]
12927 #[doc = ""]
12928 #[doc = "Arguments:"]
12929 #[doc = "* `container_name`: The container name."]
12930 #[doc = "* `blob`: The blob name."]
12931 #[doc = "* `x_ms_copy_source`: Specify a URL to the copy source."]
12932 #[doc = "* `content_length`: The length of the request."]
12933 pub fn append_block_from_url(
12934 &self,
12935 container_name: impl Into<String>,
12936 blob: impl Into<String>,
12937 x_ms_copy_source: impl Into<String>,
12938 content_length: i64,
12939 ) -> append_block_from_url::RequestBuilder {
12940 append_block_from_url::RequestBuilder {
12941 client: self.0.clone(),
12942 container_name: container_name.into(),
12943 blob: blob.into(),
12944 x_ms_copy_source: x_ms_copy_source.into(),
12945 content_length,
12946 x_ms_source_range: None,
12947 x_ms_source_content_md5: None,
12948 x_ms_source_content_crc64: None,
12949 timeout: None,
12950 content_md5: None,
12951 x_ms_encryption_key: None,
12952 x_ms_encryption_key_sha256: None,
12953 x_ms_encryption_algorithm: None,
12954 x_ms_encryption_scope: None,
12955 x_ms_lease_id: None,
12956 x_ms_blob_condition_maxsize: None,
12957 x_ms_blob_condition_appendpos: None,
12958 if_modified_since: None,
12959 if_unmodified_since: None,
12960 if_match: None,
12961 if_none_match: None,
12962 x_ms_if_tags: None,
12963 x_ms_source_if_modified_since: None,
12964 x_ms_source_if_unmodified_since: None,
12965 x_ms_source_if_match: None,
12966 x_ms_source_if_none_match: None,
12967 x_ms_client_request_id: None,
12968 x_ms_copy_source_authorization: None,
12969 }
12970 }
12971 #[doc = "The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 version or later."]
12972 #[doc = ""]
12973 #[doc = "Arguments:"]
12974 #[doc = "* `container_name`: The container name."]
12975 #[doc = "* `blob`: The blob name."]
12976 pub fn seal(&self, container_name: impl Into<String>, blob: impl Into<String>) -> seal::RequestBuilder {
12977 seal::RequestBuilder {
12978 client: self.0.clone(),
12979 container_name: container_name.into(),
12980 blob: blob.into(),
12981 timeout: None,
12982 x_ms_client_request_id: None,
12983 x_ms_lease_id: None,
12984 if_modified_since: None,
12985 if_unmodified_since: None,
12986 if_match: None,
12987 if_none_match: None,
12988 x_ms_blob_condition_appendpos: None,
12989 }
12990 }
12991 }
12992 pub mod create {
12993 use super::models;
12994 #[cfg(not(target_arch = "wasm32"))]
12995 use futures::future::BoxFuture;
12996 #[cfg(target_arch = "wasm32")]
12997 use futures::future::LocalBoxFuture as BoxFuture;
12998 #[derive(Debug)]
12999 pub struct Response(azure_core::Response);
13000 impl Response {
13001 pub fn into_raw_response(self) -> azure_core::Response {
13002 self.0
13003 }
13004 pub fn as_raw_response(&self) -> &azure_core::Response {
13005 &self.0
13006 }
13007 pub fn headers(&self) -> Headers {
13008 Headers(self.0.headers())
13009 }
13010 }
13011 impl From<Response> for azure_core::Response {
13012 fn from(rsp: Response) -> Self {
13013 rsp.into_raw_response()
13014 }
13015 }
13016 impl AsRef<azure_core::Response> for Response {
13017 fn as_ref(&self) -> &azure_core::Response {
13018 self.as_raw_response()
13019 }
13020 }
13021 pub struct Headers<'a>(&'a azure_core::headers::Headers);
13022 impl<'a> Headers<'a> {
13023 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
13024 pub fn e_tag(&self) -> azure_core::Result<&str> {
13025 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
13026 }
13027 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
13028 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
13029 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
13030 }
13031 #[doc = "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."]
13032 pub fn content_md5(&self) -> azure_core::Result<&str> {
13033 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
13034 }
13035 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
13036 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
13037 self.0
13038 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
13039 }
13040 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
13041 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
13042 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
13043 }
13044 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
13045 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
13046 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
13047 }
13048 #[doc = "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."]
13049 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
13050 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
13051 }
13052 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
13053 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
13054 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
13055 }
13056 #[doc = "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."]
13057 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
13058 self.0
13059 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
13060 }
13061 #[doc = "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."]
13062 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
13063 self.0
13064 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
13065 }
13066 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
13067 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
13068 self.0
13069 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
13070 }
13071 }
13072 #[derive(Clone)]
13073 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13074 #[doc = r""]
13075 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13076 #[doc = r" parameters can be chained."]
13077 #[doc = r""]
13078 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13079 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
13080 #[doc = r" executes the request and returns a `Result` with the parsed"]
13081 #[doc = r" response."]
13082 #[doc = r""]
13083 #[doc = r" In order to execute the request without polling the service"]
13084 #[doc = r" until the operation completes, use `.send().await` instead."]
13085 #[doc = r""]
13086 #[doc = r" If you need lower-level access to the raw response details"]
13087 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13088 #[doc = r" can finalize the request using the"]
13089 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13090 #[doc = r" that resolves to a lower-level [`Response`] value."]
13091 pub struct RequestBuilder {
13092 pub(crate) client: super::super::Client,
13093 pub(crate) container_name: String,
13094 pub(crate) blob: String,
13095 pub(crate) x_ms_blob_type: String,
13096 pub(crate) content_length: i64,
13097 pub(crate) timeout: Option<i64>,
13098 pub(crate) x_ms_blob_content_type: Option<String>,
13099 pub(crate) x_ms_blob_content_encoding: Option<String>,
13100 pub(crate) x_ms_blob_content_language: Option<String>,
13101 pub(crate) x_ms_blob_content_md5: Option<String>,
13102 pub(crate) x_ms_blob_cache_control: Option<String>,
13103 pub(crate) x_ms_meta: Option<String>,
13104 pub(crate) x_ms_lease_id: Option<String>,
13105 pub(crate) x_ms_blob_content_disposition: Option<String>,
13106 pub(crate) x_ms_encryption_key: Option<String>,
13107 pub(crate) x_ms_encryption_key_sha256: Option<String>,
13108 pub(crate) x_ms_encryption_algorithm: Option<String>,
13109 pub(crate) x_ms_encryption_scope: Option<String>,
13110 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
13111 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
13112 pub(crate) if_match: Option<String>,
13113 pub(crate) if_none_match: Option<String>,
13114 pub(crate) x_ms_if_tags: Option<String>,
13115 pub(crate) x_ms_client_request_id: Option<String>,
13116 pub(crate) x_ms_tags: Option<String>,
13117 pub(crate) x_ms_immutability_policy_until_date: Option<::time::OffsetDateTime>,
13118 pub(crate) x_ms_immutability_policy_mode: Option<String>,
13119 pub(crate) x_ms_legal_hold: Option<bool>,
13120 }
13121 impl RequestBuilder {
13122 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
13123 pub fn timeout(mut self, timeout: i64) -> Self {
13124 self.timeout = Some(timeout);
13125 self
13126 }
13127 #[doc = "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request."]
13128 pub fn x_ms_blob_content_type(mut self, x_ms_blob_content_type: impl Into<String>) -> Self {
13129 self.x_ms_blob_content_type = Some(x_ms_blob_content_type.into());
13130 self
13131 }
13132 #[doc = "Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request."]
13133 pub fn x_ms_blob_content_encoding(mut self, x_ms_blob_content_encoding: impl Into<String>) -> Self {
13134 self.x_ms_blob_content_encoding = Some(x_ms_blob_content_encoding.into());
13135 self
13136 }
13137 #[doc = "Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request."]
13138 pub fn x_ms_blob_content_language(mut self, x_ms_blob_content_language: impl Into<String>) -> Self {
13139 self.x_ms_blob_content_language = Some(x_ms_blob_content_language.into());
13140 self
13141 }
13142 #[doc = "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."]
13143 pub fn x_ms_blob_content_md5(mut self, x_ms_blob_content_md5: impl Into<String>) -> Self {
13144 self.x_ms_blob_content_md5 = Some(x_ms_blob_content_md5.into());
13145 self
13146 }
13147 #[doc = "Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request."]
13148 pub fn x_ms_blob_cache_control(mut self, x_ms_blob_cache_control: impl Into<String>) -> Self {
13149 self.x_ms_blob_cache_control = Some(x_ms_blob_cache_control.into());
13150 self
13151 }
13152 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
13153 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
13154 self.x_ms_meta = Some(x_ms_meta.into());
13155 self
13156 }
13157 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
13158 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
13159 self.x_ms_lease_id = Some(x_ms_lease_id.into());
13160 self
13161 }
13162 #[doc = "Optional. Sets the blob's Content-Disposition header."]
13163 pub fn x_ms_blob_content_disposition(mut self, x_ms_blob_content_disposition: impl Into<String>) -> Self {
13164 self.x_ms_blob_content_disposition = Some(x_ms_blob_content_disposition.into());
13165 self
13166 }
13167 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
13168 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
13169 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
13170 self
13171 }
13172 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
13173 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
13174 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
13175 self
13176 }
13177 #[doc = "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."]
13178 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
13179 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
13180 self
13181 }
13182 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
13183 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
13184 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
13185 self
13186 }
13187 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
13188 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
13189 self.if_modified_since = Some(if_modified_since.into());
13190 self
13191 }
13192 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
13193 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
13194 self.if_unmodified_since = Some(if_unmodified_since.into());
13195 self
13196 }
13197 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
13198 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
13199 self.if_match = Some(if_match.into());
13200 self
13201 }
13202 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
13203 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
13204 self.if_none_match = Some(if_none_match.into());
13205 self
13206 }
13207 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
13208 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
13209 self.x_ms_if_tags = Some(x_ms_if_tags.into());
13210 self
13211 }
13212 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
13213 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
13214 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
13215 self
13216 }
13217 #[doc = "Optional. Used to set blob tags in various blob operations."]
13218 pub fn x_ms_tags(mut self, x_ms_tags: impl Into<String>) -> Self {
13219 self.x_ms_tags = Some(x_ms_tags.into());
13220 self
13221 }
13222 #[doc = "Specifies the date time when the blobs immutability policy is set to expire."]
13223 pub fn x_ms_immutability_policy_until_date(
13224 mut self,
13225 x_ms_immutability_policy_until_date: impl Into<::time::OffsetDateTime>,
13226 ) -> Self {
13227 self.x_ms_immutability_policy_until_date = Some(x_ms_immutability_policy_until_date.into());
13228 self
13229 }
13230 #[doc = "Specifies the immutability policy mode to set on the blob."]
13231 pub fn x_ms_immutability_policy_mode(mut self, x_ms_immutability_policy_mode: impl Into<String>) -> Self {
13232 self.x_ms_immutability_policy_mode = Some(x_ms_immutability_policy_mode.into());
13233 self
13234 }
13235 #[doc = "Specified if a legal hold should be set on the blob."]
13236 pub fn x_ms_legal_hold(mut self, x_ms_legal_hold: bool) -> Self {
13237 self.x_ms_legal_hold = Some(x_ms_legal_hold);
13238 self
13239 }
13240 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13241 #[doc = ""]
13242 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13243 #[doc = "However, this function can provide more flexibility when required."]
13244 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13245 Box::pin({
13246 let this = self.clone();
13247 async move {
13248 let url = this.url()?;
13249 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
13250 let bearer_token = this.client.bearer_token().await?;
13251 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
13252 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
13253 req.insert_header("x-ms-blob-type", &this.x_ms_blob_type);
13254 if let Some(timeout) = &this.timeout {
13255 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
13256 }
13257 req.insert_header("content-length", this.content_length.to_string());
13258 if let Some(x_ms_blob_content_type) = &this.x_ms_blob_content_type {
13259 req.insert_header("x-ms-blob-content-type", x_ms_blob_content_type);
13260 }
13261 if let Some(x_ms_blob_content_encoding) = &this.x_ms_blob_content_encoding {
13262 req.insert_header("x-ms-blob-content-encoding", x_ms_blob_content_encoding);
13263 }
13264 if let Some(x_ms_blob_content_language) = &this.x_ms_blob_content_language {
13265 req.insert_header("x-ms-blob-content-language", x_ms_blob_content_language);
13266 }
13267 if let Some(x_ms_blob_content_md5) = &this.x_ms_blob_content_md5 {
13268 req.insert_header("x-ms-blob-content-md5", x_ms_blob_content_md5);
13269 }
13270 if let Some(x_ms_blob_cache_control) = &this.x_ms_blob_cache_control {
13271 req.insert_header("x-ms-blob-cache-control", x_ms_blob_cache_control);
13272 }
13273 if let Some(x_ms_meta) = &this.x_ms_meta {
13274 req.insert_header("x-ms-meta", x_ms_meta);
13275 }
13276 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
13277 req.insert_header("x-ms-lease-id", x_ms_lease_id);
13278 }
13279 if let Some(x_ms_blob_content_disposition) = &this.x_ms_blob_content_disposition {
13280 req.insert_header("x-ms-blob-content-disposition", x_ms_blob_content_disposition);
13281 }
13282 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
13283 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
13284 }
13285 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
13286 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
13287 }
13288 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
13289 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
13290 }
13291 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
13292 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
13293 }
13294 if let Some(if_modified_since) = &this.if_modified_since {
13295 req.insert_header("if-modified-since", if_modified_since.to_string());
13296 }
13297 if let Some(if_unmodified_since) = &this.if_unmodified_since {
13298 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
13299 }
13300 if let Some(if_match) = &this.if_match {
13301 req.insert_header("if-match", if_match);
13302 }
13303 if let Some(if_none_match) = &this.if_none_match {
13304 req.insert_header("if-none-match", if_none_match);
13305 }
13306 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
13307 req.insert_header("x-ms-if-tags", x_ms_if_tags);
13308 }
13309 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
13310 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
13311 }
13312 if let Some(x_ms_tags) = &this.x_ms_tags {
13313 req.insert_header("x-ms-tags", x_ms_tags);
13314 }
13315 if let Some(x_ms_immutability_policy_until_date) = &this.x_ms_immutability_policy_until_date {
13316 req.insert_header(
13317 "x-ms-immutability-policy-until-date",
13318 x_ms_immutability_policy_until_date.to_string(),
13319 );
13320 }
13321 if let Some(x_ms_immutability_policy_mode) = &this.x_ms_immutability_policy_mode {
13322 req.insert_header("x-ms-immutability-policy-mode", x_ms_immutability_policy_mode);
13323 }
13324 if let Some(x_ms_legal_hold) = &this.x_ms_legal_hold {
13325 req.insert_header("x-ms-legal-hold", x_ms_legal_hold.to_string());
13326 }
13327 let req_body = azure_core::EMPTY_BODY;
13328 req.set_body(req_body);
13329 Ok(Response(this.client.send(&mut req).await?))
13330 }
13331 })
13332 }
13333 fn url(&self) -> azure_core::Result<azure_core::Url> {
13334 let mut url = self.client.endpoint().clone();
13335 url.set_path(&format!("/{}/{}?AppendBlob", &self.container_name, &self.blob));
13336 Ok(url)
13337 }
13338 }
13339 }
13340 pub mod append_block {
13341 use super::models;
13342 #[cfg(not(target_arch = "wasm32"))]
13343 use futures::future::BoxFuture;
13344 #[cfg(target_arch = "wasm32")]
13345 use futures::future::LocalBoxFuture as BoxFuture;
13346 #[derive(Debug)]
13347 pub struct Response(azure_core::Response);
13348 impl Response {
13349 pub fn into_raw_response(self) -> azure_core::Response {
13350 self.0
13351 }
13352 pub fn as_raw_response(&self) -> &azure_core::Response {
13353 &self.0
13354 }
13355 pub fn headers(&self) -> Headers {
13356 Headers(self.0.headers())
13357 }
13358 }
13359 impl From<Response> for azure_core::Response {
13360 fn from(rsp: Response) -> Self {
13361 rsp.into_raw_response()
13362 }
13363 }
13364 impl AsRef<azure_core::Response> for Response {
13365 fn as_ref(&self) -> &azure_core::Response {
13366 self.as_raw_response()
13367 }
13368 }
13369 pub struct Headers<'a>(&'a azure_core::headers::Headers);
13370 impl<'a> Headers<'a> {
13371 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
13372 pub fn e_tag(&self) -> azure_core::Result<&str> {
13373 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
13374 }
13375 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
13376 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
13377 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
13378 }
13379 #[doc = "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."]
13380 pub fn content_md5(&self) -> azure_core::Result<&str> {
13381 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
13382 }
13383 #[doc = "This header is returned so that the client can check for message content integrity. The value of this header is computed by the Blob service; it is not necessarily the same value specified in the request headers."]
13384 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
13385 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
13386 }
13387 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
13388 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
13389 self.0
13390 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
13391 }
13392 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
13393 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
13394 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
13395 }
13396 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
13397 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
13398 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
13399 }
13400 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
13401 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
13402 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
13403 }
13404 #[doc = "This response header is returned only for append operations. It returns the offset at which the block was committed, in bytes."]
13405 pub fn x_ms_blob_append_offset(&self) -> azure_core::Result<&str> {
13406 self.0
13407 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-blob-append-offset"))
13408 }
13409 #[doc = "The number of committed blocks present in the blob. This header is returned only for append blobs."]
13410 pub fn x_ms_blob_committed_block_count(&self) -> azure_core::Result<i32> {
13411 self.0
13412 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-committed-block-count"))
13413 }
13414 #[doc = "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."]
13415 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
13416 self.0
13417 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
13418 }
13419 #[doc = "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key."]
13420 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
13421 self.0
13422 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
13423 }
13424 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
13425 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
13426 self.0
13427 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
13428 }
13429 }
13430 #[derive(Clone)]
13431 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13432 #[doc = r""]
13433 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13434 #[doc = r" parameters can be chained."]
13435 #[doc = r""]
13436 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13437 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
13438 #[doc = r" executes the request and returns a `Result` with the parsed"]
13439 #[doc = r" response."]
13440 #[doc = r""]
13441 #[doc = r" In order to execute the request without polling the service"]
13442 #[doc = r" until the operation completes, use `.send().await` instead."]
13443 #[doc = r""]
13444 #[doc = r" If you need lower-level access to the raw response details"]
13445 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13446 #[doc = r" can finalize the request using the"]
13447 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13448 #[doc = r" that resolves to a lower-level [`Response`] value."]
13449 pub struct RequestBuilder {
13450 pub(crate) client: super::super::Client,
13451 pub(crate) container_name: String,
13452 pub(crate) blob: String,
13453 pub(crate) body: serde_json::Value,
13454 pub(crate) content_length: i64,
13455 pub(crate) timeout: Option<i64>,
13456 pub(crate) content_md5: Option<String>,
13457 pub(crate) x_ms_content_crc64: Option<String>,
13458 pub(crate) x_ms_lease_id: Option<String>,
13459 pub(crate) x_ms_blob_condition_maxsize: Option<i64>,
13460 pub(crate) x_ms_blob_condition_appendpos: Option<i64>,
13461 pub(crate) x_ms_encryption_key: Option<String>,
13462 pub(crate) x_ms_encryption_key_sha256: Option<String>,
13463 pub(crate) x_ms_encryption_algorithm: Option<String>,
13464 pub(crate) x_ms_encryption_scope: Option<String>,
13465 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
13466 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
13467 pub(crate) if_match: Option<String>,
13468 pub(crate) if_none_match: Option<String>,
13469 pub(crate) x_ms_if_tags: Option<String>,
13470 pub(crate) x_ms_client_request_id: Option<String>,
13471 }
13472 impl RequestBuilder {
13473 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
13474 pub fn timeout(mut self, timeout: i64) -> Self {
13475 self.timeout = Some(timeout);
13476 self
13477 }
13478 #[doc = "Specify the transactional md5 for the body, to be validated by the service."]
13479 pub fn content_md5(mut self, content_md5: impl Into<String>) -> Self {
13480 self.content_md5 = Some(content_md5.into());
13481 self
13482 }
13483 #[doc = "Specify the transactional crc64 for the body, to be validated by the service."]
13484 pub fn x_ms_content_crc64(mut self, x_ms_content_crc64: impl Into<String>) -> Self {
13485 self.x_ms_content_crc64 = Some(x_ms_content_crc64.into());
13486 self
13487 }
13488 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
13489 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
13490 self.x_ms_lease_id = Some(x_ms_lease_id.into());
13491 self
13492 }
13493 #[doc = "Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed)."]
13494 pub fn x_ms_blob_condition_maxsize(mut self, x_ms_blob_condition_maxsize: i64) -> Self {
13495 self.x_ms_blob_condition_maxsize = Some(x_ms_blob_condition_maxsize);
13496 self
13497 }
13498 #[doc = "Optional conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed)."]
13499 pub fn x_ms_blob_condition_appendpos(mut self, x_ms_blob_condition_appendpos: i64) -> Self {
13500 self.x_ms_blob_condition_appendpos = Some(x_ms_blob_condition_appendpos);
13501 self
13502 }
13503 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
13504 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
13505 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
13506 self
13507 }
13508 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
13509 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
13510 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
13511 self
13512 }
13513 #[doc = "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."]
13514 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
13515 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
13516 self
13517 }
13518 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
13519 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
13520 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
13521 self
13522 }
13523 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
13524 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
13525 self.if_modified_since = Some(if_modified_since.into());
13526 self
13527 }
13528 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
13529 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
13530 self.if_unmodified_since = Some(if_unmodified_since.into());
13531 self
13532 }
13533 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
13534 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
13535 self.if_match = Some(if_match.into());
13536 self
13537 }
13538 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
13539 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
13540 self.if_none_match = Some(if_none_match.into());
13541 self
13542 }
13543 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
13544 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
13545 self.x_ms_if_tags = Some(x_ms_if_tags.into());
13546 self
13547 }
13548 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
13549 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
13550 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
13551 self
13552 }
13553 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13554 #[doc = ""]
13555 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13556 #[doc = "However, this function can provide more flexibility when required."]
13557 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13558 Box::pin({
13559 let this = self.clone();
13560 async move {
13561 let url = this.url()?;
13562 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
13563 let bearer_token = this.client.bearer_token().await?;
13564 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
13565 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
13566 req.insert_header("content-type", "application/octet-stream");
13567 let req_body = azure_core::to_json(&this.body)?;
13568 if let Some(timeout) = &this.timeout {
13569 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
13570 }
13571 req.insert_header("content-length", this.content_length.to_string());
13572 if let Some(content_md5) = &this.content_md5 {
13573 req.insert_header("content-md5", content_md5);
13574 }
13575 if let Some(x_ms_content_crc64) = &this.x_ms_content_crc64 {
13576 req.insert_header("x-ms-content-crc64", x_ms_content_crc64);
13577 }
13578 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
13579 req.insert_header("x-ms-lease-id", x_ms_lease_id);
13580 }
13581 if let Some(x_ms_blob_condition_maxsize) = &this.x_ms_blob_condition_maxsize {
13582 req.insert_header("x-ms-blob-condition-maxsize", x_ms_blob_condition_maxsize.to_string());
13583 }
13584 if let Some(x_ms_blob_condition_appendpos) = &this.x_ms_blob_condition_appendpos {
13585 req.insert_header("x-ms-blob-condition-appendpos", x_ms_blob_condition_appendpos.to_string());
13586 }
13587 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
13588 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
13589 }
13590 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
13591 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
13592 }
13593 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
13594 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
13595 }
13596 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
13597 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
13598 }
13599 if let Some(if_modified_since) = &this.if_modified_since {
13600 req.insert_header("if-modified-since", if_modified_since.to_string());
13601 }
13602 if let Some(if_unmodified_since) = &this.if_unmodified_since {
13603 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
13604 }
13605 if let Some(if_match) = &this.if_match {
13606 req.insert_header("if-match", if_match);
13607 }
13608 if let Some(if_none_match) = &this.if_none_match {
13609 req.insert_header("if-none-match", if_none_match);
13610 }
13611 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
13612 req.insert_header("x-ms-if-tags", x_ms_if_tags);
13613 }
13614 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
13615 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
13616 }
13617 req.set_body(req_body);
13618 Ok(Response(this.client.send(&mut req).await?))
13619 }
13620 })
13621 }
13622 fn url(&self) -> azure_core::Result<azure_core::Url> {
13623 let mut url = self.client.endpoint().clone();
13624 url.set_path(&format!("/{}/{}?comp=appendblock", &self.container_name, &self.blob));
13625 Ok(url)
13626 }
13627 }
13628 }
13629 pub mod append_block_from_url {
13630 use super::models;
13631 #[cfg(not(target_arch = "wasm32"))]
13632 use futures::future::BoxFuture;
13633 #[cfg(target_arch = "wasm32")]
13634 use futures::future::LocalBoxFuture as BoxFuture;
13635 #[derive(Debug)]
13636 pub struct Response(azure_core::Response);
13637 impl Response {
13638 pub fn into_raw_response(self) -> azure_core::Response {
13639 self.0
13640 }
13641 pub fn as_raw_response(&self) -> &azure_core::Response {
13642 &self.0
13643 }
13644 pub fn headers(&self) -> Headers {
13645 Headers(self.0.headers())
13646 }
13647 }
13648 impl From<Response> for azure_core::Response {
13649 fn from(rsp: Response) -> Self {
13650 rsp.into_raw_response()
13651 }
13652 }
13653 impl AsRef<azure_core::Response> for Response {
13654 fn as_ref(&self) -> &azure_core::Response {
13655 self.as_raw_response()
13656 }
13657 }
13658 pub struct Headers<'a>(&'a azure_core::headers::Headers);
13659 impl<'a> Headers<'a> {
13660 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
13661 pub fn e_tag(&self) -> azure_core::Result<&str> {
13662 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
13663 }
13664 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
13665 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
13666 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
13667 }
13668 #[doc = "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."]
13669 pub fn content_md5(&self) -> azure_core::Result<&str> {
13670 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
13671 }
13672 #[doc = "This header is returned so that the client can check for message content integrity. The value of this header is computed by the Blob service; it is not necessarily the same value specified in the request headers."]
13673 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
13674 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
13675 }
13676 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
13677 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
13678 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
13679 }
13680 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
13681 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
13682 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
13683 }
13684 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
13685 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
13686 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
13687 }
13688 #[doc = "This response header is returned only for append operations. It returns the offset at which the block was committed, in bytes."]
13689 pub fn x_ms_blob_append_offset(&self) -> azure_core::Result<&str> {
13690 self.0
13691 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-blob-append-offset"))
13692 }
13693 #[doc = "The number of committed blocks present in the blob. This header is returned only for append blobs."]
13694 pub fn x_ms_blob_committed_block_count(&self) -> azure_core::Result<i32> {
13695 self.0
13696 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-committed-block-count"))
13697 }
13698 #[doc = "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key."]
13699 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
13700 self.0
13701 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
13702 }
13703 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
13704 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
13705 self.0
13706 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
13707 }
13708 #[doc = "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."]
13709 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
13710 self.0
13711 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
13712 }
13713 }
13714 #[derive(Clone)]
13715 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13716 #[doc = r""]
13717 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13718 #[doc = r" parameters can be chained."]
13719 #[doc = r""]
13720 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13721 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
13722 #[doc = r" executes the request and returns a `Result` with the parsed"]
13723 #[doc = r" response."]
13724 #[doc = r""]
13725 #[doc = r" In order to execute the request without polling the service"]
13726 #[doc = r" until the operation completes, use `.send().await` instead."]
13727 #[doc = r""]
13728 #[doc = r" If you need lower-level access to the raw response details"]
13729 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13730 #[doc = r" can finalize the request using the"]
13731 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13732 #[doc = r" that resolves to a lower-level [`Response`] value."]
13733 pub struct RequestBuilder {
13734 pub(crate) client: super::super::Client,
13735 pub(crate) container_name: String,
13736 pub(crate) blob: String,
13737 pub(crate) x_ms_copy_source: String,
13738 pub(crate) content_length: i64,
13739 pub(crate) x_ms_source_range: Option<String>,
13740 pub(crate) x_ms_source_content_md5: Option<String>,
13741 pub(crate) x_ms_source_content_crc64: Option<String>,
13742 pub(crate) timeout: Option<i64>,
13743 pub(crate) content_md5: Option<String>,
13744 pub(crate) x_ms_encryption_key: Option<String>,
13745 pub(crate) x_ms_encryption_key_sha256: Option<String>,
13746 pub(crate) x_ms_encryption_algorithm: Option<String>,
13747 pub(crate) x_ms_encryption_scope: Option<String>,
13748 pub(crate) x_ms_lease_id: Option<String>,
13749 pub(crate) x_ms_blob_condition_maxsize: Option<i64>,
13750 pub(crate) x_ms_blob_condition_appendpos: Option<i64>,
13751 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
13752 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
13753 pub(crate) if_match: Option<String>,
13754 pub(crate) if_none_match: Option<String>,
13755 pub(crate) x_ms_if_tags: Option<String>,
13756 pub(crate) x_ms_source_if_modified_since: Option<::time::OffsetDateTime>,
13757 pub(crate) x_ms_source_if_unmodified_since: Option<::time::OffsetDateTime>,
13758 pub(crate) x_ms_source_if_match: Option<String>,
13759 pub(crate) x_ms_source_if_none_match: Option<String>,
13760 pub(crate) x_ms_client_request_id: Option<String>,
13761 pub(crate) x_ms_copy_source_authorization: Option<String>,
13762 }
13763 impl RequestBuilder {
13764 #[doc = "Bytes of source data in the specified range."]
13765 pub fn x_ms_source_range(mut self, x_ms_source_range: impl Into<String>) -> Self {
13766 self.x_ms_source_range = Some(x_ms_source_range.into());
13767 self
13768 }
13769 #[doc = "Specify the md5 calculated for the range of bytes that must be read from the copy source."]
13770 pub fn x_ms_source_content_md5(mut self, x_ms_source_content_md5: impl Into<String>) -> Self {
13771 self.x_ms_source_content_md5 = Some(x_ms_source_content_md5.into());
13772 self
13773 }
13774 #[doc = "Specify the crc64 calculated for the range of bytes that must be read from the copy source."]
13775 pub fn x_ms_source_content_crc64(mut self, x_ms_source_content_crc64: impl Into<String>) -> Self {
13776 self.x_ms_source_content_crc64 = Some(x_ms_source_content_crc64.into());
13777 self
13778 }
13779 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
13780 pub fn timeout(mut self, timeout: i64) -> Self {
13781 self.timeout = Some(timeout);
13782 self
13783 }
13784 #[doc = "Specify the transactional md5 for the body, to be validated by the service."]
13785 pub fn content_md5(mut self, content_md5: impl Into<String>) -> Self {
13786 self.content_md5 = Some(content_md5.into());
13787 self
13788 }
13789 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
13790 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
13791 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
13792 self
13793 }
13794 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
13795 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
13796 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
13797 self
13798 }
13799 #[doc = "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."]
13800 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
13801 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
13802 self
13803 }
13804 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
13805 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
13806 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
13807 self
13808 }
13809 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
13810 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
13811 self.x_ms_lease_id = Some(x_ms_lease_id.into());
13812 self
13813 }
13814 #[doc = "Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed)."]
13815 pub fn x_ms_blob_condition_maxsize(mut self, x_ms_blob_condition_maxsize: i64) -> Self {
13816 self.x_ms_blob_condition_maxsize = Some(x_ms_blob_condition_maxsize);
13817 self
13818 }
13819 #[doc = "Optional conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed)."]
13820 pub fn x_ms_blob_condition_appendpos(mut self, x_ms_blob_condition_appendpos: i64) -> Self {
13821 self.x_ms_blob_condition_appendpos = Some(x_ms_blob_condition_appendpos);
13822 self
13823 }
13824 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
13825 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
13826 self.if_modified_since = Some(if_modified_since.into());
13827 self
13828 }
13829 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
13830 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
13831 self.if_unmodified_since = Some(if_unmodified_since.into());
13832 self
13833 }
13834 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
13835 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
13836 self.if_match = Some(if_match.into());
13837 self
13838 }
13839 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
13840 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
13841 self.if_none_match = Some(if_none_match.into());
13842 self
13843 }
13844 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
13845 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
13846 self.x_ms_if_tags = Some(x_ms_if_tags.into());
13847 self
13848 }
13849 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
13850 pub fn x_ms_source_if_modified_since(mut self, x_ms_source_if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
13851 self.x_ms_source_if_modified_since = Some(x_ms_source_if_modified_since.into());
13852 self
13853 }
13854 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
13855 pub fn x_ms_source_if_unmodified_since(mut self, x_ms_source_if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
13856 self.x_ms_source_if_unmodified_since = Some(x_ms_source_if_unmodified_since.into());
13857 self
13858 }
13859 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
13860 pub fn x_ms_source_if_match(mut self, x_ms_source_if_match: impl Into<String>) -> Self {
13861 self.x_ms_source_if_match = Some(x_ms_source_if_match.into());
13862 self
13863 }
13864 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
13865 pub fn x_ms_source_if_none_match(mut self, x_ms_source_if_none_match: impl Into<String>) -> Self {
13866 self.x_ms_source_if_none_match = Some(x_ms_source_if_none_match.into());
13867 self
13868 }
13869 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
13870 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
13871 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
13872 self
13873 }
13874 #[doc = "Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source."]
13875 pub fn x_ms_copy_source_authorization(mut self, x_ms_copy_source_authorization: impl Into<String>) -> Self {
13876 self.x_ms_copy_source_authorization = Some(x_ms_copy_source_authorization.into());
13877 self
13878 }
13879 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13880 #[doc = ""]
13881 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13882 #[doc = "However, this function can provide more flexibility when required."]
13883 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13884 Box::pin({
13885 let this = self.clone();
13886 async move {
13887 let url = this.url()?;
13888 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
13889 let bearer_token = this.client.bearer_token().await?;
13890 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
13891 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
13892 req.insert_header("x-ms-copy-source", &this.x_ms_copy_source);
13893 if let Some(x_ms_source_range) = &this.x_ms_source_range {
13894 req.insert_header("x-ms-source-range", x_ms_source_range);
13895 }
13896 if let Some(x_ms_source_content_md5) = &this.x_ms_source_content_md5 {
13897 req.insert_header("x-ms-source-content-md5", x_ms_source_content_md5);
13898 }
13899 if let Some(x_ms_source_content_crc64) = &this.x_ms_source_content_crc64 {
13900 req.insert_header("x-ms-source-content-crc64", x_ms_source_content_crc64);
13901 }
13902 if let Some(timeout) = &this.timeout {
13903 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
13904 }
13905 req.insert_header("content-length", this.content_length.to_string());
13906 if let Some(content_md5) = &this.content_md5 {
13907 req.insert_header("content-md5", content_md5);
13908 }
13909 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
13910 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
13911 }
13912 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
13913 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
13914 }
13915 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
13916 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
13917 }
13918 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
13919 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
13920 }
13921 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
13922 req.insert_header("x-ms-lease-id", x_ms_lease_id);
13923 }
13924 if let Some(x_ms_blob_condition_maxsize) = &this.x_ms_blob_condition_maxsize {
13925 req.insert_header("x-ms-blob-condition-maxsize", x_ms_blob_condition_maxsize.to_string());
13926 }
13927 if let Some(x_ms_blob_condition_appendpos) = &this.x_ms_blob_condition_appendpos {
13928 req.insert_header("x-ms-blob-condition-appendpos", x_ms_blob_condition_appendpos.to_string());
13929 }
13930 if let Some(if_modified_since) = &this.if_modified_since {
13931 req.insert_header("if-modified-since", if_modified_since.to_string());
13932 }
13933 if let Some(if_unmodified_since) = &this.if_unmodified_since {
13934 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
13935 }
13936 if let Some(if_match) = &this.if_match {
13937 req.insert_header("if-match", if_match);
13938 }
13939 if let Some(if_none_match) = &this.if_none_match {
13940 req.insert_header("if-none-match", if_none_match);
13941 }
13942 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
13943 req.insert_header("x-ms-if-tags", x_ms_if_tags);
13944 }
13945 if let Some(x_ms_source_if_modified_since) = &this.x_ms_source_if_modified_since {
13946 req.insert_header("x-ms-source-if-modified-since", x_ms_source_if_modified_since.to_string());
13947 }
13948 if let Some(x_ms_source_if_unmodified_since) = &this.x_ms_source_if_unmodified_since {
13949 req.insert_header("x-ms-source-if-unmodified-since", x_ms_source_if_unmodified_since.to_string());
13950 }
13951 if let Some(x_ms_source_if_match) = &this.x_ms_source_if_match {
13952 req.insert_header("x-ms-source-if-match", x_ms_source_if_match);
13953 }
13954 if let Some(x_ms_source_if_none_match) = &this.x_ms_source_if_none_match {
13955 req.insert_header("x-ms-source-if-none-match", x_ms_source_if_none_match);
13956 }
13957 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
13958 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
13959 }
13960 if let Some(x_ms_copy_source_authorization) = &this.x_ms_copy_source_authorization {
13961 req.insert_header("x-ms-copy-source-authorization", x_ms_copy_source_authorization);
13962 }
13963 let req_body = azure_core::EMPTY_BODY;
13964 req.set_body(req_body);
13965 Ok(Response(this.client.send(&mut req).await?))
13966 }
13967 })
13968 }
13969 fn url(&self) -> azure_core::Result<azure_core::Url> {
13970 let mut url = self.client.endpoint().clone();
13971 url.set_path(&format!("/{}/{}?comp=appendblock&fromUrl", &self.container_name, &self.blob));
13972 Ok(url)
13973 }
13974 }
13975 }
13976 pub mod seal {
13977 use super::models;
13978 #[cfg(not(target_arch = "wasm32"))]
13979 use futures::future::BoxFuture;
13980 #[cfg(target_arch = "wasm32")]
13981 use futures::future::LocalBoxFuture as BoxFuture;
13982 #[derive(Debug)]
13983 pub struct Response(azure_core::Response);
13984 impl Response {
13985 pub fn into_raw_response(self) -> azure_core::Response {
13986 self.0
13987 }
13988 pub fn as_raw_response(&self) -> &azure_core::Response {
13989 &self.0
13990 }
13991 pub fn headers(&self) -> Headers {
13992 Headers(self.0.headers())
13993 }
13994 }
13995 impl From<Response> for azure_core::Response {
13996 fn from(rsp: Response) -> Self {
13997 rsp.into_raw_response()
13998 }
13999 }
14000 impl AsRef<azure_core::Response> for Response {
14001 fn as_ref(&self) -> &azure_core::Response {
14002 self.as_raw_response()
14003 }
14004 }
14005 pub struct Headers<'a>(&'a azure_core::headers::Headers);
14006 impl<'a> Headers<'a> {
14007 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
14008 pub fn e_tag(&self) -> azure_core::Result<&str> {
14009 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
14010 }
14011 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
14012 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
14013 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
14014 }
14015 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
14016 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
14017 self.0
14018 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
14019 }
14020 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
14021 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
14022 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
14023 }
14024 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
14025 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
14026 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
14027 }
14028 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
14029 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
14030 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
14031 }
14032 #[doc = "If this blob has been sealed"]
14033 pub fn x_ms_blob_sealed(&self) -> azure_core::Result<bool> {
14034 self.0.get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-sealed"))
14035 }
14036 }
14037 #[derive(Clone)]
14038 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
14039 #[doc = r""]
14040 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
14041 #[doc = r" parameters can be chained."]
14042 #[doc = r""]
14043 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
14044 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
14045 #[doc = r" executes the request and returns a `Result` with the parsed"]
14046 #[doc = r" response."]
14047 #[doc = r""]
14048 #[doc = r" In order to execute the request without polling the service"]
14049 #[doc = r" until the operation completes, use `.send().await` instead."]
14050 #[doc = r""]
14051 #[doc = r" If you need lower-level access to the raw response details"]
14052 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
14053 #[doc = r" can finalize the request using the"]
14054 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
14055 #[doc = r" that resolves to a lower-level [`Response`] value."]
14056 pub struct RequestBuilder {
14057 pub(crate) client: super::super::Client,
14058 pub(crate) container_name: String,
14059 pub(crate) blob: String,
14060 pub(crate) timeout: Option<i64>,
14061 pub(crate) x_ms_client_request_id: Option<String>,
14062 pub(crate) x_ms_lease_id: Option<String>,
14063 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
14064 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
14065 pub(crate) if_match: Option<String>,
14066 pub(crate) if_none_match: Option<String>,
14067 pub(crate) x_ms_blob_condition_appendpos: Option<i64>,
14068 }
14069 impl RequestBuilder {
14070 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
14071 pub fn timeout(mut self, timeout: i64) -> Self {
14072 self.timeout = Some(timeout);
14073 self
14074 }
14075 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
14076 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
14077 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
14078 self
14079 }
14080 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
14081 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
14082 self.x_ms_lease_id = Some(x_ms_lease_id.into());
14083 self
14084 }
14085 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
14086 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
14087 self.if_modified_since = Some(if_modified_since.into());
14088 self
14089 }
14090 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
14091 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
14092 self.if_unmodified_since = Some(if_unmodified_since.into());
14093 self
14094 }
14095 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
14096 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
14097 self.if_match = Some(if_match.into());
14098 self
14099 }
14100 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
14101 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
14102 self.if_none_match = Some(if_none_match.into());
14103 self
14104 }
14105 #[doc = "Optional conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed)."]
14106 pub fn x_ms_blob_condition_appendpos(mut self, x_ms_blob_condition_appendpos: i64) -> Self {
14107 self.x_ms_blob_condition_appendpos = Some(x_ms_blob_condition_appendpos);
14108 self
14109 }
14110 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
14111 #[doc = ""]
14112 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
14113 #[doc = "However, this function can provide more flexibility when required."]
14114 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
14115 Box::pin({
14116 let this = self.clone();
14117 async move {
14118 let url = this.url()?;
14119 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
14120 let bearer_token = this.client.bearer_token().await?;
14121 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
14122 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
14123 if let Some(timeout) = &this.timeout {
14124 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
14125 }
14126 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
14127 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
14128 }
14129 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
14130 req.insert_header("x-ms-lease-id", x_ms_lease_id);
14131 }
14132 if let Some(if_modified_since) = &this.if_modified_since {
14133 req.insert_header("if-modified-since", if_modified_since.to_string());
14134 }
14135 if let Some(if_unmodified_since) = &this.if_unmodified_since {
14136 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
14137 }
14138 if let Some(if_match) = &this.if_match {
14139 req.insert_header("if-match", if_match);
14140 }
14141 if let Some(if_none_match) = &this.if_none_match {
14142 req.insert_header("if-none-match", if_none_match);
14143 }
14144 if let Some(x_ms_blob_condition_appendpos) = &this.x_ms_blob_condition_appendpos {
14145 req.insert_header("x-ms-blob-condition-appendpos", x_ms_blob_condition_appendpos.to_string());
14146 }
14147 let req_body = azure_core::EMPTY_BODY;
14148 req.set_body(req_body);
14149 Ok(Response(this.client.send(&mut req).await?))
14150 }
14151 })
14152 }
14153 fn url(&self) -> azure_core::Result<azure_core::Url> {
14154 let mut url = self.client.endpoint().clone();
14155 url.set_path(&format!("/{}/{}?comp=seal", &self.container_name, &self.blob));
14156 Ok(url)
14157 }
14158 }
14159 }
14160}
14161pub mod block_blob {
14162 use super::models;
14163 #[cfg(not(target_arch = "wasm32"))]
14164 use futures::future::BoxFuture;
14165 #[cfg(target_arch = "wasm32")]
14166 use futures::future::LocalBoxFuture as BoxFuture;
14167 pub struct Client(pub(crate) super::Client);
14168 impl Client {
14169 #[doc = "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."]
14170 #[doc = ""]
14171 #[doc = "Arguments:"]
14172 #[doc = "* `container_name`: The container name."]
14173 #[doc = "* `blob`: The blob name."]
14174 #[doc = "* `x_ms_blob_type`: Specifies the type of blob to create: block blob, page blob, or append blob."]
14175 #[doc = "* `body`: Initial data"]
14176 #[doc = "* `content_length`: The length of the request."]
14177 pub fn upload(
14178 &self,
14179 container_name: impl Into<String>,
14180 blob: impl Into<String>,
14181 x_ms_blob_type: impl Into<String>,
14182 body: impl Into<serde_json::Value>,
14183 content_length: i64,
14184 ) -> upload::RequestBuilder {
14185 upload::RequestBuilder {
14186 client: self.0.clone(),
14187 container_name: container_name.into(),
14188 blob: blob.into(),
14189 x_ms_blob_type: x_ms_blob_type.into(),
14190 body: body.into(),
14191 content_length,
14192 timeout: None,
14193 content_md5: None,
14194 x_ms_blob_content_type: None,
14195 x_ms_blob_content_encoding: None,
14196 x_ms_blob_content_language: None,
14197 x_ms_blob_content_md5: None,
14198 x_ms_blob_cache_control: None,
14199 x_ms_meta: None,
14200 x_ms_lease_id: None,
14201 x_ms_blob_content_disposition: None,
14202 x_ms_encryption_key: None,
14203 x_ms_encryption_key_sha256: None,
14204 x_ms_encryption_algorithm: None,
14205 x_ms_encryption_scope: None,
14206 x_ms_access_tier: None,
14207 if_modified_since: None,
14208 if_unmodified_since: None,
14209 if_match: None,
14210 if_none_match: None,
14211 x_ms_if_tags: None,
14212 x_ms_client_request_id: None,
14213 x_ms_tags: None,
14214 x_ms_immutability_policy_until_date: None,
14215 x_ms_immutability_policy_mode: None,
14216 x_ms_legal_hold: None,
14217 x_ms_content_crc64: None,
14218 }
14219 }
14220 #[doc = "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."]
14221 #[doc = ""]
14222 #[doc = "Arguments:"]
14223 #[doc = "* `container_name`: The container name."]
14224 #[doc = "* `blob`: The blob name."]
14225 #[doc = "* `x_ms_blob_type`: Specifies the type of blob to create: block blob, page blob, or append blob."]
14226 #[doc = "* `content_length`: The length of the request."]
14227 #[doc = "* `x_ms_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."]
14228 pub fn put_blob_from_url(
14229 &self,
14230 container_name: impl Into<String>,
14231 blob: impl Into<String>,
14232 x_ms_blob_type: impl Into<String>,
14233 content_length: i64,
14234 x_ms_copy_source: impl Into<String>,
14235 ) -> put_blob_from_url::RequestBuilder {
14236 put_blob_from_url::RequestBuilder {
14237 client: self.0.clone(),
14238 container_name: container_name.into(),
14239 blob: blob.into(),
14240 x_ms_blob_type: x_ms_blob_type.into(),
14241 content_length,
14242 x_ms_copy_source: x_ms_copy_source.into(),
14243 timeout: None,
14244 content_md5: None,
14245 x_ms_blob_content_type: None,
14246 x_ms_blob_content_encoding: None,
14247 x_ms_blob_content_language: None,
14248 x_ms_blob_content_md5: None,
14249 x_ms_blob_cache_control: None,
14250 x_ms_meta: None,
14251 x_ms_lease_id: None,
14252 x_ms_blob_content_disposition: None,
14253 x_ms_encryption_key: None,
14254 x_ms_encryption_key_sha256: None,
14255 x_ms_encryption_algorithm: None,
14256 x_ms_encryption_scope: None,
14257 x_ms_access_tier: None,
14258 if_modified_since: None,
14259 if_unmodified_since: None,
14260 if_match: None,
14261 if_none_match: None,
14262 x_ms_if_tags: None,
14263 x_ms_source_if_modified_since: None,
14264 x_ms_source_if_unmodified_since: None,
14265 x_ms_source_if_match: None,
14266 x_ms_source_if_none_match: None,
14267 x_ms_source_if_tags: None,
14268 x_ms_client_request_id: None,
14269 x_ms_source_content_md5: None,
14270 x_ms_tags: None,
14271 x_ms_copy_source_blob_properties: None,
14272 x_ms_copy_source_authorization: None,
14273 x_ms_copy_source_tag_option: None,
14274 }
14275 }
14276 #[doc = "The Stage Block operation creates a new block to be committed as part of a blob"]
14277 #[doc = ""]
14278 #[doc = "Arguments:"]
14279 #[doc = "* `container_name`: The container name."]
14280 #[doc = "* `blob`: The blob name."]
14281 #[doc = "* `blockid`: 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."]
14282 #[doc = "* `content_length`: The length of the request."]
14283 #[doc = "* `body`: Initial data"]
14284 pub fn stage_block(
14285 &self,
14286 container_name: impl Into<String>,
14287 blob: impl Into<String>,
14288 blockid: impl Into<String>,
14289 content_length: i64,
14290 body: impl Into<serde_json::Value>,
14291 ) -> stage_block::RequestBuilder {
14292 stage_block::RequestBuilder {
14293 client: self.0.clone(),
14294 container_name: container_name.into(),
14295 blob: blob.into(),
14296 blockid: blockid.into(),
14297 content_length,
14298 body: body.into(),
14299 content_md5: None,
14300 x_ms_content_crc64: None,
14301 timeout: None,
14302 x_ms_lease_id: None,
14303 x_ms_encryption_key: None,
14304 x_ms_encryption_key_sha256: None,
14305 x_ms_encryption_algorithm: None,
14306 x_ms_encryption_scope: None,
14307 x_ms_client_request_id: None,
14308 }
14309 }
14310 #[doc = "The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL."]
14311 #[doc = ""]
14312 #[doc = "Arguments:"]
14313 #[doc = "* `container_name`: The container name."]
14314 #[doc = "* `blob`: The blob name."]
14315 #[doc = "* `blockid`: 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."]
14316 #[doc = "* `content_length`: The length of the request."]
14317 #[doc = "* `x_ms_copy_source`: Specify a URL to the copy source."]
14318 pub fn stage_block_from_url(
14319 &self,
14320 container_name: impl Into<String>,
14321 blob: impl Into<String>,
14322 blockid: impl Into<String>,
14323 content_length: i64,
14324 x_ms_copy_source: impl Into<String>,
14325 ) -> stage_block_from_url::RequestBuilder {
14326 stage_block_from_url::RequestBuilder {
14327 client: self.0.clone(),
14328 container_name: container_name.into(),
14329 blob: blob.into(),
14330 blockid: blockid.into(),
14331 content_length,
14332 x_ms_copy_source: x_ms_copy_source.into(),
14333 x_ms_source_range: None,
14334 x_ms_source_content_md5: None,
14335 x_ms_source_content_crc64: None,
14336 timeout: None,
14337 x_ms_encryption_key: None,
14338 x_ms_encryption_key_sha256: None,
14339 x_ms_encryption_algorithm: None,
14340 x_ms_encryption_scope: None,
14341 x_ms_lease_id: None,
14342 x_ms_source_if_modified_since: None,
14343 x_ms_source_if_unmodified_since: None,
14344 x_ms_source_if_match: None,
14345 x_ms_source_if_none_match: None,
14346 x_ms_client_request_id: None,
14347 x_ms_copy_source_authorization: None,
14348 }
14349 }
14350 #[doc = "The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob"]
14351 #[doc = ""]
14352 #[doc = "Arguments:"]
14353 #[doc = "* `container_name`: The container name."]
14354 #[doc = "* `blob`: The blob name."]
14355 #[doc = "* `blocklisttype`: Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together."]
14356 pub fn get_block_list(
14357 &self,
14358 container_name: impl Into<String>,
14359 blob: impl Into<String>,
14360 blocklisttype: impl Into<String>,
14361 ) -> get_block_list::RequestBuilder {
14362 get_block_list::RequestBuilder {
14363 client: self.0.clone(),
14364 container_name: container_name.into(),
14365 blob: blob.into(),
14366 blocklisttype: blocklisttype.into(),
14367 snapshot: None,
14368 timeout: None,
14369 x_ms_lease_id: None,
14370 x_ms_if_tags: None,
14371 x_ms_client_request_id: None,
14372 }
14373 }
14374 #[doc = "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."]
14375 #[doc = ""]
14376 #[doc = "Arguments:"]
14377 #[doc = "* `container_name`: The container name."]
14378 #[doc = "* `blob`: The blob name."]
14379 #[doc = "* `blocks`: Blob Blocks."]
14380 pub fn commit_block_list(
14381 &self,
14382 container_name: impl Into<String>,
14383 blob: impl Into<String>,
14384 blocks: impl Into<models::BlockLookupList>,
14385 ) -> commit_block_list::RequestBuilder {
14386 commit_block_list::RequestBuilder {
14387 client: self.0.clone(),
14388 container_name: container_name.into(),
14389 blob: blob.into(),
14390 blocks: blocks.into(),
14391 timeout: None,
14392 x_ms_blob_cache_control: None,
14393 x_ms_blob_content_type: None,
14394 x_ms_blob_content_encoding: None,
14395 x_ms_blob_content_language: None,
14396 x_ms_blob_content_md5: None,
14397 content_md5: None,
14398 x_ms_content_crc64: None,
14399 x_ms_meta: None,
14400 x_ms_lease_id: None,
14401 x_ms_blob_content_disposition: None,
14402 x_ms_encryption_key: None,
14403 x_ms_encryption_key_sha256: None,
14404 x_ms_encryption_algorithm: None,
14405 x_ms_encryption_scope: None,
14406 x_ms_access_tier: None,
14407 if_modified_since: None,
14408 if_unmodified_since: None,
14409 if_match: None,
14410 if_none_match: None,
14411 x_ms_if_tags: None,
14412 x_ms_client_request_id: None,
14413 x_ms_tags: None,
14414 x_ms_immutability_policy_until_date: None,
14415 x_ms_immutability_policy_mode: None,
14416 x_ms_legal_hold: None,
14417 }
14418 }
14419 }
14420 pub mod upload {
14421 use super::models;
14422 #[cfg(not(target_arch = "wasm32"))]
14423 use futures::future::BoxFuture;
14424 #[cfg(target_arch = "wasm32")]
14425 use futures::future::LocalBoxFuture as BoxFuture;
14426 #[derive(Debug)]
14427 pub struct Response(azure_core::Response);
14428 impl Response {
14429 pub fn into_raw_response(self) -> azure_core::Response {
14430 self.0
14431 }
14432 pub fn as_raw_response(&self) -> &azure_core::Response {
14433 &self.0
14434 }
14435 pub fn headers(&self) -> Headers {
14436 Headers(self.0.headers())
14437 }
14438 }
14439 impl From<Response> for azure_core::Response {
14440 fn from(rsp: Response) -> Self {
14441 rsp.into_raw_response()
14442 }
14443 }
14444 impl AsRef<azure_core::Response> for Response {
14445 fn as_ref(&self) -> &azure_core::Response {
14446 self.as_raw_response()
14447 }
14448 }
14449 pub struct Headers<'a>(&'a azure_core::headers::Headers);
14450 impl<'a> Headers<'a> {
14451 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
14452 pub fn e_tag(&self) -> azure_core::Result<&str> {
14453 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
14454 }
14455 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
14456 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
14457 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
14458 }
14459 #[doc = "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."]
14460 pub fn content_md5(&self) -> azure_core::Result<&str> {
14461 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
14462 }
14463 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
14464 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
14465 self.0
14466 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
14467 }
14468 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
14469 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
14470 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
14471 }
14472 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
14473 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
14474 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
14475 }
14476 #[doc = "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."]
14477 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
14478 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
14479 }
14480 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
14481 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
14482 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
14483 }
14484 #[doc = "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."]
14485 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
14486 self.0
14487 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
14488 }
14489 #[doc = "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."]
14490 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
14491 self.0
14492 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
14493 }
14494 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
14495 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
14496 self.0
14497 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
14498 }
14499 }
14500 #[derive(Clone)]
14501 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
14502 #[doc = r""]
14503 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
14504 #[doc = r" parameters can be chained."]
14505 #[doc = r""]
14506 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
14507 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
14508 #[doc = r" executes the request and returns a `Result` with the parsed"]
14509 #[doc = r" response."]
14510 #[doc = r""]
14511 #[doc = r" In order to execute the request without polling the service"]
14512 #[doc = r" until the operation completes, use `.send().await` instead."]
14513 #[doc = r""]
14514 #[doc = r" If you need lower-level access to the raw response details"]
14515 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
14516 #[doc = r" can finalize the request using the"]
14517 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
14518 #[doc = r" that resolves to a lower-level [`Response`] value."]
14519 pub struct RequestBuilder {
14520 pub(crate) client: super::super::Client,
14521 pub(crate) container_name: String,
14522 pub(crate) blob: String,
14523 pub(crate) x_ms_blob_type: String,
14524 pub(crate) body: serde_json::Value,
14525 pub(crate) content_length: i64,
14526 pub(crate) timeout: Option<i64>,
14527 pub(crate) content_md5: Option<String>,
14528 pub(crate) x_ms_blob_content_type: Option<String>,
14529 pub(crate) x_ms_blob_content_encoding: Option<String>,
14530 pub(crate) x_ms_blob_content_language: Option<String>,
14531 pub(crate) x_ms_blob_content_md5: Option<String>,
14532 pub(crate) x_ms_blob_cache_control: Option<String>,
14533 pub(crate) x_ms_meta: Option<String>,
14534 pub(crate) x_ms_lease_id: Option<String>,
14535 pub(crate) x_ms_blob_content_disposition: Option<String>,
14536 pub(crate) x_ms_encryption_key: Option<String>,
14537 pub(crate) x_ms_encryption_key_sha256: Option<String>,
14538 pub(crate) x_ms_encryption_algorithm: Option<String>,
14539 pub(crate) x_ms_encryption_scope: Option<String>,
14540 pub(crate) x_ms_access_tier: Option<String>,
14541 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
14542 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
14543 pub(crate) if_match: Option<String>,
14544 pub(crate) if_none_match: Option<String>,
14545 pub(crate) x_ms_if_tags: Option<String>,
14546 pub(crate) x_ms_client_request_id: Option<String>,
14547 pub(crate) x_ms_tags: Option<String>,
14548 pub(crate) x_ms_immutability_policy_until_date: Option<::time::OffsetDateTime>,
14549 pub(crate) x_ms_immutability_policy_mode: Option<String>,
14550 pub(crate) x_ms_legal_hold: Option<bool>,
14551 pub(crate) x_ms_content_crc64: Option<String>,
14552 }
14553 impl RequestBuilder {
14554 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
14555 pub fn timeout(mut self, timeout: i64) -> Self {
14556 self.timeout = Some(timeout);
14557 self
14558 }
14559 #[doc = "Specify the transactional md5 for the body, to be validated by the service."]
14560 pub fn content_md5(mut self, content_md5: impl Into<String>) -> Self {
14561 self.content_md5 = Some(content_md5.into());
14562 self
14563 }
14564 #[doc = "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request."]
14565 pub fn x_ms_blob_content_type(mut self, x_ms_blob_content_type: impl Into<String>) -> Self {
14566 self.x_ms_blob_content_type = Some(x_ms_blob_content_type.into());
14567 self
14568 }
14569 #[doc = "Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request."]
14570 pub fn x_ms_blob_content_encoding(mut self, x_ms_blob_content_encoding: impl Into<String>) -> Self {
14571 self.x_ms_blob_content_encoding = Some(x_ms_blob_content_encoding.into());
14572 self
14573 }
14574 #[doc = "Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request."]
14575 pub fn x_ms_blob_content_language(mut self, x_ms_blob_content_language: impl Into<String>) -> Self {
14576 self.x_ms_blob_content_language = Some(x_ms_blob_content_language.into());
14577 self
14578 }
14579 #[doc = "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."]
14580 pub fn x_ms_blob_content_md5(mut self, x_ms_blob_content_md5: impl Into<String>) -> Self {
14581 self.x_ms_blob_content_md5 = Some(x_ms_blob_content_md5.into());
14582 self
14583 }
14584 #[doc = "Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request."]
14585 pub fn x_ms_blob_cache_control(mut self, x_ms_blob_cache_control: impl Into<String>) -> Self {
14586 self.x_ms_blob_cache_control = Some(x_ms_blob_cache_control.into());
14587 self
14588 }
14589 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
14590 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
14591 self.x_ms_meta = Some(x_ms_meta.into());
14592 self
14593 }
14594 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
14595 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
14596 self.x_ms_lease_id = Some(x_ms_lease_id.into());
14597 self
14598 }
14599 #[doc = "Optional. Sets the blob's Content-Disposition header."]
14600 pub fn x_ms_blob_content_disposition(mut self, x_ms_blob_content_disposition: impl Into<String>) -> Self {
14601 self.x_ms_blob_content_disposition = Some(x_ms_blob_content_disposition.into());
14602 self
14603 }
14604 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
14605 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
14606 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
14607 self
14608 }
14609 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
14610 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
14611 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
14612 self
14613 }
14614 #[doc = "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."]
14615 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
14616 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
14617 self
14618 }
14619 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
14620 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
14621 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
14622 self
14623 }
14624 #[doc = "Optional. Indicates the tier to be set on the blob."]
14625 pub fn x_ms_access_tier(mut self, x_ms_access_tier: impl Into<String>) -> Self {
14626 self.x_ms_access_tier = Some(x_ms_access_tier.into());
14627 self
14628 }
14629 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
14630 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
14631 self.if_modified_since = Some(if_modified_since.into());
14632 self
14633 }
14634 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
14635 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
14636 self.if_unmodified_since = Some(if_unmodified_since.into());
14637 self
14638 }
14639 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
14640 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
14641 self.if_match = Some(if_match.into());
14642 self
14643 }
14644 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
14645 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
14646 self.if_none_match = Some(if_none_match.into());
14647 self
14648 }
14649 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
14650 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
14651 self.x_ms_if_tags = Some(x_ms_if_tags.into());
14652 self
14653 }
14654 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
14655 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
14656 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
14657 self
14658 }
14659 #[doc = "Optional. Used to set blob tags in various blob operations."]
14660 pub fn x_ms_tags(mut self, x_ms_tags: impl Into<String>) -> Self {
14661 self.x_ms_tags = Some(x_ms_tags.into());
14662 self
14663 }
14664 #[doc = "Specifies the date time when the blobs immutability policy is set to expire."]
14665 pub fn x_ms_immutability_policy_until_date(
14666 mut self,
14667 x_ms_immutability_policy_until_date: impl Into<::time::OffsetDateTime>,
14668 ) -> Self {
14669 self.x_ms_immutability_policy_until_date = Some(x_ms_immutability_policy_until_date.into());
14670 self
14671 }
14672 #[doc = "Specifies the immutability policy mode to set on the blob."]
14673 pub fn x_ms_immutability_policy_mode(mut self, x_ms_immutability_policy_mode: impl Into<String>) -> Self {
14674 self.x_ms_immutability_policy_mode = Some(x_ms_immutability_policy_mode.into());
14675 self
14676 }
14677 #[doc = "Specified if a legal hold should be set on the blob."]
14678 pub fn x_ms_legal_hold(mut self, x_ms_legal_hold: bool) -> Self {
14679 self.x_ms_legal_hold = Some(x_ms_legal_hold);
14680 self
14681 }
14682 #[doc = "Specify the transactional crc64 for the body, to be validated by the service."]
14683 pub fn x_ms_content_crc64(mut self, x_ms_content_crc64: impl Into<String>) -> Self {
14684 self.x_ms_content_crc64 = Some(x_ms_content_crc64.into());
14685 self
14686 }
14687 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
14688 #[doc = ""]
14689 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
14690 #[doc = "However, this function can provide more flexibility when required."]
14691 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
14692 Box::pin({
14693 let this = self.clone();
14694 async move {
14695 let url = this.url()?;
14696 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
14697 let bearer_token = this.client.bearer_token().await?;
14698 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
14699 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
14700 req.insert_header("x-ms-blob-type", &this.x_ms_blob_type);
14701 req.insert_header("content-type", "application/octet-stream");
14702 let req_body = azure_core::to_json(&this.body)?;
14703 if let Some(timeout) = &this.timeout {
14704 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
14705 }
14706 if let Some(content_md5) = &this.content_md5 {
14707 req.insert_header("content-md5", content_md5);
14708 }
14709 req.insert_header("content-length", this.content_length.to_string());
14710 if let Some(x_ms_blob_content_type) = &this.x_ms_blob_content_type {
14711 req.insert_header("x-ms-blob-content-type", x_ms_blob_content_type);
14712 }
14713 if let Some(x_ms_blob_content_encoding) = &this.x_ms_blob_content_encoding {
14714 req.insert_header("x-ms-blob-content-encoding", x_ms_blob_content_encoding);
14715 }
14716 if let Some(x_ms_blob_content_language) = &this.x_ms_blob_content_language {
14717 req.insert_header("x-ms-blob-content-language", x_ms_blob_content_language);
14718 }
14719 if let Some(x_ms_blob_content_md5) = &this.x_ms_blob_content_md5 {
14720 req.insert_header("x-ms-blob-content-md5", x_ms_blob_content_md5);
14721 }
14722 if let Some(x_ms_blob_cache_control) = &this.x_ms_blob_cache_control {
14723 req.insert_header("x-ms-blob-cache-control", x_ms_blob_cache_control);
14724 }
14725 if let Some(x_ms_meta) = &this.x_ms_meta {
14726 req.insert_header("x-ms-meta", x_ms_meta);
14727 }
14728 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
14729 req.insert_header("x-ms-lease-id", x_ms_lease_id);
14730 }
14731 if let Some(x_ms_blob_content_disposition) = &this.x_ms_blob_content_disposition {
14732 req.insert_header("x-ms-blob-content-disposition", x_ms_blob_content_disposition);
14733 }
14734 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
14735 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
14736 }
14737 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
14738 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
14739 }
14740 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
14741 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
14742 }
14743 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
14744 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
14745 }
14746 if let Some(x_ms_access_tier) = &this.x_ms_access_tier {
14747 req.insert_header("x-ms-access-tier", x_ms_access_tier);
14748 }
14749 if let Some(if_modified_since) = &this.if_modified_since {
14750 req.insert_header("if-modified-since", if_modified_since.to_string());
14751 }
14752 if let Some(if_unmodified_since) = &this.if_unmodified_since {
14753 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
14754 }
14755 if let Some(if_match) = &this.if_match {
14756 req.insert_header("if-match", if_match);
14757 }
14758 if let Some(if_none_match) = &this.if_none_match {
14759 req.insert_header("if-none-match", if_none_match);
14760 }
14761 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
14762 req.insert_header("x-ms-if-tags", x_ms_if_tags);
14763 }
14764 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
14765 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
14766 }
14767 if let Some(x_ms_tags) = &this.x_ms_tags {
14768 req.insert_header("x-ms-tags", x_ms_tags);
14769 }
14770 if let Some(x_ms_immutability_policy_until_date) = &this.x_ms_immutability_policy_until_date {
14771 req.insert_header(
14772 "x-ms-immutability-policy-until-date",
14773 x_ms_immutability_policy_until_date.to_string(),
14774 );
14775 }
14776 if let Some(x_ms_immutability_policy_mode) = &this.x_ms_immutability_policy_mode {
14777 req.insert_header("x-ms-immutability-policy-mode", x_ms_immutability_policy_mode);
14778 }
14779 if let Some(x_ms_legal_hold) = &this.x_ms_legal_hold {
14780 req.insert_header("x-ms-legal-hold", x_ms_legal_hold.to_string());
14781 }
14782 if let Some(x_ms_content_crc64) = &this.x_ms_content_crc64 {
14783 req.insert_header("x-ms-content-crc64", x_ms_content_crc64);
14784 }
14785 req.set_body(req_body);
14786 Ok(Response(this.client.send(&mut req).await?))
14787 }
14788 })
14789 }
14790 fn url(&self) -> azure_core::Result<azure_core::Url> {
14791 let mut url = self.client.endpoint().clone();
14792 url.set_path(&format!("/{}/{}?BlockBlob", &self.container_name, &self.blob));
14793 Ok(url)
14794 }
14795 }
14796 }
14797 pub mod put_blob_from_url {
14798 use super::models;
14799 #[cfg(not(target_arch = "wasm32"))]
14800 use futures::future::BoxFuture;
14801 #[cfg(target_arch = "wasm32")]
14802 use futures::future::LocalBoxFuture as BoxFuture;
14803 #[derive(Debug)]
14804 pub struct Response(azure_core::Response);
14805 impl Response {
14806 pub fn into_raw_response(self) -> azure_core::Response {
14807 self.0
14808 }
14809 pub fn as_raw_response(&self) -> &azure_core::Response {
14810 &self.0
14811 }
14812 pub fn headers(&self) -> Headers {
14813 Headers(self.0.headers())
14814 }
14815 }
14816 impl From<Response> for azure_core::Response {
14817 fn from(rsp: Response) -> Self {
14818 rsp.into_raw_response()
14819 }
14820 }
14821 impl AsRef<azure_core::Response> for Response {
14822 fn as_ref(&self) -> &azure_core::Response {
14823 self.as_raw_response()
14824 }
14825 }
14826 pub struct Headers<'a>(&'a azure_core::headers::Headers);
14827 impl<'a> Headers<'a> {
14828 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
14829 pub fn e_tag(&self) -> azure_core::Result<&str> {
14830 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
14831 }
14832 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
14833 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
14834 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
14835 }
14836 #[doc = "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."]
14837 pub fn content_md5(&self) -> azure_core::Result<&str> {
14838 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
14839 }
14840 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
14841 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
14842 self.0
14843 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
14844 }
14845 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
14846 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
14847 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
14848 }
14849 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
14850 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
14851 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
14852 }
14853 #[doc = "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."]
14854 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
14855 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
14856 }
14857 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
14858 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
14859 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
14860 }
14861 #[doc = "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."]
14862 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
14863 self.0
14864 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
14865 }
14866 #[doc = "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."]
14867 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
14868 self.0
14869 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
14870 }
14871 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
14872 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
14873 self.0
14874 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
14875 }
14876 }
14877 #[derive(Clone)]
14878 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
14879 #[doc = r""]
14880 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
14881 #[doc = r" parameters can be chained."]
14882 #[doc = r""]
14883 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
14884 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
14885 #[doc = r" executes the request and returns a `Result` with the parsed"]
14886 #[doc = r" response."]
14887 #[doc = r""]
14888 #[doc = r" In order to execute the request without polling the service"]
14889 #[doc = r" until the operation completes, use `.send().await` instead."]
14890 #[doc = r""]
14891 #[doc = r" If you need lower-level access to the raw response details"]
14892 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
14893 #[doc = r" can finalize the request using the"]
14894 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
14895 #[doc = r" that resolves to a lower-level [`Response`] value."]
14896 pub struct RequestBuilder {
14897 pub(crate) client: super::super::Client,
14898 pub(crate) container_name: String,
14899 pub(crate) blob: String,
14900 pub(crate) x_ms_blob_type: String,
14901 pub(crate) content_length: i64,
14902 pub(crate) x_ms_copy_source: String,
14903 pub(crate) timeout: Option<i64>,
14904 pub(crate) content_md5: Option<String>,
14905 pub(crate) x_ms_blob_content_type: Option<String>,
14906 pub(crate) x_ms_blob_content_encoding: Option<String>,
14907 pub(crate) x_ms_blob_content_language: Option<String>,
14908 pub(crate) x_ms_blob_content_md5: Option<String>,
14909 pub(crate) x_ms_blob_cache_control: Option<String>,
14910 pub(crate) x_ms_meta: Option<String>,
14911 pub(crate) x_ms_lease_id: Option<String>,
14912 pub(crate) x_ms_blob_content_disposition: Option<String>,
14913 pub(crate) x_ms_encryption_key: Option<String>,
14914 pub(crate) x_ms_encryption_key_sha256: Option<String>,
14915 pub(crate) x_ms_encryption_algorithm: Option<String>,
14916 pub(crate) x_ms_encryption_scope: Option<String>,
14917 pub(crate) x_ms_access_tier: Option<String>,
14918 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
14919 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
14920 pub(crate) if_match: Option<String>,
14921 pub(crate) if_none_match: Option<String>,
14922 pub(crate) x_ms_if_tags: Option<String>,
14923 pub(crate) x_ms_source_if_modified_since: Option<::time::OffsetDateTime>,
14924 pub(crate) x_ms_source_if_unmodified_since: Option<::time::OffsetDateTime>,
14925 pub(crate) x_ms_source_if_match: Option<String>,
14926 pub(crate) x_ms_source_if_none_match: Option<String>,
14927 pub(crate) x_ms_source_if_tags: Option<String>,
14928 pub(crate) x_ms_client_request_id: Option<String>,
14929 pub(crate) x_ms_source_content_md5: Option<String>,
14930 pub(crate) x_ms_tags: Option<String>,
14931 pub(crate) x_ms_copy_source_blob_properties: Option<bool>,
14932 pub(crate) x_ms_copy_source_authorization: Option<String>,
14933 pub(crate) x_ms_copy_source_tag_option: Option<String>,
14934 }
14935 impl RequestBuilder {
14936 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
14937 pub fn timeout(mut self, timeout: i64) -> Self {
14938 self.timeout = Some(timeout);
14939 self
14940 }
14941 #[doc = "Specify the transactional md5 for the body, to be validated by the service."]
14942 pub fn content_md5(mut self, content_md5: impl Into<String>) -> Self {
14943 self.content_md5 = Some(content_md5.into());
14944 self
14945 }
14946 #[doc = "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request."]
14947 pub fn x_ms_blob_content_type(mut self, x_ms_blob_content_type: impl Into<String>) -> Self {
14948 self.x_ms_blob_content_type = Some(x_ms_blob_content_type.into());
14949 self
14950 }
14951 #[doc = "Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request."]
14952 pub fn x_ms_blob_content_encoding(mut self, x_ms_blob_content_encoding: impl Into<String>) -> Self {
14953 self.x_ms_blob_content_encoding = Some(x_ms_blob_content_encoding.into());
14954 self
14955 }
14956 #[doc = "Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request."]
14957 pub fn x_ms_blob_content_language(mut self, x_ms_blob_content_language: impl Into<String>) -> Self {
14958 self.x_ms_blob_content_language = Some(x_ms_blob_content_language.into());
14959 self
14960 }
14961 #[doc = "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."]
14962 pub fn x_ms_blob_content_md5(mut self, x_ms_blob_content_md5: impl Into<String>) -> Self {
14963 self.x_ms_blob_content_md5 = Some(x_ms_blob_content_md5.into());
14964 self
14965 }
14966 #[doc = "Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request."]
14967 pub fn x_ms_blob_cache_control(mut self, x_ms_blob_cache_control: impl Into<String>) -> Self {
14968 self.x_ms_blob_cache_control = Some(x_ms_blob_cache_control.into());
14969 self
14970 }
14971 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
14972 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
14973 self.x_ms_meta = Some(x_ms_meta.into());
14974 self
14975 }
14976 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
14977 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
14978 self.x_ms_lease_id = Some(x_ms_lease_id.into());
14979 self
14980 }
14981 #[doc = "Optional. Sets the blob's Content-Disposition header."]
14982 pub fn x_ms_blob_content_disposition(mut self, x_ms_blob_content_disposition: impl Into<String>) -> Self {
14983 self.x_ms_blob_content_disposition = Some(x_ms_blob_content_disposition.into());
14984 self
14985 }
14986 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
14987 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
14988 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
14989 self
14990 }
14991 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
14992 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
14993 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
14994 self
14995 }
14996 #[doc = "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."]
14997 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
14998 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
14999 self
15000 }
15001 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
15002 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
15003 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
15004 self
15005 }
15006 #[doc = "Optional. Indicates the tier to be set on the blob."]
15007 pub fn x_ms_access_tier(mut self, x_ms_access_tier: impl Into<String>) -> Self {
15008 self.x_ms_access_tier = Some(x_ms_access_tier.into());
15009 self
15010 }
15011 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
15012 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
15013 self.if_modified_since = Some(if_modified_since.into());
15014 self
15015 }
15016 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
15017 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
15018 self.if_unmodified_since = Some(if_unmodified_since.into());
15019 self
15020 }
15021 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
15022 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
15023 self.if_match = Some(if_match.into());
15024 self
15025 }
15026 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
15027 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
15028 self.if_none_match = Some(if_none_match.into());
15029 self
15030 }
15031 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
15032 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
15033 self.x_ms_if_tags = Some(x_ms_if_tags.into());
15034 self
15035 }
15036 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
15037 pub fn x_ms_source_if_modified_since(mut self, x_ms_source_if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
15038 self.x_ms_source_if_modified_since = Some(x_ms_source_if_modified_since.into());
15039 self
15040 }
15041 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
15042 pub fn x_ms_source_if_unmodified_since(mut self, x_ms_source_if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
15043 self.x_ms_source_if_unmodified_since = Some(x_ms_source_if_unmodified_since.into());
15044 self
15045 }
15046 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
15047 pub fn x_ms_source_if_match(mut self, x_ms_source_if_match: impl Into<String>) -> Self {
15048 self.x_ms_source_if_match = Some(x_ms_source_if_match.into());
15049 self
15050 }
15051 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
15052 pub fn x_ms_source_if_none_match(mut self, x_ms_source_if_none_match: impl Into<String>) -> Self {
15053 self.x_ms_source_if_none_match = Some(x_ms_source_if_none_match.into());
15054 self
15055 }
15056 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
15057 pub fn x_ms_source_if_tags(mut self, x_ms_source_if_tags: impl Into<String>) -> Self {
15058 self.x_ms_source_if_tags = Some(x_ms_source_if_tags.into());
15059 self
15060 }
15061 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
15062 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
15063 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
15064 self
15065 }
15066 #[doc = "Specify the md5 calculated for the range of bytes that must be read from the copy source."]
15067 pub fn x_ms_source_content_md5(mut self, x_ms_source_content_md5: impl Into<String>) -> Self {
15068 self.x_ms_source_content_md5 = Some(x_ms_source_content_md5.into());
15069 self
15070 }
15071 #[doc = "Optional. Used to set blob tags in various blob operations."]
15072 pub fn x_ms_tags(mut self, x_ms_tags: impl Into<String>) -> Self {
15073 self.x_ms_tags = Some(x_ms_tags.into());
15074 self
15075 }
15076 #[doc = "Optional, default is true. Indicates if properties from the source blob should be copied."]
15077 pub fn x_ms_copy_source_blob_properties(mut self, x_ms_copy_source_blob_properties: bool) -> Self {
15078 self.x_ms_copy_source_blob_properties = Some(x_ms_copy_source_blob_properties);
15079 self
15080 }
15081 #[doc = "Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source."]
15082 pub fn x_ms_copy_source_authorization(mut self, x_ms_copy_source_authorization: impl Into<String>) -> Self {
15083 self.x_ms_copy_source_authorization = Some(x_ms_copy_source_authorization.into());
15084 self
15085 }
15086 #[doc = "Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags."]
15087 pub fn x_ms_copy_source_tag_option(mut self, x_ms_copy_source_tag_option: impl Into<String>) -> Self {
15088 self.x_ms_copy_source_tag_option = Some(x_ms_copy_source_tag_option.into());
15089 self
15090 }
15091 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15092 #[doc = ""]
15093 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15094 #[doc = "However, this function can provide more flexibility when required."]
15095 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15096 Box::pin({
15097 let this = self.clone();
15098 async move {
15099 let url = this.url()?;
15100 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
15101 let bearer_token = this.client.bearer_token().await?;
15102 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
15103 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
15104 req.insert_header("x-ms-blob-type", &this.x_ms_blob_type);
15105 if let Some(timeout) = &this.timeout {
15106 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
15107 }
15108 if let Some(content_md5) = &this.content_md5 {
15109 req.insert_header("content-md5", content_md5);
15110 }
15111 req.insert_header("content-length", this.content_length.to_string());
15112 if let Some(x_ms_blob_content_type) = &this.x_ms_blob_content_type {
15113 req.insert_header("x-ms-blob-content-type", x_ms_blob_content_type);
15114 }
15115 if let Some(x_ms_blob_content_encoding) = &this.x_ms_blob_content_encoding {
15116 req.insert_header("x-ms-blob-content-encoding", x_ms_blob_content_encoding);
15117 }
15118 if let Some(x_ms_blob_content_language) = &this.x_ms_blob_content_language {
15119 req.insert_header("x-ms-blob-content-language", x_ms_blob_content_language);
15120 }
15121 if let Some(x_ms_blob_content_md5) = &this.x_ms_blob_content_md5 {
15122 req.insert_header("x-ms-blob-content-md5", x_ms_blob_content_md5);
15123 }
15124 if let Some(x_ms_blob_cache_control) = &this.x_ms_blob_cache_control {
15125 req.insert_header("x-ms-blob-cache-control", x_ms_blob_cache_control);
15126 }
15127 if let Some(x_ms_meta) = &this.x_ms_meta {
15128 req.insert_header("x-ms-meta", x_ms_meta);
15129 }
15130 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
15131 req.insert_header("x-ms-lease-id", x_ms_lease_id);
15132 }
15133 if let Some(x_ms_blob_content_disposition) = &this.x_ms_blob_content_disposition {
15134 req.insert_header("x-ms-blob-content-disposition", x_ms_blob_content_disposition);
15135 }
15136 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
15137 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
15138 }
15139 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
15140 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
15141 }
15142 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
15143 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
15144 }
15145 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
15146 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
15147 }
15148 if let Some(x_ms_access_tier) = &this.x_ms_access_tier {
15149 req.insert_header("x-ms-access-tier", x_ms_access_tier);
15150 }
15151 if let Some(if_modified_since) = &this.if_modified_since {
15152 req.insert_header("if-modified-since", if_modified_since.to_string());
15153 }
15154 if let Some(if_unmodified_since) = &this.if_unmodified_since {
15155 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
15156 }
15157 if let Some(if_match) = &this.if_match {
15158 req.insert_header("if-match", if_match);
15159 }
15160 if let Some(if_none_match) = &this.if_none_match {
15161 req.insert_header("if-none-match", if_none_match);
15162 }
15163 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
15164 req.insert_header("x-ms-if-tags", x_ms_if_tags);
15165 }
15166 if let Some(x_ms_source_if_modified_since) = &this.x_ms_source_if_modified_since {
15167 req.insert_header("x-ms-source-if-modified-since", x_ms_source_if_modified_since.to_string());
15168 }
15169 if let Some(x_ms_source_if_unmodified_since) = &this.x_ms_source_if_unmodified_since {
15170 req.insert_header("x-ms-source-if-unmodified-since", x_ms_source_if_unmodified_since.to_string());
15171 }
15172 if let Some(x_ms_source_if_match) = &this.x_ms_source_if_match {
15173 req.insert_header("x-ms-source-if-match", x_ms_source_if_match);
15174 }
15175 if let Some(x_ms_source_if_none_match) = &this.x_ms_source_if_none_match {
15176 req.insert_header("x-ms-source-if-none-match", x_ms_source_if_none_match);
15177 }
15178 if let Some(x_ms_source_if_tags) = &this.x_ms_source_if_tags {
15179 req.insert_header("x-ms-source-if-tags", x_ms_source_if_tags);
15180 }
15181 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
15182 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
15183 }
15184 if let Some(x_ms_source_content_md5) = &this.x_ms_source_content_md5 {
15185 req.insert_header("x-ms-source-content-md5", x_ms_source_content_md5);
15186 }
15187 if let Some(x_ms_tags) = &this.x_ms_tags {
15188 req.insert_header("x-ms-tags", x_ms_tags);
15189 }
15190 req.insert_header("x-ms-copy-source", &this.x_ms_copy_source);
15191 if let Some(x_ms_copy_source_blob_properties) = &this.x_ms_copy_source_blob_properties {
15192 req.insert_header("x-ms-copy-source-blob-properties", x_ms_copy_source_blob_properties.to_string());
15193 }
15194 if let Some(x_ms_copy_source_authorization) = &this.x_ms_copy_source_authorization {
15195 req.insert_header("x-ms-copy-source-authorization", x_ms_copy_source_authorization);
15196 }
15197 if let Some(x_ms_copy_source_tag_option) = &this.x_ms_copy_source_tag_option {
15198 req.insert_header("x-ms-copy-source-tag-option", x_ms_copy_source_tag_option);
15199 }
15200 let req_body = azure_core::EMPTY_BODY;
15201 req.set_body(req_body);
15202 Ok(Response(this.client.send(&mut req).await?))
15203 }
15204 })
15205 }
15206 fn url(&self) -> azure_core::Result<azure_core::Url> {
15207 let mut url = self.client.endpoint().clone();
15208 url.set_path(&format!("/{}/{}?BlockBlob&fromUrl", &self.container_name, &self.blob));
15209 Ok(url)
15210 }
15211 }
15212 }
15213 pub mod stage_block {
15214 use super::models;
15215 #[cfg(not(target_arch = "wasm32"))]
15216 use futures::future::BoxFuture;
15217 #[cfg(target_arch = "wasm32")]
15218 use futures::future::LocalBoxFuture as BoxFuture;
15219 #[derive(Debug)]
15220 pub struct Response(azure_core::Response);
15221 impl Response {
15222 pub fn into_raw_response(self) -> azure_core::Response {
15223 self.0
15224 }
15225 pub fn as_raw_response(&self) -> &azure_core::Response {
15226 &self.0
15227 }
15228 pub fn headers(&self) -> Headers {
15229 Headers(self.0.headers())
15230 }
15231 }
15232 impl From<Response> for azure_core::Response {
15233 fn from(rsp: Response) -> Self {
15234 rsp.into_raw_response()
15235 }
15236 }
15237 impl AsRef<azure_core::Response> for Response {
15238 fn as_ref(&self) -> &azure_core::Response {
15239 self.as_raw_response()
15240 }
15241 }
15242 pub struct Headers<'a>(&'a azure_core::headers::Headers);
15243 impl<'a> Headers<'a> {
15244 #[doc = "This header is returned so that the client can check for message content integrity. The value of this header is computed by the Blob service; it is not necessarily the same value specified in the request headers."]
15245 pub fn content_md5(&self) -> azure_core::Result<&str> {
15246 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
15247 }
15248 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
15249 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
15250 self.0
15251 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
15252 }
15253 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
15254 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
15255 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
15256 }
15257 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
15258 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
15259 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
15260 }
15261 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
15262 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
15263 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
15264 }
15265 #[doc = "This header is returned so that the client can check for message content integrity. The value of this header is computed by the Blob service; it is not necessarily the same value specified in the request headers."]
15266 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
15267 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
15268 }
15269 #[doc = "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."]
15270 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
15271 self.0
15272 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
15273 }
15274 #[doc = "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key."]
15275 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
15276 self.0
15277 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
15278 }
15279 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
15280 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
15281 self.0
15282 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
15283 }
15284 }
15285 #[derive(Clone)]
15286 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15287 #[doc = r""]
15288 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15289 #[doc = r" parameters can be chained."]
15290 #[doc = r""]
15291 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15292 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
15293 #[doc = r" executes the request and returns a `Result` with the parsed"]
15294 #[doc = r" response."]
15295 #[doc = r""]
15296 #[doc = r" In order to execute the request without polling the service"]
15297 #[doc = r" until the operation completes, use `.send().await` instead."]
15298 #[doc = r""]
15299 #[doc = r" If you need lower-level access to the raw response details"]
15300 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15301 #[doc = r" can finalize the request using the"]
15302 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15303 #[doc = r" that resolves to a lower-level [`Response`] value."]
15304 pub struct RequestBuilder {
15305 pub(crate) client: super::super::Client,
15306 pub(crate) container_name: String,
15307 pub(crate) blob: String,
15308 pub(crate) blockid: String,
15309 pub(crate) content_length: i64,
15310 pub(crate) body: serde_json::Value,
15311 pub(crate) content_md5: Option<String>,
15312 pub(crate) x_ms_content_crc64: Option<String>,
15313 pub(crate) timeout: Option<i64>,
15314 pub(crate) x_ms_lease_id: Option<String>,
15315 pub(crate) x_ms_encryption_key: Option<String>,
15316 pub(crate) x_ms_encryption_key_sha256: Option<String>,
15317 pub(crate) x_ms_encryption_algorithm: Option<String>,
15318 pub(crate) x_ms_encryption_scope: Option<String>,
15319 pub(crate) x_ms_client_request_id: Option<String>,
15320 }
15321 impl RequestBuilder {
15322 #[doc = "Specify the transactional md5 for the body, to be validated by the service."]
15323 pub fn content_md5(mut self, content_md5: impl Into<String>) -> Self {
15324 self.content_md5 = Some(content_md5.into());
15325 self
15326 }
15327 #[doc = "Specify the transactional crc64 for the body, to be validated by the service."]
15328 pub fn x_ms_content_crc64(mut self, x_ms_content_crc64: impl Into<String>) -> Self {
15329 self.x_ms_content_crc64 = Some(x_ms_content_crc64.into());
15330 self
15331 }
15332 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
15333 pub fn timeout(mut self, timeout: i64) -> Self {
15334 self.timeout = Some(timeout);
15335 self
15336 }
15337 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
15338 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
15339 self.x_ms_lease_id = Some(x_ms_lease_id.into());
15340 self
15341 }
15342 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
15343 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
15344 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
15345 self
15346 }
15347 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
15348 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
15349 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
15350 self
15351 }
15352 #[doc = "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."]
15353 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
15354 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
15355 self
15356 }
15357 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
15358 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
15359 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
15360 self
15361 }
15362 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
15363 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
15364 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
15365 self
15366 }
15367 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15368 #[doc = ""]
15369 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15370 #[doc = "However, this function can provide more flexibility when required."]
15371 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15372 Box::pin({
15373 let this = self.clone();
15374 async move {
15375 let url = this.url()?;
15376 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
15377 let bearer_token = this.client.bearer_token().await?;
15378 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
15379 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
15380 let blockid = &this.blockid;
15381 req.url_mut().query_pairs_mut().append_pair("blockid", blockid);
15382 req.insert_header("content-length", this.content_length.to_string());
15383 if let Some(content_md5) = &this.content_md5 {
15384 req.insert_header("content-md5", content_md5);
15385 }
15386 if let Some(x_ms_content_crc64) = &this.x_ms_content_crc64 {
15387 req.insert_header("x-ms-content-crc64", x_ms_content_crc64);
15388 }
15389 req.insert_header("content-type", "application/octet-stream");
15390 let req_body = azure_core::to_json(&this.body)?;
15391 if let Some(timeout) = &this.timeout {
15392 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
15393 }
15394 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
15395 req.insert_header("x-ms-lease-id", x_ms_lease_id);
15396 }
15397 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
15398 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
15399 }
15400 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
15401 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
15402 }
15403 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
15404 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
15405 }
15406 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
15407 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
15408 }
15409 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
15410 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
15411 }
15412 req.set_body(req_body);
15413 Ok(Response(this.client.send(&mut req).await?))
15414 }
15415 })
15416 }
15417 fn url(&self) -> azure_core::Result<azure_core::Url> {
15418 let mut url = self.client.endpoint().clone();
15419 url.set_path(&format!("/{}/{}?comp=block", &self.container_name, &self.blob));
15420 Ok(url)
15421 }
15422 }
15423 }
15424 pub mod stage_block_from_url {
15425 use super::models;
15426 #[cfg(not(target_arch = "wasm32"))]
15427 use futures::future::BoxFuture;
15428 #[cfg(target_arch = "wasm32")]
15429 use futures::future::LocalBoxFuture as BoxFuture;
15430 #[derive(Debug)]
15431 pub struct Response(azure_core::Response);
15432 impl Response {
15433 pub fn into_raw_response(self) -> azure_core::Response {
15434 self.0
15435 }
15436 pub fn as_raw_response(&self) -> &azure_core::Response {
15437 &self.0
15438 }
15439 pub fn headers(&self) -> Headers {
15440 Headers(self.0.headers())
15441 }
15442 }
15443 impl From<Response> for azure_core::Response {
15444 fn from(rsp: Response) -> Self {
15445 rsp.into_raw_response()
15446 }
15447 }
15448 impl AsRef<azure_core::Response> for Response {
15449 fn as_ref(&self) -> &azure_core::Response {
15450 self.as_raw_response()
15451 }
15452 }
15453 pub struct Headers<'a>(&'a azure_core::headers::Headers);
15454 impl<'a> Headers<'a> {
15455 #[doc = "This header is returned so that the client can check for message content integrity. The value of this header is computed by the Blob service; it is not necessarily the same value specified in the request headers."]
15456 pub fn content_md5(&self) -> azure_core::Result<&str> {
15457 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
15458 }
15459 #[doc = "This header is returned so that the client can check for message content integrity. The value of this header is computed by the Blob service; it is not necessarily the same value specified in the request headers."]
15460 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
15461 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
15462 }
15463 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
15464 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
15465 self.0
15466 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
15467 }
15468 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
15469 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
15470 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
15471 }
15472 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
15473 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
15474 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
15475 }
15476 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
15477 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
15478 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
15479 }
15480 #[doc = "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."]
15481 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
15482 self.0
15483 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
15484 }
15485 #[doc = "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key."]
15486 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
15487 self.0
15488 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
15489 }
15490 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
15491 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
15492 self.0
15493 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
15494 }
15495 }
15496 #[derive(Clone)]
15497 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15498 #[doc = r""]
15499 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15500 #[doc = r" parameters can be chained."]
15501 #[doc = r""]
15502 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15503 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
15504 #[doc = r" executes the request and returns a `Result` with the parsed"]
15505 #[doc = r" response."]
15506 #[doc = r""]
15507 #[doc = r" In order to execute the request without polling the service"]
15508 #[doc = r" until the operation completes, use `.send().await` instead."]
15509 #[doc = r""]
15510 #[doc = r" If you need lower-level access to the raw response details"]
15511 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15512 #[doc = r" can finalize the request using the"]
15513 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15514 #[doc = r" that resolves to a lower-level [`Response`] value."]
15515 pub struct RequestBuilder {
15516 pub(crate) client: super::super::Client,
15517 pub(crate) container_name: String,
15518 pub(crate) blob: String,
15519 pub(crate) blockid: String,
15520 pub(crate) content_length: i64,
15521 pub(crate) x_ms_copy_source: String,
15522 pub(crate) x_ms_source_range: Option<String>,
15523 pub(crate) x_ms_source_content_md5: Option<String>,
15524 pub(crate) x_ms_source_content_crc64: Option<String>,
15525 pub(crate) timeout: Option<i64>,
15526 pub(crate) x_ms_encryption_key: Option<String>,
15527 pub(crate) x_ms_encryption_key_sha256: Option<String>,
15528 pub(crate) x_ms_encryption_algorithm: Option<String>,
15529 pub(crate) x_ms_encryption_scope: Option<String>,
15530 pub(crate) x_ms_lease_id: Option<String>,
15531 pub(crate) x_ms_source_if_modified_since: Option<::time::OffsetDateTime>,
15532 pub(crate) x_ms_source_if_unmodified_since: Option<::time::OffsetDateTime>,
15533 pub(crate) x_ms_source_if_match: Option<String>,
15534 pub(crate) x_ms_source_if_none_match: Option<String>,
15535 pub(crate) x_ms_client_request_id: Option<String>,
15536 pub(crate) x_ms_copy_source_authorization: Option<String>,
15537 }
15538 impl RequestBuilder {
15539 #[doc = "Bytes of source data in the specified range."]
15540 pub fn x_ms_source_range(mut self, x_ms_source_range: impl Into<String>) -> Self {
15541 self.x_ms_source_range = Some(x_ms_source_range.into());
15542 self
15543 }
15544 #[doc = "Specify the md5 calculated for the range of bytes that must be read from the copy source."]
15545 pub fn x_ms_source_content_md5(mut self, x_ms_source_content_md5: impl Into<String>) -> Self {
15546 self.x_ms_source_content_md5 = Some(x_ms_source_content_md5.into());
15547 self
15548 }
15549 #[doc = "Specify the crc64 calculated for the range of bytes that must be read from the copy source."]
15550 pub fn x_ms_source_content_crc64(mut self, x_ms_source_content_crc64: impl Into<String>) -> Self {
15551 self.x_ms_source_content_crc64 = Some(x_ms_source_content_crc64.into());
15552 self
15553 }
15554 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
15555 pub fn timeout(mut self, timeout: i64) -> Self {
15556 self.timeout = Some(timeout);
15557 self
15558 }
15559 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
15560 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
15561 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
15562 self
15563 }
15564 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
15565 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
15566 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
15567 self
15568 }
15569 #[doc = "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."]
15570 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
15571 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
15572 self
15573 }
15574 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
15575 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
15576 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
15577 self
15578 }
15579 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
15580 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
15581 self.x_ms_lease_id = Some(x_ms_lease_id.into());
15582 self
15583 }
15584 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
15585 pub fn x_ms_source_if_modified_since(mut self, x_ms_source_if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
15586 self.x_ms_source_if_modified_since = Some(x_ms_source_if_modified_since.into());
15587 self
15588 }
15589 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
15590 pub fn x_ms_source_if_unmodified_since(mut self, x_ms_source_if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
15591 self.x_ms_source_if_unmodified_since = Some(x_ms_source_if_unmodified_since.into());
15592 self
15593 }
15594 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
15595 pub fn x_ms_source_if_match(mut self, x_ms_source_if_match: impl Into<String>) -> Self {
15596 self.x_ms_source_if_match = Some(x_ms_source_if_match.into());
15597 self
15598 }
15599 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
15600 pub fn x_ms_source_if_none_match(mut self, x_ms_source_if_none_match: impl Into<String>) -> Self {
15601 self.x_ms_source_if_none_match = Some(x_ms_source_if_none_match.into());
15602 self
15603 }
15604 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
15605 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
15606 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
15607 self
15608 }
15609 #[doc = "Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source."]
15610 pub fn x_ms_copy_source_authorization(mut self, x_ms_copy_source_authorization: impl Into<String>) -> Self {
15611 self.x_ms_copy_source_authorization = Some(x_ms_copy_source_authorization.into());
15612 self
15613 }
15614 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15615 #[doc = ""]
15616 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15617 #[doc = "However, this function can provide more flexibility when required."]
15618 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15619 Box::pin({
15620 let this = self.clone();
15621 async move {
15622 let url = this.url()?;
15623 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
15624 let bearer_token = this.client.bearer_token().await?;
15625 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
15626 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
15627 let blockid = &this.blockid;
15628 req.url_mut().query_pairs_mut().append_pair("blockid", blockid);
15629 req.insert_header("content-length", this.content_length.to_string());
15630 req.insert_header("x-ms-copy-source", &this.x_ms_copy_source);
15631 if let Some(x_ms_source_range) = &this.x_ms_source_range {
15632 req.insert_header("x-ms-source-range", x_ms_source_range);
15633 }
15634 if let Some(x_ms_source_content_md5) = &this.x_ms_source_content_md5 {
15635 req.insert_header("x-ms-source-content-md5", x_ms_source_content_md5);
15636 }
15637 if let Some(x_ms_source_content_crc64) = &this.x_ms_source_content_crc64 {
15638 req.insert_header("x-ms-source-content-crc64", x_ms_source_content_crc64);
15639 }
15640 if let Some(timeout) = &this.timeout {
15641 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
15642 }
15643 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
15644 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
15645 }
15646 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
15647 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
15648 }
15649 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
15650 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
15651 }
15652 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
15653 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
15654 }
15655 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
15656 req.insert_header("x-ms-lease-id", x_ms_lease_id);
15657 }
15658 if let Some(x_ms_source_if_modified_since) = &this.x_ms_source_if_modified_since {
15659 req.insert_header("x-ms-source-if-modified-since", x_ms_source_if_modified_since.to_string());
15660 }
15661 if let Some(x_ms_source_if_unmodified_since) = &this.x_ms_source_if_unmodified_since {
15662 req.insert_header("x-ms-source-if-unmodified-since", x_ms_source_if_unmodified_since.to_string());
15663 }
15664 if let Some(x_ms_source_if_match) = &this.x_ms_source_if_match {
15665 req.insert_header("x-ms-source-if-match", x_ms_source_if_match);
15666 }
15667 if let Some(x_ms_source_if_none_match) = &this.x_ms_source_if_none_match {
15668 req.insert_header("x-ms-source-if-none-match", x_ms_source_if_none_match);
15669 }
15670 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
15671 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
15672 }
15673 if let Some(x_ms_copy_source_authorization) = &this.x_ms_copy_source_authorization {
15674 req.insert_header("x-ms-copy-source-authorization", x_ms_copy_source_authorization);
15675 }
15676 let req_body = azure_core::EMPTY_BODY;
15677 req.set_body(req_body);
15678 Ok(Response(this.client.send(&mut req).await?))
15679 }
15680 })
15681 }
15682 fn url(&self) -> azure_core::Result<azure_core::Url> {
15683 let mut url = self.client.endpoint().clone();
15684 url.set_path(&format!("/{}/{}?comp=block&fromURL", &self.container_name, &self.blob));
15685 Ok(url)
15686 }
15687 }
15688 }
15689 pub mod get_block_list {
15690 use super::models;
15691 #[cfg(not(target_arch = "wasm32"))]
15692 use futures::future::BoxFuture;
15693 #[cfg(target_arch = "wasm32")]
15694 use futures::future::LocalBoxFuture as BoxFuture;
15695 #[derive(Debug)]
15696 pub struct Response(azure_core::Response);
15697 impl Response {
15698 pub async fn into_body(self) -> azure_core::Result<models::BlockList> {
15699 let bytes = self.0.into_body().collect().await?;
15700 let body: models::BlockList = azure_core::xml::read_xml(&bytes)?;
15701 Ok(body)
15702 }
15703 pub fn into_raw_response(self) -> azure_core::Response {
15704 self.0
15705 }
15706 pub fn as_raw_response(&self) -> &azure_core::Response {
15707 &self.0
15708 }
15709 pub fn headers(&self) -> Headers {
15710 Headers(self.0.headers())
15711 }
15712 }
15713 impl From<Response> for azure_core::Response {
15714 fn from(rsp: Response) -> Self {
15715 rsp.into_raw_response()
15716 }
15717 }
15718 impl AsRef<azure_core::Response> for Response {
15719 fn as_ref(&self) -> &azure_core::Response {
15720 self.as_raw_response()
15721 }
15722 }
15723 pub struct Headers<'a>(&'a azure_core::headers::Headers);
15724 impl<'a> Headers<'a> {
15725 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
15726 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
15727 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
15728 }
15729 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
15730 pub fn e_tag(&self) -> azure_core::Result<&str> {
15731 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
15732 }
15733 #[doc = "The media type of the body of the response. For Get Block List this is 'application/xml'"]
15734 pub fn content_type(&self) -> azure_core::Result<&str> {
15735 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-type"))
15736 }
15737 #[doc = "The size of the blob in bytes."]
15738 pub fn x_ms_blob_content_length(&self) -> azure_core::Result<i64> {
15739 self.0
15740 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-blob-content-length"))
15741 }
15742 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
15743 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
15744 self.0
15745 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
15746 }
15747 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
15748 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
15749 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
15750 }
15751 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
15752 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
15753 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
15754 }
15755 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
15756 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
15757 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
15758 }
15759 }
15760 #[derive(Clone)]
15761 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15762 #[doc = r""]
15763 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15764 #[doc = r" parameters can be chained."]
15765 #[doc = r""]
15766 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15767 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
15768 #[doc = r" executes the request and returns a `Result` with the parsed"]
15769 #[doc = r" response."]
15770 #[doc = r""]
15771 #[doc = r" In order to execute the request without polling the service"]
15772 #[doc = r" until the operation completes, use `.send().await` instead."]
15773 #[doc = r""]
15774 #[doc = r" If you need lower-level access to the raw response details"]
15775 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15776 #[doc = r" can finalize the request using the"]
15777 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15778 #[doc = r" that resolves to a lower-level [`Response`] value."]
15779 pub struct RequestBuilder {
15780 pub(crate) client: super::super::Client,
15781 pub(crate) container_name: String,
15782 pub(crate) blob: String,
15783 pub(crate) blocklisttype: String,
15784 pub(crate) snapshot: Option<String>,
15785 pub(crate) timeout: Option<i64>,
15786 pub(crate) x_ms_lease_id: Option<String>,
15787 pub(crate) x_ms_if_tags: Option<String>,
15788 pub(crate) x_ms_client_request_id: Option<String>,
15789 }
15790 impl RequestBuilder {
15791 #[doc = "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 <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob\">Creating a Snapshot of a Blob.</a>"]
15792 pub fn snapshot(mut self, snapshot: impl Into<String>) -> Self {
15793 self.snapshot = Some(snapshot.into());
15794 self
15795 }
15796 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
15797 pub fn timeout(mut self, timeout: i64) -> Self {
15798 self.timeout = Some(timeout);
15799 self
15800 }
15801 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
15802 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
15803 self.x_ms_lease_id = Some(x_ms_lease_id.into());
15804 self
15805 }
15806 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
15807 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
15808 self.x_ms_if_tags = Some(x_ms_if_tags.into());
15809 self
15810 }
15811 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
15812 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
15813 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
15814 self
15815 }
15816 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15817 #[doc = ""]
15818 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15819 #[doc = "However, this function can provide more flexibility when required."]
15820 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15821 Box::pin({
15822 let this = self.clone();
15823 async move {
15824 let url = this.url()?;
15825 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
15826 let bearer_token = this.client.bearer_token().await?;
15827 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
15828 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
15829 if let Some(snapshot) = &this.snapshot {
15830 req.url_mut().query_pairs_mut().append_pair("snapshot", snapshot);
15831 }
15832 let blocklisttype = &this.blocklisttype;
15833 req.url_mut().query_pairs_mut().append_pair("blocklisttype", blocklisttype);
15834 if let Some(timeout) = &this.timeout {
15835 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
15836 }
15837 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
15838 req.insert_header("x-ms-lease-id", x_ms_lease_id);
15839 }
15840 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
15841 req.insert_header("x-ms-if-tags", x_ms_if_tags);
15842 }
15843 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
15844 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
15845 }
15846 let req_body = azure_core::EMPTY_BODY;
15847 req.set_body(req_body);
15848 Ok(Response(this.client.send(&mut req).await?))
15849 }
15850 })
15851 }
15852 fn url(&self) -> azure_core::Result<azure_core::Url> {
15853 let mut url = self.client.endpoint().clone();
15854 url.set_path(&format!("/{}/{}?comp=blocklist", &self.container_name, &self.blob));
15855 Ok(url)
15856 }
15857 }
15858 impl std::future::IntoFuture for RequestBuilder {
15859 type Output = azure_core::Result<models::BlockList>;
15860 type IntoFuture = BoxFuture<'static, azure_core::Result<models::BlockList>>;
15861 #[doc = "Returns a future that sends the request and returns the parsed response body."]
15862 #[doc = ""]
15863 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
15864 #[doc = ""]
15865 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
15866 fn into_future(self) -> Self::IntoFuture {
15867 Box::pin(async move { self.send().await?.into_body().await })
15868 }
15869 }
15870 }
15871 pub mod commit_block_list {
15872 use super::models;
15873 #[cfg(not(target_arch = "wasm32"))]
15874 use futures::future::BoxFuture;
15875 #[cfg(target_arch = "wasm32")]
15876 use futures::future::LocalBoxFuture as BoxFuture;
15877 #[derive(Debug)]
15878 pub struct Response(azure_core::Response);
15879 impl Response {
15880 pub fn into_raw_response(self) -> azure_core::Response {
15881 self.0
15882 }
15883 pub fn as_raw_response(&self) -> &azure_core::Response {
15884 &self.0
15885 }
15886 pub fn headers(&self) -> Headers {
15887 Headers(self.0.headers())
15888 }
15889 }
15890 impl From<Response> for azure_core::Response {
15891 fn from(rsp: Response) -> Self {
15892 rsp.into_raw_response()
15893 }
15894 }
15895 impl AsRef<azure_core::Response> for Response {
15896 fn as_ref(&self) -> &azure_core::Response {
15897 self.as_raw_response()
15898 }
15899 }
15900 pub struct Headers<'a>(&'a azure_core::headers::Headers);
15901 impl<'a> Headers<'a> {
15902 #[doc = "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."]
15903 pub fn e_tag(&self) -> azure_core::Result<&str> {
15904 self.0.get_str(&azure_core::headers::HeaderName::from_static("etag"))
15905 }
15906 #[doc = "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."]
15907 pub fn last_modified(&self) -> azure_core::Result<::time::OffsetDateTime> {
15908 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("last-modified"))?)
15909 }
15910 #[doc = "This header is returned so that the client can check for message content integrity. This header refers to the content of the request, meaning, in this case, the list of blocks, and not the content of the blob itself."]
15911 pub fn content_md5(&self) -> azure_core::Result<&str> {
15912 self.0.get_str(&azure_core::headers::HeaderName::from_static("content-md5"))
15913 }
15914 #[doc = "This header is returned so that the client can check for message content integrity. This header refers to the content of the request, meaning, in this case, the list of blocks, and not the content of the blob itself."]
15915 pub fn x_ms_content_crc64(&self) -> azure_core::Result<&str> {
15916 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-content-crc64"))
15917 }
15918 #[doc = "If a client request id header is sent in the request, this header will be present in the response with the same value."]
15919 pub fn x_ms_client_request_id(&self) -> azure_core::Result<&str> {
15920 self.0
15921 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-client-request-id"))
15922 }
15923 #[doc = "This header uniquely identifies the request that was made and can be used for troubleshooting the request."]
15924 pub fn x_ms_request_id(&self) -> azure_core::Result<&str> {
15925 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-request-id"))
15926 }
15927 #[doc = "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."]
15928 pub fn x_ms_version(&self) -> azure_core::Result<&str> {
15929 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version"))
15930 }
15931 #[doc = "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."]
15932 pub fn x_ms_version_id(&self) -> azure_core::Result<&str> {
15933 self.0.get_str(&azure_core::headers::HeaderName::from_static("x-ms-version-id"))
15934 }
15935 #[doc = "UTC date/time value generated by the service that indicates the time at which the response was initiated"]
15936 pub fn date(&self) -> azure_core::Result<::time::OffsetDateTime> {
15937 azure_core::date::parse_rfc1123(self.0.get_str(&azure_core::headers::HeaderName::from_static("date"))?)
15938 }
15939 #[doc = "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."]
15940 pub fn x_ms_request_server_encrypted(&self) -> azure_core::Result<bool> {
15941 self.0
15942 .get_as(&azure_core::headers::HeaderName::from_static("x-ms-request-server-encrypted"))
15943 }
15944 #[doc = "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."]
15945 pub fn x_ms_encryption_key_sha256(&self) -> azure_core::Result<&str> {
15946 self.0
15947 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-key-sha256"))
15948 }
15949 #[doc = "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."]
15950 pub fn x_ms_encryption_scope(&self) -> azure_core::Result<&str> {
15951 self.0
15952 .get_str(&azure_core::headers::HeaderName::from_static("x-ms-encryption-scope"))
15953 }
15954 }
15955 #[derive(Clone)]
15956 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15957 #[doc = r""]
15958 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15959 #[doc = r" parameters can be chained."]
15960 #[doc = r""]
15961 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15962 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
15963 #[doc = r" executes the request and returns a `Result` with the parsed"]
15964 #[doc = r" response."]
15965 #[doc = r""]
15966 #[doc = r" In order to execute the request without polling the service"]
15967 #[doc = r" until the operation completes, use `.send().await` instead."]
15968 #[doc = r""]
15969 #[doc = r" If you need lower-level access to the raw response details"]
15970 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15971 #[doc = r" can finalize the request using the"]
15972 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15973 #[doc = r" that resolves to a lower-level [`Response`] value."]
15974 pub struct RequestBuilder {
15975 pub(crate) client: super::super::Client,
15976 pub(crate) container_name: String,
15977 pub(crate) blob: String,
15978 pub(crate) blocks: models::BlockLookupList,
15979 pub(crate) timeout: Option<i64>,
15980 pub(crate) x_ms_blob_cache_control: Option<String>,
15981 pub(crate) x_ms_blob_content_type: Option<String>,
15982 pub(crate) x_ms_blob_content_encoding: Option<String>,
15983 pub(crate) x_ms_blob_content_language: Option<String>,
15984 pub(crate) x_ms_blob_content_md5: Option<String>,
15985 pub(crate) content_md5: Option<String>,
15986 pub(crate) x_ms_content_crc64: Option<String>,
15987 pub(crate) x_ms_meta: Option<String>,
15988 pub(crate) x_ms_lease_id: Option<String>,
15989 pub(crate) x_ms_blob_content_disposition: Option<String>,
15990 pub(crate) x_ms_encryption_key: Option<String>,
15991 pub(crate) x_ms_encryption_key_sha256: Option<String>,
15992 pub(crate) x_ms_encryption_algorithm: Option<String>,
15993 pub(crate) x_ms_encryption_scope: Option<String>,
15994 pub(crate) x_ms_access_tier: Option<String>,
15995 pub(crate) if_modified_since: Option<::time::OffsetDateTime>,
15996 pub(crate) if_unmodified_since: Option<::time::OffsetDateTime>,
15997 pub(crate) if_match: Option<String>,
15998 pub(crate) if_none_match: Option<String>,
15999 pub(crate) x_ms_if_tags: Option<String>,
16000 pub(crate) x_ms_client_request_id: Option<String>,
16001 pub(crate) x_ms_tags: Option<String>,
16002 pub(crate) x_ms_immutability_policy_until_date: Option<::time::OffsetDateTime>,
16003 pub(crate) x_ms_immutability_policy_mode: Option<String>,
16004 pub(crate) x_ms_legal_hold: Option<bool>,
16005 }
16006 impl RequestBuilder {
16007 #[doc = "The timeout parameter is expressed in seconds. For more information, see <a href=\"https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations\">Setting Timeouts for Blob Service Operations.</a>"]
16008 pub fn timeout(mut self, timeout: i64) -> Self {
16009 self.timeout = Some(timeout);
16010 self
16011 }
16012 #[doc = "Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request."]
16013 pub fn x_ms_blob_cache_control(mut self, x_ms_blob_cache_control: impl Into<String>) -> Self {
16014 self.x_ms_blob_cache_control = Some(x_ms_blob_cache_control.into());
16015 self
16016 }
16017 #[doc = "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request."]
16018 pub fn x_ms_blob_content_type(mut self, x_ms_blob_content_type: impl Into<String>) -> Self {
16019 self.x_ms_blob_content_type = Some(x_ms_blob_content_type.into());
16020 self
16021 }
16022 #[doc = "Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request."]
16023 pub fn x_ms_blob_content_encoding(mut self, x_ms_blob_content_encoding: impl Into<String>) -> Self {
16024 self.x_ms_blob_content_encoding = Some(x_ms_blob_content_encoding.into());
16025 self
16026 }
16027 #[doc = "Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request."]
16028 pub fn x_ms_blob_content_language(mut self, x_ms_blob_content_language: impl Into<String>) -> Self {
16029 self.x_ms_blob_content_language = Some(x_ms_blob_content_language.into());
16030 self
16031 }
16032 #[doc = "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."]
16033 pub fn x_ms_blob_content_md5(mut self, x_ms_blob_content_md5: impl Into<String>) -> Self {
16034 self.x_ms_blob_content_md5 = Some(x_ms_blob_content_md5.into());
16035 self
16036 }
16037 #[doc = "Specify the transactional md5 for the body, to be validated by the service."]
16038 pub fn content_md5(mut self, content_md5: impl Into<String>) -> Self {
16039 self.content_md5 = Some(content_md5.into());
16040 self
16041 }
16042 #[doc = "Specify the transactional crc64 for the body, to be validated by the service."]
16043 pub fn x_ms_content_crc64(mut self, x_ms_content_crc64: impl Into<String>) -> Self {
16044 self.x_ms_content_crc64 = Some(x_ms_content_crc64.into());
16045 self
16046 }
16047 #[doc = "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information."]
16048 pub fn x_ms_meta(mut self, x_ms_meta: impl Into<String>) -> Self {
16049 self.x_ms_meta = Some(x_ms_meta.into());
16050 self
16051 }
16052 #[doc = "If specified, the operation only succeeds if the resource's lease is active and matches this ID."]
16053 pub fn x_ms_lease_id(mut self, x_ms_lease_id: impl Into<String>) -> Self {
16054 self.x_ms_lease_id = Some(x_ms_lease_id.into());
16055 self
16056 }
16057 #[doc = "Optional. Sets the blob's Content-Disposition header."]
16058 pub fn x_ms_blob_content_disposition(mut self, x_ms_blob_content_disposition: impl Into<String>) -> Self {
16059 self.x_ms_blob_content_disposition = Some(x_ms_blob_content_disposition.into());
16060 self
16061 }
16062 #[doc = "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services."]
16063 pub fn x_ms_encryption_key(mut self, x_ms_encryption_key: impl Into<String>) -> Self {
16064 self.x_ms_encryption_key = Some(x_ms_encryption_key.into());
16065 self
16066 }
16067 #[doc = "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided."]
16068 pub fn x_ms_encryption_key_sha256(mut self, x_ms_encryption_key_sha256: impl Into<String>) -> Self {
16069 self.x_ms_encryption_key_sha256 = Some(x_ms_encryption_key_sha256.into());
16070 self
16071 }
16072 #[doc = "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."]
16073 pub fn x_ms_encryption_algorithm(mut self, x_ms_encryption_algorithm: impl Into<String>) -> Self {
16074 self.x_ms_encryption_algorithm = Some(x_ms_encryption_algorithm.into());
16075 self
16076 }
16077 #[doc = "Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services."]
16078 pub fn x_ms_encryption_scope(mut self, x_ms_encryption_scope: impl Into<String>) -> Self {
16079 self.x_ms_encryption_scope = Some(x_ms_encryption_scope.into());
16080 self
16081 }
16082 #[doc = "Optional. Indicates the tier to be set on the blob."]
16083 pub fn x_ms_access_tier(mut self, x_ms_access_tier: impl Into<String>) -> Self {
16084 self.x_ms_access_tier = Some(x_ms_access_tier.into());
16085 self
16086 }
16087 #[doc = "Specify this header value to operate only on a blob if it has been modified since the specified date/time."]
16088 pub fn if_modified_since(mut self, if_modified_since: impl Into<::time::OffsetDateTime>) -> Self {
16089 self.if_modified_since = Some(if_modified_since.into());
16090 self
16091 }
16092 #[doc = "Specify this header value to operate only on a blob if it has not been modified since the specified date/time."]
16093 pub fn if_unmodified_since(mut self, if_unmodified_since: impl Into<::time::OffsetDateTime>) -> Self {
16094 self.if_unmodified_since = Some(if_unmodified_since.into());
16095 self
16096 }
16097 #[doc = "Specify an ETag value to operate only on blobs with a matching value."]
16098 pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
16099 self.if_match = Some(if_match.into());
16100 self
16101 }
16102 #[doc = "Specify an ETag value to operate only on blobs without a matching value."]
16103 pub fn if_none_match(mut self, if_none_match: impl Into<String>) -> Self {
16104 self.if_none_match = Some(if_none_match.into());
16105 self
16106 }
16107 #[doc = "Specify a SQL where clause on blob tags to operate only on blobs with a matching value."]
16108 pub fn x_ms_if_tags(mut self, x_ms_if_tags: impl Into<String>) -> Self {
16109 self.x_ms_if_tags = Some(x_ms_if_tags.into());
16110 self
16111 }
16112 #[doc = "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled."]
16113 pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into<String>) -> Self {
16114 self.x_ms_client_request_id = Some(x_ms_client_request_id.into());
16115 self
16116 }
16117 #[doc = "Optional. Used to set blob tags in various blob operations."]
16118 pub fn x_ms_tags(mut self, x_ms_tags: impl Into<String>) -> Self {
16119 self.x_ms_tags = Some(x_ms_tags.into());
16120 self
16121 }
16122 #[doc = "Specifies the date time when the blobs immutability policy is set to expire."]
16123 pub fn x_ms_immutability_policy_until_date(
16124 mut self,
16125 x_ms_immutability_policy_until_date: impl Into<::time::OffsetDateTime>,
16126 ) -> Self {
16127 self.x_ms_immutability_policy_until_date = Some(x_ms_immutability_policy_until_date.into());
16128 self
16129 }
16130 #[doc = "Specifies the immutability policy mode to set on the blob."]
16131 pub fn x_ms_immutability_policy_mode(mut self, x_ms_immutability_policy_mode: impl Into<String>) -> Self {
16132 self.x_ms_immutability_policy_mode = Some(x_ms_immutability_policy_mode.into());
16133 self
16134 }
16135 #[doc = "Specified if a legal hold should be set on the blob."]
16136 pub fn x_ms_legal_hold(mut self, x_ms_legal_hold: bool) -> Self {
16137 self.x_ms_legal_hold = Some(x_ms_legal_hold);
16138 self
16139 }
16140 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
16141 #[doc = ""]
16142 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
16143 #[doc = "However, this function can provide more flexibility when required."]
16144 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
16145 Box::pin({
16146 let this = self.clone();
16147 async move {
16148 let url = this.url()?;
16149 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
16150 let bearer_token = this.client.bearer_token().await?;
16151 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
16152 req.insert_header(azure_core::headers::VERSION, "2021-12-02");
16153 if let Some(timeout) = &this.timeout {
16154 req.url_mut().query_pairs_mut().append_pair("timeout", &timeout.to_string());
16155 }
16156 if let Some(x_ms_blob_cache_control) = &this.x_ms_blob_cache_control {
16157 req.insert_header("x-ms-blob-cache-control", x_ms_blob_cache_control);
16158 }
16159 if let Some(x_ms_blob_content_type) = &this.x_ms_blob_content_type {
16160 req.insert_header("x-ms-blob-content-type", x_ms_blob_content_type);
16161 }
16162 if let Some(x_ms_blob_content_encoding) = &this.x_ms_blob_content_encoding {
16163 req.insert_header("x-ms-blob-content-encoding", x_ms_blob_content_encoding);
16164 }
16165 if let Some(x_ms_blob_content_language) = &this.x_ms_blob_content_language {
16166 req.insert_header("x-ms-blob-content-language", x_ms_blob_content_language);
16167 }
16168 if let Some(x_ms_blob_content_md5) = &this.x_ms_blob_content_md5 {
16169 req.insert_header("x-ms-blob-content-md5", x_ms_blob_content_md5);
16170 }
16171 if let Some(content_md5) = &this.content_md5 {
16172 req.insert_header("content-md5", content_md5);
16173 }
16174 if let Some(x_ms_content_crc64) = &this.x_ms_content_crc64 {
16175 req.insert_header("x-ms-content-crc64", x_ms_content_crc64);
16176 }
16177 if let Some(x_ms_meta) = &this.x_ms_meta {
16178 req.insert_header("x-ms-meta", x_ms_meta);
16179 }
16180 if let Some(x_ms_lease_id) = &this.x_ms_lease_id {
16181 req.insert_header("x-ms-lease-id", x_ms_lease_id);
16182 }
16183 if let Some(x_ms_blob_content_disposition) = &this.x_ms_blob_content_disposition {
16184 req.insert_header("x-ms-blob-content-disposition", x_ms_blob_content_disposition);
16185 }
16186 if let Some(x_ms_encryption_key) = &this.x_ms_encryption_key {
16187 req.insert_header("x-ms-encryption-key", x_ms_encryption_key);
16188 }
16189 if let Some(x_ms_encryption_key_sha256) = &this.x_ms_encryption_key_sha256 {
16190 req.insert_header("x-ms-encryption-key-sha256", x_ms_encryption_key_sha256);
16191 }
16192 if let Some(x_ms_encryption_algorithm) = &this.x_ms_encryption_algorithm {
16193 req.insert_header("x-ms-encryption-algorithm", x_ms_encryption_algorithm);
16194 }
16195 if let Some(x_ms_encryption_scope) = &this.x_ms_encryption_scope {
16196 req.insert_header("x-ms-encryption-scope", x_ms_encryption_scope);
16197 }
16198 if let Some(x_ms_access_tier) = &this.x_ms_access_tier {
16199 req.insert_header("x-ms-access-tier", x_ms_access_tier);
16200 }
16201 if let Some(if_modified_since) = &this.if_modified_since {
16202 req.insert_header("if-modified-since", if_modified_since.to_string());
16203 }
16204 if let Some(if_unmodified_since) = &this.if_unmodified_since {
16205 req.insert_header("if-unmodified-since", if_unmodified_since.to_string());
16206 }
16207 if let Some(if_match) = &this.if_match {
16208 req.insert_header("if-match", if_match);
16209 }
16210 if let Some(if_none_match) = &this.if_none_match {
16211 req.insert_header("if-none-match", if_none_match);
16212 }
16213 if let Some(x_ms_if_tags) = &this.x_ms_if_tags {
16214 req.insert_header("x-ms-if-tags", x_ms_if_tags);
16215 }
16216 req.insert_header("content-type", "application/xml");
16217 let req_body = azure_core::xml::to_xml(&this.blocks)?;
16218 if let Some(x_ms_client_request_id) = &this.x_ms_client_request_id {
16219 req.insert_header("x-ms-client-request-id", x_ms_client_request_id);
16220 }
16221 if let Some(x_ms_tags) = &this.x_ms_tags {
16222 req.insert_header("x-ms-tags", x_ms_tags);
16223 }
16224 if let Some(x_ms_immutability_policy_until_date) = &this.x_ms_immutability_policy_until_date {
16225 req.insert_header(
16226 "x-ms-immutability-policy-until-date",
16227 x_ms_immutability_policy_until_date.to_string(),
16228 );
16229 }
16230 if let Some(x_ms_immutability_policy_mode) = &this.x_ms_immutability_policy_mode {
16231 req.insert_header("x-ms-immutability-policy-mode", x_ms_immutability_policy_mode);
16232 }
16233 if let Some(x_ms_legal_hold) = &this.x_ms_legal_hold {
16234 req.insert_header("x-ms-legal-hold", x_ms_legal_hold.to_string());
16235 }
16236 req.set_body(req_body);
16237 Ok(Response(this.client.send(&mut req).await?))
16238 }
16239 })
16240 }
16241 fn url(&self) -> azure_core::Result<azure_core::Url> {
16242 let mut url = self.client.endpoint().clone();
16243 url.set_path(&format!("/{}/{}?comp=blocklist", &self.container_name, &self.blob));
16244 Ok(url)
16245 }
16246 }
16247 }
16248}