aws_sdk_kms/operation/delete_imported_key_material/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::delete_imported_key_material::_delete_imported_key_material_output::DeleteImportedKeyMaterialOutputBuilder;
3
4pub use crate::operation::delete_imported_key_material::_delete_imported_key_material_input::DeleteImportedKeyMaterialInputBuilder;
5
6impl crate::operation::delete_imported_key_material::builders::DeleteImportedKeyMaterialInputBuilder {
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_imported_key_material::DeleteImportedKeyMaterialOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.delete_imported_key_material();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `DeleteImportedKeyMaterial`.
24///
25/// <p>Deletes key material that was previously imported. This operation makes the specified KMS key temporarily unusable. To restore the usability of the KMS key, reimport the same key material. For more information about importing key material into KMS, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">Importing Key Material</a> in the <i>Key Management Service Developer Guide</i>.</p>
26/// <p>When the specified KMS key is in the <code>PendingDeletion</code> state, this operation does not change the KMS key's state. Otherwise, it changes the KMS key's state to <code>PendingImport</code>.</p>
27/// <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>
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:DeleteImportedKeyMaterial</a> (key policy)</p>
30/// <p><b>Related operations:</b></p>
31/// <ul>
32/// <li>
33/// <p><code>GetParametersForImport</code></p></li>
34/// <li>
35/// <p><code>ListKeyRotations</code></p></li>
36/// <li>
37/// <p><code>ImportKeyMaterial</code></p></li>
38/// </ul>
39/// <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>
40#[derive(::std::clone::Clone, ::std::fmt::Debug)]
41pub struct DeleteImportedKeyMaterialFluentBuilder {
42 handle: ::std::sync::Arc<crate::client::Handle>,
43 inner: crate::operation::delete_imported_key_material::builders::DeleteImportedKeyMaterialInputBuilder,
44 config_override: ::std::option::Option<crate::config::Builder>,
45}
46impl
47 crate::client::customize::internal::CustomizableSend<
48 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialOutput,
49 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialError,
50 > for DeleteImportedKeyMaterialFluentBuilder
51{
52 fn send(
53 self,
54 config_override: crate::config::Builder,
55 ) -> crate::client::customize::internal::BoxFuture<
56 crate::client::customize::internal::SendResult<
57 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialOutput,
58 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialError,
59 >,
60 > {
61 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
62 }
63}
64impl DeleteImportedKeyMaterialFluentBuilder {
65 /// Creates a new `DeleteImportedKeyMaterialFluentBuilder`.
66 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
67 Self {
68 handle,
69 inner: ::std::default::Default::default(),
70 config_override: ::std::option::Option::None,
71 }
72 }
73 /// Access the DeleteImportedKeyMaterial as a reference.
74 pub fn as_input(&self) -> &crate::operation::delete_imported_key_material::builders::DeleteImportedKeyMaterialInputBuilder {
75 &self.inner
76 }
77 /// Sends the request and returns the response.
78 ///
79 /// If an error occurs, an `SdkError` will be returned with additional details that
80 /// can be matched against.
81 ///
82 /// By default, any retryable failures will be retried twice. Retry behavior
83 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
84 /// set when configuring the client.
85 pub async fn send(
86 self,
87 ) -> ::std::result::Result<
88 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialOutput,
89 ::aws_smithy_runtime_api::client::result::SdkError<
90 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialError,
91 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
92 >,
93 > {
94 let input = self
95 .inner
96 .build()
97 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
98 let runtime_plugins = crate::operation::delete_imported_key_material::DeleteImportedKeyMaterial::operation_runtime_plugins(
99 self.handle.runtime_plugins.clone(),
100 &self.handle.conf,
101 self.config_override,
102 );
103 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterial::orchestrate(&runtime_plugins, input).await
104 }
105
106 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
107 pub fn customize(
108 self,
109 ) -> crate::client::customize::CustomizableOperation<
110 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialOutput,
111 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialError,
112 Self,
113 > {
114 crate::client::customize::CustomizableOperation::new(self)
115 }
116 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
117 self.set_config_override(::std::option::Option::Some(config_override.into()));
118 self
119 }
120
121 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
122 self.config_override = config_override;
123 self
124 }
125 /// <p>Identifies the KMS key from which you are deleting imported key material. The <code>Origin</code> of the KMS key must be <code>EXTERNAL</code>.</p>
126 /// <p>Specify the key ID or key ARN of the KMS key.</p>
127 /// <p>For example:</p>
128 /// <ul>
129 /// <li>
130 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
131 /// <li>
132 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
133 /// </ul>
134 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
135 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136 self.inner = self.inner.key_id(input.into());
137 self
138 }
139 /// <p>Identifies the KMS key from which you are deleting imported key material. The <code>Origin</code> of the KMS key must be <code>EXTERNAL</code>.</p>
140 /// <p>Specify the key ID or key ARN of the KMS key.</p>
141 /// <p>For example:</p>
142 /// <ul>
143 /// <li>
144 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
145 /// <li>
146 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
147 /// </ul>
148 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
149 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150 self.inner = self.inner.set_key_id(input);
151 self
152 }
153 /// <p>Identifies the KMS key from which you are deleting imported key material. The <code>Origin</code> of the KMS key must be <code>EXTERNAL</code>.</p>
154 /// <p>Specify the key ID or key ARN of the KMS key.</p>
155 /// <p>For example:</p>
156 /// <ul>
157 /// <li>
158 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
159 /// <li>
160 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
161 /// </ul>
162 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
163 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
164 self.inner.get_key_id()
165 }
166 /// <p>Identifies the imported key material you are deleting.</p><important>
167 /// <p>If no KeyMaterialId is specified, KMS deletes the current key material.</p>
168 /// </important>
169 /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
170 pub fn key_material_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171 self.inner = self.inner.key_material_id(input.into());
172 self
173 }
174 /// <p>Identifies the imported key material you are deleting.</p><important>
175 /// <p>If no KeyMaterialId is specified, KMS deletes the current key material.</p>
176 /// </important>
177 /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
178 pub fn set_key_material_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
179 self.inner = self.inner.set_key_material_id(input);
180 self
181 }
182 /// <p>Identifies the imported key material you are deleting.</p><important>
183 /// <p>If no KeyMaterialId is specified, KMS deletes the current key material.</p>
184 /// </important>
185 /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
186 pub fn get_key_material_id(&self) -> &::std::option::Option<::std::string::String> {
187 self.inner.get_key_material_id()
188 }
189}