aws_sdk_kms/operation/list_keys/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_keys::_list_keys_input::ListKeysInputBuilder;
3
4pub use crate::operation::list_keys::_list_keys_output::ListKeysOutputBuilder;
5
6impl crate::operation::list_keys::builders::ListKeysInputBuilder {
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_keys::ListKeysOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::list_keys::ListKeysError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.list_keys();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ListKeys`.
24///
25/// <p>Gets a list of all KMS keys in the caller's Amazon Web Services account and Region.</p>
26/// <p>You can also use <code>ListKeys</code> to list KMS keys in the Region that other Amazon Web Services accounts shared with the caller's Amazon Web Services account through Resource Access Manager (RAM). To list them, use the <code>ResourceOwners</code> parameter. If you omit <code>ResourceOwners</code>, <code>ListKeys</code> lists only the KMS keys in the caller's Amazon Web Services account.</p>
27/// <p>When <code>ResourceOwners</code> includes <code>OTHER_ACCOUNTS_VIA_RAM</code>, <code>ListKeys</code> returns the KMS keys that other Amazon Web Services accounts currently share with the caller's Amazon Web Services account through RAM. For information about how and when a resource that another account shares becomes available to your Amazon Web Services account, see <a href="https://docs.aws.amazon.com/ram/latest/userguide/working-with-shared.html">Access Amazon Web Services resources shared with you</a> in the <i>RAM User Guide</i>.</p>
28/// <p><b>Cross-account use</b>: No. This operation doesn't take a KMS key parameter, so you can't use it to list the KMS keys of a specific Amazon Web Services account. The only KMS keys in other Amazon Web Services accounts that <code>ListKeys</code> returns are the ones that other accounts shared with the caller's Amazon Web Services account through RAM. To list them, set the <code>ResourceOwners</code> parameter to include <code>OTHER_ACCOUNTS_VIA_RAM</code>.</p>
29/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:ListKeys</a> (IAM policy)</p>
30/// <p>The same <code>kms:ListKeys</code> permission lets you list the KMS keys that other accounts shared with you through RAM. KMS doesn't evaluate the key policies of shared KMS keys when it lists them. To use a shared KMS key, you need permission for each operation on that KMS key.</p>
31/// <p><b>Related operations:</b></p>
32/// <ul>
33/// <li>
34/// <p><code>CreateKey</code></p></li>
35/// <li>
36/// <p><code>DescribeKey</code></p></li>
37/// <li>
38/// <p><code>ListAliases</code></p></li>
39/// <li>
40/// <p><code>ListResourceTags</code></p></li>
41/// </ul>
42/// <p><b>Eventual consistency</b>: The KMS API follows an eventual consistency model. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/accessing-kms.html#programming-eventual-consistency">KMS eventual consistency</a>.</p>
43/// <p>KMS keys that other Amazon Web Services accounts share with you can take some time to appear in or disappear from <code>ListKeys</code> results after changes to resource shares, such as accepting an invitation or deleting a resource share.</p>
44#[derive(::std::clone::Clone, ::std::fmt::Debug)]
45pub struct ListKeysFluentBuilder {
46 handle: ::std::sync::Arc<crate::client::Handle>,
47 inner: crate::operation::list_keys::builders::ListKeysInputBuilder,
48 config_override: ::std::option::Option<crate::config::Builder>,
49}
50impl crate::client::customize::internal::CustomizableSend<crate::operation::list_keys::ListKeysOutput, crate::operation::list_keys::ListKeysError>
51 for ListKeysFluentBuilder
52{
53 fn send(
54 self,
55 config_override: crate::config::Builder,
56 ) -> crate::client::customize::internal::BoxFuture<
57 crate::client::customize::internal::SendResult<crate::operation::list_keys::ListKeysOutput, crate::operation::list_keys::ListKeysError>,
58 > {
59 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
60 }
61}
62impl ListKeysFluentBuilder {
63 /// Creates a new `ListKeysFluentBuilder`.
64 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
65 Self {
66 handle,
67 inner: ::std::default::Default::default(),
68 config_override: ::std::option::Option::None,
69 }
70 }
71 /// Access the ListKeys as a reference.
72 pub fn as_input(&self) -> &crate::operation::list_keys::builders::ListKeysInputBuilder {
73 &self.inner
74 }
75 /// Sends the request and returns the response.
76 ///
77 /// If an error occurs, an `SdkError` will be returned with additional details that
78 /// can be matched against.
79 ///
80 /// By default, any retryable failures will be retried twice. Retry behavior
81 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
82 /// set when configuring the client.
83 pub async fn send(
84 self,
85 ) -> ::std::result::Result<
86 crate::operation::list_keys::ListKeysOutput,
87 ::aws_smithy_runtime_api::client::result::SdkError<
88 crate::operation::list_keys::ListKeysError,
89 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
90 >,
91 > {
92 let input = self
93 .inner
94 .build()
95 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
96 let runtime_plugins = crate::operation::list_keys::ListKeys::operation_runtime_plugins(
97 self.handle.runtime_plugins.clone(),
98 &self.handle.conf,
99 self.config_override,
100 );
101 crate::operation::list_keys::ListKeys::orchestrate(&runtime_plugins, input).await
102 }
103
104 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
105 pub fn customize(
106 self,
107 ) -> crate::client::customize::CustomizableOperation<crate::operation::list_keys::ListKeysOutput, crate::operation::list_keys::ListKeysError, 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 /// Create a paginator for this request
121 ///
122 /// Paginators are used by calling [`send().await`](crate::operation::list_keys::paginator::ListKeysPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
123 pub fn into_paginator(self) -> crate::operation::list_keys::paginator::ListKeysPaginator {
124 crate::operation::list_keys::paginator::ListKeysPaginator::new(self.handle, self.inner)
125 }
126 /// <p>Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.</p>
127 /// <p>This value is optional. If you include a value, it must be between 1 and 1000, inclusive. If you do not include a value, it defaults to 100.</p>
128 pub fn limit(mut self, input: i32) -> Self {
129 self.inner = self.inner.limit(input);
130 self
131 }
132 /// <p>Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.</p>
133 /// <p>This value is optional. If you include a value, it must be between 1 and 1000, inclusive. If you do not include a value, it defaults to 100.</p>
134 pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
135 self.inner = self.inner.set_limit(input);
136 self
137 }
138 /// <p>Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.</p>
139 /// <p>This value is optional. If you include a value, it must be between 1 and 1000, inclusive. If you do not include a value, it defaults to 100.</p>
140 pub fn get_limit(&self) -> &::std::option::Option<i32> {
141 self.inner.get_limit()
142 }
143 /// <p>Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of <code>NextMarker</code> from the truncated response you just received.</p>
144 pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145 self.inner = self.inner.marker(input.into());
146 self
147 }
148 /// <p>Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of <code>NextMarker</code> from the truncated response you just received.</p>
149 pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150 self.inner = self.inner.set_marker(input);
151 self
152 }
153 /// <p>Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of <code>NextMarker</code> from the truncated response you just received.</p>
154 pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
155 self.inner.get_marker()
156 }
157 ///
158 /// Appends an item to `ResourceOwners`.
159 ///
160 /// To override the contents of this collection use [`set_resource_owners`](Self::set_resource_owners).
161 ///
162 /// <p>Specifies whose KMS keys to list. Use this parameter to list KMS keys that other Amazon Web Services accounts shared with your Amazon Web Services account through Resource Access Manager (RAM).</p>
163 /// <p>Specify one or two values. Valid values are:</p>
164 /// <dl>
165 /// <dt>
166 /// SELF
167 /// </dt>
168 /// <dd>
169 /// <p>Lists the KMS keys in your Amazon Web Services account and Region.</p>
170 /// </dd>
171 /// <dt>
172 /// OTHER_ACCOUNTS_VIA_RAM
173 /// </dt>
174 /// <dd>
175 /// <p>Lists the KMS keys in the Region that other Amazon Web Services accounts currently share with your Amazon Web Services account through RAM. This list doesn't include KMS keys that your Amazon Web Services account owns. For each of these KMS keys, the key ARN in the response contains the account ID of the Amazon Web Services account that owns the KMS key.</p>
176 /// </dd>
177 /// </dl>
178 /// <p>If you omit this parameter, <code>ListKeys</code> lists only the KMS keys in your Amazon Web Services account. If you specify both values, in either order, <code>ListKeys</code> returns the KMS keys in your Amazon Web Services account first, and then the KMS keys that other Amazon Web Services accounts shared with you. A single response doesn't contain both kinds of KMS keys.</p>
179 /// <p>When <code>ResourceOwners</code> includes <code>OTHER_ACCOUNTS_VIA_RAM</code>, a response can contain fewer KMS keys than the <code>Limit</code> value, or none, even when <code>Truncated</code> is true. To get all of the KMS keys, continue calling <code>ListKeys</code> with the <code>NextMarker</code> value from each response until <code>Truncated</code> is false. Use a <code>NextMarker</code> value only in a request that has the same <code>ResourceOwners</code> value as the request that returned it. Otherwise, the request can fail with an <code>InvalidMarkerException</code>.</p>
180 /// <p>KMS keys that other Amazon Web Services accounts share with you can take some time to appear in or disappear from the results after changes to resource shares.</p>
181 pub fn resource_owners(mut self, input: crate::types::ResourceOwnerType) -> Self {
182 self.inner = self.inner.resource_owners(input);
183 self
184 }
185 /// <p>Specifies whose KMS keys to list. Use this parameter to list KMS keys that other Amazon Web Services accounts shared with your Amazon Web Services account through Resource Access Manager (RAM).</p>
186 /// <p>Specify one or two values. Valid values are:</p>
187 /// <dl>
188 /// <dt>
189 /// SELF
190 /// </dt>
191 /// <dd>
192 /// <p>Lists the KMS keys in your Amazon Web Services account and Region.</p>
193 /// </dd>
194 /// <dt>
195 /// OTHER_ACCOUNTS_VIA_RAM
196 /// </dt>
197 /// <dd>
198 /// <p>Lists the KMS keys in the Region that other Amazon Web Services accounts currently share with your Amazon Web Services account through RAM. This list doesn't include KMS keys that your Amazon Web Services account owns. For each of these KMS keys, the key ARN in the response contains the account ID of the Amazon Web Services account that owns the KMS key.</p>
199 /// </dd>
200 /// </dl>
201 /// <p>If you omit this parameter, <code>ListKeys</code> lists only the KMS keys in your Amazon Web Services account. If you specify both values, in either order, <code>ListKeys</code> returns the KMS keys in your Amazon Web Services account first, and then the KMS keys that other Amazon Web Services accounts shared with you. A single response doesn't contain both kinds of KMS keys.</p>
202 /// <p>When <code>ResourceOwners</code> includes <code>OTHER_ACCOUNTS_VIA_RAM</code>, a response can contain fewer KMS keys than the <code>Limit</code> value, or none, even when <code>Truncated</code> is true. To get all of the KMS keys, continue calling <code>ListKeys</code> with the <code>NextMarker</code> value from each response until <code>Truncated</code> is false. Use a <code>NextMarker</code> value only in a request that has the same <code>ResourceOwners</code> value as the request that returned it. Otherwise, the request can fail with an <code>InvalidMarkerException</code>.</p>
203 /// <p>KMS keys that other Amazon Web Services accounts share with you can take some time to appear in or disappear from the results after changes to resource shares.</p>
204 pub fn set_resource_owners(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceOwnerType>>) -> Self {
205 self.inner = self.inner.set_resource_owners(input);
206 self
207 }
208 /// <p>Specifies whose KMS keys to list. Use this parameter to list KMS keys that other Amazon Web Services accounts shared with your Amazon Web Services account through Resource Access Manager (RAM).</p>
209 /// <p>Specify one or two values. Valid values are:</p>
210 /// <dl>
211 /// <dt>
212 /// SELF
213 /// </dt>
214 /// <dd>
215 /// <p>Lists the KMS keys in your Amazon Web Services account and Region.</p>
216 /// </dd>
217 /// <dt>
218 /// OTHER_ACCOUNTS_VIA_RAM
219 /// </dt>
220 /// <dd>
221 /// <p>Lists the KMS keys in the Region that other Amazon Web Services accounts currently share with your Amazon Web Services account through RAM. This list doesn't include KMS keys that your Amazon Web Services account owns. For each of these KMS keys, the key ARN in the response contains the account ID of the Amazon Web Services account that owns the KMS key.</p>
222 /// </dd>
223 /// </dl>
224 /// <p>If you omit this parameter, <code>ListKeys</code> lists only the KMS keys in your Amazon Web Services account. If you specify both values, in either order, <code>ListKeys</code> returns the KMS keys in your Amazon Web Services account first, and then the KMS keys that other Amazon Web Services accounts shared with you. A single response doesn't contain both kinds of KMS keys.</p>
225 /// <p>When <code>ResourceOwners</code> includes <code>OTHER_ACCOUNTS_VIA_RAM</code>, a response can contain fewer KMS keys than the <code>Limit</code> value, or none, even when <code>Truncated</code> is true. To get all of the KMS keys, continue calling <code>ListKeys</code> with the <code>NextMarker</code> value from each response until <code>Truncated</code> is false. Use a <code>NextMarker</code> value only in a request that has the same <code>ResourceOwners</code> value as the request that returned it. Otherwise, the request can fail with an <code>InvalidMarkerException</code>.</p>
226 /// <p>KMS keys that other Amazon Web Services accounts share with you can take some time to appear in or disappear from the results after changes to resource shares.</p>
227 pub fn get_resource_owners(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceOwnerType>> {
228 self.inner.get_resource_owners()
229 }
230}