aws_sdk_ssoadmin/operation/put_application_grant/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_application_grant::_put_application_grant_output::PutApplicationGrantOutputBuilder;
3
4pub use crate::operation::put_application_grant::_put_application_grant_input::PutApplicationGrantInputBuilder;
5
6impl crate::operation::put_application_grant::builders::PutApplicationGrantInputBuilder {
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::put_application_grant::PutApplicationGrantOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_application_grant::PutApplicationGrantError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_application_grant();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutApplicationGrant`.
24///
25/// <p>Creates a configuration for an application to use grants. Conceptually grants are authorization to request actions related to tokens. This configuration will be used when parties are requesting and receiving tokens during the trusted identity propagation process. For more information on the IAM Identity Center supported grant workflows, see <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/customermanagedapps-saml2-oauth2.html">SAML 2.0 and OAuth 2.0</a>.</p>
26/// <p>A grant is created between your applications and Identity Center instance which enables an application to use specified mechanisms to obtain tokens. These tokens are used by your applications to gain access to Amazon Web Services resources on behalf of users. The following elements are within these exchanges:</p>
27/// <ul>
28/// <li>
29/// <p><b>Requester</b> - The application requesting access to Amazon Web Services resources.</p></li>
30/// <li>
31/// <p><b>Subject</b> - Typically the user that is requesting access to Amazon Web Services resources.</p></li>
32/// <li>
33/// <p><b>Grant</b> - Conceptually, a grant is authorization to access Amazon Web Services resources. These grants authorize token generation for authenticating access to the requester and for the request to make requests on behalf of the subjects. There are four types of grants:</p>
34/// <ul>
35/// <li>
36/// <p><b>AuthorizationCode</b> - Allows an application to request authorization through a series of user-agent redirects.</p></li>
37/// <li>
38/// <p><b>JWT bearer </b> - Authorizes an application to exchange a JSON Web Token that came from an external identity provider. To learn more, see <a href="https://datatracker.ietf.org/doc/html/rfc6749">RFC 6479</a>.</p></li>
39/// <li>
40/// <p><b>Refresh token</b> - Enables application to request new access tokens to replace expiring or expired access tokens.</p></li>
41/// <li>
42/// <p><b>Exchange token</b> - A grant that requests tokens from the authorization server by providing a ‘subject’ token with access scope authorizing trusted identity propagation to this application. To learn more, see <a href="https://datatracker.ietf.org/doc/html/rfc8693">RFC 8693</a>.</p></li>
43/// </ul></li>
44/// <li>
45/// <p><b>Authorization server</b> - IAM Identity Center requests tokens.</p></li>
46/// </ul>
47/// <p>User credentials are never shared directly within these exchanges. Instead, applications use grants to request access tokens from IAM Identity Center. For more information, see <a href="https://datatracker.ietf.org/doc/html/rfc6749">RFC 6479</a>.</p>
48/// <p class="title"><b>Use cases</b></p>
49/// <ul>
50/// <li>
51/// <p>Connecting to custom applications.</p></li>
52/// <li>
53/// <p>Configuring an Amazon Web Services service to make calls to another Amazon Web Services services using JWT tokens.</p></li>
54/// </ul>
55#[derive(::std::clone::Clone, ::std::fmt::Debug)]
56pub struct PutApplicationGrantFluentBuilder {
57    handle: ::std::sync::Arc<crate::client::Handle>,
58    inner: crate::operation::put_application_grant::builders::PutApplicationGrantInputBuilder,
59    config_override: ::std::option::Option<crate::config::Builder>,
60}
61impl
62    crate::client::customize::internal::CustomizableSend<
63        crate::operation::put_application_grant::PutApplicationGrantOutput,
64        crate::operation::put_application_grant::PutApplicationGrantError,
65    > for PutApplicationGrantFluentBuilder
66{
67    fn send(
68        self,
69        config_override: crate::config::Builder,
70    ) -> crate::client::customize::internal::BoxFuture<
71        crate::client::customize::internal::SendResult<
72            crate::operation::put_application_grant::PutApplicationGrantOutput,
73            crate::operation::put_application_grant::PutApplicationGrantError,
74        >,
75    > {
76        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
77    }
78}
79impl PutApplicationGrantFluentBuilder {
80    /// Creates a new `PutApplicationGrantFluentBuilder`.
81    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
82        Self {
83            handle,
84            inner: ::std::default::Default::default(),
85            config_override: ::std::option::Option::None,
86        }
87    }
88    /// Access the PutApplicationGrant as a reference.
89    pub fn as_input(&self) -> &crate::operation::put_application_grant::builders::PutApplicationGrantInputBuilder {
90        &self.inner
91    }
92    /// Sends the request and returns the response.
93    ///
94    /// If an error occurs, an `SdkError` will be returned with additional details that
95    /// can be matched against.
96    ///
97    /// By default, any retryable failures will be retried twice. Retry behavior
98    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
99    /// set when configuring the client.
100    pub async fn send(
101        self,
102    ) -> ::std::result::Result<
103        crate::operation::put_application_grant::PutApplicationGrantOutput,
104        ::aws_smithy_runtime_api::client::result::SdkError<
105            crate::operation::put_application_grant::PutApplicationGrantError,
106            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
107        >,
108    > {
109        let input = self
110            .inner
111            .build()
112            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
113        let runtime_plugins = crate::operation::put_application_grant::PutApplicationGrant::operation_runtime_plugins(
114            self.handle.runtime_plugins.clone(),
115            &self.handle.conf,
116            self.config_override,
117        );
118        crate::operation::put_application_grant::PutApplicationGrant::orchestrate(&runtime_plugins, input).await
119    }
120
121    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
122    pub fn customize(
123        self,
124    ) -> crate::client::customize::CustomizableOperation<
125        crate::operation::put_application_grant::PutApplicationGrantOutput,
126        crate::operation::put_application_grant::PutApplicationGrantError,
127        Self,
128    > {
129        crate::client::customize::CustomizableOperation::new(self)
130    }
131    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
132        self.set_config_override(::std::option::Option::Some(config_override.into()));
133        self
134    }
135
136    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
137        self.config_override = config_override;
138        self
139    }
140    /// <p>Specifies the ARN of the application to update.</p>
141    pub fn application_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.inner = self.inner.application_arn(input.into());
143        self
144    }
145    /// <p>Specifies the ARN of the application to update.</p>
146    pub fn set_application_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.inner = self.inner.set_application_arn(input);
148        self
149    }
150    /// <p>Specifies the ARN of the application to update.</p>
151    pub fn get_application_arn(&self) -> &::std::option::Option<::std::string::String> {
152        self.inner.get_application_arn()
153    }
154    /// <p>Specifies the type of grant to update.</p>
155    pub fn grant_type(mut self, input: crate::types::GrantType) -> Self {
156        self.inner = self.inner.grant_type(input);
157        self
158    }
159    /// <p>Specifies the type of grant to update.</p>
160    pub fn set_grant_type(mut self, input: ::std::option::Option<crate::types::GrantType>) -> Self {
161        self.inner = self.inner.set_grant_type(input);
162        self
163    }
164    /// <p>Specifies the type of grant to update.</p>
165    pub fn get_grant_type(&self) -> &::std::option::Option<crate::types::GrantType> {
166        self.inner.get_grant_type()
167    }
168    /// <p>Specifies a structure that describes the grant to update.</p>
169    pub fn grant(mut self, input: crate::types::Grant) -> Self {
170        self.inner = self.inner.grant(input);
171        self
172    }
173    /// <p>Specifies a structure that describes the grant to update.</p>
174    pub fn set_grant(mut self, input: ::std::option::Option<crate::types::Grant>) -> Self {
175        self.inner = self.inner.set_grant(input);
176        self
177    }
178    /// <p>Specifies a structure that describes the grant to update.</p>
179    pub fn get_grant(&self) -> &::std::option::Option<crate::types::Grant> {
180        self.inner.get_grant()
181    }
182}