Skip to main content

nominal_api/conjure/objects/ingest/api/
new_data_source.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 NewDataSource {
16    #[builder(custom(type = super::IngestSource, convert = Box::new))]
17    #[serde(rename = "source")]
18    source: Box<super::IngestSource>,
19    #[builder(default, map(key(type = String, into), value(type = String, into)))]
20    #[serde(
21        rename = "properties",
22        skip_serializing_if = "std::collections::BTreeMap::is_empty",
23        default
24    )]
25    properties: std::collections::BTreeMap<String, String>,
26    #[builder(default, set(item(type = String, into)))]
27    #[serde(
28        rename = "labels",
29        skip_serializing_if = "std::collections::BTreeSet::is_empty",
30        default
31    )]
32    labels: std::collections::BTreeSet<String>,
33    #[builder(default, into)]
34    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
35    description: Option<String>,
36    #[builder(default, into)]
37    #[serde(rename = "name", skip_serializing_if = "Option::is_none", default)]
38    name: Option<String>,
39    #[builder(
40        default,
41        custom(
42            type = impl
43            Into<Option<super::TimestampMetadata>>,
44            convert = |v|v.into().map(Box::new)
45        )
46    )]
47    #[serde(rename = "timeColumnSpec", skip_serializing_if = "Option::is_none", default)]
48    time_column_spec: Option<Box<super::TimestampMetadata>>,
49    #[builder(
50        default,
51        custom(
52            type = impl
53            Into<Option<super::ChannelConfig>>,
54            convert = |v|v.into().map(Box::new)
55        )
56    )]
57    #[serde(rename = "channelConfig", skip_serializing_if = "Option::is_none", default)]
58    channel_config: Option<Box<super::ChannelConfig>>,
59}
60impl NewDataSource {
61    /// Constructs a new instance of the type.
62    #[inline]
63    pub fn new(source: super::IngestSource) -> Self {
64        Self::builder().source(source).build()
65    }
66    #[inline]
67    pub fn source(&self) -> &super::IngestSource {
68        &*self.source
69    }
70    #[inline]
71    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
72        &self.properties
73    }
74    #[inline]
75    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
76        &self.labels
77    }
78    #[inline]
79    pub fn description(&self) -> Option<&str> {
80        self.description.as_ref().map(|o| &**o)
81    }
82    #[inline]
83    pub fn name(&self) -> Option<&str> {
84        self.name.as_ref().map(|o| &**o)
85    }
86    #[inline]
87    pub fn time_column_spec(&self) -> Option<&super::TimestampMetadata> {
88        self.time_column_spec.as_ref().map(|o| &**o)
89    }
90    #[inline]
91    pub fn channel_config(&self) -> Option<&super::ChannelConfig> {
92        self.channel_config.as_ref().map(|o| &**o)
93    }
94}