Skip to main content

nominal_api_conjure/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    #[builder(default, into)]
57    #[serde(rename = "storage", skip_serializing_if = "Option::is_none", default)]
58    storage: Option<super::SeriesStorage>,
59}
60impl DataSourceChannel {
61    /// Constructs a new instance of the type.
62    #[inline]
63    pub fn new(
64        data_source_rid: super::StringConstant,
65        channel: super::StringConstant,
66    ) -> Self {
67        Self::builder().data_source_rid(data_source_rid).channel(channel).build()
68    }
69    #[inline]
70    pub fn data_source_rid(&self) -> &super::StringConstant {
71        &*self.data_source_rid
72    }
73    #[inline]
74    pub fn channel(&self) -> &super::StringConstant {
75        &*self.channel
76    }
77    #[deprecated(note = "Use tagFilters")]
78    #[inline]
79    pub fn tags(&self) -> &std::collections::BTreeMap<String, super::StringConstant> {
80        &self.tags
81    }
82    /// Tags to filter the channel by. Only returns points from the channel where tag values match the provided
83    /// expression. For log series, include arg filters here in addition to tag filters.
84    #[inline]
85    pub fn tag_filters(&self) -> Option<&super::TagFilters> {
86        self.tag_filters.as_ref().map(|o| &**o)
87    }
88    #[deprecated(
89        note = "Use groupByTags instead. Throws if both tagsToGroupBy and groupByTags are specified.\n"
90    )]
91    #[inline]
92    pub fn tags_to_group_by(&self) -> &std::collections::BTreeSet<String> {
93        &self.tags_to_group_by
94    }
95    /// Tags that the channel should be grouped by. If this is non-empty a grouped result will be returned
96    /// with an entry for each grouping. Only one of tagsToGroupBy and groupByTags should be specified.
97    #[inline]
98    pub fn group_by_tags(&self) -> &std::collections::BTreeSet<super::StringConstant> {
99        &self.group_by_tags
100    }
101    /// Storage engine to read this series from. Only applies to datasets written to both engines; see
102    /// `SeriesStorage`. Defaults to the engine configured for the caller. In general this field should
103    /// not be specified, and will be removed at a later date.
104    #[inline]
105    pub fn storage(&self) -> Option<&super::SeriesStorage> {
106        self.storage.as_ref().map(|o| &*o)
107    }
108}