Skip to main content

nominal_api/conjure/objects/scout/compute/api/deprecated/
thresholding_ranges_node.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 ThresholdingRangesNode {
13    #[builder(custom(type = super::NumericSeriesNode, convert = Box::new))]
14    #[serde(rename = "input")]
15    input: Box<super::NumericSeriesNode>,
16    #[serde(rename = "threshold")]
17    #[derive_with(with = conjure_object::private::DoubleWrapper)]
18    threshold: f64,
19    #[serde(rename = "operator")]
20    operator: super::super::ThresholdOperator,
21    #[builder(default, into)]
22    #[serde(rename = "minPoints", skip_serializing_if = "Option::is_none", default)]
23    min_points: Option<i32>,
24    #[builder(
25        default,
26        custom(
27            type = impl
28            Into<Option<super::super::super::super::run::api::Duration>>,
29            convert = |v|v.into().map(Box::new)
30        )
31    )]
32    #[serde(rename = "minDuration", skip_serializing_if = "Option::is_none", default)]
33    min_duration: Option<Box<super::super::super::super::run::api::Duration>>,
34    #[builder(
35        default,
36        custom(
37            type = impl
38            Into<Option<super::PersistenceWindowConfiguration>>,
39            convert = |v|v.into().map(Box::new)
40        )
41    )]
42    #[serde(
43        rename = "persistenceWindowConfiguration",
44        skip_serializing_if = "Option::is_none",
45        default
46    )]
47    persistence_window_configuration: Option<Box<super::PersistenceWindowConfiguration>>,
48}
49impl ThresholdingRangesNode {
50    /// Constructs a new instance of the type.
51    #[inline]
52    pub fn new(
53        input: super::NumericSeriesNode,
54        threshold: f64,
55        operator: super::super::ThresholdOperator,
56    ) -> Self {
57        Self::builder().input(input).threshold(threshold).operator(operator).build()
58    }
59    #[inline]
60    pub fn input(&self) -> &super::NumericSeriesNode {
61        &*self.input
62    }
63    #[inline]
64    pub fn threshold(&self) -> f64 {
65        self.threshold
66    }
67    #[inline]
68    pub fn operator(&self) -> &super::super::ThresholdOperator {
69        &self.operator
70    }
71    /// The minimum number of points for which this condition is satisfied. Must be non-negative. If not present,
72    /// will default to 1.
73    #[deprecated(note = "Use persistenceWindowConfiguration instead.")]
74    #[inline]
75    pub fn min_points(&self) -> Option<i32> {
76        self.min_points.as_ref().map(|o| *o)
77    }
78    /// The minimum duration for which this condition is satisfied. Must be non-negative. If not present, will
79    /// default to 1 nanosecond.
80    #[deprecated(note = "Use persistenceWindowConfiguration instead.")]
81    #[inline]
82    pub fn min_duration(
83        &self,
84    ) -> Option<&super::super::super::super::run::api::Duration> {
85        self.min_duration.as_ref().map(|o| &**o)
86    }
87    #[inline]
88    pub fn persistence_window_configuration(
89        &self,
90    ) -> Option<&super::PersistenceWindowConfiguration> {
91        self.persistence_window_configuration.as_ref().map(|o| &**o)
92    }
93}