azure_storage_blobs/container/operations/
get_acl.rs1use crate::{container::public_access_from_header, prelude::*};
2use azure_core::{date, headers::*, prelude::*, Method, RequestId, Response};
3use time::OffsetDateTime;
4
5operation! {
6 GetACL,
7 client: ContainerClient,
8 ?lease_id: LeaseId
9}
10
11impl GetACLBuilder {
12 pub fn into_future(mut self) -> GetACL {
13 Box::pin(async move {
14 let url = self.client.url()?;
15
16 let mut headers = Headers::new();
17 headers.add(self.lease_id);
18
19 let mut request = ContainerClient::finalize_request(url, Method::Get, headers, None)?;
20
21 let response = self.client.send(&mut self.context, &mut request).await?;
22 GetACLResponse::from_response(response).await
23 })
24 }
25}
26
27#[derive(Debug, Clone)]
28pub struct GetACLResponse {
29 pub public_access: PublicAccess,
30 pub etag: String,
31 pub last_modified: OffsetDateTime,
32 pub request_id: RequestId,
33 pub date: OffsetDateTime,
34 pub stored_access_policy_list: StoredAccessPolicyList,
35}
36
37impl GetACLResponse {
38 pub(crate) async fn from_response(response: Response) -> azure_core::Result<GetACLResponse> {
40 let (_, headers, body) = response.deconstruct();
41 let body = body.collect().await?;
42
43 let public_access = public_access_from_header(&headers)?;
45
46 let etag = headers.get_as(&ETAG)?;
47
48 let last_modified = headers.get_str(&LAST_MODIFIED)?;
49 let last_modified = date::parse_rfc1123(last_modified)?;
50
51 let request_id = headers.get_as(&REQUEST_ID)?;
52
53 let date = headers.get_str(&DATE)?;
54 let date = date::parse_rfc1123(date)?;
55
56 let stored_access_policy_list = StoredAccessPolicyList::from_xml(&body)?;
57
58 Ok(GetACLResponse {
59 public_access,
60 etag,
61 last_modified,
62 request_id,
63 date,
64 stored_access_policy_list,
65 })
66 }
67}