Skip to main content

nominal_api/conjure/objects/scout/compute/api/
data_source_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 DataSourceChannel {
16    #[builder(custom(type = super::StringConstant, convert = Box::new))]
17    #[serde(rename = "dataSourceRid")]
18    data_source_rid: Box<super::StringConstant>,
19    #[builder(custom(type = super::StringConstant, convert = Box::new))]
20    #[serde(rename = "channel")]
21    channel: Box<super::StringConstant>,
22    #[builder(
23        default,
24        map(key(type = String, into), value(type = super::StringConstant))
25    )]
26    #[serde(
27        rename = "tags",
28        skip_serializing_if = "std::collections::BTreeMap::is_empty",
29        default
30    )]
31    tags: std::collections::BTreeMap<String, super::StringConstant>,
32    #[builder(
33        default,
34        custom(
35            type = impl
36            Into<Option<super::TagFilters>>,
37            convert = |v|v.into().map(Box::new)
38        )
39    )]
40    #[serde(rename = "tagFilters", skip_serializing_if = "Option::is_none", default)]
41    tag_filters: Option<Box<super::TagFilters>>,
42    #[builder(default, set(item(type = String, into)))]
43    #[serde(
44        rename = "tagsToGroupBy",
45        skip_serializing_if = "std::collections::BTreeSet::is_empty",
46        default
47    )]
48    tags_to_group_by: std::collections::BTreeSet<String>,
49    #[builder(default, set(item(type = super::StringConstant)))]
50    #[serde(
51        rename = "groupByTags",
52        skip_serializing_if = "std::collections::BTreeSet::is_empty",
53        default
54    )]
55    group_by_tags: std::collections::BTreeSet<super::StringConstant>,
56}
57impl DataSourceChannel {
58    /// Constructs a new instance of the type.
59    #[inline]
60    pub fn new(
61        data_source_rid: super::StringConstant,
62        channel: super::StringConstant,
63    ) -> Self {
64        Self::builder().data_source_rid(data_source_rid).channel(channel).build()
65    }
66    #[inline]
67    pub fn data_source_rid(&self) -> &super::StringConstant {
68        &*self.data_source_rid
69    }
70    #[inline]
71    pub fn channel(&self) -> &super::StringConstant {
72        &*self.channel
73    }
74    #[deprecated(note = "Use tagFilters")]
75    #[inline]
76    pub fn tags(&self) -> &std::collections::BTreeMap<String, super::StringConstant> {
77        &self.tags
78    }
79    /// Tags to filter the channel by. Only returns points from the channel where tag values match the provided
80    /// expression. For log series, include arg filters here in addition to tag filters.
81    #[inline]
82    pub fn tag_filters(&self) -> Option<&super::TagFilters> {
83        self.tag_filters.as_ref().map(|o| &**o)
84    }
85    #[deprecated(
86        note = "Use groupByTags instead. Throws if both tagsToGroupBy and groupByTags are specified.\n"
87    )]
88    #[inline]
89    pub fn tags_to_group_by(&self) -> &std::collections::BTreeSet<String> {
90        &self.tags_to_group_by
91    }
92    /// Tags that the channel should be grouped by. If this is non-empty a grouped result will be returned
93    /// with an entry for each grouping. Only one of tagsToGroupBy and groupByTags should be specified.
94    #[inline]
95    pub fn group_by_tags(&self) -> &std::collections::BTreeSet<super::StringConstant> {
96        &self.group_by_tags
97    }
98}