Skip to main content

nominal_api/conjure/objects/scout/checks/api/
create_check_request.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct CreateCheckRequest {
13    #[builder(default, into)]
14    #[serde(
15        rename = "checkLineageRid",
16        skip_serializing_if = "Option::is_none",
17        default
18    )]
19    check_lineage_rid: Option<conjure_object::Uuid>,
20    #[builder(into)]
21    #[serde(rename = "title")]
22    title: String,
23    #[builder(into)]
24    #[serde(rename = "description")]
25    description: String,
26    #[builder(default, into)]
27    #[serde(
28        rename = "autoGeneratedTitle",
29        skip_serializing_if = "Option::is_none",
30        default
31    )]
32    auto_generated_title: Option<String>,
33    #[builder(default, into)]
34    #[serde(
35        rename = "autoGeneratedDescription",
36        skip_serializing_if = "Option::is_none",
37        default
38    )]
39    auto_generated_description: Option<String>,
40    #[serde(rename = "priority")]
41    priority: super::super::super::api::Priority,
42    #[builder(default, into)]
43    #[serde(
44        rename = "generatedEventType",
45        skip_serializing_if = "Option::is_none",
46        default
47    )]
48    generated_event_type: Option<super::super::super::super::event::EventType>,
49    #[builder(default, into)]
50    #[serde(
51        rename = "generatedEventLabels",
52        skip_serializing_if = "Option::is_none",
53        default
54    )]
55    generated_event_labels: Option<
56        std::collections::BTreeSet<super::super::super::super::api::Label>,
57    >,
58    #[builder(
59        default,
60        custom(
61            type = impl
62            Into<Option<super::UnresolvedCheckCondition>>,
63            convert = |v|v.into().map(Box::new)
64        )
65    )]
66    #[serde(rename = "condition", skip_serializing_if = "Option::is_none", default)]
67    condition: Option<Box<super::UnresolvedCheckCondition>>,
68}
69impl CreateCheckRequest {
70    /// Constructs a new instance of the type.
71    #[inline]
72    pub fn new(
73        title: impl Into<String>,
74        description: impl Into<String>,
75        priority: super::super::super::api::Priority,
76    ) -> Self {
77        Self::builder().title(title).description(description).priority(priority).build()
78    }
79    /// Identifies the lineage of checks this check belongs to. If not specified, a new lineage will be created.
80    /// This is named checkLineageRid for historical reasons but is actually a UUID.
81    #[inline]
82    pub fn check_lineage_rid(&self) -> Option<conjure_object::Uuid> {
83        self.check_lineage_rid.as_ref().map(|o| *o)
84    }
85    #[inline]
86    pub fn title(&self) -> &str {
87        &*self.title
88    }
89    #[inline]
90    pub fn description(&self) -> &str {
91        &*self.description
92    }
93    #[inline]
94    pub fn auto_generated_title(&self) -> Option<&str> {
95        self.auto_generated_title.as_ref().map(|o| &**o)
96    }
97    #[inline]
98    pub fn auto_generated_description(&self) -> Option<&str> {
99        self.auto_generated_description.as_ref().map(|o| &**o)
100    }
101    #[inline]
102    pub fn priority(&self) -> &super::super::super::api::Priority {
103        &self.priority
104    }
105    /// The event type that will be used for events generated from an execution of this check.
106    /// If the check is executed through a data review, the event will have this type.
107    /// Defaults to ERROR.
108    #[inline]
109    pub fn generated_event_type(
110        &self,
111    ) -> Option<&super::super::super::super::event::EventType> {
112        self.generated_event_type.as_ref().map(|o| &*o)
113    }
114    #[inline]
115    pub fn generated_event_labels(
116        &self,
117    ) -> Option<&std::collections::BTreeSet<super::super::super::super::api::Label>> {
118        self.generated_event_labels.as_ref().map(|o| &*o)
119    }
120    /// This field should not be omitted.
121    #[inline]
122    pub fn condition(&self) -> Option<&super::UnresolvedCheckCondition> {
123        self.condition.as_ref().map(|o| &**o)
124    }
125}