aws_sdk_kms/operation/describe_key/_describe_key_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct DescribeKeyInput {
6 /// <p>Describes the specified KMS key.</p>
7 /// <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>
8 /// <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>
9 /// <p>For example:</p>
10 /// <ul>
11 /// <li>
12 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
13 /// <li>
14 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
15 /// <li>
16 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
17 /// <li>
18 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
19 /// </ul>
20 /// <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>
21 pub key_id: ::std::option::Option<::std::string::String>,
22 /// <p>A list of grant tokens.</p>
23 /// <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>
24 pub grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
25}
26impl DescribeKeyInput {
27 /// <p>Describes the specified KMS key.</p>
28 /// <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>
29 /// <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>
30 /// <p>For example:</p>
31 /// <ul>
32 /// <li>
33 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
34 /// <li>
35 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
36 /// <li>
37 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
38 /// <li>
39 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
40 /// </ul>
41 /// <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>
42 pub fn key_id(&self) -> ::std::option::Option<&str> {
43 self.key_id.as_deref()
44 }
45 /// <p>A list of grant tokens.</p>
46 /// <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>
47 ///
48 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.grant_tokens.is_none()`.
49 pub fn grant_tokens(&self) -> &[::std::string::String] {
50 self.grant_tokens.as_deref().unwrap_or_default()
51 }
52}
53impl DescribeKeyInput {
54 /// Creates a new builder-style object to manufacture [`DescribeKeyInput`](crate::operation::describe_key::DescribeKeyInput).
55 pub fn builder() -> crate::operation::describe_key::builders::DescribeKeyInputBuilder {
56 crate::operation::describe_key::builders::DescribeKeyInputBuilder::default()
57 }
58}
59
60/// A builder for [`DescribeKeyInput`](crate::operation::describe_key::DescribeKeyInput).
61#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
62#[non_exhaustive]
63pub struct DescribeKeyInputBuilder {
64 pub(crate) key_id: ::std::option::Option<::std::string::String>,
65 pub(crate) grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
66}
67impl DescribeKeyInputBuilder {
68 /// <p>Describes the specified KMS key.</p>
69 /// <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>
70 /// <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>
71 /// <p>For example:</p>
72 /// <ul>
73 /// <li>
74 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
75 /// <li>
76 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
77 /// <li>
78 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
79 /// <li>
80 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
81 /// </ul>
82 /// <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>
83 /// This field is required.
84 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
85 self.key_id = ::std::option::Option::Some(input.into());
86 self
87 }
88 /// <p>Describes the specified KMS key.</p>
89 /// <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>
90 /// <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>
91 /// <p>For example:</p>
92 /// <ul>
93 /// <li>
94 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
95 /// <li>
96 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
97 /// <li>
98 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
99 /// <li>
100 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
101 /// </ul>
102 /// <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>
103 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104 self.key_id = input;
105 self
106 }
107 /// <p>Describes the specified KMS key.</p>
108 /// <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>
109 /// <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>
110 /// <p>For example:</p>
111 /// <ul>
112 /// <li>
113 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
114 /// <li>
115 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
116 /// <li>
117 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
118 /// <li>
119 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
120 /// </ul>
121 /// <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>
122 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
123 &self.key_id
124 }
125 /// Appends an item to `grant_tokens`.
126 ///
127 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
128 ///
129 /// <p>A list of grant tokens.</p>
130 /// <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>
131 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132 let mut v = self.grant_tokens.unwrap_or_default();
133 v.push(input.into());
134 self.grant_tokens = ::std::option::Option::Some(v);
135 self
136 }
137 /// <p>A list of grant tokens.</p>
138 /// <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>
139 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
140 self.grant_tokens = input;
141 self
142 }
143 /// <p>A list of grant tokens.</p>
144 /// <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>
145 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
146 &self.grant_tokens
147 }
148 /// Consumes the builder and constructs a [`DescribeKeyInput`](crate::operation::describe_key::DescribeKeyInput).
149 pub fn build(self) -> ::std::result::Result<crate::operation::describe_key::DescribeKeyInput, ::aws_smithy_types::error::operation::BuildError> {
150 ::std::result::Result::Ok(crate::operation::describe_key::DescribeKeyInput {
151 key_id: self.key_id,
152 grant_tokens: self.grant_tokens,
153 })
154 }
155}