aws_sdk_kms/operation/disconnect_custom_key_store/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::disconnect_custom_key_store::_disconnect_custom_key_store_output::DisconnectCustomKeyStoreOutputBuilder;
3
4pub use crate::operation::disconnect_custom_key_store::_disconnect_custom_key_store_input::DisconnectCustomKeyStoreInputBuilder;
5
6impl crate::operation::disconnect_custom_key_store::builders::DisconnectCustomKeyStoreInputBuilder {
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::disconnect_custom_key_store::DisconnectCustomKeyStoreOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStoreError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.disconnect_custom_key_store();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DisconnectCustomKeyStore`.
24///
25/// <p>Disconnects the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store</a> from its backing key store. This operation disconnects an CloudHSM key store from its associated CloudHSM cluster or disconnects an external key store from the external key store proxy that communicates with your external key manager.</p>
26/// <p>This operation is part of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key stores</a> feature in KMS, which combines the convenience and extensive integration of KMS with the isolation and control of a key store that you own and manage.</p>
27/// <p>While a custom key store is disconnected, you can manage the custom key store and its KMS keys, but you cannot create or use its KMS keys. You can reconnect the custom key store at any time.</p><note>
28/// <p>While a custom key store is disconnected, all attempts to create KMS keys in the custom key store or to use existing KMS keys in <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a> will fail. This action can prevent users from storing and accessing sensitive data.</p>
29/// </note>
30/// <p>When you disconnect a custom key store, its <code>ConnectionState</code> changes to <code>Disconnected</code>. To find the connection state of a custom key store, use the <code>DescribeCustomKeyStores</code> operation. To reconnect a custom key store, use the <code>ConnectCustomKeyStore</code> operation.</p>
31/// <p>If the operation succeeds, it returns a JSON object with no properties.</p>
32/// <p><b>Cross-account use</b>: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.</p>
33/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:DisconnectCustomKeyStore</a> (IAM policy)</p>
34/// <p><b>Related operations:</b></p>
35/// <ul>
36/// <li>
37/// <p><code>ConnectCustomKeyStore</code></p></li>
38/// <li>
39/// <p><code>CreateCustomKeyStore</code></p></li>
40/// <li>
41/// <p><code>DeleteCustomKeyStore</code></p></li>
42/// <li>
43/// <p><code>DescribeCustomKeyStores</code></p></li>
44/// <li>
45/// <p><code>UpdateCustomKeyStore</code></p></li>
46/// </ul>
47/// <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>
48#[derive(::std::clone::Clone, ::std::fmt::Debug)]
49pub struct DisconnectCustomKeyStoreFluentBuilder {
50    handle: ::std::sync::Arc<crate::client::Handle>,
51    inner: crate::operation::disconnect_custom_key_store::builders::DisconnectCustomKeyStoreInputBuilder,
52    config_override: ::std::option::Option<crate::config::Builder>,
53}
54impl
55    crate::client::customize::internal::CustomizableSend<
56        crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStoreOutput,
57        crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStoreError,
58    > for DisconnectCustomKeyStoreFluentBuilder
59{
60    fn send(
61        self,
62        config_override: crate::config::Builder,
63    ) -> crate::client::customize::internal::BoxFuture<
64        crate::client::customize::internal::SendResult<
65            crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStoreOutput,
66            crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStoreError,
67        >,
68    > {
69        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
70    }
71}
72impl DisconnectCustomKeyStoreFluentBuilder {
73    /// Creates a new `DisconnectCustomKeyStoreFluentBuilder`.
74    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
75        Self {
76            handle,
77            inner: ::std::default::Default::default(),
78            config_override: ::std::option::Option::None,
79        }
80    }
81    /// Access the DisconnectCustomKeyStore as a reference.
82    pub fn as_input(&self) -> &crate::operation::disconnect_custom_key_store::builders::DisconnectCustomKeyStoreInputBuilder {
83        &self.inner
84    }
85    /// Sends the request and returns the response.
86    ///
87    /// If an error occurs, an `SdkError` will be returned with additional details that
88    /// can be matched against.
89    ///
90    /// By default, any retryable failures will be retried twice. Retry behavior
91    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
92    /// set when configuring the client.
93    pub async fn send(
94        self,
95    ) -> ::std::result::Result<
96        crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStoreOutput,
97        ::aws_smithy_runtime_api::client::result::SdkError<
98            crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStoreError,
99            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
100        >,
101    > {
102        let input = self
103            .inner
104            .build()
105            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
106        let runtime_plugins = crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStore::operation_runtime_plugins(
107            self.handle.runtime_plugins.clone(),
108            &self.handle.conf,
109            self.config_override,
110        );
111        crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStore::orchestrate(&runtime_plugins, input).await
112    }
113
114    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
115    pub fn customize(
116        self,
117    ) -> crate::client::customize::CustomizableOperation<
118        crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStoreOutput,
119        crate::operation::disconnect_custom_key_store::DisconnectCustomKeyStoreError,
120        Self,
121    > {
122        crate::client::customize::CustomizableOperation::new(self)
123    }
124    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
125        self.set_config_override(::std::option::Option::Some(config_override.into()));
126        self
127    }
128
129    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
130        self.config_override = config_override;
131        self
132    }
133    /// <p>Enter the ID of the custom key store you want to disconnect. To find the ID of a custom key store, use the <code>DescribeCustomKeyStores</code> operation.</p>
134    pub fn custom_key_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.custom_key_store_id(input.into());
136        self
137    }
138    /// <p>Enter the ID of the custom key store you want to disconnect. To find the ID of a custom key store, use the <code>DescribeCustomKeyStores</code> operation.</p>
139    pub fn set_custom_key_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_custom_key_store_id(input);
141        self
142    }
143    /// <p>Enter the ID of the custom key store you want to disconnect. To find the ID of a custom key store, use the <code>DescribeCustomKeyStores</code> operation.</p>
144    pub fn get_custom_key_store_id(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_custom_key_store_id()
146    }
147}