aws_sdk_iot/operation/create_thing/
_create_thing_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The input for the CreateThing operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateThingInput {
7    /// <p>The name of the thing to create.</p>
8    /// <p>You can't change a thing's name after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.</p>
9    pub thing_name: ::std::option::Option<::std::string::String>,
10    /// <p>The name of the thing type associated with the new thing.</p>
11    pub thing_type_name: ::std::option::Option<::std::string::String>,
12    /// <p>The attribute payload, which consists of up to three name/value pairs in a JSON document. For example:</p>
13    /// <p><code>{\"attributes\":{\"string1\":\"string2\"}}</code></p>
14    pub attribute_payload: ::std::option::Option<crate::types::AttributePayload>,
15    /// <p>The name of the billing group the thing will be added to.</p>
16    pub billing_group_name: ::std::option::Option<::std::string::String>,
17}
18impl CreateThingInput {
19    /// <p>The name of the thing to create.</p>
20    /// <p>You can't change a thing's name after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.</p>
21    pub fn thing_name(&self) -> ::std::option::Option<&str> {
22        self.thing_name.as_deref()
23    }
24    /// <p>The name of the thing type associated with the new thing.</p>
25    pub fn thing_type_name(&self) -> ::std::option::Option<&str> {
26        self.thing_type_name.as_deref()
27    }
28    /// <p>The attribute payload, which consists of up to three name/value pairs in a JSON document. For example:</p>
29    /// <p><code>{\"attributes\":{\"string1\":\"string2\"}}</code></p>
30    pub fn attribute_payload(&self) -> ::std::option::Option<&crate::types::AttributePayload> {
31        self.attribute_payload.as_ref()
32    }
33    /// <p>The name of the billing group the thing will be added to.</p>
34    pub fn billing_group_name(&self) -> ::std::option::Option<&str> {
35        self.billing_group_name.as_deref()
36    }
37}
38impl CreateThingInput {
39    /// Creates a new builder-style object to manufacture [`CreateThingInput`](crate::operation::create_thing::CreateThingInput).
40    pub fn builder() -> crate::operation::create_thing::builders::CreateThingInputBuilder {
41        crate::operation::create_thing::builders::CreateThingInputBuilder::default()
42    }
43}
44
45/// A builder for [`CreateThingInput`](crate::operation::create_thing::CreateThingInput).
46#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
47#[non_exhaustive]
48pub struct CreateThingInputBuilder {
49    pub(crate) thing_name: ::std::option::Option<::std::string::String>,
50    pub(crate) thing_type_name: ::std::option::Option<::std::string::String>,
51    pub(crate) attribute_payload: ::std::option::Option<crate::types::AttributePayload>,
52    pub(crate) billing_group_name: ::std::option::Option<::std::string::String>,
53}
54impl CreateThingInputBuilder {
55    /// <p>The name of the thing to create.</p>
56    /// <p>You can't change a thing's name after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.</p>
57    /// This field is required.
58    pub fn thing_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
59        self.thing_name = ::std::option::Option::Some(input.into());
60        self
61    }
62    /// <p>The name of the thing to create.</p>
63    /// <p>You can't change a thing's name after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.</p>
64    pub fn set_thing_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
65        self.thing_name = input;
66        self
67    }
68    /// <p>The name of the thing to create.</p>
69    /// <p>You can't change a thing's name after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.</p>
70    pub fn get_thing_name(&self) -> &::std::option::Option<::std::string::String> {
71        &self.thing_name
72    }
73    /// <p>The name of the thing type associated with the new thing.</p>
74    pub fn thing_type_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
75        self.thing_type_name = ::std::option::Option::Some(input.into());
76        self
77    }
78    /// <p>The name of the thing type associated with the new thing.</p>
79    pub fn set_thing_type_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
80        self.thing_type_name = input;
81        self
82    }
83    /// <p>The name of the thing type associated with the new thing.</p>
84    pub fn get_thing_type_name(&self) -> &::std::option::Option<::std::string::String> {
85        &self.thing_type_name
86    }
87    /// <p>The attribute payload, which consists of up to three name/value pairs in a JSON document. For example:</p>
88    /// <p><code>{\"attributes\":{\"string1\":\"string2\"}}</code></p>
89    pub fn attribute_payload(mut self, input: crate::types::AttributePayload) -> Self {
90        self.attribute_payload = ::std::option::Option::Some(input);
91        self
92    }
93    /// <p>The attribute payload, which consists of up to three name/value pairs in a JSON document. For example:</p>
94    /// <p><code>{\"attributes\":{\"string1\":\"string2\"}}</code></p>
95    pub fn set_attribute_payload(mut self, input: ::std::option::Option<crate::types::AttributePayload>) -> Self {
96        self.attribute_payload = input;
97        self
98    }
99    /// <p>The attribute payload, which consists of up to three name/value pairs in a JSON document. For example:</p>
100    /// <p><code>{\"attributes\":{\"string1\":\"string2\"}}</code></p>
101    pub fn get_attribute_payload(&self) -> &::std::option::Option<crate::types::AttributePayload> {
102        &self.attribute_payload
103    }
104    /// <p>The name of the billing group the thing will be added to.</p>
105    pub fn billing_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
106        self.billing_group_name = ::std::option::Option::Some(input.into());
107        self
108    }
109    /// <p>The name of the billing group the thing will be added to.</p>
110    pub fn set_billing_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
111        self.billing_group_name = input;
112        self
113    }
114    /// <p>The name of the billing group the thing will be added to.</p>
115    pub fn get_billing_group_name(&self) -> &::std::option::Option<::std::string::String> {
116        &self.billing_group_name
117    }
118    /// Consumes the builder and constructs a [`CreateThingInput`](crate::operation::create_thing::CreateThingInput).
119    pub fn build(self) -> ::std::result::Result<crate::operation::create_thing::CreateThingInput, ::aws_smithy_types::error::operation::BuildError> {
120        ::std::result::Result::Ok(crate::operation::create_thing::CreateThingInput {
121            thing_name: self.thing_name,
122            thing_type_name: self.thing_type_name,
123            attribute_payload: self.attribute_payload,
124            billing_group_name: self.billing_group_name,
125        })
126    }
127}