Skip to main content

nominal_api/conjure/objects/timeseries/logicalseries/api/
timestream_locator.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 TimestreamLocator {
16    #[serde(rename = "table")]
17    table: super::TableName,
18    #[builder(default, map(key(type = String, into), value(type = String, into)))]
19    #[serde(
20        rename = "dimensions",
21        skip_serializing_if = "std::collections::BTreeMap::is_empty",
22        default
23    )]
24    dimensions: std::collections::BTreeMap<String, String>,
25    #[serde(rename = "measure")]
26    measure: super::MeasureName,
27    #[builder(default, into)]
28    #[serde(rename = "attribute", skip_serializing_if = "Option::is_none", default)]
29    attribute: Option<super::AttributeName>,
30    #[serde(rename = "type")]
31    type_: super::TimestreamType,
32}
33impl TimestreamLocator {
34    /// Constructs a new instance of the type.
35    #[inline]
36    pub fn new(
37        table: super::TableName,
38        measure: super::MeasureName,
39        type_: super::TimestreamType,
40    ) -> Self {
41        Self::builder().table(table).measure(measure).type_(type_).build()
42    }
43    #[inline]
44    pub fn table(&self) -> &super::TableName {
45        &self.table
46    }
47    #[inline]
48    pub fn dimensions(&self) -> &std::collections::BTreeMap<String, String> {
49        &self.dimensions
50    }
51    #[inline]
52    pub fn measure(&self) -> &super::MeasureName {
53        &self.measure
54    }
55    /// If present, will be the attribute within the measurement for multi-measures.
56    #[inline]
57    pub fn attribute(&self) -> Option<&super::AttributeName> {
58        self.attribute.as_ref().map(|o| &*o)
59    }
60    #[inline]
61    pub fn type_(&self) -> &super::TimestreamType {
62        &self.type_
63    }
64}