aws_sdk_kms/operation/disable_key_rotation/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::disable_key_rotation::_disable_key_rotation_output::DisableKeyRotationOutputBuilder;
3
4pub use crate::operation::disable_key_rotation::_disable_key_rotation_input::DisableKeyRotationInputBuilder;
5
6impl crate::operation::disable_key_rotation::builders::DisableKeyRotationInputBuilder {
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::disable_key_rotation::DisableKeyRotationOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::disable_key_rotation::DisableKeyRotationError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.disable_key_rotation();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DisableKeyRotation`.
24///
25/// <p>Disables <a href="https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html">automatic rotation of the key material</a> of the specified symmetric encryption KMS key.</p>
26/// <p>Automatic key rotation is supported only on symmetric encryption KMS keys. You cannot enable automatic rotation of <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html">asymmetric KMS keys</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html">HMAC KMS keys</a>, KMS keys with <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">imported key material</a>, or KMS keys in a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store</a>. To enable or disable automatic rotation of a set of related <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-rotate">multi-Region keys</a>, set the property on the primary key.</p>
27/// <p>You can enable (<code>EnableKeyRotation</code>) and disable automatic rotation of the key material in <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk">customer managed KMS keys</a>. Key material rotation of <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed KMS keys</a> is not configurable. KMS always rotates the key material for every year. Rotation of <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk">Amazon Web Services owned KMS keys</a> varies.</p><note>
28/// <p>In May 2022, KMS changed the rotation schedule for Amazon Web Services managed keys from every three years to every year. For details, see <code>EnableKeyRotation</code>.</p>
29/// </note>
30/// <p>The KMS key that you use for this operation must be in a compatible key state. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of KMS keys</a> in the <i>Key Management Service Developer Guide</i>.</p>
31/// <p><b>Cross-account use</b>: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.</p>
32/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:DisableKeyRotation</a> (key policy)</p>
33/// <p><b>Related operations:</b></p>
34/// <ul>
35/// <li>
36/// <p><code>EnableKeyRotation</code></p></li>
37/// <li>
38/// <p><code>GetKeyRotationStatus</code></p></li>
39/// <li>
40/// <p><code>ListKeyRotations</code></p></li>
41/// <li>
42/// <p><code>RotateKeyOnDemand</code></p></li>
43/// </ul>
44/// <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>
45#[derive(::std::clone::Clone, ::std::fmt::Debug)]
46pub struct DisableKeyRotationFluentBuilder {
47    handle: ::std::sync::Arc<crate::client::Handle>,
48    inner: crate::operation::disable_key_rotation::builders::DisableKeyRotationInputBuilder,
49    config_override: ::std::option::Option<crate::config::Builder>,
50}
51impl
52    crate::client::customize::internal::CustomizableSend<
53        crate::operation::disable_key_rotation::DisableKeyRotationOutput,
54        crate::operation::disable_key_rotation::DisableKeyRotationError,
55    > for DisableKeyRotationFluentBuilder
56{
57    fn send(
58        self,
59        config_override: crate::config::Builder,
60    ) -> crate::client::customize::internal::BoxFuture<
61        crate::client::customize::internal::SendResult<
62            crate::operation::disable_key_rotation::DisableKeyRotationOutput,
63            crate::operation::disable_key_rotation::DisableKeyRotationError,
64        >,
65    > {
66        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
67    }
68}
69impl DisableKeyRotationFluentBuilder {
70    /// Creates a new `DisableKeyRotationFluentBuilder`.
71    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
72        Self {
73            handle,
74            inner: ::std::default::Default::default(),
75            config_override: ::std::option::Option::None,
76        }
77    }
78    /// Access the DisableKeyRotation as a reference.
79    pub fn as_input(&self) -> &crate::operation::disable_key_rotation::builders::DisableKeyRotationInputBuilder {
80        &self.inner
81    }
82    /// Sends the request and returns the response.
83    ///
84    /// If an error occurs, an `SdkError` will be returned with additional details that
85    /// can be matched against.
86    ///
87    /// By default, any retryable failures will be retried twice. Retry behavior
88    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
89    /// set when configuring the client.
90    pub async fn send(
91        self,
92    ) -> ::std::result::Result<
93        crate::operation::disable_key_rotation::DisableKeyRotationOutput,
94        ::aws_smithy_runtime_api::client::result::SdkError<
95            crate::operation::disable_key_rotation::DisableKeyRotationError,
96            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
97        >,
98    > {
99        let input = self
100            .inner
101            .build()
102            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
103        let runtime_plugins = crate::operation::disable_key_rotation::DisableKeyRotation::operation_runtime_plugins(
104            self.handle.runtime_plugins.clone(),
105            &self.handle.conf,
106            self.config_override,
107        );
108        crate::operation::disable_key_rotation::DisableKeyRotation::orchestrate(&runtime_plugins, input).await
109    }
110
111    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
112    pub fn customize(
113        self,
114    ) -> crate::client::customize::CustomizableOperation<
115        crate::operation::disable_key_rotation::DisableKeyRotationOutput,
116        crate::operation::disable_key_rotation::DisableKeyRotationError,
117        Self,
118    > {
119        crate::client::customize::CustomizableOperation::new(self)
120    }
121    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
122        self.set_config_override(::std::option::Option::Some(config_override.into()));
123        self
124    }
125
126    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
127        self.config_override = config_override;
128        self
129    }
130    /// <p>Identifies a symmetric encryption KMS key. You cannot enable or disable automatic rotation of <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html#asymmetric-cmks">asymmetric KMS keys</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html">HMAC KMS keys</a>, KMS keys with <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">imported key material</a>, or KMS keys in a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store</a>.</p>
131    /// <p>Specify the key ID or key ARN of the KMS key.</p>
132    /// <p>For example:</p>
133    /// <ul>
134    /// <li>
135    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
136    /// <li>
137    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
138    /// </ul>
139    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
140    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.key_id(input.into());
142        self
143    }
144    /// <p>Identifies a symmetric encryption KMS key. You cannot enable or disable automatic rotation of <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html#asymmetric-cmks">asymmetric KMS keys</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html">HMAC KMS keys</a>, KMS keys with <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">imported key material</a>, or KMS keys in a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store</a>.</p>
145    /// <p>Specify the key ID or key ARN of the KMS key.</p>
146    /// <p>For example:</p>
147    /// <ul>
148    /// <li>
149    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
150    /// <li>
151    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
152    /// </ul>
153    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
154    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155        self.inner = self.inner.set_key_id(input);
156        self
157    }
158    /// <p>Identifies a symmetric encryption KMS key. You cannot enable or disable automatic rotation of <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html#asymmetric-cmks">asymmetric KMS keys</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html">HMAC KMS keys</a>, KMS keys with <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">imported key material</a>, or KMS keys in a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store</a>.</p>
159    /// <p>Specify the key ID or key ARN of the KMS key.</p>
160    /// <p>For example:</p>
161    /// <ul>
162    /// <li>
163    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
164    /// <li>
165    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
166    /// </ul>
167    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
168    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
169        self.inner.get_key_id()
170    }
171}