Skip to main content

azure_storage_common/models/
mod.rs

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4use azure_core::{base64, fmt::SafeDebug, time::OffsetDateTime};
5use serde::{Deserialize, Serialize};
6
7/// A user delegation key.
8#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
9#[serde(rename_all = "PascalCase")]
10pub struct UserDelegationKey {
11    /// The delegated user tenant ID in Entra ID. Returned if DelegatedUserTid is specified.
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub signed_delegated_user_tid: Option<String>,
14
15    /// The date-time the key expires.
16    #[serde(
17        default,
18        skip_serializing_if = "Option::is_none",
19        with = "crate::rfc3339::option"
20    )]
21    pub signed_expiry: Option<OffsetDateTime>,
22
23    /// The Entra ID object ID in GUID format.
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub signed_oid: Option<String>,
26
27    /// Abbreviation of the Azure Storage service that accepts the key.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub signed_service: Option<String>,
30
31    /// The date-time the key is active.
32    #[serde(
33        default,
34        skip_serializing_if = "Option::is_none",
35        with = "crate::rfc3339::option"
36    )]
37    pub signed_start: Option<OffsetDateTime>,
38
39    /// The Entra ID tenant ID in GUID format.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub signed_tid: Option<String>,
42
43    /// The service version that created the key.
44    #[serde(skip_serializing_if = "Option::is_none")]
45    pub signed_version: Option<String>,
46
47    /// The base64 encoded key value.
48    #[serde(
49        default,
50        deserialize_with = "base64::option::deserialize",
51        serialize_with = "base64::option::serialize",
52        skip_serializing_if = "Option::is_none"
53    )]
54    pub value: Option<Vec<u8>>,
55}