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<
36        std::collections::BTreeMap<
37            super::super::super::api::TagName,
38            super::super::super::api::TagValue,
39        >,
40    >,
41}
42impl DataflashOpts {
43    /// Constructs a new instance of the type.
44    #[inline]
45    pub fn new(source: super::IngestSource, target: super::DatasetIngestTarget) -> Self {
46        Self::builder().source(source).target(target).build()
47    }
48    #[inline]
49    pub fn source(&self) -> &super::IngestSource {
50        &*self.source
51    }
52    #[inline]
53    pub fn target(&self) -> &super::DatasetIngestTarget {
54        &*self.target
55    }
56    /// If true, skips dataflash records whose timestamp cannot be represented (corrupted/out-of-range)
57    /// instead of failing the entire ingest. If not provided, defaults to false.
58    #[inline]
59    pub fn ignore_invalid_timestamps(&self) -> Option<bool> {
60        self.ignore_invalid_timestamps.as_ref().map(|o| *o)
61    }
62    /// Specifies a tag set to apply to all data in the file.
63    #[inline]
64    pub fn additional_file_tags(
65        &self,
66    ) -> Option<
67        &std::collections::BTreeMap<
68            super::super::super::api::TagName,
69            super::super::super::api::TagValue,
70        >,
71    > {
72        self.additional_file_tags.as_ref().map(|o| &*o)
73    }
74}