nominal_api/conjure/objects/event/
create_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 CreateEvent {
16 #[builder(default, set(item(type = super::super::scout::rids::api::AssetRid)))]
17 #[serde(
18 rename = "assetRids",
19 skip_serializing_if = "std::collections::BTreeSet::is_empty",
20 default
21 )]
22 asset_rids: std::collections::BTreeSet<super::super::scout::rids::api::AssetRid>,
23 #[builder(default, set(item(type = super::EventOrigin)))]
24 #[serde(
25 rename = "origins",
26 skip_serializing_if = "std::collections::BTreeSet::is_empty",
27 default
28 )]
29 origins: std::collections::BTreeSet<super::EventOrigin>,
30 #[builder(custom(type = super::super::api::Timestamp, convert = Box::new))]
31 #[serde(rename = "timestamp")]
32 timestamp: Box<super::super::api::Timestamp>,
33 #[builder(
34 custom(type = super::super::scout::run::api::Duration, convert = Box::new)
35 )]
36 #[serde(rename = "duration")]
37 duration: Box<super::super::scout::run::api::Duration>,
38 #[builder(into)]
39 #[serde(rename = "name")]
40 name: String,
41 #[builder(default, into)]
42 #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
43 description: Option<String>,
44 #[serde(rename = "type")]
45 type_: super::EventType,
46 #[builder(default, set(item(type = String, into)))]
47 #[serde(
48 rename = "labels",
49 skip_serializing_if = "std::collections::BTreeSet::is_empty",
50 default
51 )]
52 labels: std::collections::BTreeSet<String>,
53 #[builder(default, map(key(type = String, into), value(type = String, into)))]
54 #[serde(
55 rename = "properties",
56 skip_serializing_if = "std::collections::BTreeMap::is_empty",
57 default
58 )]
59 properties: std::collections::BTreeMap<String, String>,
60 #[builder(
61 default,
62 custom(
63 type = impl
64 Into<Option<super::EventDisposition>>,
65 convert = |v|v.into().map(Box::new)
66 )
67 )]
68 #[serde(rename = "disposition", skip_serializing_if = "Option::is_none", default)]
69 disposition: Option<Box<super::EventDisposition>>,
70}
71impl CreateEvent {
72 #[inline]
74 pub fn asset_rids(
75 &self,
76 ) -> &std::collections::BTreeSet<super::super::scout::rids::api::AssetRid> {
77 &self.asset_rids
78 }
79 #[inline]
81 pub fn origins(&self) -> &std::collections::BTreeSet<super::EventOrigin> {
82 &self.origins
83 }
84 #[inline]
85 pub fn timestamp(&self) -> &super::super::api::Timestamp {
86 &*self.timestamp
87 }
88 #[inline]
89 pub fn duration(&self) -> &super::super::scout::run::api::Duration {
90 &*self.duration
91 }
92 #[inline]
93 pub fn name(&self) -> &str {
94 &*self.name
95 }
96 #[inline]
98 pub fn description(&self) -> Option<&str> {
99 self.description.as_ref().map(|o| &**o)
100 }
101 #[inline]
102 pub fn type_(&self) -> &super::EventType {
103 &self.type_
104 }
105 #[inline]
106 pub fn labels(&self) -> &std::collections::BTreeSet<String> {
107 &self.labels
108 }
109 #[inline]
110 pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
111 &self.properties
112 }
113 #[inline]
114 pub fn disposition(&self) -> Option<&super::EventDisposition> {
115 self.disposition.as_ref().map(|o| &**o)
116 }
117}