aws_sdk_kms/operation/describe_key/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::describe_key::_describe_key_output::DescribeKeyOutputBuilder;
3
4pub use crate::operation::describe_key::_describe_key_input::DescribeKeyInputBuilder;
5
6impl crate::operation::describe_key::builders::DescribeKeyInputBuilder {
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::describe_key::DescribeKeyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::describe_key::DescribeKeyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.describe_key();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DescribeKey`.
24///
25/// <p>Provides detailed information about a KMS key. You can run <code>DescribeKey</code> on a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk">customer managed key</a> or an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed key</a>.</p>
26/// <p>This detailed information includes the key ARN, creation date (and deletion date, if applicable), the key state, and the origin and expiration date (if any) of the key material. It includes fields, like <code>KeySpec</code>, that help you distinguish different types of KMS keys. It also displays the key usage (encryption, signing, or generating and verifying MACs) and the algorithms that the KMS key supports.</p>
27/// <p>For <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">multi-Region keys</a>, <code>DescribeKey</code> displays the primary key and all related replica keys. For KMS keys in <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-cloudhsm.html">CloudHSM key stores</a>, it includes information about the key store, such as the key store ID and the CloudHSM cluster ID. For KMS keys in <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html">external key stores</a>, it includes the custom key store ID and the ID of the external key.</p>
28/// <p><code>DescribeKey</code> does not return the following information:</p>
29/// <ul>
30/// <li>
31/// <p>Aliases associated with the KMS key. To get this information, use <code>ListAliases</code>.</p></li>
32/// <li>
33/// <p>Whether automatic key rotation is enabled on the KMS key. To get this information, use <code>GetKeyRotationStatus</code>. Also, some key states prevent a KMS key from being automatically rotated. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotate-keys-how-it-works">How Automatic Key Rotation Works</a> in the <i>Key Management Service Developer Guide</i>.</p></li>
34/// <li>
35/// <p>Tags on the KMS key. To get this information, use <code>ListResourceTags</code>.</p></li>
36/// <li>
37/// <p>Key policies and grants on the KMS key. To get this information, use <code>GetKeyPolicy</code> and <code>ListGrants</code>.</p></li>
38/// </ul>
39/// <p>In general, <code>DescribeKey</code> is a non-mutating operation. It returns data about KMS keys, but doesn't change them. However, Amazon Web Services services use <code>DescribeKey</code> to create <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed keys</a> from a <i>predefined Amazon Web Services alias</i> with no key ID.</p>
40/// <p><b>Cross-account use</b>: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the <code>KeyId</code> parameter.</p>
41/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:DescribeKey</a> (key policy)</p>
42/// <p><b>Related operations:</b></p>
43/// <ul>
44/// <li>
45/// <p><code>GetKeyPolicy</code></p></li>
46/// <li>
47/// <p><code>GetKeyRotationStatus</code></p></li>
48/// <li>
49/// <p><code>ListAliases</code></p></li>
50/// <li>
51/// <p><code>ListGrants</code></p></li>
52/// <li>
53/// <p><code>ListKeys</code></p></li>
54/// <li>
55/// <p><code>ListResourceTags</code></p></li>
56/// <li>
57/// <p><code>ListRetirableGrants</code></p></li>
58/// </ul>
59/// <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>
60#[derive(::std::clone::Clone, ::std::fmt::Debug)]
61pub struct DescribeKeyFluentBuilder {
62    handle: ::std::sync::Arc<crate::client::Handle>,
63    inner: crate::operation::describe_key::builders::DescribeKeyInputBuilder,
64    config_override: ::std::option::Option<crate::config::Builder>,
65}
66impl
67    crate::client::customize::internal::CustomizableSend<
68        crate::operation::describe_key::DescribeKeyOutput,
69        crate::operation::describe_key::DescribeKeyError,
70    > for DescribeKeyFluentBuilder
71{
72    fn send(
73        self,
74        config_override: crate::config::Builder,
75    ) -> crate::client::customize::internal::BoxFuture<
76        crate::client::customize::internal::SendResult<
77            crate::operation::describe_key::DescribeKeyOutput,
78            crate::operation::describe_key::DescribeKeyError,
79        >,
80    > {
81        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
82    }
83}
84impl DescribeKeyFluentBuilder {
85    /// Creates a new `DescribeKeyFluentBuilder`.
86    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
87        Self {
88            handle,
89            inner: ::std::default::Default::default(),
90            config_override: ::std::option::Option::None,
91        }
92    }
93    /// Access the DescribeKey as a reference.
94    pub fn as_input(&self) -> &crate::operation::describe_key::builders::DescribeKeyInputBuilder {
95        &self.inner
96    }
97    /// Sends the request and returns the response.
98    ///
99    /// If an error occurs, an `SdkError` will be returned with additional details that
100    /// can be matched against.
101    ///
102    /// By default, any retryable failures will be retried twice. Retry behavior
103    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
104    /// set when configuring the client.
105    pub async fn send(
106        self,
107    ) -> ::std::result::Result<
108        crate::operation::describe_key::DescribeKeyOutput,
109        ::aws_smithy_runtime_api::client::result::SdkError<
110            crate::operation::describe_key::DescribeKeyError,
111            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
112        >,
113    > {
114        let input = self
115            .inner
116            .build()
117            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
118        let runtime_plugins = crate::operation::describe_key::DescribeKey::operation_runtime_plugins(
119            self.handle.runtime_plugins.clone(),
120            &self.handle.conf,
121            self.config_override,
122        );
123        crate::operation::describe_key::DescribeKey::orchestrate(&runtime_plugins, input).await
124    }
125
126    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
127    pub fn customize(
128        self,
129    ) -> crate::client::customize::CustomizableOperation<
130        crate::operation::describe_key::DescribeKeyOutput,
131        crate::operation::describe_key::DescribeKeyError,
132        Self,
133    > {
134        crate::client::customize::CustomizableOperation::new(self)
135    }
136    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
137        self.set_config_override(::std::option::Option::Some(config_override.into()));
138        self
139    }
140
141    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
142        self.config_override = config_override;
143        self
144    }
145    /// <p>Describes the specified KMS key.</p>
146    /// <p>If you specify a predefined Amazon Web Services alias (an Amazon Web Services alias with no key ID), KMS associates the alias with an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html##aws-managed-cmk">Amazon Web Services managed key</a> and returns its <code>KeyId</code> and <code>Arn</code> in the response.</p>
147    /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</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    /// <li>
155    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
156    /// <li>
157    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
158    /// </ul>
159    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
160    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.key_id(input.into());
162        self
163    }
164    /// <p>Describes the specified KMS key.</p>
165    /// <p>If you specify a predefined Amazon Web Services alias (an Amazon Web Services alias with no key ID), KMS associates the alias with an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html##aws-managed-cmk">Amazon Web Services managed key</a> and returns its <code>KeyId</code> and <code>Arn</code> in the response.</p>
166    /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
167    /// <p>For example:</p>
168    /// <ul>
169    /// <li>
170    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
171    /// <li>
172    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
173    /// <li>
174    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
175    /// <li>
176    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
177    /// </ul>
178    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
179    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180        self.inner = self.inner.set_key_id(input);
181        self
182    }
183    /// <p>Describes the specified KMS key.</p>
184    /// <p>If you specify a predefined Amazon Web Services alias (an Amazon Web Services alias with no key ID), KMS associates the alias with an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html##aws-managed-cmk">Amazon Web Services managed key</a> and returns its <code>KeyId</code> and <code>Arn</code> in the response.</p>
185    /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
186    /// <p>For example:</p>
187    /// <ul>
188    /// <li>
189    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
190    /// <li>
191    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
192    /// <li>
193    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
194    /// <li>
195    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
196    /// </ul>
197    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
198    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
199        self.inner.get_key_id()
200    }
201    ///
202    /// Appends an item to `GrantTokens`.
203    ///
204    /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
205    ///
206    /// <p>A list of grant tokens.</p>
207    /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
208    pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209        self.inner = self.inner.grant_tokens(input.into());
210        self
211    }
212    /// <p>A list of grant tokens.</p>
213    /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
214    pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
215        self.inner = self.inner.set_grant_tokens(input);
216        self
217    }
218    /// <p>A list of grant tokens.</p>
219    /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
220    pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
221        self.inner.get_grant_tokens()
222    }
223}