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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct TestAuthorizationInput {
/// <p>The principal. Valid principals are CertificateArn (arn:aws:iot:<i>region</i>:<i>accountId</i>:cert/<i>certificateId</i>) and CognitoId (<i>region</i>:<i>id</i>).</p>
pub principal: ::std::option::Option<::std::string::String>,
/// <p>The Cognito identity pool ID.</p>
pub cognito_identity_pool_id: ::std::option::Option<::std::string::String>,
/// <p>A list of authorization info objects. Simulating authorization will create a response for each <code>authInfo</code> object in the list.</p>
pub auth_infos: ::std::option::Option<::std::vec::Vec<crate::types::AuthInfo>>,
/// <p>The MQTT client ID.</p>
pub client_id: ::std::option::Option<::std::string::String>,
/// <p>When testing custom authorization, the policies specified here are treated as if they are attached to the principal being authorized.</p>
pub policy_names_to_add: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
/// <p>When testing custom authorization, the policies specified here are treated as if they are not attached to the principal being authorized.</p>
pub policy_names_to_skip: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl TestAuthorizationInput {
/// <p>The principal. Valid principals are CertificateArn (arn:aws:iot:<i>region</i>:<i>accountId</i>:cert/<i>certificateId</i>) and CognitoId (<i>region</i>:<i>id</i>).</p>
pub fn principal(&self) -> ::std::option::Option<&str> {
self.principal.as_deref()
}
/// <p>The Cognito identity pool ID.</p>
pub fn cognito_identity_pool_id(&self) -> ::std::option::Option<&str> {
self.cognito_identity_pool_id.as_deref()
}
/// <p>A list of authorization info objects. Simulating authorization will create a response for each <code>authInfo</code> object in the list.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.auth_infos.is_none()`.
pub fn auth_infos(&self) -> &[crate::types::AuthInfo] {
self.auth_infos.as_deref().unwrap_or_default()
}
/// <p>The MQTT client ID.</p>
pub fn client_id(&self) -> ::std::option::Option<&str> {
self.client_id.as_deref()
}
/// <p>When testing custom authorization, the policies specified here are treated as if they are attached to the principal being authorized.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.policy_names_to_add.is_none()`.
pub fn policy_names_to_add(&self) -> &[::std::string::String] {
self.policy_names_to_add.as_deref().unwrap_or_default()
}
/// <p>When testing custom authorization, the policies specified here are treated as if they are not attached to the principal being authorized.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.policy_names_to_skip.is_none()`.
pub fn policy_names_to_skip(&self) -> &[::std::string::String] {
self.policy_names_to_skip.as_deref().unwrap_or_default()
}
}
impl TestAuthorizationInput {
/// Creates a new builder-style object to manufacture [`TestAuthorizationInput`](crate::operation::test_authorization::TestAuthorizationInput).
pub fn builder() -> crate::operation::test_authorization::builders::TestAuthorizationInputBuilder {
crate::operation::test_authorization::builders::TestAuthorizationInputBuilder::default()
}
}
/// A builder for [`TestAuthorizationInput`](crate::operation::test_authorization::TestAuthorizationInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct TestAuthorizationInputBuilder {
pub(crate) principal: ::std::option::Option<::std::string::String>,
pub(crate) cognito_identity_pool_id: ::std::option::Option<::std::string::String>,
pub(crate) auth_infos: ::std::option::Option<::std::vec::Vec<crate::types::AuthInfo>>,
pub(crate) client_id: ::std::option::Option<::std::string::String>,
pub(crate) policy_names_to_add: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub(crate) policy_names_to_skip: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl TestAuthorizationInputBuilder {
/// <p>The principal. Valid principals are CertificateArn (arn:aws:iot:<i>region</i>:<i>accountId</i>:cert/<i>certificateId</i>) and CognitoId (<i>region</i>:<i>id</i>).</p>
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. Valid principals are CertificateArn (arn:aws:iot:<i>region</i>:<i>accountId</i>:cert/<i>certificateId</i>) and CognitoId (<i>region</i>:<i>id</i>).</p>
pub fn set_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.principal = input;
self
}
/// <p>The principal. Valid principals are CertificateArn (arn:aws:iot:<i>region</i>:<i>accountId</i>:cert/<i>certificateId</i>) and CognitoId (<i>region</i>:<i>id</i>).</p>
pub fn get_principal(&self) -> &::std::option::Option<::std::string::String> {
&self.principal
}
/// <p>The Cognito identity pool ID.</p>
pub fn cognito_identity_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.cognito_identity_pool_id = ::std::option::Option::Some(input.into());
self
}
/// <p>The Cognito identity pool ID.</p>
pub fn set_cognito_identity_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.cognito_identity_pool_id = input;
self
}
/// <p>The Cognito identity pool ID.</p>
pub fn get_cognito_identity_pool_id(&self) -> &::std::option::Option<::std::string::String> {
&self.cognito_identity_pool_id
}
/// Appends an item to `auth_infos`.
///
/// To override the contents of this collection use [`set_auth_infos`](Self::set_auth_infos).
///
/// <p>A list of authorization info objects. Simulating authorization will create a response for each <code>authInfo</code> object in the list.</p>
pub fn auth_infos(mut self, input: crate::types::AuthInfo) -> Self {
let mut v = self.auth_infos.unwrap_or_default();
v.push(input);
self.auth_infos = ::std::option::Option::Some(v);
self
}
/// <p>A list of authorization info objects. Simulating authorization will create a response for each <code>authInfo</code> object in the list.</p>
pub fn set_auth_infos(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AuthInfo>>) -> Self {
self.auth_infos = input;
self
}
/// <p>A list of authorization info objects. Simulating authorization will create a response for each <code>authInfo</code> object in the list.</p>
pub fn get_auth_infos(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AuthInfo>> {
&self.auth_infos
}
/// <p>The MQTT client ID.</p>
pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.client_id = ::std::option::Option::Some(input.into());
self
}
/// <p>The MQTT client ID.</p>
pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.client_id = input;
self
}
/// <p>The MQTT client ID.</p>
pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
&self.client_id
}
/// Appends an item to `policy_names_to_add`.
///
/// To override the contents of this collection use [`set_policy_names_to_add`](Self::set_policy_names_to_add).
///
/// <p>When testing custom authorization, the policies specified here are treated as if they are attached to the principal being authorized.</p>
pub fn policy_names_to_add(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.policy_names_to_add.unwrap_or_default();
v.push(input.into());
self.policy_names_to_add = ::std::option::Option::Some(v);
self
}
/// <p>When testing custom authorization, the policies specified here are treated as if they are attached to the principal being authorized.</p>
pub fn set_policy_names_to_add(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.policy_names_to_add = input;
self
}
/// <p>When testing custom authorization, the policies specified here are treated as if they are attached to the principal being authorized.</p>
pub fn get_policy_names_to_add(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.policy_names_to_add
}
/// Appends an item to `policy_names_to_skip`.
///
/// To override the contents of this collection use [`set_policy_names_to_skip`](Self::set_policy_names_to_skip).
///
/// <p>When testing custom authorization, the policies specified here are treated as if they are not attached to the principal being authorized.</p>
pub fn policy_names_to_skip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.policy_names_to_skip.unwrap_or_default();
v.push(input.into());
self.policy_names_to_skip = ::std::option::Option::Some(v);
self
}
/// <p>When testing custom authorization, the policies specified here are treated as if they are not attached to the principal being authorized.</p>
pub fn set_policy_names_to_skip(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.policy_names_to_skip = input;
self
}
/// <p>When testing custom authorization, the policies specified here are treated as if they are not attached to the principal being authorized.</p>
pub fn get_policy_names_to_skip(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.policy_names_to_skip
}
/// Consumes the builder and constructs a [`TestAuthorizationInput`](crate::operation::test_authorization::TestAuthorizationInput).
pub fn build(
self,
) -> ::std::result::Result<crate::operation::test_authorization::TestAuthorizationInput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::test_authorization::TestAuthorizationInput {
principal: self.principal,
cognito_identity_pool_id: self.cognito_identity_pool_id,
auth_infos: self.auth_infos,
client_id: self.client_id,
policy_names_to_add: self.policy_names_to_add,
policy_names_to_skip: self.policy_names_to_skip,
})
}
}