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(
59        default,
60        map(
61            key(type = super::super::super::api::TagName),
62            value(type = super::super::super::api::TagValue)
63        )
64    )]
65    #[serde(
66        rename = "additionalFileTags",
67        skip_serializing_if = "std::collections::BTreeMap::is_empty",
68        default
69    )]
70    additional_file_tags: std::collections::BTreeMap<
71        super::super::super::api::TagName,
72        super::super::super::api::TagValue,
73    >,
74}
75impl ContainerizedOpts {
76    /// Constructs a new instance of the type.
77    #[inline]
78    pub fn new(
79        extractor_rid: super::ContainerizedExtractorRid,
80        target: super::DatasetIngestTarget,
81    ) -> Self {
82        Self::builder().extractor_rid(extractor_rid).target(target).build()
83    }
84    #[inline]
85    pub fn sources(
86        &self,
87    ) -> &std::collections::BTreeMap<super::EnvironmentVariable, super::IngestSource> {
88        &self.sources
89    }
90    #[inline]
91    pub fn arguments(
92        &self,
93    ) -> &std::collections::BTreeMap<super::EnvironmentVariable, String> {
94        &self.arguments
95    }
96    #[inline]
97    pub fn extractor_rid(&self) -> &super::ContainerizedExtractorRid {
98        &self.extractor_rid
99    }
100    #[inline]
101    pub fn timestamp_metadata(&self) -> Option<&super::TimestampMetadata> {
102        self.timestamp_metadata.as_ref().map(|o| &**o)
103    }
104    #[inline]
105    pub fn tag(&self) -> Option<&str> {
106        self.tag.as_ref().map(|o| &**o)
107    }
108    #[inline]
109    pub fn target(&self) -> &super::DatasetIngestTarget {
110        &*self.target
111    }
112    /// Specifies a tag set to apply to all data in the file.
113    #[inline]
114    pub fn additional_file_tags(
115        &self,
116    ) -> &std::collections::BTreeMap<
117        super::super::super::api::TagName,
118        super::super::super::api::TagValue,
119    > {
120        &self.additional_file_tags
121    }
122}