Skip to main content

nominal_api/conjure/objects/event/
event.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 Event {
16    #[serde(rename = "uuid")]
17    uuid: conjure_object::Uuid,
18    #[serde(rename = "rid")]
19    rid: super::super::api::rids::EventRid,
20    #[builder(default, set(item(type = super::super::scout::rids::api::AssetRid)))]
21    #[serde(
22        rename = "assetRids",
23        skip_serializing_if = "std::collections::BTreeSet::is_empty",
24        default
25    )]
26    asset_rids: std::collections::BTreeSet<super::super::scout::rids::api::AssetRid>,
27    #[builder(default, set(item(type = super::EventOrigin)))]
28    #[serde(
29        rename = "origins",
30        skip_serializing_if = "std::collections::BTreeSet::is_empty",
31        default
32    )]
33    origins: std::collections::BTreeSet<super::EventOrigin>,
34    #[builder(custom(type = super::super::api::Timestamp, convert = Box::new))]
35    #[serde(rename = "timestamp")]
36    timestamp: Box<super::super::api::Timestamp>,
37    #[builder(
38        custom(type = super::super::scout::run::api::Duration, convert = Box::new)
39    )]
40    #[serde(rename = "duration")]
41    duration: Box<super::super::scout::run::api::Duration>,
42    #[builder(into)]
43    #[serde(rename = "name")]
44    name: String,
45    #[builder(into)]
46    #[serde(rename = "description")]
47    description: String,
48    #[serde(rename = "type")]
49    type_: super::EventType,
50    #[builder(default, set(item(type = super::super::api::Label)))]
51    #[serde(
52        rename = "labels",
53        skip_serializing_if = "std::collections::BTreeSet::is_empty",
54        default
55    )]
56    labels: std::collections::BTreeSet<super::super::api::Label>,
57    #[builder(
58        default,
59        map(
60            key(type = super::super::api::PropertyName),
61            value(type = super::super::api::PropertyValue)
62        )
63    )]
64    #[serde(
65        rename = "properties",
66        skip_serializing_if = "std::collections::BTreeMap::is_empty",
67        default
68    )]
69    properties: std::collections::BTreeMap<
70        super::super::api::PropertyName,
71        super::super::api::PropertyValue,
72    >,
73    #[serde(rename = "isArchived")]
74    is_archived: bool,
75    #[builder(default, into)]
76    #[serde(rename = "createdBy", skip_serializing_if = "Option::is_none", default)]
77    created_by: Option<super::super::scout::rids::api::UserRid>,
78    #[builder(
79        default,
80        custom(
81            type = impl
82            Into<Option<super::EventDisposition>>,
83            convert = |v|v.into().map(Box::new)
84        )
85    )]
86    #[serde(rename = "disposition", skip_serializing_if = "Option::is_none", default)]
87    disposition: Option<Box<super::EventDisposition>>,
88}
89impl Event {
90    #[deprecated(note = "This field is deprecated. Use the rid field instead.\n")]
91    #[inline]
92    pub fn uuid(&self) -> conjure_object::Uuid {
93        self.uuid
94    }
95    #[inline]
96    pub fn rid(&self) -> &super::super::api::rids::EventRid {
97        &self.rid
98    }
99    /// A set of asset rids associated with the event.
100    #[inline]
101    pub fn asset_rids(
102        &self,
103    ) -> &std::collections::BTreeSet<super::super::scout::rids::api::AssetRid> {
104        &self.asset_rids
105    }
106    /// A set of origins associated with the event.
107    #[inline]
108    pub fn origins(&self) -> &std::collections::BTreeSet<super::EventOrigin> {
109        &self.origins
110    }
111    #[inline]
112    pub fn timestamp(&self) -> &super::super::api::Timestamp {
113        &*self.timestamp
114    }
115    #[inline]
116    pub fn duration(&self) -> &super::super::scout::run::api::Duration {
117        &*self.duration
118    }
119    #[inline]
120    pub fn name(&self) -> &str {
121        &*self.name
122    }
123    #[inline]
124    pub fn description(&self) -> &str {
125        &*self.description
126    }
127    #[inline]
128    pub fn type_(&self) -> &super::EventType {
129        &self.type_
130    }
131    #[inline]
132    pub fn labels(&self) -> &std::collections::BTreeSet<super::super::api::Label> {
133        &self.labels
134    }
135    #[inline]
136    pub fn properties(
137        &self,
138    ) -> &std::collections::BTreeMap<
139        super::super::api::PropertyName,
140        super::super::api::PropertyValue,
141    > {
142        &self.properties
143    }
144    #[inline]
145    pub fn is_archived(&self) -> bool {
146        self.is_archived
147    }
148    /// The user who created the event.
149    /// This field may be missing for legacy events.
150    #[inline]
151    pub fn created_by(&self) -> Option<&super::super::scout::rids::api::UserRid> {
152        self.created_by.as_ref().map(|o| &*o)
153    }
154    #[inline]
155    pub fn disposition(&self) -> Option<&super::EventDisposition> {
156        self.disposition.as_ref().map(|o| &**o)
157    }
158}