Skip to main content

aws_sdk_kms/client/
list_keys.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3    /// Constructs a fluent builder for the [`ListKeys`](crate::operation::list_keys::builders::ListKeysFluentBuilder) operation.
4    /// This operation supports pagination; See [`into_paginator()`](crate::operation::list_keys::builders::ListKeysFluentBuilder::into_paginator).
5    ///
6    /// - The fluent builder is configurable:
7    ///   - [`limit(i32)`](crate::operation::list_keys::builders::ListKeysFluentBuilder::limit) / [`set_limit(Option<i32>)`](crate::operation::list_keys::builders::ListKeysFluentBuilder::set_limit):<br>required: **false**<br><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> <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><br>
8    ///   - [`marker(impl Into<String>)`](crate::operation::list_keys::builders::ListKeysFluentBuilder::marker) / [`set_marker(Option<String>)`](crate::operation::list_keys::builders::ListKeysFluentBuilder::set_marker):<br>required: **false**<br><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><br>
9    ///   - [`resource_owners(ResourceOwnerType)`](crate::operation::list_keys::builders::ListKeysFluentBuilder::resource_owners) / [`set_resource_owners(Option<Vec::<ResourceOwnerType>>)`](crate::operation::list_keys::builders::ListKeysFluentBuilder::set_resource_owners):<br>required: **false**<br><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> <p>Specify one or two values. Valid values are:</p> <dl>  <dt>   SELF  </dt>  <dd>   <p>Lists the KMS keys in your Amazon Web Services account and Region.</p>  </dd>  <dt>   OTHER_ACCOUNTS_VIA_RAM  </dt>  <dd>   <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>  </dd> </dl> <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> <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> <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><br>
10    /// - On success, responds with [`ListKeysOutput`](crate::operation::list_keys::ListKeysOutput) with field(s):
11    ///   - [`keys(Option<Vec::<KeyListEntry>>)`](crate::operation::list_keys::ListKeysOutput::keys): <p>A list of KMS keys. For a KMS key that another Amazon Web Services account shared with you through RAM, the key ARN contains the account ID of the Amazon Web Services account that owns the KMS key.</p>
12    ///   - [`next_marker(Option<String>)`](crate::operation::list_keys::ListKeysOutput::next_marker): <p>When <code>Truncated</code> is true, this element is present and contains the value to use for the <code>Marker</code> parameter in a subsequent request.</p>
13    ///   - [`truncated(bool)`](crate::operation::list_keys::ListKeysOutput::truncated): <p>A flag that indicates whether there are more items in the list. When this value is true, the list in this response is truncated. To get more items, pass the value of the <code>NextMarker</code> element in this response to the <code>Marker</code> parameter in a subsequent request.</p>
14    /// - On failure, responds with [`SdkError<ListKeysError>`](crate::operation::list_keys::ListKeysError)
15    pub fn list_keys(&self) -> crate::operation::list_keys::builders::ListKeysFluentBuilder {
16        crate::operation::list_keys::builders::ListKeysFluentBuilder::new(self.handle.clone())
17    }
18}