Skip to main content

nominal_api/conjure/objects/timeseries/metadata/api/
create_series_metadata_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 CreateSeriesMetadataRequest {
16    #[builder(into)]
17    #[serde(rename = "channel")]
18    channel: String,
19    #[serde(rename = "dataSourceRid")]
20    data_source_rid: conjure_object::ResourceIdentifier,
21    #[builder(custom(type = super::LocatorTemplate, convert = Box::new))]
22    #[serde(rename = "locator")]
23    locator: Box<super::LocatorTemplate>,
24    #[builder(default, into)]
25    #[serde(rename = "unit", skip_serializing_if = "Option::is_none", default)]
26    unit: Option<String>,
27    #[builder(default, into)]
28    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
29    description: Option<String>,
30    #[builder(default, map(key(type = String, into), value(type = String, into)))]
31    #[serde(
32        rename = "tags",
33        skip_serializing_if = "std::collections::BTreeMap::is_empty",
34        default
35    )]
36    tags: std::collections::BTreeMap<String, String>,
37}
38impl CreateSeriesMetadataRequest {
39    /// Constructs a new instance of the type.
40    #[inline]
41    pub fn new(
42        channel: impl Into<String>,
43        data_source_rid: conjure_object::ResourceIdentifier,
44        locator: super::LocatorTemplate,
45    ) -> Self {
46        Self::builder()
47            .channel(channel)
48            .data_source_rid(data_source_rid)
49            .locator(locator)
50            .build()
51    }
52    /// This name should be unique amongst SeriesMetadata within the data source. All series created from this
53    /// metadata will share this name.
54    #[inline]
55    pub fn channel(&self) -> &str {
56        &*self.channel
57    }
58    #[inline]
59    pub fn data_source_rid(&self) -> &conjure_object::ResourceIdentifier {
60        &self.data_source_rid
61    }
62    #[inline]
63    pub fn locator(&self) -> &super::LocatorTemplate {
64        &*self.locator
65    }
66    #[inline]
67    pub fn unit(&self) -> Option<&str> {
68        self.unit.as_ref().map(|o| &**o)
69    }
70    #[inline]
71    pub fn description(&self) -> Option<&str> {
72        self.description.as_ref().map(|o| &**o)
73    }
74    /// Tags specified here will take precedence over tags specified in the RunDatasource, in the case that both specify the same TagName.
75    #[deprecated(note = "Deprecated. Should not be used.")]
76    #[inline]
77    pub fn tags(&self) -> &std::collections::BTreeMap<String, String> {
78        &self.tags
79    }
80}