aws_sdk_sts/operation/get_web_identity_token/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_web_identity_token::_get_web_identity_token_input::GetWebIdentityTokenInputBuilder;
3
4pub use crate::operation::get_web_identity_token::_get_web_identity_token_output::GetWebIdentityTokenOutputBuilder;
5
6impl crate::operation::get_web_identity_token::builders::GetWebIdentityTokenInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result<
9 crate::operation::get_web_identity_token::GetWebIdentityTokenOutput,
10 ::aws_smithy_runtime_api::client::result::SdkError<
11 crate::operation::get_web_identity_token::GetWebIdentityTokenError,
12 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13 >
14 > {
15 let mut fluent_builder = client.get_web_identity_token();
16 fluent_builder.inner = self;
17 fluent_builder.send().await
18 }
19 }
20/// Fluent builder constructing a request to `GetWebIdentityToken`.
21///
22/// <p>Returns a signed JSON Web Token (JWT) that represents the calling Amazon Web Services identity. The returned JWT can be used to authenticate with external services that support OIDC discovery. The token is signed by Amazon Web Services STS and can be publicly verified using the verification keys published at the issuer's JWKS endpoint.</p>
23#[derive(::std::clone::Clone, ::std::fmt::Debug)]
24pub struct GetWebIdentityTokenFluentBuilder {
25 handle: ::std::sync::Arc<crate::client::Handle>,
26 inner: crate::operation::get_web_identity_token::builders::GetWebIdentityTokenInputBuilder,
27config_override: ::std::option::Option<crate::config::Builder>,
28 }
29impl
30 crate::client::customize::internal::CustomizableSend<
31 crate::operation::get_web_identity_token::GetWebIdentityTokenOutput,
32 crate::operation::get_web_identity_token::GetWebIdentityTokenError,
33 > for GetWebIdentityTokenFluentBuilder
34 {
35 fn send(
36 self,
37 config_override: crate::config::Builder,
38 ) -> crate::client::customize::internal::BoxFuture<
39 crate::client::customize::internal::SendResult<
40 crate::operation::get_web_identity_token::GetWebIdentityTokenOutput,
41 crate::operation::get_web_identity_token::GetWebIdentityTokenError,
42 >,
43 > {
44 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
45 }
46 }
47impl GetWebIdentityTokenFluentBuilder {
48 /// Creates a new `GetWebIdentityTokenFluentBuilder`.
49 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
50 Self {
51 handle,
52 inner: ::std::default::Default::default(),
53 config_override: ::std::option::Option::None,
54 }
55 }
56 /// Access the GetWebIdentityToken as a reference.
57 pub fn as_input(&self) -> &crate::operation::get_web_identity_token::builders::GetWebIdentityTokenInputBuilder {
58 &self.inner
59 }
60 /// Sends the request and returns the response.
61 ///
62 /// If an error occurs, an `SdkError` will be returned with additional details that
63 /// can be matched against.
64 ///
65 /// By default, any retryable failures will be retried twice. Retry behavior
66 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
67 /// set when configuring the client.
68 pub async fn send(self) -> ::std::result::Result<crate::operation::get_web_identity_token::GetWebIdentityTokenOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_web_identity_token::GetWebIdentityTokenError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
69 let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
70 let runtime_plugins = crate::operation::get_web_identity_token::GetWebIdentityToken::operation_runtime_plugins(
71 self.handle.runtime_plugins.clone(),
72 &self.handle.conf,
73 self.config_override,
74 );
75 crate::operation::get_web_identity_token::GetWebIdentityToken::orchestrate(&runtime_plugins, input).await
76 }
77
78 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
79 pub fn customize(
80 self,
81 ) -> crate::client::customize::CustomizableOperation<crate::operation::get_web_identity_token::GetWebIdentityTokenOutput, crate::operation::get_web_identity_token::GetWebIdentityTokenError, Self> {
82 crate::client::customize::CustomizableOperation::new(self)
83 }
84 pub(crate) fn config_override(
85 mut self,
86 config_override: impl ::std::convert::Into<crate::config::Builder>,
87 ) -> Self {
88 self.set_config_override(::std::option::Option::Some(config_override.into()));
89 self
90 }
91
92 pub(crate) fn set_config_override(
93 &mut self,
94 config_override: ::std::option::Option<crate::config::Builder>,
95 ) -> &mut Self {
96 self.config_override = config_override;
97 self
98 }
99 ///
100 /// Appends an item to `Audience`.
101 ///
102 /// To override the contents of this collection use [`set_audience`](Self::set_audience).
103 ///
104 /// <p>The intended recipient of the web identity token. This value populates the <code>aud</code> claim in the JWT and should identify the service or application that will validate and use the token. The external service should verify this claim to ensure the token was intended for their use.</p>
105 pub fn audience(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
106 self.inner = self.inner.audience(input.into());
107 self
108 }
109 /// <p>The intended recipient of the web identity token. This value populates the <code>aud</code> claim in the JWT and should identify the service or application that will validate and use the token. The external service should verify this claim to ensure the token was intended for their use.</p>
110 pub fn set_audience(mut self, input: ::std::option::Option<::std::vec::Vec::<::std::string::String>>) -> Self {
111 self.inner = self.inner.set_audience(input);
112 self
113 }
114 /// <p>The intended recipient of the web identity token. This value populates the <code>aud</code> claim in the JWT and should identify the service or application that will validate and use the token. The external service should verify this claim to ensure the token was intended for their use.</p>
115 pub fn get_audience(&self) -> &::std::option::Option<::std::vec::Vec::<::std::string::String>> {
116 self.inner.get_audience()
117 }
118 /// <p>The duration, in seconds, for which the JSON Web Token (JWT) will remain valid. The value can range from 60 seconds (1 minute) to 3600 seconds (1 hour). If not specified, the default duration is 300 seconds (5 minutes). The token is designed to be short-lived and should be used for proof of identity, then exchanged for credentials or short-lived tokens in the external service.</p>
119 pub fn duration_seconds(mut self, input: i32) -> Self {
120 self.inner = self.inner.duration_seconds(input);
121 self
122 }
123 /// <p>The duration, in seconds, for which the JSON Web Token (JWT) will remain valid. The value can range from 60 seconds (1 minute) to 3600 seconds (1 hour). If not specified, the default duration is 300 seconds (5 minutes). The token is designed to be short-lived and should be used for proof of identity, then exchanged for credentials or short-lived tokens in the external service.</p>
124 pub fn set_duration_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
125 self.inner = self.inner.set_duration_seconds(input);
126 self
127 }
128 /// <p>The duration, in seconds, for which the JSON Web Token (JWT) will remain valid. The value can range from 60 seconds (1 minute) to 3600 seconds (1 hour). If not specified, the default duration is 300 seconds (5 minutes). The token is designed to be short-lived and should be used for proof of identity, then exchanged for credentials or short-lived tokens in the external service.</p>
129 pub fn get_duration_seconds(&self) -> &::std::option::Option<i32> {
130 self.inner.get_duration_seconds()
131 }
132 /// <p>The cryptographic algorithm to use for signing the JSON Web Token (JWT). Valid values are RS256 (RSA with SHA-256) and ES384 (ECDSA using P-384 curve with SHA-384).</p>
133 pub fn signing_algorithm(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134 self.inner = self.inner.signing_algorithm(input.into());
135 self
136 }
137 /// <p>The cryptographic algorithm to use for signing the JSON Web Token (JWT). Valid values are RS256 (RSA with SHA-256) and ES384 (ECDSA using P-384 curve with SHA-384).</p>
138 pub fn set_signing_algorithm(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139 self.inner = self.inner.set_signing_algorithm(input);
140 self
141 }
142 /// <p>The cryptographic algorithm to use for signing the JSON Web Token (JWT). Valid values are RS256 (RSA with SHA-256) and ES384 (ECDSA using P-384 curve with SHA-384).</p>
143 pub fn get_signing_algorithm(&self) -> &::std::option::Option<::std::string::String> {
144 self.inner.get_signing_algorithm()
145 }
146 ///
147 /// Appends an item to `Tags`.
148 ///
149 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
150 ///
151 /// <p>An optional list of tags to include in the JSON Web Token (JWT). These tags are added as custom claims to the JWT and can be used by the downstream service for authorization decisions.</p>
152 pub fn tags(mut self, input: crate::types::Tag) -> Self {
153 self.inner = self.inner.tags(input);
154 self
155 }
156 /// <p>An optional list of tags to include in the JSON Web Token (JWT). These tags are added as custom claims to the JWT and can be used by the downstream service for authorization decisions.</p>
157 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec::<crate::types::Tag>>) -> Self {
158 self.inner = self.inner.set_tags(input);
159 self
160 }
161 /// <p>An optional list of tags to include in the JSON Web Token (JWT). These tags are added as custom claims to the JWT and can be used by the downstream service for authorization decisions.</p>
162 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec::<crate::types::Tag>> {
163 self.inner.get_tags()
164 }
165}
166