aws_sdk_sso/operation/list_accounts/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_accounts::_list_accounts_output::ListAccountsOutputBuilder;
3
4pub use crate::operation::list_accounts::_list_accounts_input::ListAccountsInputBuilder;
5
6impl crate::operation::list_accounts::builders::ListAccountsInputBuilder {
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::list_accounts::ListAccountsOutput,
10 ::aws_smithy_runtime_api::client::result::SdkError<
11 crate::operation::list_accounts::ListAccountsError,
12 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13 >
14 > {
15 let mut fluent_builder = client.list_accounts();
16 fluent_builder.inner = self;
17 fluent_builder.send().await
18 }
19 }
20/// Fluent builder constructing a request to `ListAccounts`.
21///
22/// <p>Lists all AWS accounts assigned to the user. These AWS accounts are assigned by the administrator of the account. For more information, see <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/useraccess.html#assignusers">Assign User Access</a> in the <i>IAM Identity Center User Guide</i>. This operation returns a paginated response.</p>
23#[derive(::std::clone::Clone, ::std::fmt::Debug)]
24pub struct ListAccountsFluentBuilder {
25 handle: ::std::sync::Arc<crate::client::Handle>,
26 inner: crate::operation::list_accounts::builders::ListAccountsInputBuilder,
27config_override: ::std::option::Option<crate::config::Builder>,
28 }
29impl
30 crate::client::customize::internal::CustomizableSend<
31 crate::operation::list_accounts::ListAccountsOutput,
32 crate::operation::list_accounts::ListAccountsError,
33 > for ListAccountsFluentBuilder
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::list_accounts::ListAccountsOutput,
41 crate::operation::list_accounts::ListAccountsError,
42 >,
43 > {
44 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
45 }
46 }
47impl ListAccountsFluentBuilder {
48 /// Creates a new `ListAccountsFluentBuilder`.
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 ListAccounts as a reference.
57 pub fn as_input(&self) -> &crate::operation::list_accounts::builders::ListAccountsInputBuilder {
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. Note: retries are enabled by default when using
68 /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
69 pub async fn send(self) -> ::std::result::Result<crate::operation::list_accounts::ListAccountsOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_accounts::ListAccountsError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
70 let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
71 let runtime_plugins = crate::operation::list_accounts::ListAccounts::operation_runtime_plugins(
72 self.handle.runtime_plugins.clone(),
73 &self.handle.conf,
74 self.config_override,
75 );
76 crate::operation::list_accounts::ListAccounts::orchestrate(&runtime_plugins, input).await
77 }
78
79 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
80 pub fn customize(
81 self,
82 ) -> crate::client::customize::CustomizableOperation<crate::operation::list_accounts::ListAccountsOutput, crate::operation::list_accounts::ListAccountsError, Self> {
83 crate::client::customize::CustomizableOperation::new(self)
84 }
85 pub(crate) fn config_override(
86 mut self,
87 config_override: impl ::std::convert::Into<crate::config::Builder>,
88 ) -> Self {
89 self.set_config_override(::std::option::Option::Some(config_override.into()));
90 self
91 }
92
93 pub(crate) fn set_config_override(
94 &mut self,
95 config_override: ::std::option::Option<crate::config::Builder>,
96 ) -> &mut Self {
97 self.config_override = config_override;
98 self
99 }
100 /// Create a paginator for this request
101 ///
102 /// Paginators are used by calling [`send().await`](crate::operation::list_accounts::paginator::ListAccountsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
103 pub fn into_paginator(self) -> crate::operation::list_accounts::paginator::ListAccountsPaginator {
104 crate::operation::list_accounts::paginator::ListAccountsPaginator::new(self.handle, self.inner)
105 }
106 /// <p>(Optional) When requesting subsequent pages, this is the page token from the previous response output.</p>
107 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108 self.inner = self.inner.next_token(input.into());
109 self
110 }
111 /// <p>(Optional) When requesting subsequent pages, this is the page token from the previous response output.</p>
112 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
113 self.inner = self.inner.set_next_token(input);
114 self
115 }
116 /// <p>(Optional) When requesting subsequent pages, this is the page token from the previous response output.</p>
117 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
118 self.inner.get_next_token()
119 }
120 /// <p>This is the number of items clients can request per page.</p>
121 pub fn max_results(mut self, input: i32) -> Self {
122 self.inner = self.inner.max_results(input);
123 self
124 }
125 /// <p>This is the number of items clients can request per page.</p>
126 pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
127 self.inner = self.inner.set_max_results(input);
128 self
129 }
130 /// <p>This is the number of items clients can request per page.</p>
131 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
132 self.inner.get_max_results()
133 }
134 /// <p>The token issued by the <code>CreateToken</code> API call. For more information, see <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html">CreateToken</a> in the <i>IAM Identity Center OIDC API Reference Guide</i>.</p>
135 pub fn access_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136 self.inner = self.inner.access_token(input.into());
137 self
138 }
139 /// <p>The token issued by the <code>CreateToken</code> API call. For more information, see <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html">CreateToken</a> in the <i>IAM Identity Center OIDC API Reference Guide</i>.</p>
140 pub fn set_access_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141 self.inner = self.inner.set_access_token(input);
142 self
143 }
144 /// <p>The token issued by the <code>CreateToken</code> API call. For more information, see <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html">CreateToken</a> in the <i>IAM Identity Center OIDC API Reference Guide</i>.</p>
145 pub fn get_access_token(&self) -> &::std::option::Option<::std::string::String> {
146 self.inner.get_access_token()
147 }
148}
149