Skip to main content

nominal_api/conjure/objects/event/
events_histogram_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 EventsHistogramRequest {
16    #[builder(custom(type = super::super::api::Timestamp, convert = Box::new))]
17    #[serde(rename = "startInclusive")]
18    start_inclusive: Box<super::super::api::Timestamp>,
19    #[builder(custom(type = super::super::api::Timestamp, convert = Box::new))]
20    #[serde(rename = "endExclusive")]
21    end_exclusive: Box<super::super::api::Timestamp>,
22    #[builder(
23        default,
24        custom(
25            type = impl
26            Into<Option<super::HistogramFilterQuery>>,
27            convert = |v|v.into().map(Box::new)
28        )
29    )]
30    #[serde(rename = "filterQuery", skip_serializing_if = "Option::is_none", default)]
31    filter_query: Option<Box<super::HistogramFilterQuery>>,
32    #[builder(default, into)]
33    #[serde(
34        rename = "archivedStatuses",
35        skip_serializing_if = "Option::is_none",
36        default
37    )]
38    archived_statuses: Option<
39        std::collections::BTreeSet<super::super::api::ArchivedStatus>,
40    >,
41    #[builder(default, into)]
42    #[serde(rename = "numBins", skip_serializing_if = "Option::is_none", default)]
43    num_bins: Option<i32>,
44    #[builder(default, into)]
45    #[serde(rename = "eventLimit", skip_serializing_if = "Option::is_none", default)]
46    event_limit: Option<i32>,
47}
48impl EventsHistogramRequest {
49    /// Constructs a new instance of the type.
50    #[inline]
51    pub fn new(
52        start_inclusive: super::super::api::Timestamp,
53        end_exclusive: super::super::api::Timestamp,
54    ) -> Self {
55        Self::builder()
56            .start_inclusive(start_inclusive)
57            .end_exclusive(end_exclusive)
58            .build()
59    }
60    #[inline]
61    pub fn start_inclusive(&self) -> &super::super::api::Timestamp {
62        &*self.start_inclusive
63    }
64    #[inline]
65    pub fn end_exclusive(&self) -> &super::super::api::Timestamp {
66        &*self.end_exclusive
67    }
68    /// The query to filter the events to be included in the histogram.
69    #[inline]
70    pub fn filter_query(&self) -> Option<&super::HistogramFilterQuery> {
71        self.filter_query.as_ref().map(|o| &**o)
72    }
73    /// Filters search on check alerts based on the archived statuses provided.
74    /// Default is NOT_ARCHIVED only if none are provided.
75    #[inline]
76    pub fn archived_statuses(
77        &self,
78    ) -> Option<&std::collections::BTreeSet<super::super::api::ArchivedStatus>> {
79        self.archived_statuses.as_ref().map(|o| &*o)
80    }
81    /// Defaults to 100. Throws if larger than 1_000.
82    /// The resulting histogram may have fewer bins than requested if the requested time window is too small.
83    #[inline]
84    pub fn num_bins(&self) -> Option<i32> {
85        self.num_bins.as_ref().map(|o| *o)
86    }
87    /// Limits the number of events to be included in the histogram.
88    /// Defaults to 1_000. Throws if larger than 10_000.
89    #[inline]
90    pub fn event_limit(&self) -> Option<i32> {
91        self.event_limit.as_ref().map(|o| *o)
92    }
93}