aws_sdk_verifiedpermissions/operation/batch_is_authorized_with_token/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::batch_is_authorized_with_token::_batch_is_authorized_with_token_output::BatchIsAuthorizedWithTokenOutputBuilder;
3
4pub use crate::operation::batch_is_authorized_with_token::_batch_is_authorized_with_token_input::BatchIsAuthorizedWithTokenInputBuilder;
5
6impl crate::operation::batch_is_authorized_with_token::builders::BatchIsAuthorizedWithTokenInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.batch_is_authorized_with_token();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `BatchIsAuthorizedWithToken`.
24///
25/// <p>Makes a series of decisions about multiple authorization requests for one token. The principal in this request comes from an external identity source in the form of an identity or access token, formatted as a <a href="https://wikipedia.org/wiki/JSON_Web_Token">JSON web token (JWT)</a>. The information in the parameters can also define additional context that Verified Permissions can include in the evaluations.</p>
26/// <p>The request is evaluated against all policies in the specified policy store that match the entities that you provide in the entities declaration and in the token. The result of the decisions is a series of <code>Allow</code> or <code>Deny</code> responses, along with the IDs of the policies that produced each decision.</p>
27/// <p>The <code>entities</code> of a <code>BatchIsAuthorizedWithToken</code> API request can contain up to 100 resources and up to 99 user groups. The <code>requests</code> of a <code>BatchIsAuthorizedWithToken</code> API request can contain up to 30 requests.</p><note>
28/// <p>The <code>BatchIsAuthorizedWithToken</code> operation doesn't have its own IAM permission. To authorize this operation for Amazon Web Services principals, include the permission <code>verifiedpermissions:IsAuthorizedWithToken</code> in their IAM policies.</p>
29/// </note>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct BatchIsAuthorizedWithTokenFluentBuilder {
32 handle: ::std::sync::Arc<crate::client::Handle>,
33 inner: crate::operation::batch_is_authorized_with_token::builders::BatchIsAuthorizedWithTokenInputBuilder,
34 config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37 crate::client::customize::internal::CustomizableSend<
38 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenOutput,
39 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenError,
40 > for BatchIsAuthorizedWithTokenFluentBuilder
41{
42 fn send(
43 self,
44 config_override: crate::config::Builder,
45 ) -> crate::client::customize::internal::BoxFuture<
46 crate::client::customize::internal::SendResult<
47 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenOutput,
48 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenError,
49 >,
50 > {
51 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52 }
53}
54impl BatchIsAuthorizedWithTokenFluentBuilder {
55 /// Creates a new `BatchIsAuthorizedWithTokenFluentBuilder`.
56 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57 Self {
58 handle,
59 inner: ::std::default::Default::default(),
60 config_override: ::std::option::Option::None,
61 }
62 }
63 /// Access the BatchIsAuthorizedWithToken as a reference.
64 pub fn as_input(&self) -> &crate::operation::batch_is_authorized_with_token::builders::BatchIsAuthorizedWithTokenInputBuilder {
65 &self.inner
66 }
67 /// Sends the request and returns the response.
68 ///
69 /// If an error occurs, an `SdkError` will be returned with additional details that
70 /// can be matched against.
71 ///
72 /// By default, any retryable failures will be retried twice. Retry behavior
73 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74 /// set when configuring the client.
75 pub async fn send(
76 self,
77 ) -> ::std::result::Result<
78 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenOutput,
79 ::aws_smithy_runtime_api::client::result::SdkError<
80 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenError,
81 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82 >,
83 > {
84 let input = self
85 .inner
86 .build()
87 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88 let runtime_plugins = crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithToken::operation_runtime_plugins(
89 self.handle.runtime_plugins.clone(),
90 &self.handle.conf,
91 self.config_override,
92 );
93 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithToken::orchestrate(&runtime_plugins, input).await
94 }
95
96 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97 pub fn customize(
98 self,
99 ) -> crate::client::customize::CustomizableOperation<
100 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenOutput,
101 crate::operation::batch_is_authorized_with_token::BatchIsAuthorizedWithTokenError,
102 Self,
103 > {
104 crate::client::customize::CustomizableOperation::new(self)
105 }
106 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107 self.set_config_override(::std::option::Option::Some(config_override.into()));
108 self
109 }
110
111 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112 self.config_override = config_override;
113 self
114 }
115 /// <p>Specifies the ID of the policy store. Policies in this policy store will be used to make an authorization decision for the input.</p>
116 pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117 self.inner = self.inner.policy_store_id(input.into());
118 self
119 }
120 /// <p>Specifies the ID of the policy store. Policies in this policy store will be used to make an authorization decision for the input.</p>
121 pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122 self.inner = self.inner.set_policy_store_id(input);
123 self
124 }
125 /// <p>Specifies the ID of the policy store. Policies in this policy store will be used to make an authorization decision for the input.</p>
126 pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
127 self.inner.get_policy_store_id()
128 }
129 /// <p>Specifies an identity (ID) token for the principal that you want to authorize in each request. This token is provided to you by the identity provider (IdP) associated with the specified identity source. You must specify either an <code>accessToken</code>, an <code>identityToken</code>, or both.</p>
130 /// <p>Must be an ID token. Verified Permissions returns an error if the <code>token_use</code> claim in the submitted token isn't <code>id</code>.</p>
131 pub fn identity_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132 self.inner = self.inner.identity_token(input.into());
133 self
134 }
135 /// <p>Specifies an identity (ID) token for the principal that you want to authorize in each request. This token is provided to you by the identity provider (IdP) associated with the specified identity source. You must specify either an <code>accessToken</code>, an <code>identityToken</code>, or both.</p>
136 /// <p>Must be an ID token. Verified Permissions returns an error if the <code>token_use</code> claim in the submitted token isn't <code>id</code>.</p>
137 pub fn set_identity_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138 self.inner = self.inner.set_identity_token(input);
139 self
140 }
141 /// <p>Specifies an identity (ID) token for the principal that you want to authorize in each request. This token is provided to you by the identity provider (IdP) associated with the specified identity source. You must specify either an <code>accessToken</code>, an <code>identityToken</code>, or both.</p>
142 /// <p>Must be an ID token. Verified Permissions returns an error if the <code>token_use</code> claim in the submitted token isn't <code>id</code>.</p>
143 pub fn get_identity_token(&self) -> &::std::option::Option<::std::string::String> {
144 self.inner.get_identity_token()
145 }
146 /// <p>Specifies an access token for the principal that you want to authorize in each request. This token is provided to you by the identity provider (IdP) associated with the specified identity source. You must specify either an <code>accessToken</code>, an <code>identityToken</code>, or both.</p>
147 /// <p>Must be an access token. Verified Permissions returns an error if the <code>token_use</code> claim in the submitted token isn't <code>access</code>.</p>
148 pub fn access_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149 self.inner = self.inner.access_token(input.into());
150 self
151 }
152 /// <p>Specifies an access token for the principal that you want to authorize in each request. This token is provided to you by the identity provider (IdP) associated with the specified identity source. You must specify either an <code>accessToken</code>, an <code>identityToken</code>, or both.</p>
153 /// <p>Must be an access token. Verified Permissions returns an error if the <code>token_use</code> claim in the submitted token isn't <code>access</code>.</p>
154 pub fn set_access_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155 self.inner = self.inner.set_access_token(input);
156 self
157 }
158 /// <p>Specifies an access token for the principal that you want to authorize in each request. This token is provided to you by the identity provider (IdP) associated with the specified identity source. You must specify either an <code>accessToken</code>, an <code>identityToken</code>, or both.</p>
159 /// <p>Must be an access token. Verified Permissions returns an error if the <code>token_use</code> claim in the submitted token isn't <code>access</code>.</p>
160 pub fn get_access_token(&self) -> &::std::option::Option<::std::string::String> {
161 self.inner.get_access_token()
162 }
163 /// <p>(Optional) Specifies the list of resources and their associated attributes that Verified Permissions can examine when evaluating the policies. These additional entities and their attributes can be referenced and checked by conditional elements in the policies in the specified policy store.</p><important>
164 /// <p>You can't include principals in this parameter, only resource and action entities. This parameter can't include any entities of a type that matches the user or group entity types that you defined in your identity source.</p>
165 /// <ul>
166 /// <li>
167 /// <p>The <code>BatchIsAuthorizedWithToken</code> operation takes principal attributes from <b> <i>only</i> </b> the <code>identityToken</code> or <code>accessToken</code> passed to the operation.</p></li>
168 /// <li>
169 /// <p>For action entities, you can include only their <code>Identifier</code> and <code>EntityType</code>.</p></li>
170 /// </ul>
171 /// </important>
172 pub fn entities(mut self, input: crate::types::EntitiesDefinition) -> Self {
173 self.inner = self.inner.entities(input);
174 self
175 }
176 /// <p>(Optional) Specifies the list of resources and their associated attributes that Verified Permissions can examine when evaluating the policies. These additional entities and their attributes can be referenced and checked by conditional elements in the policies in the specified policy store.</p><important>
177 /// <p>You can't include principals in this parameter, only resource and action entities. This parameter can't include any entities of a type that matches the user or group entity types that you defined in your identity source.</p>
178 /// <ul>
179 /// <li>
180 /// <p>The <code>BatchIsAuthorizedWithToken</code> operation takes principal attributes from <b> <i>only</i> </b> the <code>identityToken</code> or <code>accessToken</code> passed to the operation.</p></li>
181 /// <li>
182 /// <p>For action entities, you can include only their <code>Identifier</code> and <code>EntityType</code>.</p></li>
183 /// </ul>
184 /// </important>
185 pub fn set_entities(mut self, input: ::std::option::Option<crate::types::EntitiesDefinition>) -> Self {
186 self.inner = self.inner.set_entities(input);
187 self
188 }
189 /// <p>(Optional) Specifies the list of resources and their associated attributes that Verified Permissions can examine when evaluating the policies. These additional entities and their attributes can be referenced and checked by conditional elements in the policies in the specified policy store.</p><important>
190 /// <p>You can't include principals in this parameter, only resource and action entities. This parameter can't include any entities of a type that matches the user or group entity types that you defined in your identity source.</p>
191 /// <ul>
192 /// <li>
193 /// <p>The <code>BatchIsAuthorizedWithToken</code> operation takes principal attributes from <b> <i>only</i> </b> the <code>identityToken</code> or <code>accessToken</code> passed to the operation.</p></li>
194 /// <li>
195 /// <p>For action entities, you can include only their <code>Identifier</code> and <code>EntityType</code>.</p></li>
196 /// </ul>
197 /// </important>
198 pub fn get_entities(&self) -> &::std::option::Option<crate::types::EntitiesDefinition> {
199 self.inner.get_entities()
200 }
201 ///
202 /// Appends an item to `requests`.
203 ///
204 /// To override the contents of this collection use [`set_requests`](Self::set_requests).
205 ///
206 /// <p>An array of up to 30 requests that you want Verified Permissions to evaluate.</p>
207 pub fn requests(mut self, input: crate::types::BatchIsAuthorizedWithTokenInputItem) -> Self {
208 self.inner = self.inner.requests(input);
209 self
210 }
211 /// <p>An array of up to 30 requests that you want Verified Permissions to evaluate.</p>
212 pub fn set_requests(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::BatchIsAuthorizedWithTokenInputItem>>) -> Self {
213 self.inner = self.inner.set_requests(input);
214 self
215 }
216 /// <p>An array of up to 30 requests that you want Verified Permissions to evaluate.</p>
217 pub fn get_requests(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::BatchIsAuthorizedWithTokenInputItem>> {
218 self.inner.get_requests()
219 }
220}