azure_storage_blobs/service/operations/
get_blob_service_properties.rs

1use crate::prelude::BlobServiceClient;
2use azure_core::headers::Headers;
3use azure_core::{Method, Response};
4use azure_storage::headers::CommonStorageResponseHeaders;
5use azure_svc_blobstorage::models::StorageServiceProperties;
6
7operation! {
8    GetBlobServiceProperties,
9    client: BlobServiceClient,
10}
11
12impl GetBlobServicePropertiesBuilder {
13    pub fn into_future(mut self) -> GetBlobServiceProperties {
14        Box::pin(async move {
15            let mut url = self.client.url()?;
16
17            url.query_pairs_mut()
18                .extend_pairs([("restype", "service"), ("comp", "properties")]);
19
20            let mut request =
21                BlobServiceClient::finalize_request(url, Method::Get, Headers::new(), None)?;
22
23            let response = self.client.send(&mut self.context, &mut request).await?;
24
25            GetBlobServicePropertiesResponse::try_from(response).await
26        })
27    }
28}
29
30#[derive(Debug, Clone)]
31pub struct GetBlobServicePropertiesResponse {
32    pub common: CommonStorageResponseHeaders,
33    pub properties: StorageServiceProperties,
34}
35
36impl GetBlobServicePropertiesResponse {
37    pub(crate) async fn try_from(
38        response: Response,
39    ) -> azure_core::Result<GetBlobServicePropertiesResponse> {
40        let common = CommonStorageResponseHeaders::try_from(response.headers())?;
41        let properties = response.xml().await?;
42
43        Ok(GetBlobServicePropertiesResponse { common, properties })
44    }
45}