azure_storage_blobs/blob/operations/
set_expiry.rs1use crate::prelude::*;
2use azure_core::{headers::*, prelude::*, RequestId, Response};
3
4operation! {
5 SetBlobExpiry,
6 client: BlobClient,
7 blob_expiry: BlobExpiry,
8 ?lease_id: LeaseId
9}
10
11impl SetBlobExpiryBuilder {
12 pub fn into_future(mut self) -> SetBlobExpiry {
13 Box::pin(async move {
14 let mut url = self.client.url()?;
15 url.query_pairs_mut().append_pair("comp", "expiry");
16
17 let mut headers = self.blob_expiry.to_headers();
18 headers.add(self.lease_id);
19
20 let mut request =
21 BlobClient::finalize_request(url, azure_core::Method::Put, headers, None)?;
22
23 let response = self.client.send(&mut self.context, &mut request).await?;
24 response.try_into()
25 })
26 }
27}
28
29#[derive(Debug, Clone)]
30pub struct SetBlobExpiryResponse {
31 pub request_id: RequestId,
32 pub client_request_id: Option<String>,
33 pub version: String,
34}
35
36impl TryFrom<Response> for SetBlobExpiryResponse {
37 type Error = azure_core::Error;
38
39 fn try_from(response: Response) -> Result<Self, Self::Error> {
40 let headers = response.headers();
41 Ok(SetBlobExpiryResponse {
42 request_id: request_id_from_headers(headers)?,
43 client_request_id: client_request_id_from_headers_optional(headers),
44 version: version_from_headers(headers)?,
45 })
46 }
47}