aws_sdk_verifiedpermissions/operation/create_identity_source/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_identity_source::_create_identity_source_output::CreateIdentitySourceOutputBuilder;
3
4pub use crate::operation::create_identity_source::_create_identity_source_input::CreateIdentitySourceInputBuilder;
5
6impl crate::operation::create_identity_source::builders::CreateIdentitySourceInputBuilder {
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::create_identity_source::CreateIdentitySourceOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_identity_source::CreateIdentitySourceError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_identity_source();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateIdentitySource`.
24///
25/// <p>Adds an identity source to a policy store–an Amazon Cognito user pool or OpenID Connect (OIDC) identity provider (IdP).</p>
26/// <p>After you create an identity source, you can use the identities provided by the IdP as proxies for the principal in authorization queries that use the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_IsAuthorizedWithToken.html">IsAuthorizedWithToken</a> or <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_BatchIsAuthorizedWithToken.html">BatchIsAuthorizedWithToken</a> API operations. These identities take the form of tokens that contain claims about the user, such as IDs, attributes and group memberships. Identity sources provide identity (ID) tokens and access tokens. Verified Permissions derives information about your user and session from token claims. Access tokens provide action <code>context</code> to your policies, and ID tokens provide principal <code>Attributes</code>.</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> <note>
29/// <p>To reference a user from this identity source in your Cedar policies, refer to the following syntax examples.</p>
30/// <ul>
31/// <li>
32/// <p>Amazon Cognito user pool: <code>Namespace::\[Entity type\]::\[User pool ID\]|\[user principal attribute\]</code>, for example <code>MyCorp::User::us-east-1_EXAMPLE|a1b2c3d4-5678-90ab-cdef-EXAMPLE11111</code>.</p></li>
33/// <li>
34/// <p>OpenID Connect (OIDC) provider: <code>Namespace::\[Entity type\]::\[entityIdPrefix\]|\[user principal attribute\]</code>, for example <code>MyCorp::User::MyOIDCProvider|a1b2c3d4-5678-90ab-cdef-EXAMPLE22222</code>.</p></li>
35/// </ul>
36/// </note> <note>
37/// <p>Verified Permissions is <i> <a href="https://wikipedia.org/wiki/Eventual_consistency">eventually consistent</a> </i>. It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.</p>
38/// </note>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct CreateIdentitySourceFluentBuilder {
41    handle: ::std::sync::Arc<crate::client::Handle>,
42    inner: crate::operation::create_identity_source::builders::CreateIdentitySourceInputBuilder,
43    config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl
46    crate::client::customize::internal::CustomizableSend<
47        crate::operation::create_identity_source::CreateIdentitySourceOutput,
48        crate::operation::create_identity_source::CreateIdentitySourceError,
49    > for CreateIdentitySourceFluentBuilder
50{
51    fn send(
52        self,
53        config_override: crate::config::Builder,
54    ) -> crate::client::customize::internal::BoxFuture<
55        crate::client::customize::internal::SendResult<
56            crate::operation::create_identity_source::CreateIdentitySourceOutput,
57            crate::operation::create_identity_source::CreateIdentitySourceError,
58        >,
59    > {
60        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
61    }
62}
63impl CreateIdentitySourceFluentBuilder {
64    /// Creates a new `CreateIdentitySourceFluentBuilder`.
65    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
66        Self {
67            handle,
68            inner: ::std::default::Default::default(),
69            config_override: ::std::option::Option::None,
70        }
71    }
72    /// Access the CreateIdentitySource as a reference.
73    pub fn as_input(&self) -> &crate::operation::create_identity_source::builders::CreateIdentitySourceInputBuilder {
74        &self.inner
75    }
76    /// Sends the request and returns the response.
77    ///
78    /// If an error occurs, an `SdkError` will be returned with additional details that
79    /// can be matched against.
80    ///
81    /// By default, any retryable failures will be retried twice. Retry behavior
82    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
83    /// set when configuring the client.
84    pub async fn send(
85        self,
86    ) -> ::std::result::Result<
87        crate::operation::create_identity_source::CreateIdentitySourceOutput,
88        ::aws_smithy_runtime_api::client::result::SdkError<
89            crate::operation::create_identity_source::CreateIdentitySourceError,
90            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
91        >,
92    > {
93        let input = self
94            .inner
95            .build()
96            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
97        let runtime_plugins = crate::operation::create_identity_source::CreateIdentitySource::operation_runtime_plugins(
98            self.handle.runtime_plugins.clone(),
99            &self.handle.conf,
100            self.config_override,
101        );
102        crate::operation::create_identity_source::CreateIdentitySource::orchestrate(&runtime_plugins, input).await
103    }
104
105    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
106    pub fn customize(
107        self,
108    ) -> crate::client::customize::CustomizableOperation<
109        crate::operation::create_identity_source::CreateIdentitySourceOutput,
110        crate::operation::create_identity_source::CreateIdentitySourceError,
111        Self,
112    > {
113        crate::client::customize::CustomizableOperation::new(self)
114    }
115    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
116        self.set_config_override(::std::option::Option::Some(config_override.into()));
117        self
118    }
119
120    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
121        self.config_override = config_override;
122        self
123    }
124    /// <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
125    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
126    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>ConflictException</code> error.</p>
127    /// <p>Verified Permissions recognizes a <code>ClientToken</code> for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of <code>ClientToken</code>.</p>
128    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.client_token(input.into());
130        self
131    }
132    /// <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
133    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
134    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>ConflictException</code> error.</p>
135    /// <p>Verified Permissions recognizes a <code>ClientToken</code> for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of <code>ClientToken</code>.</p>
136    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_client_token(input);
138        self
139    }
140    /// <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
141    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
142    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>ConflictException</code> error.</p>
143    /// <p>Verified Permissions recognizes a <code>ClientToken</code> for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of <code>ClientToken</code>.</p>
144    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_client_token()
146    }
147    /// <p>Specifies the ID of the policy store in which you want to store this identity source. Only policies and requests made using this policy store can reference identities from the identity provider configured in the new identity source.</p>
148    pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149        self.inner = self.inner.policy_store_id(input.into());
150        self
151    }
152    /// <p>Specifies the ID of the policy store in which you want to store this identity source. Only policies and requests made using this policy store can reference identities from the identity provider configured in the new identity source.</p>
153    pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.inner = self.inner.set_policy_store_id(input);
155        self
156    }
157    /// <p>Specifies the ID of the policy store in which you want to store this identity source. Only policies and requests made using this policy store can reference identities from the identity provider configured in the new identity source.</p>
158    pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
159        self.inner.get_policy_store_id()
160    }
161    /// <p>Specifies the details required to communicate with the identity provider (IdP) associated with this identity source.</p>
162    pub fn configuration(mut self, input: crate::types::Configuration) -> Self {
163        self.inner = self.inner.configuration(input);
164        self
165    }
166    /// <p>Specifies the details required to communicate with the identity provider (IdP) associated with this identity source.</p>
167    pub fn set_configuration(mut self, input: ::std::option::Option<crate::types::Configuration>) -> Self {
168        self.inner = self.inner.set_configuration(input);
169        self
170    }
171    /// <p>Specifies the details required to communicate with the identity provider (IdP) associated with this identity source.</p>
172    pub fn get_configuration(&self) -> &::std::option::Option<crate::types::Configuration> {
173        self.inner.get_configuration()
174    }
175    /// <p>Specifies the namespace and data type of the principals generated for identities authenticated by the new identity source.</p>
176    pub fn principal_entity_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177        self.inner = self.inner.principal_entity_type(input.into());
178        self
179    }
180    /// <p>Specifies the namespace and data type of the principals generated for identities authenticated by the new identity source.</p>
181    pub fn set_principal_entity_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182        self.inner = self.inner.set_principal_entity_type(input);
183        self
184    }
185    /// <p>Specifies the namespace and data type of the principals generated for identities authenticated by the new identity source.</p>
186    pub fn get_principal_entity_type(&self) -> &::std::option::Option<::std::string::String> {
187        self.inner.get_principal_entity_type()
188    }
189}