Skip to main content

nominal_api/conjure/objects/scout/compute/api/
asset_channel.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 AssetChannel {
16    #[builder(custom(type = super::StringConstant, convert = Box::new))]
17    #[serde(rename = "assetRid")]
18    asset_rid: Box<super::StringConstant>,
19    #[builder(custom(type = super::StringConstant, convert = Box::new))]
20    #[serde(rename = "dataScopeName")]
21    data_scope_name: Box<super::StringConstant>,
22    #[builder(custom(type = super::StringConstant, convert = Box::new))]
23    #[serde(rename = "channel")]
24    channel: Box<super::StringConstant>,
25    #[builder(
26        default,
27        map(key(type = String, into), value(type = super::StringConstant))
28    )]
29    #[serde(
30        rename = "additionalTags",
31        skip_serializing_if = "std::collections::BTreeMap::is_empty",
32        default
33    )]
34    additional_tags: std::collections::BTreeMap<String, super::StringConstant>,
35    #[builder(
36        default,
37        custom(
38            type = impl
39            Into<Option<super::TagFilters>>,
40            convert = |v|v.into().map(Box::new)
41        )
42    )]
43    #[serde(
44        rename = "additionalTagFilters",
45        skip_serializing_if = "Option::is_none",
46        default
47    )]
48    additional_tag_filters: Option<Box<super::TagFilters>>,
49    #[builder(default, set(item(type = String, into)))]
50    #[serde(
51        rename = "tagsToGroupBy",
52        skip_serializing_if = "std::collections::BTreeSet::is_empty",
53        default
54    )]
55    tags_to_group_by: std::collections::BTreeSet<String>,
56    #[builder(default, set(item(type = super::StringConstant)))]
57    #[serde(
58        rename = "groupByTags",
59        skip_serializing_if = "std::collections::BTreeSet::is_empty",
60        default
61    )]
62    group_by_tags: std::collections::BTreeSet<super::StringConstant>,
63}
64impl AssetChannel {
65    /// Constructs a new instance of the type.
66    #[inline]
67    pub fn new(
68        asset_rid: super::StringConstant,
69        data_scope_name: super::StringConstant,
70        channel: super::StringConstant,
71    ) -> Self {
72        Self::builder()
73            .asset_rid(asset_rid)
74            .data_scope_name(data_scope_name)
75            .channel(channel)
76            .build()
77    }
78    #[inline]
79    pub fn asset_rid(&self) -> &super::StringConstant {
80        &*self.asset_rid
81    }
82    /// Used to disambiguate when multiple data scopes within this asset contain channels with the same name.
83    #[inline]
84    pub fn data_scope_name(&self) -> &super::StringConstant {
85        &*self.data_scope_name
86    }
87    #[inline]
88    pub fn channel(&self) -> &super::StringConstant {
89        &*self.channel
90    }
91    #[deprecated(note = "Use additionalTagFilters")]
92    #[inline]
93    pub fn additional_tags(
94        &self,
95    ) -> &std::collections::BTreeMap<String, super::StringConstant> {
96        &self.additional_tags
97    }
98    /// Tags to filter the channel by, in addition to tag filters defined for a given Asset data scope. Throws on
99    /// collisions with tag keys already defined for the given Asset data scope. Only returns points that match
100    /// both sets of tag filters. For log series, include arg filters here in addition to tag filters.
101    #[inline]
102    pub fn additional_tag_filters(&self) -> Option<&super::TagFilters> {
103        self.additional_tag_filters.as_ref().map(|o| &**o)
104    }
105    #[deprecated(
106        note = "Use groupByTags instead. Throws if both tagsToGroupBy and groupByTags are specified.\n"
107    )]
108    #[inline]
109    pub fn tags_to_group_by(&self) -> &std::collections::BTreeSet<String> {
110        &self.tags_to_group_by
111    }
112    /// Tags that the channel should be grouped by. If this is non-empty a grouped result will be returned
113    /// with an entry for each grouping. Only one of tagsToGroupBy and groupByTags should be specified.
114    #[inline]
115    pub fn group_by_tags(&self) -> &std::collections::BTreeSet<super::StringConstant> {
116        &self.group_by_tags
117    }
118}