Skip to main content

azure_sdk_cosmos/responses/
delete_user_defined_function_response.rs

1use crate::from_headers::*;
2use crate::ResourceQuota;
3use azure_sdk_core::errors::AzureError;
4use azure_sdk_core::session_token_from_headers;
5use chrono::{DateTime, Utc};
6use http::HeaderMap;
7
8#[derive(Debug, Clone, PartialEq)]
9pub struct DeleteUserDefinedFunctionResponse {
10    pub content_location: String,
11    pub server: String,
12    pub last_state_change: DateTime<Utc>,
13    pub resource_quota: Vec<ResourceQuota>,
14    pub resource_usage: Vec<ResourceQuota>,
15    pub lsn: u64,
16    pub schema_version: String,
17    pub alt_content_path: String,
18    pub content_path: String,
19    pub quorum_acked_lsn: u64,
20    pub current_write_quorum: u64,
21    pub current_replica_set_size: u64,
22    pub role: u32,
23    pub global_committed_lsn: u64,
24    pub number_of_read_regions: u32,
25    pub transport_request_id: u64,
26    pub cosmos_llsn: u64,
27    pub cosmos_quorum_acked_llsn: u64,
28    pub session_token: String,
29    pub charge: f64,
30    pub service_version: String,
31    pub activity_id: uuid::Uuid,
32    pub gateway_version: String,
33    pub date: DateTime<Utc>,
34}
35
36impl std::convert::TryFrom<(&HeaderMap, &[u8])> for DeleteUserDefinedFunctionResponse {
37    type Error = AzureError;
38    fn try_from(value: (&HeaderMap, &[u8])) -> Result<Self, Self::Error> {
39        let headers = value.0;
40        let _body = value.1;
41
42        debug!("{:#?}", headers);
43        debug!("{:#?}", std::str::from_utf8(_body));
44
45        Ok(Self {
46            content_location: content_location_from_headers(headers)?.to_owned(),
47            server: server_from_headers(headers)?.to_owned(),
48            last_state_change: last_state_change_from_headers(headers)?,
49            resource_quota: resource_quota_from_headers(headers)?,
50            resource_usage: resource_usage_from_headers(headers)?,
51            lsn: lsn_from_headers(headers)?,
52            schema_version: schema_version_from_headers(headers)?.to_owned(),
53            alt_content_path: alt_content_path_from_headers(headers)?.to_owned(),
54            content_path: content_path_from_headers(headers)?.to_owned(),
55            quorum_acked_lsn: quorum_acked_lsn_from_headers(headers)?,
56            current_write_quorum: current_write_quorum_from_headers(headers)?,
57            current_replica_set_size: current_replica_set_size_from_headers(headers)?,
58            role: role_from_headers(headers)?,
59            global_committed_lsn: global_committed_lsn_from_headers(headers)?,
60            number_of_read_regions: number_of_read_regions_from_headers(headers)?,
61            transport_request_id: transport_request_id_from_headers(headers)?,
62            cosmos_llsn: cosmos_llsn_from_headers(headers)?,
63            cosmos_quorum_acked_llsn: cosmos_quorum_acked_llsn_from_headers(headers)?,
64            session_token: session_token_from_headers(headers)?,
65            charge: request_charge_from_headers(headers)?,
66            service_version: service_version_from_headers(headers)?.to_owned(),
67            activity_id: activity_id_from_headers(headers)?,
68            gateway_version: gateway_version_from_headers(headers)?.to_owned(),
69            date: date_from_headers(headers)?,
70        })
71    }
72}