Skip to main content

nominal_api_conjure/conjure/objects/ingest/api/
ingest_metadata.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 IngestMetadata {
16    #[builder(
17        default,
18        custom(
19            type = impl
20            Into<Option<super::TimestampMetadata>>,
21            convert = |v|v.into().map(Box::new)
22        )
23    )]
24    #[serde(
25        rename = "timestampMetadata",
26        skip_serializing_if = "Option::is_none",
27        default
28    )]
29    timestamp_metadata: Option<Box<super::TimestampMetadata>>,
30    #[builder(default, into)]
31    #[serde(rename = "channelPrefix", skip_serializing_if = "Option::is_none", default)]
32    channel_prefix: Option<String>,
33    #[builder(default, map(key(type = String, into), value(type = String, into)))]
34    #[serde(
35        rename = "channelNameOverrides",
36        skip_serializing_if = "std::collections::BTreeMap::is_empty",
37        default
38    )]
39    channel_name_overrides: std::collections::BTreeMap<String, String>,
40    #[builder(default, into)]
41    #[serde(rename = "tagColumns", skip_serializing_if = "Option::is_none", default)]
42    tag_columns: Option<std::collections::BTreeMap<String, String>>,
43    #[builder(default, into)]
44    #[serde(
45        rename = "additionalFileTags",
46        skip_serializing_if = "Option::is_none",
47        default
48    )]
49    additional_file_tags: Option<std::collections::BTreeMap<String, String>>,
50}
51impl IngestMetadata {
52    /// Constructs a new instance of the type.
53    #[inline]
54    pub fn new() -> Self {
55        Self::builder().build()
56    }
57    /// The timestamp metadata will be recovered from the dataset files if possible.
58    /// Older datasets may have unrecoverable timestamp metadata.
59    /// If unrecoverable, reingestion will throw MissingMetadataForReingest if not provided in request.
60    #[inline]
61    pub fn timestamp_metadata(&self) -> Option<&super::TimestampMetadata> {
62        self.timestamp_metadata.as_ref().map(|o| &**o)
63    }
64    /// Channel prefix to use when reingesting the dataset.
65    /// Defaults to empty string. Not recoverable from prior ingests and must be provided in request if needed.
66    #[inline]
67    pub fn channel_prefix(&self) -> Option<&str> {
68        self.channel_prefix.as_ref().map(|o| &**o)
69    }
70    /// Renames individual columns to explicit channel names. Composes with channelPrefix:
71    /// `final name = channelPrefix + channelNameOverrides.getOrDefault(column, column)`.
72    /// Defaults to empty map. Not recoverable from prior ingests and must be provided in request if needed.
73    /// At most 1000 entries may be provided. Resolved channel names must be unique across columns;
74    /// renaming a column onto another column's name fails the ingest.
75    #[inline]
76    pub fn channel_name_overrides(&self) -> &std::collections::BTreeMap<String, String> {
77        &self.channel_name_overrides
78    }
79    /// A map of tag names to column names to derive the tag values from.
80    /// Not recoverable from prior ingests and must be provided in request if needed.
81    #[inline]
82    pub fn tag_columns(&self) -> Option<&std::collections::BTreeMap<String, String>> {
83        self.tag_columns.as_ref().map(|o| &*o)
84    }
85    /// Additional tags to apply to all dataset files within the the given dataset.
86    /// Not recoverable from prior ingests and must be provided in request if needed.
87    #[inline]
88    pub fn additional_file_tags(
89        &self,
90    ) -> Option<&std::collections::BTreeMap<String, String>> {
91        self.additional_file_tags.as_ref().map(|o| &*o)
92    }
93}