azure_storage_blobs/service/operations/
get_account_information.rs

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