1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>The input for the AttachThingPrincipal operation.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct AttachThingPrincipalInput {
/// <p>The name of the thing.</p>
pub thing_name: ::std::option::Option<::std::string::String>,
/// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
pub principal: ::std::option::Option<::std::string::String>,
/// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
/// <ul>
/// <li>
/// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
/// </ul>
/// <ul>
/// <li>
/// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
/// </ul>
pub thing_principal_type: ::std::option::Option<crate::types::ThingPrincipalType>,
}
impl AttachThingPrincipalInput {
/// <p>The name of the thing.</p>
pub fn thing_name(&self) -> ::std::option::Option<&str> {
self.thing_name.as_deref()
}
/// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
pub fn principal(&self) -> ::std::option::Option<&str> {
self.principal.as_deref()
}
/// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
/// <ul>
/// <li>
/// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
/// </ul>
/// <ul>
/// <li>
/// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
/// </ul>
pub fn thing_principal_type(&self) -> ::std::option::Option<&crate::types::ThingPrincipalType> {
self.thing_principal_type.as_ref()
}
}
impl AttachThingPrincipalInput {
/// Creates a new builder-style object to manufacture [`AttachThingPrincipalInput`](crate::operation::attach_thing_principal::AttachThingPrincipalInput).
pub fn builder() -> crate::operation::attach_thing_principal::builders::AttachThingPrincipalInputBuilder {
crate::operation::attach_thing_principal::builders::AttachThingPrincipalInputBuilder::default()
}
}
/// A builder for [`AttachThingPrincipalInput`](crate::operation::attach_thing_principal::AttachThingPrincipalInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AttachThingPrincipalInputBuilder {
pub(crate) thing_name: ::std::option::Option<::std::string::String>,
pub(crate) principal: ::std::option::Option<::std::string::String>,
pub(crate) thing_principal_type: ::std::option::Option<crate::types::ThingPrincipalType>,
}
impl AttachThingPrincipalInputBuilder {
/// <p>The name of the thing.</p>
/// This field is required.
pub fn thing_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.thing_name = ::std::option::Option::Some(input.into());
self
}
/// <p>The name of the thing.</p>
pub fn set_thing_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.thing_name = input;
self
}
/// <p>The name of the thing.</p>
pub fn get_thing_name(&self) -> &::std::option::Option<::std::string::String> {
&self.thing_name
}
/// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
/// This field is required.
pub fn principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.principal = ::std::option::Option::Some(input.into());
self
}
/// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
pub fn set_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.principal = input;
self
}
/// <p>The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.</p>
pub fn get_principal(&self) -> &::std::option::Option<::std::string::String> {
&self.principal
}
/// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
/// <ul>
/// <li>
/// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
/// </ul>
/// <ul>
/// <li>
/// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
/// </ul>
pub fn thing_principal_type(mut self, input: crate::types::ThingPrincipalType) -> Self {
self.thing_principal_type = ::std::option::Option::Some(input);
self
}
/// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
/// <ul>
/// <li>
/// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
/// </ul>
/// <ul>
/// <li>
/// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
/// </ul>
pub fn set_thing_principal_type(mut self, input: ::std::option::Option<crate::types::ThingPrincipalType>) -> Self {
self.thing_principal_type = input;
self
}
/// <p>The type of the relation you want to specify when you attach a principal to a thing.</p>
/// <ul>
/// <li>
/// <p><code>EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.</p></li>
/// </ul>
/// <ul>
/// <li>
/// <p><code>NON_EXCLUSIVE_THING</code> - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.</p></li>
/// </ul>
pub fn get_thing_principal_type(&self) -> &::std::option::Option<crate::types::ThingPrincipalType> {
&self.thing_principal_type
}
/// Consumes the builder and constructs a [`AttachThingPrincipalInput`](crate::operation::attach_thing_principal::AttachThingPrincipalInput).
pub fn build(
self,
) -> ::std::result::Result<crate::operation::attach_thing_principal::AttachThingPrincipalInput, ::aws_smithy_types::error::operation::BuildError>
{
::std::result::Result::Ok(crate::operation::attach_thing_principal::AttachThingPrincipalInput {
thing_name: self.thing_name,
principal: self.principal,
thing_principal_type: self.thing_principal_type,
})
}
}