Skip to main content

nominal_api_conjure/conjure/objects/api/
numeric_property_predicate.rs

1/// Matches resources that have a numeric value for the named property and whose value satisfies the operator.
2/// NEQ excludes resources that lack the property or store a string value under the same name.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct NumericPropertyPredicate {
15    #[serde(rename = "name")]
16    name: super::PropertyName,
17    #[serde(rename = "value")]
18    #[derive_with(with = conjure_object::private::DoubleWrapper)]
19    value: f64,
20    #[serde(rename = "operator")]
21    operator: super::PropertyComparisonOperator,
22}
23impl NumericPropertyPredicate {
24    /// Constructs a new instance of the type.
25    #[inline]
26    pub fn new(
27        name: super::PropertyName,
28        value: f64,
29        operator: super::PropertyComparisonOperator,
30    ) -> Self {
31        Self::builder().name(name).value(value).operator(operator).build()
32    }
33    #[inline]
34    pub fn name(&self) -> &super::PropertyName {
35        &self.name
36    }
37    #[inline]
38    pub fn value(&self) -> f64 {
39        self.value
40    }
41    #[inline]
42    pub fn operator(&self) -> &super::PropertyComparisonOperator {
43        &self.operator
44    }
45}