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_output::ListKeysOutputBuilder;
3
4pub use crate::operation::list_keys::_list_keys_input::ListKeysInputBuilder;
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><b>Cross-account use</b>: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.</p>
27/// <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>
28/// <p><b>Related operations:</b></p>
29/// <ul>
30/// <li>
31/// <p><code>CreateKey</code></p></li>
32/// <li>
33/// <p><code>DescribeKey</code></p></li>
34/// <li>
35/// <p><code>ListAliases</code></p></li>
36/// <li>
37/// <p><code>ListResourceTags</code></p></li>
38/// </ul>
39/// <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/programming-eventual-consistency.html">KMS eventual consistency</a>.</p>
40#[derive(::std::clone::Clone, ::std::fmt::Debug)]
41pub struct ListKeysFluentBuilder {
42    handle: ::std::sync::Arc<crate::client::Handle>,
43    inner: crate::operation::list_keys::builders::ListKeysInputBuilder,
44    config_override: ::std::option::Option<crate::config::Builder>,
45}
46impl crate::client::customize::internal::CustomizableSend<crate::operation::list_keys::ListKeysOutput, crate::operation::list_keys::ListKeysError>
47    for ListKeysFluentBuilder
48{
49    fn send(
50        self,
51        config_override: crate::config::Builder,
52    ) -> crate::client::customize::internal::BoxFuture<
53        crate::client::customize::internal::SendResult<crate::operation::list_keys::ListKeysOutput, crate::operation::list_keys::ListKeysError>,
54    > {
55        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
56    }
57}
58impl ListKeysFluentBuilder {
59    /// Creates a new `ListKeysFluentBuilder`.
60    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
61        Self {
62            handle,
63            inner: ::std::default::Default::default(),
64            config_override: ::std::option::Option::None,
65        }
66    }
67    /// Access the ListKeys as a reference.
68    pub fn as_input(&self) -> &crate::operation::list_keys::builders::ListKeysInputBuilder {
69        &self.inner
70    }
71    /// Sends the request and returns the response.
72    ///
73    /// If an error occurs, an `SdkError` will be returned with additional details that
74    /// can be matched against.
75    ///
76    /// By default, any retryable failures will be retried twice. Retry behavior
77    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
78    /// set when configuring the client.
79    pub async fn send(
80        self,
81    ) -> ::std::result::Result<
82        crate::operation::list_keys::ListKeysOutput,
83        ::aws_smithy_runtime_api::client::result::SdkError<
84            crate::operation::list_keys::ListKeysError,
85            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
86        >,
87    > {
88        let input = self
89            .inner
90            .build()
91            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
92        let runtime_plugins = crate::operation::list_keys::ListKeys::operation_runtime_plugins(
93            self.handle.runtime_plugins.clone(),
94            &self.handle.conf,
95            self.config_override,
96        );
97        crate::operation::list_keys::ListKeys::orchestrate(&runtime_plugins, input).await
98    }
99
100    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
101    pub fn customize(
102        self,
103    ) -> crate::client::customize::CustomizableOperation<crate::operation::list_keys::ListKeysOutput, crate::operation::list_keys::ListKeysError, 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_keys::paginator::ListKeysPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
119    pub fn into_paginator(self) -> crate::operation::list_keys::paginator::ListKeysPaginator {
120        crate::operation::list_keys::paginator::ListKeysPaginator::new(self.handle, self.inner)
121    }
122    /// <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>
123    /// <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>
124    pub fn limit(mut self, input: i32) -> Self {
125        self.inner = self.inner.limit(input);
126        self
127    }
128    /// <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>
129    /// <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>
130    pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
131        self.inner = self.inner.set_limit(input);
132        self
133    }
134    /// <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>
135    /// <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>
136    pub fn get_limit(&self) -> &::std::option::Option<i32> {
137        self.inner.get_limit()
138    }
139    /// <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>
140    pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.marker(input.into());
142        self
143    }
144    /// <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>
145    pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_marker(input);
147        self
148    }
149    /// <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>
150    pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_marker()
152    }
153}