Skip to main content

aws_sdk_quicksight/types/
_string_parameter_declaration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A parameter declaration for the <code>String</code> data type.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct StringParameterDeclaration {
7    /// <p>The value type determines whether the parameter is a single-value or multi-value parameter.</p>
8    pub parameter_value_type: crate::types::ParameterValueType,
9    /// <p>The name of the parameter that is being declared.</p>
10    pub name: ::std::string::String,
11    /// <p>The default values of a parameter. If the parameter is a single-value parameter, a maximum of one default value can be provided.</p>
12    pub default_values: ::std::option::Option<crate::types::StringDefaultValues>,
13    /// <p>The configuration that defines the default value of a <code>String</code> parameter when a value has not been set.</p>
14    pub value_when_unset: ::std::option::Option<crate::types::StringValueWhenUnsetConfiguration>,
15    /// <p>A list of dataset parameters that are mapped to an analysis parameter.</p>
16    pub mapped_data_set_parameters: ::std::option::Option<::std::vec::Vec<crate::types::MappedDataSetParameter>>,
17}
18impl StringParameterDeclaration {
19    /// <p>The value type determines whether the parameter is a single-value or multi-value parameter.</p>
20    pub fn parameter_value_type(&self) -> &crate::types::ParameterValueType {
21        &self.parameter_value_type
22    }
23    /// <p>The name of the parameter that is being declared.</p>
24    pub fn name(&self) -> &str {
25        use std::ops::Deref;
26        self.name.deref()
27    }
28    /// <p>The default values of a parameter. If the parameter is a single-value parameter, a maximum of one default value can be provided.</p>
29    pub fn default_values(&self) -> ::std::option::Option<&crate::types::StringDefaultValues> {
30        self.default_values.as_ref()
31    }
32    /// <p>The configuration that defines the default value of a <code>String</code> parameter when a value has not been set.</p>
33    pub fn value_when_unset(&self) -> ::std::option::Option<&crate::types::StringValueWhenUnsetConfiguration> {
34        self.value_when_unset.as_ref()
35    }
36    /// <p>A list of dataset parameters that are mapped to an analysis parameter.</p>
37    ///
38    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.mapped_data_set_parameters.is_none()`.
39    pub fn mapped_data_set_parameters(&self) -> &[crate::types::MappedDataSetParameter] {
40        self.mapped_data_set_parameters.as_deref().unwrap_or_default()
41    }
42}
43impl StringParameterDeclaration {
44    /// Creates a new builder-style object to manufacture [`StringParameterDeclaration`](crate::types::StringParameterDeclaration).
45    pub fn builder() -> crate::types::builders::StringParameterDeclarationBuilder {
46        crate::types::builders::StringParameterDeclarationBuilder::default()
47    }
48}
49
50/// A builder for [`StringParameterDeclaration`](crate::types::StringParameterDeclaration).
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
52#[non_exhaustive]
53pub struct StringParameterDeclarationBuilder {
54    pub(crate) parameter_value_type: ::std::option::Option<crate::types::ParameterValueType>,
55    pub(crate) name: ::std::option::Option<::std::string::String>,
56    pub(crate) default_values: ::std::option::Option<crate::types::StringDefaultValues>,
57    pub(crate) value_when_unset: ::std::option::Option<crate::types::StringValueWhenUnsetConfiguration>,
58    pub(crate) mapped_data_set_parameters: ::std::option::Option<::std::vec::Vec<crate::types::MappedDataSetParameter>>,
59}
60impl StringParameterDeclarationBuilder {
61    /// <p>The value type determines whether the parameter is a single-value or multi-value parameter.</p>
62    /// This field is required.
63    pub fn parameter_value_type(mut self, input: crate::types::ParameterValueType) -> Self {
64        self.parameter_value_type = ::std::option::Option::Some(input);
65        self
66    }
67    /// <p>The value type determines whether the parameter is a single-value or multi-value parameter.</p>
68    pub fn set_parameter_value_type(mut self, input: ::std::option::Option<crate::types::ParameterValueType>) -> Self {
69        self.parameter_value_type = input;
70        self
71    }
72    /// <p>The value type determines whether the parameter is a single-value or multi-value parameter.</p>
73    pub fn get_parameter_value_type(&self) -> &::std::option::Option<crate::types::ParameterValueType> {
74        &self.parameter_value_type
75    }
76    /// <p>The name of the parameter that is being declared.</p>
77    /// This field is required.
78    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
79        self.name = ::std::option::Option::Some(input.into());
80        self
81    }
82    /// <p>The name of the parameter that is being declared.</p>
83    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
84        self.name = input;
85        self
86    }
87    /// <p>The name of the parameter that is being declared.</p>
88    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
89        &self.name
90    }
91    /// <p>The default values of a parameter. If the parameter is a single-value parameter, a maximum of one default value can be provided.</p>
92    pub fn default_values(mut self, input: crate::types::StringDefaultValues) -> Self {
93        self.default_values = ::std::option::Option::Some(input);
94        self
95    }
96    /// <p>The default values of a parameter. If the parameter is a single-value parameter, a maximum of one default value can be provided.</p>
97    pub fn set_default_values(mut self, input: ::std::option::Option<crate::types::StringDefaultValues>) -> Self {
98        self.default_values = input;
99        self
100    }
101    /// <p>The default values of a parameter. If the parameter is a single-value parameter, a maximum of one default value can be provided.</p>
102    pub fn get_default_values(&self) -> &::std::option::Option<crate::types::StringDefaultValues> {
103        &self.default_values
104    }
105    /// <p>The configuration that defines the default value of a <code>String</code> parameter when a value has not been set.</p>
106    pub fn value_when_unset(mut self, input: crate::types::StringValueWhenUnsetConfiguration) -> Self {
107        self.value_when_unset = ::std::option::Option::Some(input);
108        self
109    }
110    /// <p>The configuration that defines the default value of a <code>String</code> parameter when a value has not been set.</p>
111    pub fn set_value_when_unset(mut self, input: ::std::option::Option<crate::types::StringValueWhenUnsetConfiguration>) -> Self {
112        self.value_when_unset = input;
113        self
114    }
115    /// <p>The configuration that defines the default value of a <code>String</code> parameter when a value has not been set.</p>
116    pub fn get_value_when_unset(&self) -> &::std::option::Option<crate::types::StringValueWhenUnsetConfiguration> {
117        &self.value_when_unset
118    }
119    /// Appends an item to `mapped_data_set_parameters`.
120    ///
121    /// To override the contents of this collection use [`set_mapped_data_set_parameters`](Self::set_mapped_data_set_parameters).
122    ///
123    /// <p>A list of dataset parameters that are mapped to an analysis parameter.</p>
124    pub fn mapped_data_set_parameters(mut self, input: crate::types::MappedDataSetParameter) -> Self {
125        let mut v = self.mapped_data_set_parameters.unwrap_or_default();
126        v.push(input);
127        self.mapped_data_set_parameters = ::std::option::Option::Some(v);
128        self
129    }
130    /// <p>A list of dataset parameters that are mapped to an analysis parameter.</p>
131    pub fn set_mapped_data_set_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::MappedDataSetParameter>>) -> Self {
132        self.mapped_data_set_parameters = input;
133        self
134    }
135    /// <p>A list of dataset parameters that are mapped to an analysis parameter.</p>
136    pub fn get_mapped_data_set_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::MappedDataSetParameter>> {
137        &self.mapped_data_set_parameters
138    }
139    /// Consumes the builder and constructs a [`StringParameterDeclaration`](crate::types::StringParameterDeclaration).
140    /// This method will fail if any of the following fields are not set:
141    /// - [`parameter_value_type`](crate::types::builders::StringParameterDeclarationBuilder::parameter_value_type)
142    /// - [`name`](crate::types::builders::StringParameterDeclarationBuilder::name)
143    pub fn build(self) -> ::std::result::Result<crate::types::StringParameterDeclaration, ::aws_smithy_types::error::operation::BuildError> {
144        ::std::result::Result::Ok(crate::types::StringParameterDeclaration {
145            parameter_value_type: self.parameter_value_type.ok_or_else(|| {
146                ::aws_smithy_types::error::operation::BuildError::missing_field(
147                    "parameter_value_type",
148                    "parameter_value_type was not specified but it is required when building StringParameterDeclaration",
149                )
150            })?,
151            name: self.name.ok_or_else(|| {
152                ::aws_smithy_types::error::operation::BuildError::missing_field(
153                    "name",
154                    "name was not specified but it is required when building StringParameterDeclaration",
155                )
156            })?,
157            default_values: self.default_values,
158            value_when_unset: self.value_when_unset,
159            mapped_data_set_parameters: self.mapped_data_set_parameters,
160        })
161    }
162}