Skip to main content

nominal_api/conjure/objects/event/
update_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 UpdateEvent {
16    #[serde(rename = "uuid")]
17    uuid: conjure_object::Uuid,
18    #[builder(default, into)]
19    #[serde(rename = "rid", skip_serializing_if = "Option::is_none", default)]
20    rid: Option<conjure_object::ResourceIdentifier>,
21    #[builder(default, into)]
22    #[serde(rename = "assetRids", skip_serializing_if = "Option::is_none", default)]
23    asset_rids: Option<
24        std::collections::BTreeSet<super::super::scout::rids::api::AssetRid>,
25    >,
26    #[builder(
27        default,
28        custom(
29            type = impl
30            Into<Option<super::super::api::Timestamp>>,
31            convert = |v|v.into().map(Box::new)
32        )
33    )]
34    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none", default)]
35    timestamp: Option<Box<super::super::api::Timestamp>>,
36    #[builder(
37        default,
38        custom(
39            type = impl
40            Into<Option<super::super::scout::run::api::Duration>>,
41            convert = |v|v.into().map(Box::new)
42        )
43    )]
44    #[serde(rename = "duration", skip_serializing_if = "Option::is_none", default)]
45    duration: Option<Box<super::super::scout::run::api::Duration>>,
46    #[builder(default, into)]
47    #[serde(rename = "name", skip_serializing_if = "Option::is_none", default)]
48    name: Option<String>,
49    #[builder(default, into)]
50    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
51    description: Option<String>,
52    #[builder(default, into)]
53    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
54    type_: Option<super::EventType>,
55    #[builder(default, into)]
56    #[serde(rename = "labels", skip_serializing_if = "Option::is_none", default)]
57    labels: Option<std::collections::BTreeSet<String>>,
58    #[builder(default, into)]
59    #[serde(rename = "properties", skip_serializing_if = "Option::is_none", default)]
60    properties: Option<std::collections::BTreeMap<String, String>>,
61}
62impl UpdateEvent {
63    /// Constructs a new instance of the type.
64    #[inline]
65    pub fn new(uuid: conjure_object::Uuid) -> Self {
66        Self::builder().uuid(uuid).build()
67    }
68    #[deprecated(note = "This field is deprecated. Use the rid field instead.\n")]
69    #[inline]
70    pub fn uuid(&self) -> conjure_object::Uuid {
71        self.uuid
72    }
73    /// The unique identifier for the event.
74    /// This field is required if the uuid field is not provided.
75    #[inline]
76    pub fn rid(&self) -> Option<&conjure_object::ResourceIdentifier> {
77        self.rid.as_ref().map(|o| &*o)
78    }
79    /// If provided, will replace the existing asset rids.
80    /// If provided, must contain at least one asset rid.
81    #[inline]
82    pub fn asset_rids(
83        &self,
84    ) -> Option<&std::collections::BTreeSet<super::super::scout::rids::api::AssetRid>> {
85        self.asset_rids.as_ref().map(|o| &*o)
86    }
87    #[inline]
88    pub fn timestamp(&self) -> Option<&super::super::api::Timestamp> {
89        self.timestamp.as_ref().map(|o| &**o)
90    }
91    #[inline]
92    pub fn duration(&self) -> Option<&super::super::scout::run::api::Duration> {
93        self.duration.as_ref().map(|o| &**o)
94    }
95    #[inline]
96    pub fn name(&self) -> Option<&str> {
97        self.name.as_ref().map(|o| &**o)
98    }
99    #[inline]
100    pub fn description(&self) -> Option<&str> {
101        self.description.as_ref().map(|o| &**o)
102    }
103    #[inline]
104    pub fn type_(&self) -> Option<&super::EventType> {
105        self.type_.as_ref().map(|o| &*o)
106    }
107    #[inline]
108    pub fn labels(&self) -> Option<&std::collections::BTreeSet<String>> {
109        self.labels.as_ref().map(|o| &*o)
110    }
111    #[inline]
112    pub fn properties(&self) -> Option<&std::collections::BTreeMap<String, String>> {
113        self.properties.as_ref().map(|o| &*o)
114    }
115}