aws_sdk_kms/operation/enable_key/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::enable_key::_enable_key_output::EnableKeyOutputBuilder;
3
4pub use crate::operation::enable_key::_enable_key_input::EnableKeyInputBuilder;
5
6impl crate::operation::enable_key::builders::EnableKeyInputBuilder {
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::enable_key::EnableKeyOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::enable_key::EnableKeyError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.enable_key();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `EnableKey`.
24///
25/// <p>Sets the key state of a KMS key to enabled. This allows you to use the KMS key for <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.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 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>
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:EnableKey</a> (key policy)</p>
29/// <p><b>Related operations</b>: <code>DisableKey</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/programming-eventual-consistency.html">KMS eventual consistency</a>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct EnableKeyFluentBuilder {
33 handle: ::std::sync::Arc<crate::client::Handle>,
34 inner: crate::operation::enable_key::builders::EnableKeyInputBuilder,
35 config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl crate::client::customize::internal::CustomizableSend<crate::operation::enable_key::EnableKeyOutput, crate::operation::enable_key::EnableKeyError>
38 for EnableKeyFluentBuilder
39{
40 fn send(
41 self,
42 config_override: crate::config::Builder,
43 ) -> crate::client::customize::internal::BoxFuture<
44 crate::client::customize::internal::SendResult<crate::operation::enable_key::EnableKeyOutput, crate::operation::enable_key::EnableKeyError>,
45 > {
46 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
47 }
48}
49impl EnableKeyFluentBuilder {
50 /// Creates a new `EnableKeyFluentBuilder`.
51 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
52 Self {
53 handle,
54 inner: ::std::default::Default::default(),
55 config_override: ::std::option::Option::None,
56 }
57 }
58 /// Access the EnableKey as a reference.
59 pub fn as_input(&self) -> &crate::operation::enable_key::builders::EnableKeyInputBuilder {
60 &self.inner
61 }
62 /// Sends the request and returns the response.
63 ///
64 /// If an error occurs, an `SdkError` will be returned with additional details that
65 /// can be matched against.
66 ///
67 /// By default, any retryable failures will be retried twice. Retry behavior
68 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
69 /// set when configuring the client.
70 pub async fn send(
71 self,
72 ) -> ::std::result::Result<
73 crate::operation::enable_key::EnableKeyOutput,
74 ::aws_smithy_runtime_api::client::result::SdkError<
75 crate::operation::enable_key::EnableKeyError,
76 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
77 >,
78 > {
79 let input = self
80 .inner
81 .build()
82 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
83 let runtime_plugins = crate::operation::enable_key::EnableKey::operation_runtime_plugins(
84 self.handle.runtime_plugins.clone(),
85 &self.handle.conf,
86 self.config_override,
87 );
88 crate::operation::enable_key::EnableKey::orchestrate(&runtime_plugins, input).await
89 }
90
91 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
92 pub fn customize(
93 self,
94 ) -> crate::client::customize::CustomizableOperation<
95 crate::operation::enable_key::EnableKeyOutput,
96 crate::operation::enable_key::EnableKeyError,
97 Self,
98 > {
99 crate::client::customize::CustomizableOperation::new(self)
100 }
101 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
102 self.set_config_override(::std::option::Option::Some(config_override.into()));
103 self
104 }
105
106 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
107 self.config_override = config_override;
108 self
109 }
110 /// <p>Identifies the KMS key to enable.</p>
111 /// <p>Specify the key ID or key ARN of the KMS key.</p>
112 /// <p>For example:</p>
113 /// <ul>
114 /// <li>
115 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
116 /// <li>
117 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
118 /// </ul>
119 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
120 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121 self.inner = self.inner.key_id(input.into());
122 self
123 }
124 /// <p>Identifies the KMS key to enable.</p>
125 /// <p>Specify the key ID or key ARN of the KMS key.</p>
126 /// <p>For example:</p>
127 /// <ul>
128 /// <li>
129 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
130 /// <li>
131 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
132 /// </ul>
133 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
134 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135 self.inner = self.inner.set_key_id(input);
136 self
137 }
138 /// <p>Identifies the KMS key to enable.</p>
139 /// <p>Specify the key ID or key ARN of the KMS key.</p>
140 /// <p>For example:</p>
141 /// <ul>
142 /// <li>
143 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
144 /// <li>
145 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
146 /// </ul>
147 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
148 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
149 self.inner.get_key_id()
150 }
151}