Skip to main content

nominal_api/conjure/objects/scout/asset/api/
create_asset_data_scope.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 CreateAssetDataScope {
16    #[serde(rename = "dataScopeName")]
17    data_scope_name: super::super::super::api::DataSourceRefName,
18    #[builder(
19        custom(type = super::super::super::run::api::DataSource, convert = Box::new)
20    )]
21    #[serde(rename = "dataSource")]
22    data_source: Box<super::super::super::run::api::DataSource>,
23    #[builder(
24        default,
25        custom(
26            type = impl
27            Into<Option<super::super::super::run::api::Duration>>,
28            convert = |v|v.into().map(Box::new)
29        )
30    )]
31    #[serde(rename = "offset", skip_serializing_if = "Option::is_none", default)]
32    offset: Option<Box<super::super::super::run::api::Duration>>,
33    #[builder(default, map(key(type = String, into), value(type = String, into)))]
34    #[serde(
35        rename = "seriesTags",
36        skip_serializing_if = "std::collections::BTreeMap::is_empty",
37        default
38    )]
39    series_tags: std::collections::BTreeMap<String, String>,
40}
41impl CreateAssetDataScope {
42    /// Constructs a new instance of the type.
43    #[inline]
44    pub fn new(
45        data_scope_name: super::super::super::api::DataSourceRefName,
46        data_source: super::super::super::run::api::DataSource,
47    ) -> Self {
48        Self::builder().data_scope_name(data_scope_name).data_source(data_source).build()
49    }
50    /// The name of the data scope. The name is guaranteed to be be unique within the context of an asset.
51    #[inline]
52    pub fn data_scope_name(&self) -> &super::super::super::api::DataSourceRefName {
53        &self.data_scope_name
54    }
55    #[inline]
56    pub fn data_source(&self) -> &super::super::super::run::api::DataSource {
57        &*self.data_source
58    }
59    #[inline]
60    pub fn offset(&self) -> Option<&super::super::super::run::api::Duration> {
61        self.offset.as_ref().map(|o| &**o)
62    }
63    /// Filters the data source to series matching these tag values. The filtered set of series should be
64    /// the ones that belong to the asset.
65    #[inline]
66    pub fn series_tags(&self) -> &std::collections::BTreeMap<String, String> {
67        &self.series_tags
68    }
69}