Skip to main content

nominal_api/conjure/objects/scout/api/
channel_locator.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 ChannelLocator {
16    #[serde(rename = "dataSourceRef")]
17    data_source_ref: super::DataSourceRefName,
18    #[builder(into)]
19    #[serde(rename = "channel")]
20    channel: String,
21    #[builder(default, map(key(type = String, into), value(type = String, into)))]
22    #[serde(
23        rename = "tags",
24        skip_serializing_if = "std::collections::BTreeMap::is_empty",
25        default
26    )]
27    tags: std::collections::BTreeMap<String, String>,
28    #[builder(default, into)]
29    #[serde(rename = "asset", skip_serializing_if = "Option::is_none", default)]
30    asset: Option<super::super::rids::api::AssetRefName>,
31    #[builder(default, into)]
32    #[serde(rename = "run", skip_serializing_if = "Option::is_none", default)]
33    run: Option<super::super::rids::api::RunRefName>,
34}
35impl ChannelLocator {
36    /// Constructs a new instance of the type.
37    #[inline]
38    pub fn new(
39        data_source_ref: super::DataSourceRefName,
40        channel: impl Into<String>,
41    ) -> Self {
42        Self::builder().data_source_ref(data_source_ref).channel(channel).build()
43    }
44    #[inline]
45    pub fn data_source_ref(&self) -> &super::DataSourceRefName {
46        &self.data_source_ref
47    }
48    #[inline]
49    pub fn channel(&self) -> &str {
50        &*self.channel
51    }
52    #[inline]
53    pub fn tags(&self) -> &std::collections::BTreeMap<String, String> {
54        &self.tags
55    }
56    #[inline]
57    pub fn asset(&self) -> Option<&super::super::rids::api::AssetRefName> {
58        self.asset.as_ref().map(|o| &*o)
59    }
60    #[inline]
61    pub fn run(&self) -> Option<&super::super::rids::api::RunRefName> {
62        self.run.as_ref().map(|o| &*o)
63    }
64}