aws_sdk_kms/operation/list_key_rotations/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_key_rotations::_list_key_rotations_output::ListKeyRotationsOutputBuilder;
3
4pub use crate::operation::list_key_rotations::_list_key_rotations_input::ListKeyRotationsInputBuilder;
5
6impl crate::operation::list_key_rotations::builders::ListKeyRotationsInputBuilder {
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_key_rotations::ListKeyRotationsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::list_key_rotations::ListKeyRotationsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.list_key_rotations();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ListKeyRotations`.
24///
25/// <p>Returns information about all completed key material rotations for the specified KMS key.</p>
26/// <p>You must specify the KMS key in all requests. You can refine the key rotations list by limiting the number of rotations returned.</p>
27/// <p>For detailed information about automatic and on-demand key rotations, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html">Rotating KMS keys</a> in the <i>Key Management Service Developer Guide</i>.</p>
28/// <p><b>Cross-account use</b>: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.</p>
29/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:ListKeyRotations</a> (key policy)</p>
30/// <p><b>Related operations:</b></p>
31/// <ul>
32/// <li>
33/// <p><code>EnableKeyRotation</code></p></li>
34/// <li>
35/// <p><code>DisableKeyRotation</code></p></li>
36/// <li>
37/// <p><code>GetKeyRotationStatus</code></p></li>
38/// <li>
39/// <p><code>RotateKeyOnDemand</code></p></li>
40/// </ul>
41/// <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>
42#[derive(::std::clone::Clone, ::std::fmt::Debug)]
43pub struct ListKeyRotationsFluentBuilder {
44    handle: ::std::sync::Arc<crate::client::Handle>,
45    inner: crate::operation::list_key_rotations::builders::ListKeyRotationsInputBuilder,
46    config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49    crate::client::customize::internal::CustomizableSend<
50        crate::operation::list_key_rotations::ListKeyRotationsOutput,
51        crate::operation::list_key_rotations::ListKeyRotationsError,
52    > for ListKeyRotationsFluentBuilder
53{
54    fn send(
55        self,
56        config_override: crate::config::Builder,
57    ) -> crate::client::customize::internal::BoxFuture<
58        crate::client::customize::internal::SendResult<
59            crate::operation::list_key_rotations::ListKeyRotationsOutput,
60            crate::operation::list_key_rotations::ListKeyRotationsError,
61        >,
62    > {
63        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64    }
65}
66impl ListKeyRotationsFluentBuilder {
67    /// Creates a new `ListKeyRotationsFluentBuilder`.
68    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
69        Self {
70            handle,
71            inner: ::std::default::Default::default(),
72            config_override: ::std::option::Option::None,
73        }
74    }
75    /// Access the ListKeyRotations as a reference.
76    pub fn as_input(&self) -> &crate::operation::list_key_rotations::builders::ListKeyRotationsInputBuilder {
77        &self.inner
78    }
79    /// Sends the request and returns the response.
80    ///
81    /// If an error occurs, an `SdkError` will be returned with additional details that
82    /// can be matched against.
83    ///
84    /// By default, any retryable failures will be retried twice. Retry behavior
85    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
86    /// set when configuring the client.
87    pub async fn send(
88        self,
89    ) -> ::std::result::Result<
90        crate::operation::list_key_rotations::ListKeyRotationsOutput,
91        ::aws_smithy_runtime_api::client::result::SdkError<
92            crate::operation::list_key_rotations::ListKeyRotationsError,
93            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
94        >,
95    > {
96        let input = self
97            .inner
98            .build()
99            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
100        let runtime_plugins = crate::operation::list_key_rotations::ListKeyRotations::operation_runtime_plugins(
101            self.handle.runtime_plugins.clone(),
102            &self.handle.conf,
103            self.config_override,
104        );
105        crate::operation::list_key_rotations::ListKeyRotations::orchestrate(&runtime_plugins, input).await
106    }
107
108    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
109    pub fn customize(
110        self,
111    ) -> crate::client::customize::CustomizableOperation<
112        crate::operation::list_key_rotations::ListKeyRotationsOutput,
113        crate::operation::list_key_rotations::ListKeyRotationsError,
114        Self,
115    > {
116        crate::client::customize::CustomizableOperation::new(self)
117    }
118    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
119        self.set_config_override(::std::option::Option::Some(config_override.into()));
120        self
121    }
122
123    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
124        self.config_override = config_override;
125        self
126    }
127    /// Create a paginator for this request
128    ///
129    /// Paginators are used by calling [`send().await`](crate::operation::list_key_rotations::paginator::ListKeyRotationsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
130    pub fn into_paginator(self) -> crate::operation::list_key_rotations::paginator::ListKeyRotationsPaginator {
131        crate::operation::list_key_rotations::paginator::ListKeyRotationsPaginator::new(self.handle, self.inner)
132    }
133    /// <p>Gets the key rotations for the specified KMS key.</p>
134    /// <p>Specify the key ID or key ARN of the KMS key.</p>
135    /// <p>For example:</p>
136    /// <ul>
137    /// <li>
138    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
139    /// <li>
140    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
141    /// </ul>
142    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
143    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        self.inner = self.inner.key_id(input.into());
145        self
146    }
147    /// <p>Gets the key rotations for the specified KMS key.</p>
148    /// <p>Specify the key ID or key ARN of the KMS key.</p>
149    /// <p>For example:</p>
150    /// <ul>
151    /// <li>
152    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
153    /// <li>
154    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
155    /// </ul>
156    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
157    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.inner = self.inner.set_key_id(input);
159        self
160    }
161    /// <p>Gets the key rotations for the specified KMS key.</p>
162    /// <p>Specify the key ID or key ARN of the KMS key.</p>
163    /// <p>For example:</p>
164    /// <ul>
165    /// <li>
166    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
167    /// <li>
168    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
169    /// </ul>
170    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
171    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
172        self.inner.get_key_id()
173    }
174    /// <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>
175    /// <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>
176    pub fn limit(mut self, input: i32) -> Self {
177        self.inner = self.inner.limit(input);
178        self
179    }
180    /// <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>
181    /// <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>
182    pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
183        self.inner = self.inner.set_limit(input);
184        self
185    }
186    /// <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>
187    /// <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>
188    pub fn get_limit(&self) -> &::std::option::Option<i32> {
189        self.inner.get_limit()
190    }
191    /// <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>
192    pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
193        self.inner = self.inner.marker(input.into());
194        self
195    }
196    /// <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>
197    pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
198        self.inner = self.inner.set_marker(input);
199        self
200    }
201    /// <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>
202    pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
203        self.inner.get_marker()
204    }
205}