Skip to main content

nominal_api/conjure/objects/authorization/
api_key.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct ApiKey {
16    #[serde(rename = "rid")]
17    rid: super::ApiKeyRid,
18    #[builder(into)]
19    #[serde(rename = "apiKeyName")]
20    api_key_name: String,
21    #[serde(rename = "createdBy")]
22    created_by: conjure_object::ResourceIdentifier,
23    #[serde(rename = "createdAt")]
24    created_at: conjure_object::DateTime<conjure_object::Utc>,
25    #[builder(default, into)]
26    #[serde(rename = "expiresAt", skip_serializing_if = "Option::is_none", default)]
27    expires_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
28    #[serde(rename = "isDeleted")]
29    is_deleted: bool,
30}
31impl ApiKey {
32    #[inline]
33    pub fn rid(&self) -> &super::ApiKeyRid {
34        &self.rid
35    }
36    #[inline]
37    pub fn api_key_name(&self) -> &str {
38        &*self.api_key_name
39    }
40    #[inline]
41    pub fn created_by(&self) -> &conjure_object::ResourceIdentifier {
42        &self.created_by
43    }
44    #[inline]
45    pub fn created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
46        self.created_at
47    }
48    #[inline]
49    pub fn expires_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
50        self.expires_at.as_ref().map(|o| *o)
51    }
52    #[inline]
53    pub fn is_deleted(&self) -> bool {
54        self.is_deleted
55    }
56}