aws_sdk_iot/operation/update_dimension/
_update_dimension_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct UpdateDimensionInput {
6    /// <p>A unique identifier for the dimension. Choose something that describes the type and value to make it easy to remember what it does.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>Specifies the value or list of values for the dimension. For <code>TOPIC_FILTER</code> dimensions, this is a pattern used to match the MQTT topic (for example, "admin/#").</p>
9    pub string_values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10}
11impl UpdateDimensionInput {
12    /// <p>A unique identifier for the dimension. Choose something that describes the type and value to make it easy to remember what it does.</p>
13    pub fn name(&self) -> ::std::option::Option<&str> {
14        self.name.as_deref()
15    }
16    /// <p>Specifies the value or list of values for the dimension. For <code>TOPIC_FILTER</code> dimensions, this is a pattern used to match the MQTT topic (for example, "admin/#").</p>
17    ///
18    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.string_values.is_none()`.
19    pub fn string_values(&self) -> &[::std::string::String] {
20        self.string_values.as_deref().unwrap_or_default()
21    }
22}
23impl UpdateDimensionInput {
24    /// Creates a new builder-style object to manufacture [`UpdateDimensionInput`](crate::operation::update_dimension::UpdateDimensionInput).
25    pub fn builder() -> crate::operation::update_dimension::builders::UpdateDimensionInputBuilder {
26        crate::operation::update_dimension::builders::UpdateDimensionInputBuilder::default()
27    }
28}
29
30/// A builder for [`UpdateDimensionInput`](crate::operation::update_dimension::UpdateDimensionInput).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct UpdateDimensionInputBuilder {
34    pub(crate) name: ::std::option::Option<::std::string::String>,
35    pub(crate) string_values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
36}
37impl UpdateDimensionInputBuilder {
38    /// <p>A unique identifier for the dimension. Choose something that describes the type and value to make it easy to remember what it does.</p>
39    /// This field is required.
40    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.name = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>A unique identifier for the dimension. Choose something that describes the type and value to make it easy to remember what it does.</p>
45    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.name = input;
47        self
48    }
49    /// <p>A unique identifier for the dimension. Choose something that describes the type and value to make it easy to remember what it does.</p>
50    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
51        &self.name
52    }
53    /// Appends an item to `string_values`.
54    ///
55    /// To override the contents of this collection use [`set_string_values`](Self::set_string_values).
56    ///
57    /// <p>Specifies the value or list of values for the dimension. For <code>TOPIC_FILTER</code> dimensions, this is a pattern used to match the MQTT topic (for example, "admin/#").</p>
58    pub fn string_values(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
59        let mut v = self.string_values.unwrap_or_default();
60        v.push(input.into());
61        self.string_values = ::std::option::Option::Some(v);
62        self
63    }
64    /// <p>Specifies the value or list of values for the dimension. For <code>TOPIC_FILTER</code> dimensions, this is a pattern used to match the MQTT topic (for example, "admin/#").</p>
65    pub fn set_string_values(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
66        self.string_values = input;
67        self
68    }
69    /// <p>Specifies the value or list of values for the dimension. For <code>TOPIC_FILTER</code> dimensions, this is a pattern used to match the MQTT topic (for example, "admin/#").</p>
70    pub fn get_string_values(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
71        &self.string_values
72    }
73    /// Consumes the builder and constructs a [`UpdateDimensionInput`](crate::operation::update_dimension::UpdateDimensionInput).
74    pub fn build(
75        self,
76    ) -> ::std::result::Result<crate::operation::update_dimension::UpdateDimensionInput, ::aws_smithy_types::error::operation::BuildError> {
77        ::std::result::Result::Ok(crate::operation::update_dimension::UpdateDimensionInput {
78            name: self.name,
79            string_values: self.string_values,
80        })
81    }
82}