azure_storage_blobs/container/operations/
set_acl.rs1use crate::{container::public_access_from_header, prelude::*};
2use azure_core::{headers::*, prelude::*, Body, Method};
3
4operation! {
5 SetACL,
6 client: ContainerClient,
7 public_access: PublicAccess,
8 ?if_modified_since: IfModifiedSinceCondition,
9 ?stored_access_policy_list: StoredAccessPolicyList,
10 ?lease_id: LeaseId
11}
12
13impl SetACLBuilder {
14 pub fn into_future(mut self) -> SetACL {
15 Box::pin(async move {
16 let mut url = self.client.url()?;
17
18 url.query_pairs_mut().append_pair("restype", "container");
19 url.query_pairs_mut().append_pair("comp", "acl");
20
21 let xml = self.stored_access_policy_list.map(|xml| xml.to_xml());
22
23 let mut headers = Headers::new();
24 for (name, value) in self.public_access.as_headers() {
25 headers.insert(name, value);
26 }
27 headers.add(self.lease_id);
28 headers.add(self.if_modified_since);
29
30 let mut request =
31 ContainerClient::finalize_request(url, Method::Put, headers, xml.map(Body::from))?;
32
33 let response = self.client.send(&mut self.context, &mut request).await?;
34
35 public_access_from_header(response.headers())
36 })
37 }
38}
39
40type SetACLResponse = PublicAccess;