Skip to main content

aws_sdk_kms/operation/decapsulate/
_decapsulate_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 DecapsulateInput {
6    /// <p>Identifies the asymmetric ML-KEM KMS key whose public key was used to produce the encapsulated shared secret. KMS uses the private key in the specified key pair to decapsulate the shared secret.</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>The encapsulated (ciphertext) form of the shared secret to recover. This is the <code>SharedSecretCiphertextBlob</code> value that the <code>Encapsulate</code> operation returns. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
22    pub shared_secret_ciphertext_blob: ::std::option::Option<::aws_smithy_types::Blob>,
23    /// <p>Specifies the key encapsulation algorithm used to recover the shared secret. The only valid value is <code>ML_KEM</code>.</p>
24    pub encapsulation_algorithm: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>,
25    /// <p>A list of grant tokens.</p>
26    /// <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>
27    pub grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
28    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
29    /// <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>
30    pub dry_run: ::std::option::Option<bool>,
31}
32impl DecapsulateInput {
33    /// <p>Identifies the asymmetric ML-KEM KMS key whose public key was used to produce the encapsulated shared secret. KMS uses the private key in the specified key pair to decapsulate the shared secret.</p>
34    /// <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>
35    /// <p>For example:</p>
36    /// <ul>
37    /// <li>
38    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
39    /// <li>
40    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
41    /// <li>
42    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
43    /// <li>
44    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
45    /// </ul>
46    /// <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>
47    pub fn key_id(&self) -> ::std::option::Option<&str> {
48        self.key_id.as_deref()
49    }
50    /// <p>The encapsulated (ciphertext) form of the shared secret to recover. This is the <code>SharedSecretCiphertextBlob</code> value that the <code>Encapsulate</code> operation returns. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
51    pub fn shared_secret_ciphertext_blob(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
52        self.shared_secret_ciphertext_blob.as_ref()
53    }
54    /// <p>Specifies the key encapsulation algorithm used to recover the shared secret. The only valid value is <code>ML_KEM</code>.</p>
55    pub fn encapsulation_algorithm(&self) -> ::std::option::Option<&crate::types::EncapsulationAlgorithmSpec> {
56        self.encapsulation_algorithm.as_ref()
57    }
58    /// <p>A list of grant tokens.</p>
59    /// <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>
60    ///
61    /// 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()`.
62    pub fn grant_tokens(&self) -> &[::std::string::String] {
63        self.grant_tokens.as_deref().unwrap_or_default()
64    }
65    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
66    /// <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>
67    pub fn dry_run(&self) -> ::std::option::Option<bool> {
68        self.dry_run
69    }
70}
71impl DecapsulateInput {
72    /// Creates a new builder-style object to manufacture [`DecapsulateInput`](crate::operation::decapsulate::DecapsulateInput).
73    pub fn builder() -> crate::operation::decapsulate::builders::DecapsulateInputBuilder {
74        crate::operation::decapsulate::builders::DecapsulateInputBuilder::default()
75    }
76}
77
78/// A builder for [`DecapsulateInput`](crate::operation::decapsulate::DecapsulateInput).
79#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
80#[non_exhaustive]
81pub struct DecapsulateInputBuilder {
82    pub(crate) key_id: ::std::option::Option<::std::string::String>,
83    pub(crate) shared_secret_ciphertext_blob: ::std::option::Option<::aws_smithy_types::Blob>,
84    pub(crate) encapsulation_algorithm: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>,
85    pub(crate) grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
86    pub(crate) dry_run: ::std::option::Option<bool>,
87}
88impl DecapsulateInputBuilder {
89    /// <p>Identifies the asymmetric ML-KEM KMS key whose public key was used to produce the encapsulated shared secret. KMS uses the private key in the specified key pair to decapsulate the shared secret.</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    /// This field is required.
104    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.key_id = ::std::option::Option::Some(input.into());
106        self
107    }
108    /// <p>Identifies the asymmetric ML-KEM KMS key whose public key was used to produce the encapsulated shared secret. KMS uses the private key in the specified key pair to decapsulate the shared secret.</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 set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.key_id = input;
124        self
125    }
126    /// <p>Identifies the asymmetric ML-KEM KMS key whose public key was used to produce the encapsulated shared secret. KMS uses the private key in the specified key pair to decapsulate the shared secret.</p>
127    /// <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>
128    /// <p>For example:</p>
129    /// <ul>
130    /// <li>
131    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
132    /// <li>
133    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
134    /// <li>
135    /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
136    /// <li>
137    /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
138    /// </ul>
139    /// <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>
140    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
141        &self.key_id
142    }
143    /// <p>The encapsulated (ciphertext) form of the shared secret to recover. This is the <code>SharedSecretCiphertextBlob</code> value that the <code>Encapsulate</code> operation returns. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
144    /// This field is required.
145    pub fn shared_secret_ciphertext_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
146        self.shared_secret_ciphertext_blob = ::std::option::Option::Some(input);
147        self
148    }
149    /// <p>The encapsulated (ciphertext) form of the shared secret to recover. This is the <code>SharedSecretCiphertextBlob</code> value that the <code>Encapsulate</code> operation returns. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
150    pub fn set_shared_secret_ciphertext_blob(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
151        self.shared_secret_ciphertext_blob = input;
152        self
153    }
154    /// <p>The encapsulated (ciphertext) form of the shared secret to recover. This is the <code>SharedSecretCiphertextBlob</code> value that the <code>Encapsulate</code> operation returns. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
155    pub fn get_shared_secret_ciphertext_blob(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
156        &self.shared_secret_ciphertext_blob
157    }
158    /// <p>Specifies the key encapsulation algorithm used to recover the shared secret. The only valid value is <code>ML_KEM</code>.</p>
159    /// This field is required.
160    pub fn encapsulation_algorithm(mut self, input: crate::types::EncapsulationAlgorithmSpec) -> Self {
161        self.encapsulation_algorithm = ::std::option::Option::Some(input);
162        self
163    }
164    /// <p>Specifies the key encapsulation algorithm used to recover the shared secret. The only valid value is <code>ML_KEM</code>.</p>
165    pub fn set_encapsulation_algorithm(mut self, input: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>) -> Self {
166        self.encapsulation_algorithm = input;
167        self
168    }
169    /// <p>Specifies the key encapsulation algorithm used to recover the shared secret. The only valid value is <code>ML_KEM</code>.</p>
170    pub fn get_encapsulation_algorithm(&self) -> &::std::option::Option<crate::types::EncapsulationAlgorithmSpec> {
171        &self.encapsulation_algorithm
172    }
173    /// Appends an item to `grant_tokens`.
174    ///
175    /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
176    ///
177    /// <p>A list of grant tokens.</p>
178    /// <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>
179    pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
180        let mut v = self.grant_tokens.unwrap_or_default();
181        v.push(input.into());
182        self.grant_tokens = ::std::option::Option::Some(v);
183        self
184    }
185    /// <p>A list of grant tokens.</p>
186    /// <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>
187    pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
188        self.grant_tokens = input;
189        self
190    }
191    /// <p>A list of grant tokens.</p>
192    /// <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>
193    pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
194        &self.grant_tokens
195    }
196    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
197    /// <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>
198    pub fn dry_run(mut self, input: bool) -> Self {
199        self.dry_run = ::std::option::Option::Some(input);
200        self
201    }
202    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
203    /// <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>
204    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
205        self.dry_run = input;
206        self
207    }
208    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
209    /// <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>
210    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
211        &self.dry_run
212    }
213    /// Consumes the builder and constructs a [`DecapsulateInput`](crate::operation::decapsulate::DecapsulateInput).
214    pub fn build(self) -> ::std::result::Result<crate::operation::decapsulate::DecapsulateInput, ::aws_smithy_types::error::operation::BuildError> {
215        ::std::result::Result::Ok(crate::operation::decapsulate::DecapsulateInput {
216            key_id: self.key_id,
217            shared_secret_ciphertext_blob: self.shared_secret_ciphertext_blob,
218            encapsulation_algorithm: self.encapsulation_algorithm,
219            grant_tokens: self.grant_tokens,
220            dry_run: self.dry_run,
221        })
222    }
223}