aws_sdk_iot/operation/create_dimension/
_create_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 CreateDimensionInput {
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 type of dimension. Supported types: <code>TOPIC_FILTER.</code></p>
9    pub r#type: ::std::option::Option<crate::types::DimensionType>,
10    /// <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>
11    pub string_values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
12    /// <p>Metadata that can be used to manage the dimension.</p>
13    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
14    /// <p>Each dimension must have a unique client request token. If you try to create a new dimension with the same token as a dimension that already exists, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.</p>
15    pub client_request_token: ::std::option::Option<::std::string::String>,
16}
17impl CreateDimensionInput {
18    /// <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>
19    pub fn name(&self) -> ::std::option::Option<&str> {
20        self.name.as_deref()
21    }
22    /// <p>Specifies the type of dimension. Supported types: <code>TOPIC_FILTER.</code></p>
23    pub fn r#type(&self) -> ::std::option::Option<&crate::types::DimensionType> {
24        self.r#type.as_ref()
25    }
26    /// <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>
27    ///
28    /// 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()`.
29    pub fn string_values(&self) -> &[::std::string::String] {
30        self.string_values.as_deref().unwrap_or_default()
31    }
32    /// <p>Metadata that can be used to manage the dimension.</p>
33    ///
34    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
35    pub fn tags(&self) -> &[crate::types::Tag] {
36        self.tags.as_deref().unwrap_or_default()
37    }
38    /// <p>Each dimension must have a unique client request token. If you try to create a new dimension with the same token as a dimension that already exists, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.</p>
39    pub fn client_request_token(&self) -> ::std::option::Option<&str> {
40        self.client_request_token.as_deref()
41    }
42}
43impl CreateDimensionInput {
44    /// Creates a new builder-style object to manufacture [`CreateDimensionInput`](crate::operation::create_dimension::CreateDimensionInput).
45    pub fn builder() -> crate::operation::create_dimension::builders::CreateDimensionInputBuilder {
46        crate::operation::create_dimension::builders::CreateDimensionInputBuilder::default()
47    }
48}
49
50/// A builder for [`CreateDimensionInput`](crate::operation::create_dimension::CreateDimensionInput).
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
52#[non_exhaustive]
53pub struct CreateDimensionInputBuilder {
54    pub(crate) name: ::std::option::Option<::std::string::String>,
55    pub(crate) r#type: ::std::option::Option<crate::types::DimensionType>,
56    pub(crate) string_values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
57    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
58    pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
59}
60impl CreateDimensionInputBuilder {
61    /// <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>
62    /// This field is required.
63    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.name = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <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>
68    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.name = input;
70        self
71    }
72    /// <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>
73    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
74        &self.name
75    }
76    /// <p>Specifies the type of dimension. Supported types: <code>TOPIC_FILTER.</code></p>
77    /// This field is required.
78    pub fn r#type(mut self, input: crate::types::DimensionType) -> Self {
79        self.r#type = ::std::option::Option::Some(input);
80        self
81    }
82    /// <p>Specifies the type of dimension. Supported types: <code>TOPIC_FILTER.</code></p>
83    pub fn set_type(mut self, input: ::std::option::Option<crate::types::DimensionType>) -> Self {
84        self.r#type = input;
85        self
86    }
87    /// <p>Specifies the type of dimension. Supported types: <code>TOPIC_FILTER.</code></p>
88    pub fn get_type(&self) -> &::std::option::Option<crate::types::DimensionType> {
89        &self.r#type
90    }
91    /// Appends an item to `string_values`.
92    ///
93    /// To override the contents of this collection use [`set_string_values`](Self::set_string_values).
94    ///
95    /// <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>
96    pub fn string_values(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        let mut v = self.string_values.unwrap_or_default();
98        v.push(input.into());
99        self.string_values = ::std::option::Option::Some(v);
100        self
101    }
102    /// <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>
103    pub fn set_string_values(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
104        self.string_values = input;
105        self
106    }
107    /// <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>
108    pub fn get_string_values(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
109        &self.string_values
110    }
111    /// Appends an item to `tags`.
112    ///
113    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
114    ///
115    /// <p>Metadata that can be used to manage the dimension.</p>
116    pub fn tags(mut self, input: crate::types::Tag) -> Self {
117        let mut v = self.tags.unwrap_or_default();
118        v.push(input);
119        self.tags = ::std::option::Option::Some(v);
120        self
121    }
122    /// <p>Metadata that can be used to manage the dimension.</p>
123    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
124        self.tags = input;
125        self
126    }
127    /// <p>Metadata that can be used to manage the dimension.</p>
128    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
129        &self.tags
130    }
131    /// <p>Each dimension must have a unique client request token. If you try to create a new dimension with the same token as a dimension that already exists, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.</p>
132    /// This field is required.
133    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134        self.client_request_token = ::std::option::Option::Some(input.into());
135        self
136    }
137    /// <p>Each dimension must have a unique client request token. If you try to create a new dimension with the same token as a dimension that already exists, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.</p>
138    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139        self.client_request_token = input;
140        self
141    }
142    /// <p>Each dimension must have a unique client request token. If you try to create a new dimension with the same token as a dimension that already exists, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.</p>
143    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
144        &self.client_request_token
145    }
146    /// Consumes the builder and constructs a [`CreateDimensionInput`](crate::operation::create_dimension::CreateDimensionInput).
147    pub fn build(
148        self,
149    ) -> ::std::result::Result<crate::operation::create_dimension::CreateDimensionInput, ::aws_smithy_types::error::operation::BuildError> {
150        ::std::result::Result::Ok(crate::operation::create_dimension::CreateDimensionInput {
151            name: self.name,
152            r#type: self.r#type,
153            string_values: self.string_values,
154            tags: self.tags,
155            client_request_token: self.client_request_token,
156        })
157    }
158}