aws_sdk_iot/operation/update_thing/_update_thing_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The input for the UpdateThing operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct UpdateThingInput {
7 /// <p>The name of the thing to update.</p>
8 /// <p>You can't change a thing's name. 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.</p>
11 pub thing_type_name: ::std::option::Option<::std::string::String>,
12 /// <p>A list of thing attributes, a JSON string containing name-value pairs. For example:</p>
13 /// <p><code>{\"attributes\":{\"name1\":\"value2\"}}</code></p>
14 /// <p>This data is used to add new attributes or update existing attributes.</p>
15 pub attribute_payload: ::std::option::Option<crate::types::AttributePayload>,
16 /// <p>The expected version of the thing record in the registry. If the version of the record in the registry does not match the expected version specified in the request, the <code>UpdateThing</code> request is rejected with a <code>VersionConflictException</code>.</p>
17 pub expected_version: ::std::option::Option<i64>,
18 /// <p>Remove a thing type association. If <b>true</b>, the association is removed.</p>
19 pub remove_thing_type: ::std::option::Option<bool>,
20}
21impl UpdateThingInput {
22 /// <p>The name of the thing to update.</p>
23 /// <p>You can't change a thing's name. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.</p>
24 pub fn thing_name(&self) -> ::std::option::Option<&str> {
25 self.thing_name.as_deref()
26 }
27 /// <p>The name of the thing type.</p>
28 pub fn thing_type_name(&self) -> ::std::option::Option<&str> {
29 self.thing_type_name.as_deref()
30 }
31 /// <p>A list of thing attributes, a JSON string containing name-value pairs. For example:</p>
32 /// <p><code>{\"attributes\":{\"name1\":\"value2\"}}</code></p>
33 /// <p>This data is used to add new attributes or update existing attributes.</p>
34 pub fn attribute_payload(&self) -> ::std::option::Option<&crate::types::AttributePayload> {
35 self.attribute_payload.as_ref()
36 }
37 /// <p>The expected version of the thing record in the registry. If the version of the record in the registry does not match the expected version specified in the request, the <code>UpdateThing</code> request is rejected with a <code>VersionConflictException</code>.</p>
38 pub fn expected_version(&self) -> ::std::option::Option<i64> {
39 self.expected_version
40 }
41 /// <p>Remove a thing type association. If <b>true</b>, the association is removed.</p>
42 pub fn remove_thing_type(&self) -> ::std::option::Option<bool> {
43 self.remove_thing_type
44 }
45}
46impl UpdateThingInput {
47 /// Creates a new builder-style object to manufacture [`UpdateThingInput`](crate::operation::update_thing::UpdateThingInput).
48 pub fn builder() -> crate::operation::update_thing::builders::UpdateThingInputBuilder {
49 crate::operation::update_thing::builders::UpdateThingInputBuilder::default()
50 }
51}
52
53/// A builder for [`UpdateThingInput`](crate::operation::update_thing::UpdateThingInput).
54#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
55#[non_exhaustive]
56pub struct UpdateThingInputBuilder {
57 pub(crate) thing_name: ::std::option::Option<::std::string::String>,
58 pub(crate) thing_type_name: ::std::option::Option<::std::string::String>,
59 pub(crate) attribute_payload: ::std::option::Option<crate::types::AttributePayload>,
60 pub(crate) expected_version: ::std::option::Option<i64>,
61 pub(crate) remove_thing_type: ::std::option::Option<bool>,
62}
63impl UpdateThingInputBuilder {
64 /// <p>The name of the thing to update.</p>
65 /// <p>You can't change a thing's name. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.</p>
66 /// This field is required.
67 pub fn thing_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68 self.thing_name = ::std::option::Option::Some(input.into());
69 self
70 }
71 /// <p>The name of the thing to update.</p>
72 /// <p>You can't change a thing's name. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.</p>
73 pub fn set_thing_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74 self.thing_name = input;
75 self
76 }
77 /// <p>The name of the thing to update.</p>
78 /// <p>You can't change a thing's name. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.</p>
79 pub fn get_thing_name(&self) -> &::std::option::Option<::std::string::String> {
80 &self.thing_name
81 }
82 /// <p>The name of the thing type.</p>
83 pub fn thing_type_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84 self.thing_type_name = ::std::option::Option::Some(input.into());
85 self
86 }
87 /// <p>The name of the thing type.</p>
88 pub fn set_thing_type_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89 self.thing_type_name = input;
90 self
91 }
92 /// <p>The name of the thing type.</p>
93 pub fn get_thing_type_name(&self) -> &::std::option::Option<::std::string::String> {
94 &self.thing_type_name
95 }
96 /// <p>A list of thing attributes, a JSON string containing name-value pairs. For example:</p>
97 /// <p><code>{\"attributes\":{\"name1\":\"value2\"}}</code></p>
98 /// <p>This data is used to add new attributes or update existing attributes.</p>
99 pub fn attribute_payload(mut self, input: crate::types::AttributePayload) -> Self {
100 self.attribute_payload = ::std::option::Option::Some(input);
101 self
102 }
103 /// <p>A list of thing attributes, a JSON string containing name-value pairs. For example:</p>
104 /// <p><code>{\"attributes\":{\"name1\":\"value2\"}}</code></p>
105 /// <p>This data is used to add new attributes or update existing attributes.</p>
106 pub fn set_attribute_payload(mut self, input: ::std::option::Option<crate::types::AttributePayload>) -> Self {
107 self.attribute_payload = input;
108 self
109 }
110 /// <p>A list of thing attributes, a JSON string containing name-value pairs. For example:</p>
111 /// <p><code>{\"attributes\":{\"name1\":\"value2\"}}</code></p>
112 /// <p>This data is used to add new attributes or update existing attributes.</p>
113 pub fn get_attribute_payload(&self) -> &::std::option::Option<crate::types::AttributePayload> {
114 &self.attribute_payload
115 }
116 /// <p>The expected version of the thing record in the registry. If the version of the record in the registry does not match the expected version specified in the request, the <code>UpdateThing</code> request is rejected with a <code>VersionConflictException</code>.</p>
117 pub fn expected_version(mut self, input: i64) -> Self {
118 self.expected_version = ::std::option::Option::Some(input);
119 self
120 }
121 /// <p>The expected version of the thing record in the registry. If the version of the record in the registry does not match the expected version specified in the request, the <code>UpdateThing</code> request is rejected with a <code>VersionConflictException</code>.</p>
122 pub fn set_expected_version(mut self, input: ::std::option::Option<i64>) -> Self {
123 self.expected_version = input;
124 self
125 }
126 /// <p>The expected version of the thing record in the registry. If the version of the record in the registry does not match the expected version specified in the request, the <code>UpdateThing</code> request is rejected with a <code>VersionConflictException</code>.</p>
127 pub fn get_expected_version(&self) -> &::std::option::Option<i64> {
128 &self.expected_version
129 }
130 /// <p>Remove a thing type association. If <b>true</b>, the association is removed.</p>
131 pub fn remove_thing_type(mut self, input: bool) -> Self {
132 self.remove_thing_type = ::std::option::Option::Some(input);
133 self
134 }
135 /// <p>Remove a thing type association. If <b>true</b>, the association is removed.</p>
136 pub fn set_remove_thing_type(mut self, input: ::std::option::Option<bool>) -> Self {
137 self.remove_thing_type = input;
138 self
139 }
140 /// <p>Remove a thing type association. If <b>true</b>, the association is removed.</p>
141 pub fn get_remove_thing_type(&self) -> &::std::option::Option<bool> {
142 &self.remove_thing_type
143 }
144 /// Consumes the builder and constructs a [`UpdateThingInput`](crate::operation::update_thing::UpdateThingInput).
145 pub fn build(self) -> ::std::result::Result<crate::operation::update_thing::UpdateThingInput, ::aws_smithy_types::error::operation::BuildError> {
146 ::std::result::Result::Ok(crate::operation::update_thing::UpdateThingInput {
147 thing_name: self.thing_name,
148 thing_type_name: self.thing_type_name,
149 attribute_payload: self.attribute_payload,
150 expected_version: self.expected_version,
151 remove_thing_type: self.remove_thing_type,
152 })
153 }
154}