Skip to main content

nominal_api/conjure/objects/ingest/api/
file_extraction_input.rs

1/// Defines an input file to be provided to the extractor.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct FileExtractionInput {
17    #[serde(rename = "environmentVariable")]
18    environment_variable: super::EnvironmentVariable,
19    #[builder(into)]
20    #[serde(rename = "name")]
21    name: String,
22    #[builder(default, into)]
23    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
24    description: Option<String>,
25    #[builder(default, list(item(type = super::FileFilter)))]
26    #[serde(rename = "fileFilters", skip_serializing_if = "Vec::is_empty", default)]
27    file_filters: Vec<super::FileFilter>,
28    #[builder(default, into)]
29    #[serde(rename = "required", skip_serializing_if = "Option::is_none", default)]
30    required: Option<bool>,
31}
32impl FileExtractionInput {
33    /// Constructs a new instance of the type.
34    #[inline]
35    pub fn new(
36        environment_variable: super::EnvironmentVariable,
37        name: impl Into<String>,
38    ) -> Self {
39        Self::builder().environment_variable(environment_variable).name(name).build()
40    }
41    /// The environment variable that stores the path to the input file.
42    #[inline]
43    pub fn environment_variable(&self) -> &super::EnvironmentVariable {
44        &self.environment_variable
45    }
46    /// Name of the input file which users will be prompted with
47    #[inline]
48    pub fn name(&self) -> &str {
49        &*self.name
50    }
51    /// Description of the input file which users will be prompted with
52    #[inline]
53    pub fn description(&self) -> Option<&str> {
54        self.description.as_ref().map(|o| &**o)
55    }
56    /// Optionally filter files for file selection
57    #[inline]
58    pub fn file_filters(&self) -> &[super::FileFilter] {
59        &*self.file_filters
60    }
61    /// Whether the input file is required for the extractor to run.
62    #[inline]
63    pub fn required(&self) -> Option<bool> {
64        self.required.as_ref().map(|o| *o)
65    }
66}