Skip to main content

nominal_api/conjure/objects/scout/channel/api/
locator.rs

1/// One expanded leaf of a data frame. Semantic fields (assetRid, runRid, dataScope)
2/// carry the branch context from frame expansion.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash
13)]
14#[serde(crate = "conjure_object::serde")]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct Locator {
18    #[builder(default, into)]
19    #[serde(rename = "assetRid", skip_serializing_if = "Option::is_none", default)]
20    asset_rid: Option<super::super::super::rids::api::AssetRid>,
21    #[builder(default, into)]
22    #[serde(rename = "runRid", skip_serializing_if = "Option::is_none", default)]
23    run_rid: Option<super::super::super::run::api::RunRid>,
24    #[builder(default, into)]
25    #[serde(rename = "dataScope", skip_serializing_if = "Option::is_none", default)]
26    data_scope: Option<String>,
27    #[serde(rename = "dataSourceRid")]
28    data_source_rid: conjure_object::ResourceIdentifier,
29    #[builder(
30        default,
31        custom(
32            type = impl
33            Into<Option<super::super::super::super::api::Range>>,
34            convert = |v|v.into().map(Box::new)
35        )
36    )]
37    #[serde(rename = "timeRange", skip_serializing_if = "Option::is_none", default)]
38    time_range: Option<Box<super::super::super::super::api::Range>>,
39    #[builder(default, map(key(type = String, into), value(type = String, into)))]
40    #[serde(
41        rename = "injectedTags",
42        skip_serializing_if = "std::collections::BTreeMap::is_empty",
43        default
44    )]
45    injected_tags: std::collections::BTreeMap<String, String>,
46}
47impl Locator {
48    /// Constructs a new instance of the type.
49    #[inline]
50    pub fn new(data_source_rid: conjure_object::ResourceIdentifier) -> Self {
51        Self::builder().data_source_rid(data_source_rid).build()
52    }
53    #[inline]
54    pub fn asset_rid(&self) -> Option<&super::super::super::rids::api::AssetRid> {
55        self.asset_rid.as_ref().map(|o| &*o)
56    }
57    #[inline]
58    pub fn run_rid(&self) -> Option<&super::super::super::run::api::RunRid> {
59        self.run_rid.as_ref().map(|o| &*o)
60    }
61    #[inline]
62    pub fn data_scope(&self) -> Option<&str> {
63        self.data_scope.as_ref().map(|o| &**o)
64    }
65    #[inline]
66    pub fn data_source_rid(&self) -> &conjure_object::ResourceIdentifier {
67        &self.data_source_rid
68    }
69    /// Effective source time range used for this expanded locator. This can differ from the request time range
70    /// when the frame includes transforms such as `DataFrame.timeShift`.
71    #[inline]
72    pub fn time_range(&self) -> Option<&super::super::super::super::api::Range> {
73        self.time_range.as_ref().map(|o| &**o)
74    }
75    /// Frame-injected tags accumulated along this branch's resolution path. This includes reserved branch tags
76    /// such as ASSET_RID, RUN_RID, and DATA_SCOPE, data-scope series tags, and explicit TaggedFrame pairs.
77    #[inline]
78    pub fn injected_tags(&self) -> &std::collections::BTreeMap<String, String> {
79        &self.injected_tags
80    }
81}