Skip to main content

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