Skip to main content

nominal_api_conjure/conjure/objects/ingest/api/
dataflash_opts.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 DataflashOpts {
16    #[builder(custom(type = super::IngestSource, convert = Box::new))]
17    #[serde(rename = "source")]
18    source: Box<super::IngestSource>,
19    #[builder(custom(type = super::DatasetIngestTarget, convert = Box::new))]
20    #[serde(rename = "target")]
21    target: Box<super::DatasetIngestTarget>,
22    #[builder(default, into)]
23    #[serde(
24        rename = "ignoreInvalidTimestamps",
25        skip_serializing_if = "Option::is_none",
26        default
27    )]
28    ignore_invalid_timestamps: Option<bool>,
29    #[builder(default, into)]
30    #[serde(
31        rename = "additionalFileTags",
32        skip_serializing_if = "Option::is_none",
33        default
34    )]
35    additional_file_tags: Option<std::collections::BTreeMap<String, String>>,
36}
37impl DataflashOpts {
38    /// Constructs a new instance of the type.
39    #[inline]
40    pub fn new(source: super::IngestSource, target: super::DatasetIngestTarget) -> Self {
41        Self::builder().source(source).target(target).build()
42    }
43    #[inline]
44    pub fn source(&self) -> &super::IngestSource {
45        &*self.source
46    }
47    #[inline]
48    pub fn target(&self) -> &super::DatasetIngestTarget {
49        &*self.target
50    }
51    /// If true, skips dataflash records whose timestamp cannot be represented (corrupted/out-of-range)
52    /// instead of failing the entire ingest. If not provided, defaults to false.
53    #[inline]
54    pub fn ignore_invalid_timestamps(&self) -> Option<bool> {
55        self.ignore_invalid_timestamps.as_ref().map(|o| *o)
56    }
57    /// Specifies a tag set to apply to all data in the file.
58    #[inline]
59    pub fn additional_file_tags(
60        &self,
61    ) -> Option<&std::collections::BTreeMap<String, String>> {
62        self.additional_file_tags.as_ref().map(|o| &*o)
63    }
64}