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(
34        default,
35        map(
36            key(type = super::super::super::api::ColumnName),
37            value(type = super::super::super::api::Channel)
38        )
39    )]
40    #[serde(
41        rename = "channelNameOverrides",
42        skip_serializing_if = "std::collections::BTreeMap::is_empty",
43        default
44    )]
45    channel_name_overrides: std::collections::BTreeMap<
46        super::super::super::api::ColumnName,
47        super::super::super::api::Channel,
48    >,
49    #[builder(default, into)]
50    #[serde(rename = "tagColumns", skip_serializing_if = "Option::is_none", default)]
51    tag_columns: Option<
52        std::collections::BTreeMap<
53            super::super::super::api::TagName,
54            super::super::super::api::ColumnName,
55        >,
56    >,
57    #[builder(default, into)]
58    #[serde(
59        rename = "additionalFileTags",
60        skip_serializing_if = "Option::is_none",
61        default
62    )]
63    additional_file_tags: Option<
64        std::collections::BTreeMap<
65            super::super::super::api::TagName,
66            super::super::super::api::TagValue,
67        >,
68    >,
69}
70impl IngestMetadata {
71    /// Constructs a new instance of the type.
72    #[inline]
73    pub fn new() -> Self {
74        Self::builder().build()
75    }
76    /// The timestamp metadata will be recovered from the dataset files if possible.
77    /// Older datasets may have unrecoverable timestamp metadata.
78    /// If unrecoverable, reingestion will throw MissingMetadataForReingest if not provided in request.
79    #[inline]
80    pub fn timestamp_metadata(&self) -> Option<&super::TimestampMetadata> {
81        self.timestamp_metadata.as_ref().map(|o| &**o)
82    }
83    /// Channel prefix to use when reingesting the dataset.
84    /// Defaults to empty string. Not recoverable from prior ingests and must be provided in request if needed.
85    #[inline]
86    pub fn channel_prefix(&self) -> Option<&str> {
87        self.channel_prefix.as_ref().map(|o| &**o)
88    }
89    /// Renames individual columns to explicit channel names. Composes with channelPrefix:
90    /// `final name = channelPrefix + channelNameOverrides.getOrDefault(column, column)`.
91    /// Defaults to empty map. Not recoverable from prior ingests and must be provided in request if needed.
92    /// At most 1000 entries may be provided. Resolved channel names must be unique across columns;
93    /// renaming a column onto another column's name fails the ingest.
94    #[inline]
95    pub fn channel_name_overrides(
96        &self,
97    ) -> &std::collections::BTreeMap<
98        super::super::super::api::ColumnName,
99        super::super::super::api::Channel,
100    > {
101        &self.channel_name_overrides
102    }
103    /// A map of tag names to column names to derive the tag values from.
104    /// Not recoverable from prior ingests and must be provided in request if needed.
105    #[inline]
106    pub fn tag_columns(
107        &self,
108    ) -> Option<
109        &std::collections::BTreeMap<
110            super::super::super::api::TagName,
111            super::super::super::api::ColumnName,
112        >,
113    > {
114        self.tag_columns.as_ref().map(|o| &*o)
115    }
116    /// Additional tags to apply to all dataset files within the the given dataset.
117    /// Not recoverable from prior ingests and must be provided in request if needed.
118    #[inline]
119    pub fn additional_file_tags(
120        &self,
121    ) -> Option<
122        &std::collections::BTreeMap<
123            super::super::super::api::TagName,
124            super::super::super::api::TagValue,
125        >,
126    > {
127        self.additional_file_tags.as_ref().map(|o| &*o)
128    }
129}