Skip to main content

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