Skip to main content

nominal_api/conjure/objects/ingest/api/
containerized_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 ContainerizedOpts {
16    #[builder(
17        default,
18        map(key(type = super::EnvironmentVariable), value(type = super::IngestSource))
19    )]
20    #[serde(
21        rename = "sources",
22        skip_serializing_if = "std::collections::BTreeMap::is_empty",
23        default
24    )]
25    sources: std::collections::BTreeMap<super::EnvironmentVariable, super::IngestSource>,
26    #[builder(
27        default,
28        map(key(type = super::EnvironmentVariable), value(type = String, into))
29    )]
30    #[serde(
31        rename = "arguments",
32        skip_serializing_if = "std::collections::BTreeMap::is_empty",
33        default
34    )]
35    arguments: std::collections::BTreeMap<super::EnvironmentVariable, String>,
36    #[serde(rename = "extractorRid")]
37    extractor_rid: super::ContainerizedExtractorRid,
38    #[builder(
39        default,
40        custom(
41            type = impl
42            Into<Option<super::TimestampMetadata>>,
43            convert = |v|v.into().map(Box::new)
44        )
45    )]
46    #[serde(
47        rename = "timestampMetadata",
48        skip_serializing_if = "Option::is_none",
49        default
50    )]
51    timestamp_metadata: Option<Box<super::TimestampMetadata>>,
52    #[builder(default, into)]
53    #[serde(rename = "tag", skip_serializing_if = "Option::is_none", default)]
54    tag: Option<String>,
55    #[builder(custom(type = super::DatasetIngestTarget, convert = Box::new))]
56    #[serde(rename = "target")]
57    target: Box<super::DatasetIngestTarget>,
58    #[builder(default, map(key(type = String, into), value(type = String, into)))]
59    #[serde(
60        rename = "additionalFileTags",
61        skip_serializing_if = "std::collections::BTreeMap::is_empty",
62        default
63    )]
64    additional_file_tags: std::collections::BTreeMap<String, String>,
65}
66impl ContainerizedOpts {
67    /// Constructs a new instance of the type.
68    #[inline]
69    pub fn new(
70        extractor_rid: super::ContainerizedExtractorRid,
71        target: super::DatasetIngestTarget,
72    ) -> Self {
73        Self::builder().extractor_rid(extractor_rid).target(target).build()
74    }
75    #[inline]
76    pub fn sources(
77        &self,
78    ) -> &std::collections::BTreeMap<super::EnvironmentVariable, super::IngestSource> {
79        &self.sources
80    }
81    #[inline]
82    pub fn arguments(
83        &self,
84    ) -> &std::collections::BTreeMap<super::EnvironmentVariable, String> {
85        &self.arguments
86    }
87    #[inline]
88    pub fn extractor_rid(&self) -> &super::ContainerizedExtractorRid {
89        &self.extractor_rid
90    }
91    #[inline]
92    pub fn timestamp_metadata(&self) -> Option<&super::TimestampMetadata> {
93        self.timestamp_metadata.as_ref().map(|o| &**o)
94    }
95    #[inline]
96    pub fn tag(&self) -> Option<&str> {
97        self.tag.as_ref().map(|o| &**o)
98    }
99    #[inline]
100    pub fn target(&self) -> &super::DatasetIngestTarget {
101        &*self.target
102    }
103    /// Specifies a tag set to apply to all data in the file.
104    #[inline]
105    pub fn additional_file_tags(&self) -> &std::collections::BTreeMap<String, String> {
106        &self.additional_file_tags
107    }
108}