aws_sdk_kms/operation/import_key_material/
_import_key_material_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 ImportKeyMaterialInput {
6    /// <p>The identifier of the KMS key that will be associated with the imported key material. This must be the same KMS key specified in the <code>KeyID</code> parameter of the corresponding <code>GetParametersForImport</code> request. The <code>Origin</code> of the KMS key must be <code>EXTERNAL</code> and its <code>KeyState</code> must be <code>PendingImport</code>.</p>
7    /// <p>The KMS key can be a symmetric encryption KMS key, HMAC KMS key, asymmetric encryption KMS key, or asymmetric signing KMS key, including a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">multi-Region key</a> of any supported type. You cannot perform this operation on a KMS key in a custom key store, or on a KMS key in a different Amazon Web Services account.</p>
8    /// <p>Specify the key ID or key ARN of the KMS key.</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    /// </ul>
16    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
17    pub key_id: ::std::option::Option<::std::string::String>,
18    /// <p>The import token that you received in the response to a previous <code>GetParametersForImport</code> request. It must be from the same response that contained the public key that you used to encrypt the key material.</p>
19    pub import_token: ::std::option::Option<::aws_smithy_types::Blob>,
20    /// <p>The encrypted key material to import. The key material must be encrypted under the public wrapping key that <code>GetParametersForImport</code> returned, using the wrapping algorithm that you specified in the same <code>GetParametersForImport</code> request.</p>
21    pub encrypted_key_material: ::std::option::Option<::aws_smithy_types::Blob>,
22    /// <p>The date and time when the imported key material expires. This parameter is required when the value of the <code>ExpirationModel</code> parameter is <code>KEY_MATERIAL_EXPIRES</code>. Otherwise it is not valid.</p>
23    /// <p>The value of this parameter must be a future date and time. The maximum value is 365 days from the request date.</p>
24    /// <p>When the key material expires, KMS deletes the key material from the KMS key. Without its key material, the KMS key is unusable. To use the KMS key in cryptographic operations, you must reimport the same key material.</p>
25    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must delete (<code>DeleteImportedKeyMaterial</code>) and reimport the key material.</p>
26    pub valid_to: ::std::option::Option<::aws_smithy_types::DateTime>,
27    /// <p>Specifies whether the key material expires. The default is <code>KEY_MATERIAL_EXPIRES</code>. For help with this choice, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-import-key-material.html#importing-keys-expiration">Setting an expiration time</a> in the <i>Key Management Service Developer Guide</i>.</p>
28    /// <p>When the value of <code>ExpirationModel</code> is <code>KEY_MATERIAL_EXPIRES</code>, you must specify a value for the <code>ValidTo</code> parameter. When value is <code>KEY_MATERIAL_DOES_NOT_EXPIRE</code>, you must omit the <code>ValidTo</code> parameter.</p>
29    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must reimport the key material.</p>
30    pub expiration_model: ::std::option::Option<crate::types::ExpirationModelType>,
31    /// <p>Indicates whether the key material being imported is previously associated with this KMS key or not. This parameter is optional and only usable with symmetric encryption keys. If no key material has ever been imported into the KMS key, and this parameter is omitted, the parameter defaults to <code>NEW_KEY_MATERIAL</code>. After the first key material is imported, if this parameter is omitted then the parameter defaults to <code>EXISTING_KEY_MATERIAL</code>.</p>
32    pub import_type: ::std::option::Option<crate::types::ImportType>,
33    /// <p>Description for the key material being imported. This parameter is optional and only usable with symmetric encryption keys. If you do not specify a key material description, KMS retains the value you specified when you last imported the same key material into this KMS key.</p>
34    pub key_material_description: ::std::option::Option<::std::string::String>,
35    /// <p>Identifies the key material being imported. This parameter is optional and only usable with symmetric encryption keys. You cannot specify a key material ID with <code>ImportType</code> set to <code>NEW_KEY_MATERIAL</code>. Whenever you import key material into a symmetric encryption key, KMS assigns a unique identifier to the key material based on the KMS key ID and the imported key material. When you re-import key material with a specified key material ID, KMS:</p>
36    /// <ul>
37    /// <li>
38    /// <p>Computes the identifier for the key material</p></li>
39    /// <li>
40    /// <p>Matches the computed identifier against the specified key material ID</p></li>
41    /// <li>
42    /// <p>Verifies that the key material ID is already associated with the KMS key</p></li>
43    /// </ul>
44    /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
45    pub key_material_id: ::std::option::Option<::std::string::String>,
46}
47impl ImportKeyMaterialInput {
48    /// <p>The identifier of the KMS key that will be associated with the imported key material. This must be the same KMS key specified in the <code>KeyID</code> parameter of the corresponding <code>GetParametersForImport</code> request. The <code>Origin</code> of the KMS key must be <code>EXTERNAL</code> and its <code>KeyState</code> must be <code>PendingImport</code>.</p>
49    /// <p>The KMS key can be a symmetric encryption KMS key, HMAC KMS key, asymmetric encryption KMS key, or asymmetric signing KMS key, including a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">multi-Region key</a> of any supported type. You cannot perform this operation on a KMS key in a custom key store, or on a KMS key in a different Amazon Web Services account.</p>
50    /// <p>Specify the key ID or key ARN of the KMS key.</p>
51    /// <p>For example:</p>
52    /// <ul>
53    /// <li>
54    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
55    /// <li>
56    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
57    /// </ul>
58    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
59    pub fn key_id(&self) -> ::std::option::Option<&str> {
60        self.key_id.as_deref()
61    }
62    /// <p>The import token that you received in the response to a previous <code>GetParametersForImport</code> request. It must be from the same response that contained the public key that you used to encrypt the key material.</p>
63    pub fn import_token(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
64        self.import_token.as_ref()
65    }
66    /// <p>The encrypted key material to import. The key material must be encrypted under the public wrapping key that <code>GetParametersForImport</code> returned, using the wrapping algorithm that you specified in the same <code>GetParametersForImport</code> request.</p>
67    pub fn encrypted_key_material(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
68        self.encrypted_key_material.as_ref()
69    }
70    /// <p>The date and time when the imported key material expires. This parameter is required when the value of the <code>ExpirationModel</code> parameter is <code>KEY_MATERIAL_EXPIRES</code>. Otherwise it is not valid.</p>
71    /// <p>The value of this parameter must be a future date and time. The maximum value is 365 days from the request date.</p>
72    /// <p>When the key material expires, KMS deletes the key material from the KMS key. Without its key material, the KMS key is unusable. To use the KMS key in cryptographic operations, you must reimport the same key material.</p>
73    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must delete (<code>DeleteImportedKeyMaterial</code>) and reimport the key material.</p>
74    pub fn valid_to(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
75        self.valid_to.as_ref()
76    }
77    /// <p>Specifies whether the key material expires. The default is <code>KEY_MATERIAL_EXPIRES</code>. For help with this choice, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-import-key-material.html#importing-keys-expiration">Setting an expiration time</a> in the <i>Key Management Service Developer Guide</i>.</p>
78    /// <p>When the value of <code>ExpirationModel</code> is <code>KEY_MATERIAL_EXPIRES</code>, you must specify a value for the <code>ValidTo</code> parameter. When value is <code>KEY_MATERIAL_DOES_NOT_EXPIRE</code>, you must omit the <code>ValidTo</code> parameter.</p>
79    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must reimport the key material.</p>
80    pub fn expiration_model(&self) -> ::std::option::Option<&crate::types::ExpirationModelType> {
81        self.expiration_model.as_ref()
82    }
83    /// <p>Indicates whether the key material being imported is previously associated with this KMS key or not. This parameter is optional and only usable with symmetric encryption keys. If no key material has ever been imported into the KMS key, and this parameter is omitted, the parameter defaults to <code>NEW_KEY_MATERIAL</code>. After the first key material is imported, if this parameter is omitted then the parameter defaults to <code>EXISTING_KEY_MATERIAL</code>.</p>
84    pub fn import_type(&self) -> ::std::option::Option<&crate::types::ImportType> {
85        self.import_type.as_ref()
86    }
87    /// <p>Description for the key material being imported. This parameter is optional and only usable with symmetric encryption keys. If you do not specify a key material description, KMS retains the value you specified when you last imported the same key material into this KMS key.</p>
88    pub fn key_material_description(&self) -> ::std::option::Option<&str> {
89        self.key_material_description.as_deref()
90    }
91    /// <p>Identifies the key material being imported. This parameter is optional and only usable with symmetric encryption keys. You cannot specify a key material ID with <code>ImportType</code> set to <code>NEW_KEY_MATERIAL</code>. Whenever you import key material into a symmetric encryption key, KMS assigns a unique identifier to the key material based on the KMS key ID and the imported key material. When you re-import key material with a specified key material ID, KMS:</p>
92    /// <ul>
93    /// <li>
94    /// <p>Computes the identifier for the key material</p></li>
95    /// <li>
96    /// <p>Matches the computed identifier against the specified key material ID</p></li>
97    /// <li>
98    /// <p>Verifies that the key material ID is already associated with the KMS key</p></li>
99    /// </ul>
100    /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
101    pub fn key_material_id(&self) -> ::std::option::Option<&str> {
102        self.key_material_id.as_deref()
103    }
104}
105impl ImportKeyMaterialInput {
106    /// Creates a new builder-style object to manufacture [`ImportKeyMaterialInput`](crate::operation::import_key_material::ImportKeyMaterialInput).
107    pub fn builder() -> crate::operation::import_key_material::builders::ImportKeyMaterialInputBuilder {
108        crate::operation::import_key_material::builders::ImportKeyMaterialInputBuilder::default()
109    }
110}
111
112/// A builder for [`ImportKeyMaterialInput`](crate::operation::import_key_material::ImportKeyMaterialInput).
113#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
114#[non_exhaustive]
115pub struct ImportKeyMaterialInputBuilder {
116    pub(crate) key_id: ::std::option::Option<::std::string::String>,
117    pub(crate) import_token: ::std::option::Option<::aws_smithy_types::Blob>,
118    pub(crate) encrypted_key_material: ::std::option::Option<::aws_smithy_types::Blob>,
119    pub(crate) valid_to: ::std::option::Option<::aws_smithy_types::DateTime>,
120    pub(crate) expiration_model: ::std::option::Option<crate::types::ExpirationModelType>,
121    pub(crate) import_type: ::std::option::Option<crate::types::ImportType>,
122    pub(crate) key_material_description: ::std::option::Option<::std::string::String>,
123    pub(crate) key_material_id: ::std::option::Option<::std::string::String>,
124}
125impl ImportKeyMaterialInputBuilder {
126    /// <p>The identifier of the KMS key that will be associated with the imported key material. This must be the same KMS key specified in the <code>KeyID</code> parameter of the corresponding <code>GetParametersForImport</code> request. The <code>Origin</code> of the KMS key must be <code>EXTERNAL</code> and its <code>KeyState</code> must be <code>PendingImport</code>.</p>
127    /// <p>The KMS key can be a symmetric encryption KMS key, HMAC KMS key, asymmetric encryption KMS key, or asymmetric signing KMS key, including a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">multi-Region key</a> of any supported type. You cannot perform this operation on a KMS key in a custom key store, or on a KMS key in a different Amazon Web Services account.</p>
128    /// <p>Specify the key ID or key ARN of the KMS key.</p>
129    /// <p>For example:</p>
130    /// <ul>
131    /// <li>
132    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
133    /// <li>
134    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
135    /// </ul>
136    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
137    /// This field is required.
138    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.key_id = ::std::option::Option::Some(input.into());
140        self
141    }
142    /// <p>The identifier of the KMS key that will be associated with the imported key material. This must be the same KMS key specified in the <code>KeyID</code> parameter of the corresponding <code>GetParametersForImport</code> request. The <code>Origin</code> of the KMS key must be <code>EXTERNAL</code> and its <code>KeyState</code> must be <code>PendingImport</code>.</p>
143    /// <p>The KMS key can be a symmetric encryption KMS key, HMAC KMS key, asymmetric encryption KMS key, or asymmetric signing KMS key, including a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">multi-Region key</a> of any supported type. You cannot perform this operation on a KMS key in a custom key store, or on a KMS key in a different Amazon Web Services account.</p>
144    /// <p>Specify the key ID or key ARN of the KMS key.</p>
145    /// <p>For example:</p>
146    /// <ul>
147    /// <li>
148    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
149    /// <li>
150    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
151    /// </ul>
152    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
153    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.key_id = input;
155        self
156    }
157    /// <p>The identifier of the KMS key that will be associated with the imported key material. This must be the same KMS key specified in the <code>KeyID</code> parameter of the corresponding <code>GetParametersForImport</code> request. The <code>Origin</code> of the KMS key must be <code>EXTERNAL</code> and its <code>KeyState</code> must be <code>PendingImport</code>.</p>
158    /// <p>The KMS key can be a symmetric encryption KMS key, HMAC KMS key, asymmetric encryption KMS key, or asymmetric signing KMS key, including a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">multi-Region key</a> of any supported type. You cannot perform this operation on a KMS key in a custom key store, or on a KMS key in a different Amazon Web Services account.</p>
159    /// <p>Specify the key ID or key ARN of the KMS key.</p>
160    /// <p>For example:</p>
161    /// <ul>
162    /// <li>
163    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
164    /// <li>
165    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
166    /// </ul>
167    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
168    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
169        &self.key_id
170    }
171    /// <p>The import token that you received in the response to a previous <code>GetParametersForImport</code> request. It must be from the same response that contained the public key that you used to encrypt the key material.</p>
172    /// This field is required.
173    pub fn import_token(mut self, input: ::aws_smithy_types::Blob) -> Self {
174        self.import_token = ::std::option::Option::Some(input);
175        self
176    }
177    /// <p>The import token that you received in the response to a previous <code>GetParametersForImport</code> request. It must be from the same response that contained the public key that you used to encrypt the key material.</p>
178    pub fn set_import_token(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
179        self.import_token = input;
180        self
181    }
182    /// <p>The import token that you received in the response to a previous <code>GetParametersForImport</code> request. It must be from the same response that contained the public key that you used to encrypt the key material.</p>
183    pub fn get_import_token(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
184        &self.import_token
185    }
186    /// <p>The encrypted key material to import. The key material must be encrypted under the public wrapping key that <code>GetParametersForImport</code> returned, using the wrapping algorithm that you specified in the same <code>GetParametersForImport</code> request.</p>
187    /// This field is required.
188    pub fn encrypted_key_material(mut self, input: ::aws_smithy_types::Blob) -> Self {
189        self.encrypted_key_material = ::std::option::Option::Some(input);
190        self
191    }
192    /// <p>The encrypted key material to import. The key material must be encrypted under the public wrapping key that <code>GetParametersForImport</code> returned, using the wrapping algorithm that you specified in the same <code>GetParametersForImport</code> request.</p>
193    pub fn set_encrypted_key_material(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
194        self.encrypted_key_material = input;
195        self
196    }
197    /// <p>The encrypted key material to import. The key material must be encrypted under the public wrapping key that <code>GetParametersForImport</code> returned, using the wrapping algorithm that you specified in the same <code>GetParametersForImport</code> request.</p>
198    pub fn get_encrypted_key_material(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
199        &self.encrypted_key_material
200    }
201    /// <p>The date and time when the imported key material expires. This parameter is required when the value of the <code>ExpirationModel</code> parameter is <code>KEY_MATERIAL_EXPIRES</code>. Otherwise it is not valid.</p>
202    /// <p>The value of this parameter must be a future date and time. The maximum value is 365 days from the request date.</p>
203    /// <p>When the key material expires, KMS deletes the key material from the KMS key. Without its key material, the KMS key is unusable. To use the KMS key in cryptographic operations, you must reimport the same key material.</p>
204    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must delete (<code>DeleteImportedKeyMaterial</code>) and reimport the key material.</p>
205    pub fn valid_to(mut self, input: ::aws_smithy_types::DateTime) -> Self {
206        self.valid_to = ::std::option::Option::Some(input);
207        self
208    }
209    /// <p>The date and time when the imported key material expires. This parameter is required when the value of the <code>ExpirationModel</code> parameter is <code>KEY_MATERIAL_EXPIRES</code>. Otherwise it is not valid.</p>
210    /// <p>The value of this parameter must be a future date and time. The maximum value is 365 days from the request date.</p>
211    /// <p>When the key material expires, KMS deletes the key material from the KMS key. Without its key material, the KMS key is unusable. To use the KMS key in cryptographic operations, you must reimport the same key material.</p>
212    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must delete (<code>DeleteImportedKeyMaterial</code>) and reimport the key material.</p>
213    pub fn set_valid_to(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
214        self.valid_to = input;
215        self
216    }
217    /// <p>The date and time when the imported key material expires. This parameter is required when the value of the <code>ExpirationModel</code> parameter is <code>KEY_MATERIAL_EXPIRES</code>. Otherwise it is not valid.</p>
218    /// <p>The value of this parameter must be a future date and time. The maximum value is 365 days from the request date.</p>
219    /// <p>When the key material expires, KMS deletes the key material from the KMS key. Without its key material, the KMS key is unusable. To use the KMS key in cryptographic operations, you must reimport the same key material.</p>
220    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must delete (<code>DeleteImportedKeyMaterial</code>) and reimport the key material.</p>
221    pub fn get_valid_to(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
222        &self.valid_to
223    }
224    /// <p>Specifies whether the key material expires. The default is <code>KEY_MATERIAL_EXPIRES</code>. For help with this choice, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-import-key-material.html#importing-keys-expiration">Setting an expiration time</a> in the <i>Key Management Service Developer Guide</i>.</p>
225    /// <p>When the value of <code>ExpirationModel</code> is <code>KEY_MATERIAL_EXPIRES</code>, you must specify a value for the <code>ValidTo</code> parameter. When value is <code>KEY_MATERIAL_DOES_NOT_EXPIRE</code>, you must omit the <code>ValidTo</code> parameter.</p>
226    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must reimport the key material.</p>
227    pub fn expiration_model(mut self, input: crate::types::ExpirationModelType) -> Self {
228        self.expiration_model = ::std::option::Option::Some(input);
229        self
230    }
231    /// <p>Specifies whether the key material expires. The default is <code>KEY_MATERIAL_EXPIRES</code>. For help with this choice, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-import-key-material.html#importing-keys-expiration">Setting an expiration time</a> in the <i>Key Management Service Developer Guide</i>.</p>
232    /// <p>When the value of <code>ExpirationModel</code> is <code>KEY_MATERIAL_EXPIRES</code>, you must specify a value for the <code>ValidTo</code> parameter. When value is <code>KEY_MATERIAL_DOES_NOT_EXPIRE</code>, you must omit the <code>ValidTo</code> parameter.</p>
233    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must reimport the key material.</p>
234    pub fn set_expiration_model(mut self, input: ::std::option::Option<crate::types::ExpirationModelType>) -> Self {
235        self.expiration_model = input;
236        self
237    }
238    /// <p>Specifies whether the key material expires. The default is <code>KEY_MATERIAL_EXPIRES</code>. For help with this choice, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-import-key-material.html#importing-keys-expiration">Setting an expiration time</a> in the <i>Key Management Service Developer Guide</i>.</p>
239    /// <p>When the value of <code>ExpirationModel</code> is <code>KEY_MATERIAL_EXPIRES</code>, you must specify a value for the <code>ValidTo</code> parameter. When value is <code>KEY_MATERIAL_DOES_NOT_EXPIRE</code>, you must omit the <code>ValidTo</code> parameter.</p>
240    /// <p>You cannot change the <code>ExpirationModel</code> or <code>ValidTo</code> values for the current import after the request completes. To change either value, you must reimport the key material.</p>
241    pub fn get_expiration_model(&self) -> &::std::option::Option<crate::types::ExpirationModelType> {
242        &self.expiration_model
243    }
244    /// <p>Indicates whether the key material being imported is previously associated with this KMS key or not. This parameter is optional and only usable with symmetric encryption keys. If no key material has ever been imported into the KMS key, and this parameter is omitted, the parameter defaults to <code>NEW_KEY_MATERIAL</code>. After the first key material is imported, if this parameter is omitted then the parameter defaults to <code>EXISTING_KEY_MATERIAL</code>.</p>
245    pub fn import_type(mut self, input: crate::types::ImportType) -> Self {
246        self.import_type = ::std::option::Option::Some(input);
247        self
248    }
249    /// <p>Indicates whether the key material being imported is previously associated with this KMS key or not. This parameter is optional and only usable with symmetric encryption keys. If no key material has ever been imported into the KMS key, and this parameter is omitted, the parameter defaults to <code>NEW_KEY_MATERIAL</code>. After the first key material is imported, if this parameter is omitted then the parameter defaults to <code>EXISTING_KEY_MATERIAL</code>.</p>
250    pub fn set_import_type(mut self, input: ::std::option::Option<crate::types::ImportType>) -> Self {
251        self.import_type = input;
252        self
253    }
254    /// <p>Indicates whether the key material being imported is previously associated with this KMS key or not. This parameter is optional and only usable with symmetric encryption keys. If no key material has ever been imported into the KMS key, and this parameter is omitted, the parameter defaults to <code>NEW_KEY_MATERIAL</code>. After the first key material is imported, if this parameter is omitted then the parameter defaults to <code>EXISTING_KEY_MATERIAL</code>.</p>
255    pub fn get_import_type(&self) -> &::std::option::Option<crate::types::ImportType> {
256        &self.import_type
257    }
258    /// <p>Description for the key material being imported. This parameter is optional and only usable with symmetric encryption keys. If you do not specify a key material description, KMS retains the value you specified when you last imported the same key material into this KMS key.</p>
259    pub fn key_material_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
260        self.key_material_description = ::std::option::Option::Some(input.into());
261        self
262    }
263    /// <p>Description for the key material being imported. This parameter is optional and only usable with symmetric encryption keys. If you do not specify a key material description, KMS retains the value you specified when you last imported the same key material into this KMS key.</p>
264    pub fn set_key_material_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
265        self.key_material_description = input;
266        self
267    }
268    /// <p>Description for the key material being imported. This parameter is optional and only usable with symmetric encryption keys. If you do not specify a key material description, KMS retains the value you specified when you last imported the same key material into this KMS key.</p>
269    pub fn get_key_material_description(&self) -> &::std::option::Option<::std::string::String> {
270        &self.key_material_description
271    }
272    /// <p>Identifies the key material being imported. This parameter is optional and only usable with symmetric encryption keys. You cannot specify a key material ID with <code>ImportType</code> set to <code>NEW_KEY_MATERIAL</code>. Whenever you import key material into a symmetric encryption key, KMS assigns a unique identifier to the key material based on the KMS key ID and the imported key material. When you re-import key material with a specified key material ID, KMS:</p>
273    /// <ul>
274    /// <li>
275    /// <p>Computes the identifier for the key material</p></li>
276    /// <li>
277    /// <p>Matches the computed identifier against the specified key material ID</p></li>
278    /// <li>
279    /// <p>Verifies that the key material ID is already associated with the KMS key</p></li>
280    /// </ul>
281    /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
282    pub fn key_material_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
283        self.key_material_id = ::std::option::Option::Some(input.into());
284        self
285    }
286    /// <p>Identifies the key material being imported. This parameter is optional and only usable with symmetric encryption keys. You cannot specify a key material ID with <code>ImportType</code> set to <code>NEW_KEY_MATERIAL</code>. Whenever you import key material into a symmetric encryption key, KMS assigns a unique identifier to the key material based on the KMS key ID and the imported key material. When you re-import key material with a specified key material ID, KMS:</p>
287    /// <ul>
288    /// <li>
289    /// <p>Computes the identifier for the key material</p></li>
290    /// <li>
291    /// <p>Matches the computed identifier against the specified key material ID</p></li>
292    /// <li>
293    /// <p>Verifies that the key material ID is already associated with the KMS key</p></li>
294    /// </ul>
295    /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
296    pub fn set_key_material_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
297        self.key_material_id = input;
298        self
299    }
300    /// <p>Identifies the key material being imported. This parameter is optional and only usable with symmetric encryption keys. You cannot specify a key material ID with <code>ImportType</code> set to <code>NEW_KEY_MATERIAL</code>. Whenever you import key material into a symmetric encryption key, KMS assigns a unique identifier to the key material based on the KMS key ID and the imported key material. When you re-import key material with a specified key material ID, KMS:</p>
301    /// <ul>
302    /// <li>
303    /// <p>Computes the identifier for the key material</p></li>
304    /// <li>
305    /// <p>Matches the computed identifier against the specified key material ID</p></li>
306    /// <li>
307    /// <p>Verifies that the key material ID is already associated with the KMS key</p></li>
308    /// </ul>
309    /// <p>To get the list of key material IDs associated with a KMS key, use <code>ListKeyRotations</code>.</p>
310    pub fn get_key_material_id(&self) -> &::std::option::Option<::std::string::String> {
311        &self.key_material_id
312    }
313    /// Consumes the builder and constructs a [`ImportKeyMaterialInput`](crate::operation::import_key_material::ImportKeyMaterialInput).
314    pub fn build(
315        self,
316    ) -> ::std::result::Result<crate::operation::import_key_material::ImportKeyMaterialInput, ::aws_smithy_types::error::operation::BuildError> {
317        ::std::result::Result::Ok(crate::operation::import_key_material::ImportKeyMaterialInput {
318            key_id: self.key_id,
319            import_token: self.import_token,
320            encrypted_key_material: self.encrypted_key_material,
321            valid_to: self.valid_to,
322            expiration_model: self.expiration_model,
323            import_type: self.import_type,
324            key_material_description: self.key_material_description,
325            key_material_id: self.key_material_id,
326        })
327    }
328}