Skip to main content

nominal_api/conjure/objects/scout/run/api/
run_data_source.rs

1/// For read requests, we want to require all fields
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct RunDataSource {
17    #[builder(custom(type = super::DataSource, convert = Box::new))]
18    #[serde(rename = "dataSource")]
19    data_source: Box<super::DataSource>,
20    #[builder(custom(type = super::Duration, convert = Box::new))]
21    #[serde(rename = "offset")]
22    offset: Box<super::Duration>,
23    #[serde(rename = "refName")]
24    ref_name: super::super::super::api::DataSourceRefName,
25    #[serde(rename = "timestampType")]
26    timestamp_type: super::WeakTimestampType,
27    #[builder(default, map(key(type = String, into), value(type = String, into)))]
28    #[serde(
29        rename = "seriesTags",
30        skip_serializing_if = "std::collections::BTreeMap::is_empty",
31        default
32    )]
33    series_tags: std::collections::BTreeMap<String, String>,
34}
35impl RunDataSource {
36    #[inline]
37    pub fn data_source(&self) -> &super::DataSource {
38        &*self.data_source
39    }
40    /// This offset is used for small time-sync corrections. Notably, it is
41    /// not the offset to move a relative data source to the start of the run.
42    #[inline]
43    pub fn offset(&self) -> &super::Duration {
44        &*self.offset
45    }
46    /// Included for convenience, duplicated from the key of the map
47    #[inline]
48    pub fn ref_name(&self) -> &super::super::super::api::DataSourceRefName {
49        &self.ref_name
50    }
51    #[inline]
52    pub fn timestamp_type(&self) -> &super::WeakTimestampType {
53        &self.timestamp_type
54    }
55    /// Used to resolve logical series for this data source.
56    #[inline]
57    pub fn series_tags(&self) -> &std::collections::BTreeMap<String, String> {
58        &self.series_tags
59    }
60}