aws_sdk_kms/operation/encapsulate/_encapsulate_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 EncapsulateInput {
6 /// <p>Identifies an asymmetric ML-KEM KMS key. KMS uses the public key in the specified key pair to encapsulate the shared secret. ML-KEM KMS keys have a <code>KeySpec</code> value of <code>ML_KEM_512</code>, <code>ML_KEM_768</code>, or <code>ML_KEM_1024</code> and a <code>KeyUsage</code> value of <code>ENCAPSULATE_DECAPSULATE</code>. To find the <code>KeySpec</code> and <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
7 /// <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>
8 /// <p>For example:</p>
9 /// <ul>
10 /// <li>
11 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
12 /// <li>
13 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
14 /// <li>
15 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
16 /// <li>
17 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
18 /// </ul>
19 /// <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>
20 pub key_id: ::std::option::Option<::std::string::String>,
21 /// <p>Specifies the key encapsulation algorithm used to generate the shared secret and its encapsulated form. The only valid value is <code>ML_KEM</code>.</p>
22 pub encapsulation_algorithm: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>,
23 /// <p>A list of grant tokens.</p>
24 /// <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/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
25 pub grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
26 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
27 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
28 pub dry_run: ::std::option::Option<bool>,
29}
30impl EncapsulateInput {
31 /// <p>Identifies an asymmetric ML-KEM KMS key. KMS uses the public key in the specified key pair to encapsulate the shared secret. ML-KEM KMS keys have a <code>KeySpec</code> value of <code>ML_KEM_512</code>, <code>ML_KEM_768</code>, or <code>ML_KEM_1024</code> and a <code>KeyUsage</code> value of <code>ENCAPSULATE_DECAPSULATE</code>. To find the <code>KeySpec</code> and <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
32 /// <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>
33 /// <p>For example:</p>
34 /// <ul>
35 /// <li>
36 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
37 /// <li>
38 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
39 /// <li>
40 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
41 /// <li>
42 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
43 /// </ul>
44 /// <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>
45 pub fn key_id(&self) -> ::std::option::Option<&str> {
46 self.key_id.as_deref()
47 }
48 /// <p>Specifies the key encapsulation algorithm used to generate the shared secret and its encapsulated form. The only valid value is <code>ML_KEM</code>.</p>
49 pub fn encapsulation_algorithm(&self) -> ::std::option::Option<&crate::types::EncapsulationAlgorithmSpec> {
50 self.encapsulation_algorithm.as_ref()
51 }
52 /// <p>A list of grant tokens.</p>
53 /// <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/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
54 ///
55 /// 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()`.
56 pub fn grant_tokens(&self) -> &[::std::string::String] {
57 self.grant_tokens.as_deref().unwrap_or_default()
58 }
59 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
60 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
61 pub fn dry_run(&self) -> ::std::option::Option<bool> {
62 self.dry_run
63 }
64}
65impl EncapsulateInput {
66 /// Creates a new builder-style object to manufacture [`EncapsulateInput`](crate::operation::encapsulate::EncapsulateInput).
67 pub fn builder() -> crate::operation::encapsulate::builders::EncapsulateInputBuilder {
68 crate::operation::encapsulate::builders::EncapsulateInputBuilder::default()
69 }
70}
71
72/// A builder for [`EncapsulateInput`](crate::operation::encapsulate::EncapsulateInput).
73#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
74#[non_exhaustive]
75pub struct EncapsulateInputBuilder {
76 pub(crate) key_id: ::std::option::Option<::std::string::String>,
77 pub(crate) encapsulation_algorithm: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>,
78 pub(crate) grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
79 pub(crate) dry_run: ::std::option::Option<bool>,
80}
81impl EncapsulateInputBuilder {
82 /// <p>Identifies an asymmetric ML-KEM KMS key. KMS uses the public key in the specified key pair to encapsulate the shared secret. ML-KEM KMS keys have a <code>KeySpec</code> value of <code>ML_KEM_512</code>, <code>ML_KEM_768</code>, or <code>ML_KEM_1024</code> and a <code>KeyUsage</code> value of <code>ENCAPSULATE_DECAPSULATE</code>. To find the <code>KeySpec</code> and <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
83 /// <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>
84 /// <p>For example:</p>
85 /// <ul>
86 /// <li>
87 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
88 /// <li>
89 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
90 /// <li>
91 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
92 /// <li>
93 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
94 /// </ul>
95 /// <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>
96 /// This field is required.
97 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98 self.key_id = ::std::option::Option::Some(input.into());
99 self
100 }
101 /// <p>Identifies an asymmetric ML-KEM KMS key. KMS uses the public key in the specified key pair to encapsulate the shared secret. ML-KEM KMS keys have a <code>KeySpec</code> value of <code>ML_KEM_512</code>, <code>ML_KEM_768</code>, or <code>ML_KEM_1024</code> and a <code>KeyUsage</code> value of <code>ENCAPSULATE_DECAPSULATE</code>. To find the <code>KeySpec</code> and <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
102 /// <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>
103 /// <p>For example:</p>
104 /// <ul>
105 /// <li>
106 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
107 /// <li>
108 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
109 /// <li>
110 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
111 /// <li>
112 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
113 /// </ul>
114 /// <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>
115 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116 self.key_id = input;
117 self
118 }
119 /// <p>Identifies an asymmetric ML-KEM KMS key. KMS uses the public key in the specified key pair to encapsulate the shared secret. ML-KEM KMS keys have a <code>KeySpec</code> value of <code>ML_KEM_512</code>, <code>ML_KEM_768</code>, or <code>ML_KEM_1024</code> and a <code>KeyUsage</code> value of <code>ENCAPSULATE_DECAPSULATE</code>. To find the <code>KeySpec</code> and <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
120 /// <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>
121 /// <p>For example:</p>
122 /// <ul>
123 /// <li>
124 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
125 /// <li>
126 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
127 /// <li>
128 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
129 /// <li>
130 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
131 /// </ul>
132 /// <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>
133 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
134 &self.key_id
135 }
136 /// <p>Specifies the key encapsulation algorithm used to generate the shared secret and its encapsulated form. The only valid value is <code>ML_KEM</code>.</p>
137 /// This field is required.
138 pub fn encapsulation_algorithm(mut self, input: crate::types::EncapsulationAlgorithmSpec) -> Self {
139 self.encapsulation_algorithm = ::std::option::Option::Some(input);
140 self
141 }
142 /// <p>Specifies the key encapsulation algorithm used to generate the shared secret and its encapsulated form. The only valid value is <code>ML_KEM</code>.</p>
143 pub fn set_encapsulation_algorithm(mut self, input: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>) -> Self {
144 self.encapsulation_algorithm = input;
145 self
146 }
147 /// <p>Specifies the key encapsulation algorithm used to generate the shared secret and its encapsulated form. The only valid value is <code>ML_KEM</code>.</p>
148 pub fn get_encapsulation_algorithm(&self) -> &::std::option::Option<crate::types::EncapsulationAlgorithmSpec> {
149 &self.encapsulation_algorithm
150 }
151 /// Appends an item to `grant_tokens`.
152 ///
153 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
154 ///
155 /// <p>A list of grant tokens.</p>
156 /// <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/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
157 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158 let mut v = self.grant_tokens.unwrap_or_default();
159 v.push(input.into());
160 self.grant_tokens = ::std::option::Option::Some(v);
161 self
162 }
163 /// <p>A list of grant tokens.</p>
164 /// <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/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
165 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
166 self.grant_tokens = input;
167 self
168 }
169 /// <p>A list of grant tokens.</p>
170 /// <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/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
171 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
172 &self.grant_tokens
173 }
174 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
175 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
176 pub fn dry_run(mut self, input: bool) -> Self {
177 self.dry_run = ::std::option::Option::Some(input);
178 self
179 }
180 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
181 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
182 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
183 self.dry_run = input;
184 self
185 }
186 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
187 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
188 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
189 &self.dry_run
190 }
191 /// Consumes the builder and constructs a [`EncapsulateInput`](crate::operation::encapsulate::EncapsulateInput).
192 pub fn build(self) -> ::std::result::Result<crate::operation::encapsulate::EncapsulateInput, ::aws_smithy_types::error::operation::BuildError> {
193 ::std::result::Result::Ok(crate::operation::encapsulate::EncapsulateInput {
194 key_id: self.key_id,
195 encapsulation_algorithm: self.encapsulation_algorithm,
196 grant_tokens: self.grant_tokens,
197 dry_run: self.dry_run,
198 })
199 }
200}