aws_sdk_kms/operation/disable_key/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::disable_key::_disable_key_output::DisableKeyOutputBuilder;
3
4pub use crate::operation::disable_key::_disable_key_input::DisableKeyInputBuilder;
5
6impl crate::operation::disable_key::builders::DisableKeyInputBuilder {
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::DisableKeyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::disable_key::DisableKeyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.disable_key();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DisableKey`.
24///
25/// <p>Sets the state of a KMS key to disabled. This change temporarily prevents use of the KMS key for <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-cryptography.html#cryptographic-operations">cryptographic operations</a>.</p>
26/// <p>The KMS key that you use for this operation must be in a compatible key state. For more information about how key state affects the use of a KMS key, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of KMS keys</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p>
27/// <p><b>Cross-account use</b>: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.</p>
28/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:DisableKey</a> (key policy)</p>
29/// <p><b>Related operations</b>: <code>EnableKey</code></p>
30/// <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>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct DisableKeyFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::disable_key::builders::DisableKeyInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::disable_key::DisableKeyOutput,
40        crate::operation::disable_key::DisableKeyError,
41    > for DisableKeyFluentBuilder
42{
43    fn send(
44        self,
45        config_override: crate::config::Builder,
46    ) -> crate::client::customize::internal::BoxFuture<
47        crate::client::customize::internal::SendResult<
48            crate::operation::disable_key::DisableKeyOutput,
49            crate::operation::disable_key::DisableKeyError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl DisableKeyFluentBuilder {
56    /// Creates a new `DisableKeyFluentBuilder`.
57    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58        Self {
59            handle,
60            inner: ::std::default::Default::default(),
61            config_override: ::std::option::Option::None,
62        }
63    }
64    /// Access the DisableKey as a reference.
65    pub fn as_input(&self) -> &crate::operation::disable_key::builders::DisableKeyInputBuilder {
66        &self.inner
67    }
68    /// Sends the request and returns the response.
69    ///
70    /// If an error occurs, an `SdkError` will be returned with additional details that
71    /// can be matched against.
72    ///
73    /// By default, any retryable failures will be retried twice. Retry behavior
74    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75    /// set when configuring the client.
76    pub async fn send(
77        self,
78    ) -> ::std::result::Result<
79        crate::operation::disable_key::DisableKeyOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::disable_key::DisableKeyError,
82            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83        >,
84    > {
85        let input = self
86            .inner
87            .build()
88            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89        let runtime_plugins = crate::operation::disable_key::DisableKey::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::disable_key::DisableKey::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::disable_key::DisableKeyOutput,
102        crate::operation::disable_key::DisableKeyError,
103        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    /// <p>Identifies the KMS key to disable.</p>
117    /// <p>Specify the key ID or key ARN of the KMS key.</p>
118    /// <p>For example:</p>
119    /// <ul>
120    /// <li>
121    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
122    /// <li>
123    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
124    /// </ul>
125    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
126    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.key_id(input.into());
128        self
129    }
130    /// <p>Identifies the KMS key to disable.</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 set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_key_id(input);
142        self
143    }
144    /// <p>Identifies the KMS key to disable.</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 get_key_id(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_key_id()
156    }
157}