aws_sdk_paymentcryptography/operation/delete_key/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::delete_key::_delete_key_output::DeleteKeyOutputBuilder;
3
4pub use crate::operation::delete_key::_delete_key_input::DeleteKeyInputBuilder;
5
6impl crate::operation::delete_key::builders::DeleteKeyInputBuilder {
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::delete_key::DeleteKeyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::delete_key::DeleteKeyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.delete_key();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DeleteKey`.
24///
25/// <p>Deletes the key material and metadata associated with Amazon Web Services Payment Cryptography key.</p>
26/// <p>Key deletion is irreversible. After a key is deleted, you can't perform cryptographic operations using the key. For example, you can't decrypt data that was encrypted by a deleted Amazon Web Services Payment Cryptography key, and the data may become unrecoverable. Because key deletion is destructive, Amazon Web Services Payment Cryptography has a safety mechanism to prevent accidental deletion of a key. When you call this operation, Amazon Web Services Payment Cryptography disables the specified key but doesn't delete it until after a waiting period set using <code>DeleteKeyInDays</code>. The default waiting period is 7 days. During the waiting period, the <code>KeyState</code> is <code>DELETE_PENDING</code>. After the key is deleted, the <code>KeyState</code> is <code>DELETE_COMPLETE</code>.</p>
27/// <p>You should delete a key only when you are sure that you don't need to use it anymore and no other parties are utilizing this key. If you aren't sure, consider deactivating it instead by calling <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_StopKeyUsage.html">StopKeyUsage</a>.</p>
28/// <p><b>Cross-account use:</b> This operation can't be used across different Amazon Web Services accounts.</p>
29/// <p><b>Related operations:</b></p>
30/// <ul>
31/// <li>
32/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_RestoreKey.html">RestoreKey</a></p></li>
33/// <li>
34/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_StartKeyUsage.html">StartKeyUsage</a></p></li>
35/// <li>
36/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_StopKeyUsage.html">StopKeyUsage</a></p></li>
37/// </ul>
38#[derive(::std::clone::Clone, ::std::fmt::Debug)]
39pub struct DeleteKeyFluentBuilder {
40    handle: ::std::sync::Arc<crate::client::Handle>,
41    inner: crate::operation::delete_key::builders::DeleteKeyInputBuilder,
42    config_override: ::std::option::Option<crate::config::Builder>,
43}
44impl crate::client::customize::internal::CustomizableSend<crate::operation::delete_key::DeleteKeyOutput, crate::operation::delete_key::DeleteKeyError>
45    for DeleteKeyFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<crate::operation::delete_key::DeleteKeyOutput, crate::operation::delete_key::DeleteKeyError>,
52    > {
53        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54    }
55}
56impl DeleteKeyFluentBuilder {
57    /// Creates a new `DeleteKeyFluentBuilder`.
58    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59        Self {
60            handle,
61            inner: ::std::default::Default::default(),
62            config_override: ::std::option::Option::None,
63        }
64    }
65    /// Access the DeleteKey as a reference.
66    pub fn as_input(&self) -> &crate::operation::delete_key::builders::DeleteKeyInputBuilder {
67        &self.inner
68    }
69    /// Sends the request and returns the response.
70    ///
71    /// If an error occurs, an `SdkError` will be returned with additional details that
72    /// can be matched against.
73    ///
74    /// By default, any retryable failures will be retried twice. Retry behavior
75    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76    /// set when configuring the client.
77    pub async fn send(
78        self,
79    ) -> ::std::result::Result<
80        crate::operation::delete_key::DeleteKeyOutput,
81        ::aws_smithy_runtime_api::client::result::SdkError<
82            crate::operation::delete_key::DeleteKeyError,
83            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84        >,
85    > {
86        let input = self
87            .inner
88            .build()
89            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90        let runtime_plugins = crate::operation::delete_key::DeleteKey::operation_runtime_plugins(
91            self.handle.runtime_plugins.clone(),
92            &self.handle.conf,
93            self.config_override,
94        );
95        crate::operation::delete_key::DeleteKey::orchestrate(&runtime_plugins, input).await
96    }
97
98    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99    pub fn customize(
100        self,
101    ) -> crate::client::customize::CustomizableOperation<
102        crate::operation::delete_key::DeleteKeyOutput,
103        crate::operation::delete_key::DeleteKeyError,
104        Self,
105    > {
106        crate::client::customize::CustomizableOperation::new(self)
107    }
108    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109        self.set_config_override(::std::option::Option::Some(config_override.into()));
110        self
111    }
112
113    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114        self.config_override = config_override;
115        self
116    }
117    /// <p>The <code>KeyARN</code> of the key that is scheduled for deletion.</p>
118    pub fn key_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.inner = self.inner.key_identifier(input.into());
120        self
121    }
122    /// <p>The <code>KeyARN</code> of the key that is scheduled for deletion.</p>
123    pub fn set_key_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.inner = self.inner.set_key_identifier(input);
125        self
126    }
127    /// <p>The <code>KeyARN</code> of the key that is scheduled for deletion.</p>
128    pub fn get_key_identifier(&self) -> &::std::option::Option<::std::string::String> {
129        self.inner.get_key_identifier()
130    }
131    /// <p>The waiting period for key deletion. The default value is seven days.</p>
132    pub fn delete_key_in_days(mut self, input: i32) -> Self {
133        self.inner = self.inner.delete_key_in_days(input);
134        self
135    }
136    /// <p>The waiting period for key deletion. The default value is seven days.</p>
137    pub fn set_delete_key_in_days(mut self, input: ::std::option::Option<i32>) -> Self {
138        self.inner = self.inner.set_delete_key_in_days(input);
139        self
140    }
141    /// <p>The waiting period for key deletion. The default value is seven days.</p>
142    pub fn get_delete_key_in_days(&self) -> &::std::option::Option<i32> {
143        self.inner.get_delete_key_in_days()
144    }
145}