Skip to main content

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

1/// Defines an input parameter 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 FileExtractionParameter {
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, into)]
26    #[serde(rename = "required", skip_serializing_if = "Option::is_none", default)]
27    required: Option<bool>,
28}
29impl FileExtractionParameter {
30    /// Constructs a new instance of the type.
31    #[inline]
32    pub fn new(
33        environment_variable: super::EnvironmentVariable,
34        name: impl Into<String>,
35    ) -> Self {
36        Self::builder().environment_variable(environment_variable).name(name).build()
37    }
38    /// The environment variable that stores the argument
39    #[inline]
40    pub fn environment_variable(&self) -> &super::EnvironmentVariable {
41        &self.environment_variable
42    }
43    /// Name of the parameter which users will be prompted with
44    #[inline]
45    pub fn name(&self) -> &str {
46        &*self.name
47    }
48    /// Description of the parameter which users will be prompted with
49    #[inline]
50    pub fn description(&self) -> Option<&str> {
51        self.description.as_ref().map(|o| &**o)
52    }
53    /// Whether the parameter is required for the extractor to run.
54    #[inline]
55    pub fn required(&self) -> Option<bool> {
56        self.required.as_ref().map(|o| *o)
57    }
58}