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<std::collections::BTreeSet<String>>,
56    #[builder(
57        default,
58        custom(
59            type = impl
60            Into<Option<super::UnresolvedCheckCondition>>,
61            convert = |v|v.into().map(Box::new)
62        )
63    )]
64    #[serde(rename = "condition", skip_serializing_if = "Option::is_none", default)]
65    condition: Option<Box<super::UnresolvedCheckCondition>>,
66}
67impl CreateCheckRequest {
68    /// Constructs a new instance of the type.
69    #[inline]
70    pub fn new(
71        title: impl Into<String>,
72        description: impl Into<String>,
73        priority: super::super::super::api::Priority,
74    ) -> Self {
75        Self::builder().title(title).description(description).priority(priority).build()
76    }
77    /// Identifies the lineage of checks this check belongs to. If not specified, a new lineage will be created.
78    /// This is named checkLineageRid for historical reasons but is actually a UUID.
79    #[inline]
80    pub fn check_lineage_rid(&self) -> Option<conjure_object::Uuid> {
81        self.check_lineage_rid.as_ref().map(|o| *o)
82    }
83    #[inline]
84    pub fn title(&self) -> &str {
85        &*self.title
86    }
87    #[inline]
88    pub fn description(&self) -> &str {
89        &*self.description
90    }
91    #[inline]
92    pub fn auto_generated_title(&self) -> Option<&str> {
93        self.auto_generated_title.as_ref().map(|o| &**o)
94    }
95    #[inline]
96    pub fn auto_generated_description(&self) -> Option<&str> {
97        self.auto_generated_description.as_ref().map(|o| &**o)
98    }
99    #[inline]
100    pub fn priority(&self) -> &super::super::super::api::Priority {
101        &self.priority
102    }
103    /// The event type that will be used for events generated from an execution of this check.
104    /// If the check is executed through a data review, the event will have this type.
105    /// Defaults to ERROR.
106    #[inline]
107    pub fn generated_event_type(
108        &self,
109    ) -> Option<&super::super::super::super::event::EventType> {
110        self.generated_event_type.as_ref().map(|o| &*o)
111    }
112    #[inline]
113    pub fn generated_event_labels(&self) -> Option<&std::collections::BTreeSet<String>> {
114        self.generated_event_labels.as_ref().map(|o| &*o)
115    }
116    /// This field should not be omitted.
117    #[inline]
118    pub fn condition(&self) -> Option<&super::UnresolvedCheckCondition> {
119        self.condition.as_ref().map(|o| &**o)
120    }
121}