aws_sdk_cognitoidentityprovider/operation/create_resource_server/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_resource_server::_create_resource_server_output::CreateResourceServerOutputBuilder;
3
4pub use crate::operation::create_resource_server::_create_resource_server_input::CreateResourceServerInputBuilder;
5
6impl crate::operation::create_resource_server::builders::CreateResourceServerInputBuilder {
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_resource_server::CreateResourceServerOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_resource_server::CreateResourceServerError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_resource_server();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateResourceServer`.
24///
25/// <p>Creates a new OAuth2.0 resource server and defines custom scopes within it. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-define-resource-servers.html">Access control with resource servers</a>.</p><note>
26/// <p>Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.</p>
27/// <p class="title"><b>Learn more</b></p>
28/// <ul>
29/// <li>
30/// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-signing.html">Signing Amazon Web Services API Requests</a></p></li>
31/// <li>
32/// <p><a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pools-API-operations.html">Using the Amazon Cognito user pools API and user pool endpoints</a></p></li>
33/// </ul>
34/// </note>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct CreateResourceServerFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::create_resource_server::builders::CreateResourceServerInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::create_resource_server::CreateResourceServerOutput,
44        crate::operation::create_resource_server::CreateResourceServerError,
45    > for CreateResourceServerFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<
52            crate::operation::create_resource_server::CreateResourceServerOutput,
53            crate::operation::create_resource_server::CreateResourceServerError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl CreateResourceServerFluentBuilder {
60    /// Creates a new `CreateResourceServerFluentBuilder`.
61    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
62        Self {
63            handle,
64            inner: ::std::default::Default::default(),
65            config_override: ::std::option::Option::None,
66        }
67    }
68    /// Access the CreateResourceServer as a reference.
69    pub fn as_input(&self) -> &crate::operation::create_resource_server::builders::CreateResourceServerInputBuilder {
70        &self.inner
71    }
72    /// Sends the request and returns the response.
73    ///
74    /// If an error occurs, an `SdkError` will be returned with additional details that
75    /// can be matched against.
76    ///
77    /// By default, any retryable failures will be retried twice. Retry behavior
78    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
79    /// set when configuring the client.
80    pub async fn send(
81        self,
82    ) -> ::std::result::Result<
83        crate::operation::create_resource_server::CreateResourceServerOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::create_resource_server::CreateResourceServerError,
86            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
87        >,
88    > {
89        let input = self
90            .inner
91            .build()
92            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
93        let runtime_plugins = crate::operation::create_resource_server::CreateResourceServer::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::create_resource_server::CreateResourceServer::orchestrate(&runtime_plugins, input).await
99    }
100
101    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
102    pub fn customize(
103        self,
104    ) -> crate::client::customize::CustomizableOperation<
105        crate::operation::create_resource_server::CreateResourceServerOutput,
106        crate::operation::create_resource_server::CreateResourceServerError,
107        Self,
108    > {
109        crate::client::customize::CustomizableOperation::new(self)
110    }
111    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
112        self.set_config_override(::std::option::Option::Some(config_override.into()));
113        self
114    }
115
116    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
117        self.config_override = config_override;
118        self
119    }
120    /// <p>The ID of the user pool where you want to create a resource server.</p>
121    pub fn user_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.inner = self.inner.user_pool_id(input.into());
123        self
124    }
125    /// <p>The ID of the user pool where you want to create a resource server.</p>
126    pub fn set_user_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.inner = self.inner.set_user_pool_id(input);
128        self
129    }
130    /// <p>The ID of the user pool where you want to create a resource server.</p>
131    pub fn get_user_pool_id(&self) -> &::std::option::Option<::std::string::String> {
132        self.inner.get_user_pool_id()
133    }
134    /// <p>A unique resource server identifier for the resource server. The identifier can be an API friendly name like <code>solar-system-data</code>. You can also set an API URL like <code>https://solar-system-data-api.example.com</code> as your identifier.</p>
135    /// <p>Amazon Cognito represents scopes in the access token in the format <code>$resource-server-identifier/$scope</code>. Longer scope-identifier strings increase the size of your access tokens.</p>
136    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.inner = self.inner.identifier(input.into());
138        self
139    }
140    /// <p>A unique resource server identifier for the resource server. The identifier can be an API friendly name like <code>solar-system-data</code>. You can also set an API URL like <code>https://solar-system-data-api.example.com</code> as your identifier.</p>
141    /// <p>Amazon Cognito represents scopes in the access token in the format <code>$resource-server-identifier/$scope</code>. Longer scope-identifier strings increase the size of your access tokens.</p>
142    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.inner = self.inner.set_identifier(input);
144        self
145    }
146    /// <p>A unique resource server identifier for the resource server. The identifier can be an API friendly name like <code>solar-system-data</code>. You can also set an API URL like <code>https://solar-system-data-api.example.com</code> as your identifier.</p>
147    /// <p>Amazon Cognito represents scopes in the access token in the format <code>$resource-server-identifier/$scope</code>. Longer scope-identifier strings increase the size of your access tokens.</p>
148    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
149        self.inner.get_identifier()
150    }
151    /// <p>A friendly name for the resource server.</p>
152    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.inner = self.inner.name(input.into());
154        self
155    }
156    /// <p>A friendly name for the resource server.</p>
157    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.inner = self.inner.set_name(input);
159        self
160    }
161    /// <p>A friendly name for the resource server.</p>
162    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
163        self.inner.get_name()
164    }
165    ///
166    /// Appends an item to `Scopes`.
167    ///
168    /// To override the contents of this collection use [`set_scopes`](Self::set_scopes).
169    ///
170    /// <p>A list of custom scopes. Each scope is a key-value map with the keys <code>ScopeName</code> and <code>ScopeDescription</code>. The name of a custom scope is a combination of <code>ScopeName</code> and the resource server <code>Name</code> in this request, for example <code>MyResourceServerName/MyScopeName</code>.</p>
171    pub fn scopes(mut self, input: crate::types::ResourceServerScopeType) -> Self {
172        self.inner = self.inner.scopes(input);
173        self
174    }
175    /// <p>A list of custom scopes. Each scope is a key-value map with the keys <code>ScopeName</code> and <code>ScopeDescription</code>. The name of a custom scope is a combination of <code>ScopeName</code> and the resource server <code>Name</code> in this request, for example <code>MyResourceServerName/MyScopeName</code>.</p>
176    pub fn set_scopes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceServerScopeType>>) -> Self {
177        self.inner = self.inner.set_scopes(input);
178        self
179    }
180    /// <p>A list of custom scopes. Each scope is a key-value map with the keys <code>ScopeName</code> and <code>ScopeDescription</code>. The name of a custom scope is a combination of <code>ScopeName</code> and the resource server <code>Name</code> in this request, for example <code>MyResourceServerName/MyScopeName</code>.</p>
181    pub fn get_scopes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceServerScopeType>> {
182        self.inner.get_scopes()
183    }
184}