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 the key materials associated with the specified KMS key. You can use the optional <code>IncludeKeyMaterial</code> parameter to control which key materials are included in the response.</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">Rotate 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>DeleteImportedKeyMaterial</code></p></li>
36/// <li>
37/// <p><code>DisableKeyRotation</code></p></li>
38/// <li>
39/// <p><code>GetKeyRotationStatus</code></p></li>
40/// <li>
41/// <p><code>ImportKeyMaterial</code></p></li>
42/// <li>
43/// <p><code>RotateKeyOnDemand</code></p></li>
44/// </ul>
45/// <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>
46#[derive(::std::clone::Clone, ::std::fmt::Debug)]
47pub struct ListKeyRotationsFluentBuilder {
48    handle: ::std::sync::Arc<crate::client::Handle>,
49    inner: crate::operation::list_key_rotations::builders::ListKeyRotationsInputBuilder,
50    config_override: ::std::option::Option<crate::config::Builder>,
51}
52impl
53    crate::client::customize::internal::CustomizableSend<
54        crate::operation::list_key_rotations::ListKeyRotationsOutput,
55        crate::operation::list_key_rotations::ListKeyRotationsError,
56    > for ListKeyRotationsFluentBuilder
57{
58    fn send(
59        self,
60        config_override: crate::config::Builder,
61    ) -> crate::client::customize::internal::BoxFuture<
62        crate::client::customize::internal::SendResult<
63            crate::operation::list_key_rotations::ListKeyRotationsOutput,
64            crate::operation::list_key_rotations::ListKeyRotationsError,
65        >,
66    > {
67        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
68    }
69}
70impl ListKeyRotationsFluentBuilder {
71    /// Creates a new `ListKeyRotationsFluentBuilder`.
72    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
73        Self {
74            handle,
75            inner: ::std::default::Default::default(),
76            config_override: ::std::option::Option::None,
77        }
78    }
79    /// Access the ListKeyRotations as a reference.
80    pub fn as_input(&self) -> &crate::operation::list_key_rotations::builders::ListKeyRotationsInputBuilder {
81        &self.inner
82    }
83    /// Sends the request and returns the response.
84    ///
85    /// If an error occurs, an `SdkError` will be returned with additional details that
86    /// can be matched against.
87    ///
88    /// By default, any retryable failures will be retried twice. Retry behavior
89    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
90    /// set when configuring the client.
91    pub async fn send(
92        self,
93    ) -> ::std::result::Result<
94        crate::operation::list_key_rotations::ListKeyRotationsOutput,
95        ::aws_smithy_runtime_api::client::result::SdkError<
96            crate::operation::list_key_rotations::ListKeyRotationsError,
97            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
98        >,
99    > {
100        let input = self
101            .inner
102            .build()
103            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
104        let runtime_plugins = crate::operation::list_key_rotations::ListKeyRotations::operation_runtime_plugins(
105            self.handle.runtime_plugins.clone(),
106            &self.handle.conf,
107            self.config_override,
108        );
109        crate::operation::list_key_rotations::ListKeyRotations::orchestrate(&runtime_plugins, input).await
110    }
111
112    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
113    pub fn customize(
114        self,
115    ) -> crate::client::customize::CustomizableOperation<
116        crate::operation::list_key_rotations::ListKeyRotationsOutput,
117        crate::operation::list_key_rotations::ListKeyRotationsError,
118        Self,
119    > {
120        crate::client::customize::CustomizableOperation::new(self)
121    }
122    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
123        self.set_config_override(::std::option::Option::Some(config_override.into()));
124        self
125    }
126
127    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
128        self.config_override = config_override;
129        self
130    }
131    /// Create a paginator for this request
132    ///
133    /// 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).
134    pub fn into_paginator(self) -> crate::operation::list_key_rotations::paginator::ListKeyRotationsPaginator {
135        crate::operation::list_key_rotations::paginator::ListKeyRotationsPaginator::new(self.handle, self.inner)
136    }
137    /// <p>Gets the key rotations for the specified KMS key.</p>
138    /// <p>Specify the key ID or key ARN of the KMS key.</p>
139    /// <p>For example:</p>
140    /// <ul>
141    /// <li>
142    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
143    /// <li>
144    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
145    /// </ul>
146    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
147    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.inner = self.inner.key_id(input.into());
149        self
150    }
151    /// <p>Gets the key rotations for the specified KMS key.</p>
152    /// <p>Specify the key ID or key ARN of the KMS key.</p>
153    /// <p>For example:</p>
154    /// <ul>
155    /// <li>
156    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
157    /// <li>
158    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
159    /// </ul>
160    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
161    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162        self.inner = self.inner.set_key_id(input);
163        self
164    }
165    /// <p>Gets the key rotations for the specified KMS key.</p>
166    /// <p>Specify the key ID or key ARN of the KMS key.</p>
167    /// <p>For example:</p>
168    /// <ul>
169    /// <li>
170    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
171    /// <li>
172    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
173    /// </ul>
174    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
175    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
176        self.inner.get_key_id()
177    }
178    /// <p>Use this optional parameter to control which key materials associated with this key are listed in the response. The default value of this parameter is <code>ROTATIONS_ONLY</code>. If you omit this parameter, KMS returns information on the key materials created by automatic or on-demand key rotation. When you specify a value of <code>ALL_KEY_MATERIAL</code>, KMS adds the first key material and any imported key material pending rotation to the response. This parameter can only be used with KMS keys that support automatic or on-demand key rotation.</p>
179    pub fn include_key_material(mut self, input: crate::types::IncludeKeyMaterial) -> Self {
180        self.inner = self.inner.include_key_material(input);
181        self
182    }
183    /// <p>Use this optional parameter to control which key materials associated with this key are listed in the response. The default value of this parameter is <code>ROTATIONS_ONLY</code>. If you omit this parameter, KMS returns information on the key materials created by automatic or on-demand key rotation. When you specify a value of <code>ALL_KEY_MATERIAL</code>, KMS adds the first key material and any imported key material pending rotation to the response. This parameter can only be used with KMS keys that support automatic or on-demand key rotation.</p>
184    pub fn set_include_key_material(mut self, input: ::std::option::Option<crate::types::IncludeKeyMaterial>) -> Self {
185        self.inner = self.inner.set_include_key_material(input);
186        self
187    }
188    /// <p>Use this optional parameter to control which key materials associated with this key are listed in the response. The default value of this parameter is <code>ROTATIONS_ONLY</code>. If you omit this parameter, KMS returns information on the key materials created by automatic or on-demand key rotation. When you specify a value of <code>ALL_KEY_MATERIAL</code>, KMS adds the first key material and any imported key material pending rotation to the response. This parameter can only be used with KMS keys that support automatic or on-demand key rotation.</p>
189    pub fn get_include_key_material(&self) -> &::std::option::Option<crate::types::IncludeKeyMaterial> {
190        self.inner.get_include_key_material()
191    }
192    /// <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>
193    /// <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>
194    pub fn limit(mut self, input: i32) -> Self {
195        self.inner = self.inner.limit(input);
196        self
197    }
198    /// <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>
199    /// <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>
200    pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
201        self.inner = self.inner.set_limit(input);
202        self
203    }
204    /// <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>
205    /// <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>
206    pub fn get_limit(&self) -> &::std::option::Option<i32> {
207        self.inner.get_limit()
208    }
209    /// <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>
210    pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
211        self.inner = self.inner.marker(input.into());
212        self
213    }
214    /// <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>
215    pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
216        self.inner = self.inner.set_marker(input);
217        self
218    }
219    /// <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>
220    pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
221        self.inner.get_marker()
222    }
223}