aws_sdk_iam/operation/list_policies/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_policies::_list_policies_output::ListPoliciesOutputBuilder;
3
4pub use crate::operation::list_policies::_list_policies_input::ListPoliciesInputBuilder;
5
6impl crate::operation::list_policies::builders::ListPoliciesInputBuilder {
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::list_policies::ListPoliciesOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::list_policies::ListPoliciesError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.list_policies();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ListPolicies`.
24///
25/// <p>Lists all the managed policies that are available in your Amazon Web Services account, including your own customer-defined managed policies and all Amazon Web Services managed policies.</p>
26/// <p>You can filter the list of policies that is returned using the optional <code>OnlyAttached</code>, <code>Scope</code>, and <code>PathPrefix</code> parameters. For example, to list only the customer managed policies in your Amazon Web Services account, set <code>Scope</code> to <code>Local</code>. To list only Amazon Web Services managed policies, set <code>Scope</code> to <code>AWS</code>.</p>
27/// <p>You can paginate the results using the <code>MaxItems</code> and <code>Marker</code> parameters.</p>
28/// <p>For more information about managed policies, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html">Managed policies and inline policies</a> in the <i>IAM User Guide</i>.</p><note>
29/// <p>IAM resource-listing operations return a subset of the available attributes for the resource. For example, this operation does not return tags, even though they are an attribute of the returned object. To view all of the information for a customer manged policy, see <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetPolicy.html">GetPolicy</a>.</p>
30/// </note>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct ListPoliciesFluentBuilder {
33 handle: ::std::sync::Arc<crate::client::Handle>,
34 inner: crate::operation::list_policies::builders::ListPoliciesInputBuilder,
35 config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38 crate::client::customize::internal::CustomizableSend<
39 crate::operation::list_policies::ListPoliciesOutput,
40 crate::operation::list_policies::ListPoliciesError,
41 > for ListPoliciesFluentBuilder
42{
43 fn send(
44 self,
45 config_override: crate::config::Builder,
46 ) -> crate::client::customize::internal::BoxFuture<
47 crate::client::customize::internal::SendResult<
48 crate::operation::list_policies::ListPoliciesOutput,
49 crate::operation::list_policies::ListPoliciesError,
50 >,
51 > {
52 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53 }
54}
55impl ListPoliciesFluentBuilder {
56 /// Creates a new `ListPoliciesFluentBuilder`.
57 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58 Self {
59 handle,
60 inner: ::std::default::Default::default(),
61 config_override: ::std::option::Option::None,
62 }
63 }
64 /// Access the ListPolicies as a reference.
65 pub fn as_input(&self) -> &crate::operation::list_policies::builders::ListPoliciesInputBuilder {
66 &self.inner
67 }
68 /// Sends the request and returns the response.
69 ///
70 /// If an error occurs, an `SdkError` will be returned with additional details that
71 /// can be matched against.
72 ///
73 /// By default, any retryable failures will be retried twice. Retry behavior
74 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75 /// set when configuring the client.
76 pub async fn send(
77 self,
78 ) -> ::std::result::Result<
79 crate::operation::list_policies::ListPoliciesOutput,
80 ::aws_smithy_runtime_api::client::result::SdkError<
81 crate::operation::list_policies::ListPoliciesError,
82 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83 >,
84 > {
85 let input = self
86 .inner
87 .build()
88 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89 let runtime_plugins = crate::operation::list_policies::ListPolicies::operation_runtime_plugins(
90 self.handle.runtime_plugins.clone(),
91 &self.handle.conf,
92 self.config_override,
93 );
94 crate::operation::list_policies::ListPolicies::orchestrate(&runtime_plugins, input).await
95 }
96
97 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98 pub fn customize(
99 self,
100 ) -> crate::client::customize::CustomizableOperation<
101 crate::operation::list_policies::ListPoliciesOutput,
102 crate::operation::list_policies::ListPoliciesError,
103 Self,
104 > {
105 crate::client::customize::CustomizableOperation::new(self)
106 }
107 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108 self.set_config_override(::std::option::Option::Some(config_override.into()));
109 self
110 }
111
112 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113 self.config_override = config_override;
114 self
115 }
116 /// Create a paginator for this request
117 ///
118 /// Paginators are used by calling [`send().await`](crate::operation::list_policies::paginator::ListPoliciesPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
119 pub fn into_paginator(self) -> crate::operation::list_policies::paginator::ListPoliciesPaginator {
120 crate::operation::list_policies::paginator::ListPoliciesPaginator::new(self.handle, self.inner)
121 }
122 /// <p>The scope to use for filtering the results.</p>
123 /// <p>To list only Amazon Web Services managed policies, set <code>Scope</code> to <code>AWS</code>. To list only the customer managed policies in your Amazon Web Services account, set <code>Scope</code> to <code>Local</code>.</p>
124 /// <p>This parameter is optional. If it is not included, or if it is set to <code>All</code>, all policies are returned.</p>
125 pub fn scope(mut self, input: crate::types::PolicyScopeType) -> Self {
126 self.inner = self.inner.scope(input);
127 self
128 }
129 /// <p>The scope to use for filtering the results.</p>
130 /// <p>To list only Amazon Web Services managed policies, set <code>Scope</code> to <code>AWS</code>. To list only the customer managed policies in your Amazon Web Services account, set <code>Scope</code> to <code>Local</code>.</p>
131 /// <p>This parameter is optional. If it is not included, or if it is set to <code>All</code>, all policies are returned.</p>
132 pub fn set_scope(mut self, input: ::std::option::Option<crate::types::PolicyScopeType>) -> Self {
133 self.inner = self.inner.set_scope(input);
134 self
135 }
136 /// <p>The scope to use for filtering the results.</p>
137 /// <p>To list only Amazon Web Services managed policies, set <code>Scope</code> to <code>AWS</code>. To list only the customer managed policies in your Amazon Web Services account, set <code>Scope</code> to <code>Local</code>.</p>
138 /// <p>This parameter is optional. If it is not included, or if it is set to <code>All</code>, all policies are returned.</p>
139 pub fn get_scope(&self) -> &::std::option::Option<crate::types::PolicyScopeType> {
140 self.inner.get_scope()
141 }
142 /// <p>A flag to filter the results to only the attached policies.</p>
143 /// <p>When <code>OnlyAttached</code> is <code>true</code>, the returned list contains only the policies that are attached to an IAM user, group, or role. When <code>OnlyAttached</code> is <code>false</code>, or when the parameter is not included, all policies are returned.</p>
144 pub fn only_attached(mut self, input: bool) -> Self {
145 self.inner = self.inner.only_attached(input);
146 self
147 }
148 /// <p>A flag to filter the results to only the attached policies.</p>
149 /// <p>When <code>OnlyAttached</code> is <code>true</code>, the returned list contains only the policies that are attached to an IAM user, group, or role. When <code>OnlyAttached</code> is <code>false</code>, or when the parameter is not included, all policies are returned.</p>
150 pub fn set_only_attached(mut self, input: ::std::option::Option<bool>) -> Self {
151 self.inner = self.inner.set_only_attached(input);
152 self
153 }
154 /// <p>A flag to filter the results to only the attached policies.</p>
155 /// <p>When <code>OnlyAttached</code> is <code>true</code>, the returned list contains only the policies that are attached to an IAM user, group, or role. When <code>OnlyAttached</code> is <code>false</code>, or when the parameter is not included, all policies are returned.</p>
156 pub fn get_only_attached(&self) -> &::std::option::Option<bool> {
157 self.inner.get_only_attached()
158 }
159 /// <p>The path prefix for filtering the results. This parameter is optional. If it is not included, it defaults to a slash (/), listing all policies. This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (<code>\u0021</code>) through the DEL character (<code>\u007F</code>), including most punctuation characters, digits, and upper and lowercased letters.</p>
160 pub fn path_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161 self.inner = self.inner.path_prefix(input.into());
162 self
163 }
164 /// <p>The path prefix for filtering the results. This parameter is optional. If it is not included, it defaults to a slash (/), listing all policies. This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (<code>\u0021</code>) through the DEL character (<code>\u007F</code>), including most punctuation characters, digits, and upper and lowercased letters.</p>
165 pub fn set_path_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166 self.inner = self.inner.set_path_prefix(input);
167 self
168 }
169 /// <p>The path prefix for filtering the results. This parameter is optional. If it is not included, it defaults to a slash (/), listing all policies. This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (<code>\u0021</code>) through the DEL character (<code>\u007F</code>), including most punctuation characters, digits, and upper and lowercased letters.</p>
170 pub fn get_path_prefix(&self) -> &::std::option::Option<::std::string::String> {
171 self.inner.get_path_prefix()
172 }
173 /// <p>The policy usage method to use for filtering the results.</p>
174 /// <p>To list only permissions policies, set <code>PolicyUsageFilter</code> to <code>PermissionsPolicy</code>. To list only the policies used to set permissions boundaries, set the value to <code>PermissionsBoundary</code>.</p>
175 /// <p>This parameter is optional. If it is not included, all policies are returned.</p>
176 pub fn policy_usage_filter(mut self, input: crate::types::PolicyUsageType) -> Self {
177 self.inner = self.inner.policy_usage_filter(input);
178 self
179 }
180 /// <p>The policy usage method to use for filtering the results.</p>
181 /// <p>To list only permissions policies, set <code>PolicyUsageFilter</code> to <code>PermissionsPolicy</code>. To list only the policies used to set permissions boundaries, set the value to <code>PermissionsBoundary</code>.</p>
182 /// <p>This parameter is optional. If it is not included, all policies are returned.</p>
183 pub fn set_policy_usage_filter(mut self, input: ::std::option::Option<crate::types::PolicyUsageType>) -> Self {
184 self.inner = self.inner.set_policy_usage_filter(input);
185 self
186 }
187 /// <p>The policy usage method to use for filtering the results.</p>
188 /// <p>To list only permissions policies, set <code>PolicyUsageFilter</code> to <code>PermissionsPolicy</code>. To list only the policies used to set permissions boundaries, set the value to <code>PermissionsBoundary</code>.</p>
189 /// <p>This parameter is optional. If it is not included, all policies are returned.</p>
190 pub fn get_policy_usage_filter(&self) -> &::std::option::Option<crate::types::PolicyUsageType> {
191 self.inner.get_policy_usage_filter()
192 }
193 /// <p>Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the <code>Marker</code> element in the response that you received to indicate where the next call should start.</p>
194 pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
195 self.inner = self.inner.marker(input.into());
196 self
197 }
198 /// <p>Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the <code>Marker</code> element in the response that you received to indicate where the next call should start.</p>
199 pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
200 self.inner = self.inner.set_marker(input);
201 self
202 }
203 /// <p>Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the <code>Marker</code> element in the response that you received to indicate where the next call should start.</p>
204 pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
205 self.inner.get_marker()
206 }
207 /// <p>Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the <code>IsTruncated</code> response element is <code>true</code>.</p>
208 /// <p>If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the <code>IsTruncated</code> response element returns <code>true</code>, and <code>Marker</code> contains a value to include in the subsequent call that tells the service where to continue from.</p>
209 pub fn max_items(mut self, input: i32) -> Self {
210 self.inner = self.inner.max_items(input);
211 self
212 }
213 /// <p>Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the <code>IsTruncated</code> response element is <code>true</code>.</p>
214 /// <p>If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the <code>IsTruncated</code> response element returns <code>true</code>, and <code>Marker</code> contains a value to include in the subsequent call that tells the service where to continue from.</p>
215 pub fn set_max_items(mut self, input: ::std::option::Option<i32>) -> Self {
216 self.inner = self.inner.set_max_items(input);
217 self
218 }
219 /// <p>Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the <code>IsTruncated</code> response element is <code>true</code>.</p>
220 /// <p>If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the <code>IsTruncated</code> response element returns <code>true</code>, and <code>Marker</code> contains a value to include in the subsequent call that tells the service where to continue from.</p>
221 pub fn get_max_items(&self) -> &::std::option::Option<i32> {
222 self.inner.get_max_items()
223 }
224}