nominal_api/conjure/objects/event/
event.rs1#[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: conjure_object::ResourceIdentifier,
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 = String, into)))]
51 #[serde(
52 rename = "labels",
53 skip_serializing_if = "std::collections::BTreeSet::is_empty",
54 default
55 )]
56 labels: std::collections::BTreeSet<String>,
57 #[builder(default, map(key(type = String, into), value(type = String, into)))]
58 #[serde(
59 rename = "properties",
60 skip_serializing_if = "std::collections::BTreeMap::is_empty",
61 default
62 )]
63 properties: std::collections::BTreeMap<String, String>,
64 #[serde(rename = "isArchived")]
65 is_archived: bool,
66 #[builder(default, into)]
67 #[serde(rename = "createdBy", skip_serializing_if = "Option::is_none", default)]
68 created_by: Option<super::super::scout::rids::api::UserRid>,
69 #[builder(
70 default,
71 custom(
72 type = impl
73 Into<Option<super::EventDisposition>>,
74 convert = |v|v.into().map(Box::new)
75 )
76 )]
77 #[serde(rename = "disposition", skip_serializing_if = "Option::is_none", default)]
78 disposition: Option<Box<super::EventDisposition>>,
79}
80impl Event {
81 #[deprecated(note = "This field is deprecated. Use the rid field instead.\n")]
82 #[inline]
83 pub fn uuid(&self) -> conjure_object::Uuid {
84 self.uuid
85 }
86 #[inline]
87 pub fn rid(&self) -> &conjure_object::ResourceIdentifier {
88 &self.rid
89 }
90 #[inline]
92 pub fn asset_rids(
93 &self,
94 ) -> &std::collections::BTreeSet<super::super::scout::rids::api::AssetRid> {
95 &self.asset_rids
96 }
97 #[inline]
99 pub fn origins(&self) -> &std::collections::BTreeSet<super::EventOrigin> {
100 &self.origins
101 }
102 #[inline]
103 pub fn timestamp(&self) -> &super::super::api::Timestamp {
104 &*self.timestamp
105 }
106 #[inline]
107 pub fn duration(&self) -> &super::super::scout::run::api::Duration {
108 &*self.duration
109 }
110 #[inline]
111 pub fn name(&self) -> &str {
112 &*self.name
113 }
114 #[inline]
115 pub fn description(&self) -> &str {
116 &*self.description
117 }
118 #[inline]
119 pub fn type_(&self) -> &super::EventType {
120 &self.type_
121 }
122 #[inline]
123 pub fn labels(&self) -> &std::collections::BTreeSet<String> {
124 &self.labels
125 }
126 #[inline]
127 pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
128 &self.properties
129 }
130 #[inline]
131 pub fn is_archived(&self) -> bool {
132 self.is_archived
133 }
134 #[inline]
137 pub fn created_by(&self) -> Option<&super::super::scout::rids::api::UserRid> {
138 self.created_by.as_ref().map(|o| &*o)
139 }
140 #[inline]
141 pub fn disposition(&self) -> Option<&super::EventDisposition> {
142 self.disposition.as_ref().map(|o| &**o)
143 }
144}