aws_sdk_verifiedpermissions/operation/is_authorized_with_token/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::is_authorized_with_token::_is_authorized_with_token_output::IsAuthorizedWithTokenOutputBuilder;
3
4pub use crate::operation::is_authorized_with_token::_is_authorized_with_token_input::IsAuthorizedWithTokenInputBuilder;
5
6impl crate::operation::is_authorized_with_token::builders::IsAuthorizedWithTokenInputBuilder {
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::is_authorized_with_token::IsAuthorizedWithTokenOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::is_authorized_with_token::IsAuthorizedWithTokenError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.is_authorized_with_token();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `IsAuthorizedWithToken`.
24///
25/// <p>Makes an authorization decision about a service request described in the parameters. The principal in this request comes from an external identity source in the form of an identity 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 evaluation. The request is evaluated against all matching policies in the specified policy store. The result of the decision is either <code>Allow</code> or <code>Deny</code>, along with a list of the policies that resulted in the decision.</p>
26/// <p>Verified Permissions validates each token that is specified in a request by checking its expiration date and its signature.</p><important>
27/// <p>Tokens from an identity source user continue to be usable until they expire. Token revocation and resource deletion have no effect on the validity of a token in your policy store</p>
28/// </important>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct IsAuthorizedWithTokenFluentBuilder {
31 handle: ::std::sync::Arc<crate::client::Handle>,
32 inner: crate::operation::is_authorized_with_token::builders::IsAuthorizedWithTokenInputBuilder,
33 config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36 crate::client::customize::internal::CustomizableSend<
37 crate::operation::is_authorized_with_token::IsAuthorizedWithTokenOutput,
38 crate::operation::is_authorized_with_token::IsAuthorizedWithTokenError,
39 > for IsAuthorizedWithTokenFluentBuilder
40{
41 fn send(
42 self,
43 config_override: crate::config::Builder,
44 ) -> crate::client::customize::internal::BoxFuture<
45 crate::client::customize::internal::SendResult<
46 crate::operation::is_authorized_with_token::IsAuthorizedWithTokenOutput,
47 crate::operation::is_authorized_with_token::IsAuthorizedWithTokenError,
48 >,
49 > {
50 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51 }
52}
53impl IsAuthorizedWithTokenFluentBuilder {
54 /// Creates a new `IsAuthorizedWithTokenFluentBuilder`.
55 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56 Self {
57 handle,
58 inner: ::std::default::Default::default(),
59 config_override: ::std::option::Option::None,
60 }
61 }
62 /// Access the IsAuthorizedWithToken as a reference.
63 pub fn as_input(&self) -> &crate::operation::is_authorized_with_token::builders::IsAuthorizedWithTokenInputBuilder {
64 &self.inner
65 }
66 /// Sends the request and returns the response.
67 ///
68 /// If an error occurs, an `SdkError` will be returned with additional details that
69 /// can be matched against.
70 ///
71 /// By default, any retryable failures will be retried twice. Retry behavior
72 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73 /// set when configuring the client.
74 pub async fn send(
75 self,
76 ) -> ::std::result::Result<
77 crate::operation::is_authorized_with_token::IsAuthorizedWithTokenOutput,
78 ::aws_smithy_runtime_api::client::result::SdkError<
79 crate::operation::is_authorized_with_token::IsAuthorizedWithTokenError,
80 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81 >,
82 > {
83 let input = self
84 .inner
85 .build()
86 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87 let runtime_plugins = crate::operation::is_authorized_with_token::IsAuthorizedWithToken::operation_runtime_plugins(
88 self.handle.runtime_plugins.clone(),
89 &self.handle.conf,
90 self.config_override,
91 );
92 crate::operation::is_authorized_with_token::IsAuthorizedWithToken::orchestrate(&runtime_plugins, input).await
93 }
94
95 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96 pub fn customize(
97 self,
98 ) -> crate::client::customize::CustomizableOperation<
99 crate::operation::is_authorized_with_token::IsAuthorizedWithTokenOutput,
100 crate::operation::is_authorized_with_token::IsAuthorizedWithTokenError,
101 Self,
102 > {
103 crate::client::customize::CustomizableOperation::new(self)
104 }
105 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106 self.set_config_override(::std::option::Option::Some(config_override.into()));
107 self
108 }
109
110 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111 self.config_override = config_override;
112 self
113 }
114 /// <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>
115 pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116 self.inner = self.inner.policy_store_id(input.into());
117 self
118 }
119 /// <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>
120 pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121 self.inner = self.inner.set_policy_store_id(input);
122 self
123 }
124 /// <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>
125 pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
126 self.inner.get_policy_store_id()
127 }
128 /// <p>Specifies an identity token for the principal to be authorized. 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>
129 /// <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>
130 pub fn identity_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.inner = self.inner.identity_token(input.into());
132 self
133 }
134 /// <p>Specifies an identity token for the principal to be authorized. 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>
135 /// <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>
136 pub fn set_identity_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137 self.inner = self.inner.set_identity_token(input);
138 self
139 }
140 /// <p>Specifies an identity token for the principal to be authorized. 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>
141 /// <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>
142 pub fn get_identity_token(&self) -> &::std::option::Option<::std::string::String> {
143 self.inner.get_identity_token()
144 }
145 /// <p>Specifies an access token for the principal to be authorized. 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>
146 /// <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>
147 pub fn access_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148 self.inner = self.inner.access_token(input.into());
149 self
150 }
151 /// <p>Specifies an access token for the principal to be authorized. 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>
152 /// <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>
153 pub fn set_access_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154 self.inner = self.inner.set_access_token(input);
155 self
156 }
157 /// <p>Specifies an access token for the principal to be authorized. 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>
158 /// <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>
159 pub fn get_access_token(&self) -> &::std::option::Option<::std::string::String> {
160 self.inner.get_access_token()
161 }
162 /// <p>Specifies the requested action to be authorized. Is the specified principal authorized to perform this action on the specified resource.</p>
163 pub fn action(mut self, input: crate::types::ActionIdentifier) -> Self {
164 self.inner = self.inner.action(input);
165 self
166 }
167 /// <p>Specifies the requested action to be authorized. Is the specified principal authorized to perform this action on the specified resource.</p>
168 pub fn set_action(mut self, input: ::std::option::Option<crate::types::ActionIdentifier>) -> Self {
169 self.inner = self.inner.set_action(input);
170 self
171 }
172 /// <p>Specifies the requested action to be authorized. Is the specified principal authorized to perform this action on the specified resource.</p>
173 pub fn get_action(&self) -> &::std::option::Option<crate::types::ActionIdentifier> {
174 self.inner.get_action()
175 }
176 /// <p>Specifies the resource for which the authorization decision is made. For example, is the principal allowed to perform the action on the resource?</p>
177 pub fn resource(mut self, input: crate::types::EntityIdentifier) -> Self {
178 self.inner = self.inner.resource(input);
179 self
180 }
181 /// <p>Specifies the resource for which the authorization decision is made. For example, is the principal allowed to perform the action on the resource?</p>
182 pub fn set_resource(mut self, input: ::std::option::Option<crate::types::EntityIdentifier>) -> Self {
183 self.inner = self.inner.set_resource(input);
184 self
185 }
186 /// <p>Specifies the resource for which the authorization decision is made. For example, is the principal allowed to perform the action on the resource?</p>
187 pub fn get_resource(&self) -> &::std::option::Option<crate::types::EntityIdentifier> {
188 self.inner.get_resource()
189 }
190 /// <p>Specifies additional context that can be used to make more granular authorization decisions.</p>
191 pub fn context(mut self, input: crate::types::ContextDefinition) -> Self {
192 self.inner = self.inner.context(input);
193 self
194 }
195 /// <p>Specifies additional context that can be used to make more granular authorization decisions.</p>
196 pub fn set_context(mut self, input: ::std::option::Option<crate::types::ContextDefinition>) -> Self {
197 self.inner = self.inner.set_context(input);
198 self
199 }
200 /// <p>Specifies additional context that can be used to make more granular authorization decisions.</p>
201 pub fn get_context(&self) -> &::std::option::Option<crate::types::ContextDefinition> {
202 self.inner.get_context()
203 }
204 /// <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>
205 /// <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>
206 /// <ul>
207 /// <li>
208 /// <p>The <code>IsAuthorizedWithToken</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>
209 /// <li>
210 /// <p>For action entities, you can include only their <code>Identifier</code> and <code>EntityType</code>.</p></li>
211 /// </ul>
212 /// </important>
213 pub fn entities(mut self, input: crate::types::EntitiesDefinition) -> Self {
214 self.inner = self.inner.entities(input);
215 self
216 }
217 /// <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>
218 /// <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>
219 /// <ul>
220 /// <li>
221 /// <p>The <code>IsAuthorizedWithToken</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>
222 /// <li>
223 /// <p>For action entities, you can include only their <code>Identifier</code> and <code>EntityType</code>.</p></li>
224 /// </ul>
225 /// </important>
226 pub fn set_entities(mut self, input: ::std::option::Option<crate::types::EntitiesDefinition>) -> Self {
227 self.inner = self.inner.set_entities(input);
228 self
229 }
230 /// <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>
231 /// <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>
232 /// <ul>
233 /// <li>
234 /// <p>The <code>IsAuthorizedWithToken</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>
235 /// <li>
236 /// <p>For action entities, you can include only their <code>Identifier</code> and <code>EntityType</code>.</p></li>
237 /// </ul>
238 /// </important>
239 pub fn get_entities(&self) -> &::std::option::Option<crate::types::EntitiesDefinition> {
240 self.inner.get_entities()
241 }
242}