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 class="title"><b>Considerations for multi-Region symmetric encryption keys</b></p>
28/// <ul>
29/// <li>
30/// <p>When you delete the key material of a primary Region key that is in <code>PENDING_ROTATION</code> or <code>PENDING_MULTI_REGION_IMPORT_AND_ROTATION</code>state, you'll also be deleting the key materials for the replica Region keys.</p></li>
31/// <li>
32/// <p>If you delete any key material of a replica Region key, the primary Region key and other replica Region keys remain unchanged.</p></li>
33/// </ul>
34/// <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>
35/// <p><b>Cross-account use</b>: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.</p>
36/// <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>
37/// <p><b>Related operations:</b></p>
38/// <ul>
39/// <li>
40/// <p><code>GetParametersForImport</code></p></li>
41/// <li>
42/// <p><code>ListKeyRotations</code></p></li>
43/// <li>
44/// <p><code>ImportKeyMaterial</code></p></li>
45/// </ul>
46/// <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>
47#[derive(::std::clone::Clone, ::std::fmt::Debug)]
48pub struct DeleteImportedKeyMaterialFluentBuilder {
49 handle: ::std::sync::Arc<crate::client::Handle>,
50 inner: crate::operation::delete_imported_key_material::builders::DeleteImportedKeyMaterialInputBuilder,
51 config_override: ::std::option::Option<crate::config::Builder>,
52}
53impl
54 crate::client::customize::internal::CustomizableSend<
55 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialOutput,
56 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialError,
57 > for DeleteImportedKeyMaterialFluentBuilder
58{
59 fn send(
60 self,
61 config_override: crate::config::Builder,
62 ) -> crate::client::customize::internal::BoxFuture<
63 crate::client::customize::internal::SendResult<
64 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialOutput,
65 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialError,
66 >,
67 > {
68 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
69 }
70}
71impl DeleteImportedKeyMaterialFluentBuilder {
72 /// Creates a new `DeleteImportedKeyMaterialFluentBuilder`.
73 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
74 Self {
75 handle,
76 inner: ::std::default::Default::default(),
77 config_override: ::std::option::Option::None,
78 }
79 }
80 /// Access the DeleteImportedKeyMaterial as a reference.
81 pub fn as_input(&self) -> &crate::operation::delete_imported_key_material::builders::DeleteImportedKeyMaterialInputBuilder {
82 &self.inner
83 }
84 /// Sends the request and returns the response.
85 ///
86 /// If an error occurs, an `SdkError` will be returned with additional details that
87 /// can be matched against.
88 ///
89 /// By default, any retryable failures will be retried twice. Retry behavior
90 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
91 /// set when configuring the client.
92 pub async fn send(
93 self,
94 ) -> ::std::result::Result<
95 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialOutput,
96 ::aws_smithy_runtime_api::client::result::SdkError<
97 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialError,
98 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
99 >,
100 > {
101 let input = self
102 .inner
103 .build()
104 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
105 let runtime_plugins = crate::operation::delete_imported_key_material::DeleteImportedKeyMaterial::operation_runtime_plugins(
106 self.handle.runtime_plugins.clone(),
107 &self.handle.conf,
108 self.config_override,
109 );
110 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterial::orchestrate(&runtime_plugins, input).await
111 }
112
113 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
114 pub fn customize(
115 self,
116 ) -> crate::client::customize::CustomizableOperation<
117 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialOutput,
118 crate::operation::delete_imported_key_material::DeleteImportedKeyMaterialError,
119 Self,
120 > {
121 crate::client::customize::CustomizableOperation::new(self)
122 }
123 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
124 self.set_config_override(::std::option::Option::Some(config_override.into()));
125 self
126 }
127
128 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
129 self.config_override = config_override;
130 self
131 }
132 /// <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>
133 /// <p>Specify the key ID or key ARN of the KMS key.</p>
134 /// <p>For example:</p>
135 /// <ul>
136 /// <li>
137 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
138 /// <li>
139 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
140 /// </ul>
141 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
142 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143 self.inner = self.inner.key_id(input.into());
144 self
145 }
146 /// <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>
147 /// <p>Specify the key ID or key ARN of the KMS key.</p>
148 /// <p>For example:</p>
149 /// <ul>
150 /// <li>
151 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
152 /// <li>
153 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
154 /// </ul>
155 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
156 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157 self.inner = self.inner.set_key_id(input);
158 self
159 }
160 /// <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>
161 /// <p>Specify the key ID or key ARN of the KMS key.</p>
162 /// <p>For example:</p>
163 /// <ul>
164 /// <li>
165 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
166 /// <li>
167 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
168 /// </ul>
169 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
170 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
171 self.inner.get_key_id()
172 }
173 /// <p>Identifies the imported key material you are deleting.</p><important>
174 /// <p>If no KeyMaterialId is specified, KMS deletes the current key material.</p>
175 /// </important>
176 /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
177 pub fn key_material_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
178 self.inner = self.inner.key_material_id(input.into());
179 self
180 }
181 /// <p>Identifies the imported key material you are deleting.</p><important>
182 /// <p>If no KeyMaterialId is specified, KMS deletes the current key material.</p>
183 /// </important>
184 /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
185 pub fn set_key_material_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186 self.inner = self.inner.set_key_material_id(input);
187 self
188 }
189 /// <p>Identifies the imported key material you are deleting.</p><important>
190 /// <p>If no KeyMaterialId is specified, KMS deletes the current key material.</p>
191 /// </important>
192 /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
193 pub fn get_key_material_id(&self) -> &::std::option::Option<::std::string::String> {
194 self.inner.get_key_material_id()
195 }
196}