Skip to main content

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