aws_sdk_paymentcryptography/operation/create_key/_create_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 CreateKeyInput {
6 /// <p>The role of the key, the algorithm it supports, and the cryptographic operations allowed with the key. This data is immutable after the key is created.</p>
7 pub key_attributes: ::std::option::Option<crate::types::KeyAttributes>,
8 /// <p>The algorithm that Amazon Web Services Payment Cryptography uses to calculate the key check value (KCV). It is used to validate the key integrity.</p>
9 /// <p>For TDES keys, the KCV is computed by encrypting 8 bytes, each with value of zero, with the key to be checked and retaining the 3 highest order bytes of the encrypted result. For AES keys, the KCV is computed using a CMAC algorithm where the input data is 16 bytes of zero and retaining the 3 highest order bytes of the encrypted result.</p>
10 pub key_check_value_algorithm: ::std::option::Option<crate::types::KeyCheckValueAlgorithm>,
11 /// <p>Specifies whether the key is exportable from the service.</p>
12 pub exportable: ::std::option::Option<bool>,
13 /// <p>Specifies whether to enable the key. If the key is enabled, it is activated for use within the service. If the key is not enabled, then it is created but not activated. The default value is enabled.</p>
14 pub enabled: ::std::option::Option<bool>,
15 /// <p>Assigns one or more tags to the Amazon Web Services Payment Cryptography key. Use this parameter to tag a key when it is created. To tag an existing Amazon Web Services Payment Cryptography key, use the <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
16 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You can't have more than one tag on an Amazon Web Services Payment Cryptography key with the same tag key.</p><important>
17 /// <p>Don't include personal, confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
18 /// </important> <note>
19 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
20 /// </note>
21 pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
22 /// <p>The intended cryptographic usage of keys derived from the ECC key pair to be created.</p>
23 /// <p>After creating an ECC key pair, you cannot change the intended cryptographic usage of keys derived from it using ECDH.</p>
24 pub derive_key_usage: ::std::option::Option<crate::types::DeriveKeyUsage>,
25 /// <p>A list of Amazon Web Services Regions for key replication operations.</p>
26 /// <p>Each region in the list must be a valid Amazon Web Services Region identifier where Amazon Web Services Payment Cryptography is available. This list is used to specify which regions should be added to or removed from a key's replication configuration.</p>
27 pub replication_regions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
28}
29impl CreateKeyInput {
30 /// <p>The role of the key, the algorithm it supports, and the cryptographic operations allowed with the key. This data is immutable after the key is created.</p>
31 pub fn key_attributes(&self) -> ::std::option::Option<&crate::types::KeyAttributes> {
32 self.key_attributes.as_ref()
33 }
34 /// <p>The algorithm that Amazon Web Services Payment Cryptography uses to calculate the key check value (KCV). It is used to validate the key integrity.</p>
35 /// <p>For TDES keys, the KCV is computed by encrypting 8 bytes, each with value of zero, with the key to be checked and retaining the 3 highest order bytes of the encrypted result. For AES keys, the KCV is computed using a CMAC algorithm where the input data is 16 bytes of zero and retaining the 3 highest order bytes of the encrypted result.</p>
36 pub fn key_check_value_algorithm(&self) -> ::std::option::Option<&crate::types::KeyCheckValueAlgorithm> {
37 self.key_check_value_algorithm.as_ref()
38 }
39 /// <p>Specifies whether the key is exportable from the service.</p>
40 pub fn exportable(&self) -> ::std::option::Option<bool> {
41 self.exportable
42 }
43 /// <p>Specifies whether to enable the key. If the key is enabled, it is activated for use within the service. If the key is not enabled, then it is created but not activated. The default value is enabled.</p>
44 pub fn enabled(&self) -> ::std::option::Option<bool> {
45 self.enabled
46 }
47 /// <p>Assigns one or more tags to the Amazon Web Services Payment Cryptography key. Use this parameter to tag a key when it is created. To tag an existing Amazon Web Services Payment Cryptography key, use the <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
48 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You can't have more than one tag on an Amazon Web Services Payment Cryptography key with the same tag key.</p><important>
49 /// <p>Don't include personal, confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
50 /// </important> <note>
51 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
52 /// </note>
53 ///
54 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
55 pub fn tags(&self) -> &[crate::types::Tag] {
56 self.tags.as_deref().unwrap_or_default()
57 }
58 /// <p>The intended cryptographic usage of keys derived from the ECC key pair to be created.</p>
59 /// <p>After creating an ECC key pair, you cannot change the intended cryptographic usage of keys derived from it using ECDH.</p>
60 pub fn derive_key_usage(&self) -> ::std::option::Option<&crate::types::DeriveKeyUsage> {
61 self.derive_key_usage.as_ref()
62 }
63 /// <p>A list of Amazon Web Services Regions for key replication operations.</p>
64 /// <p>Each region in the list must be a valid Amazon Web Services Region identifier where Amazon Web Services Payment Cryptography is available. This list is used to specify which regions should be added to or removed from a key's replication configuration.</p>
65 ///
66 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.replication_regions.is_none()`.
67 pub fn replication_regions(&self) -> &[::std::string::String] {
68 self.replication_regions.as_deref().unwrap_or_default()
69 }
70}
71impl CreateKeyInput {
72 /// Creates a new builder-style object to manufacture [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
73 pub fn builder() -> crate::operation::create_key::builders::CreateKeyInputBuilder {
74 crate::operation::create_key::builders::CreateKeyInputBuilder::default()
75 }
76}
77
78/// A builder for [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
79#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
80#[non_exhaustive]
81pub struct CreateKeyInputBuilder {
82 pub(crate) key_attributes: ::std::option::Option<crate::types::KeyAttributes>,
83 pub(crate) key_check_value_algorithm: ::std::option::Option<crate::types::KeyCheckValueAlgorithm>,
84 pub(crate) exportable: ::std::option::Option<bool>,
85 pub(crate) enabled: ::std::option::Option<bool>,
86 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
87 pub(crate) derive_key_usage: ::std::option::Option<crate::types::DeriveKeyUsage>,
88 pub(crate) replication_regions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
89}
90impl CreateKeyInputBuilder {
91 /// <p>The role of the key, the algorithm it supports, and the cryptographic operations allowed with the key. This data is immutable after the key is created.</p>
92 /// This field is required.
93 pub fn key_attributes(mut self, input: crate::types::KeyAttributes) -> Self {
94 self.key_attributes = ::std::option::Option::Some(input);
95 self
96 }
97 /// <p>The role of the key, the algorithm it supports, and the cryptographic operations allowed with the key. This data is immutable after the key is created.</p>
98 pub fn set_key_attributes(mut self, input: ::std::option::Option<crate::types::KeyAttributes>) -> Self {
99 self.key_attributes = input;
100 self
101 }
102 /// <p>The role of the key, the algorithm it supports, and the cryptographic operations allowed with the key. This data is immutable after the key is created.</p>
103 pub fn get_key_attributes(&self) -> &::std::option::Option<crate::types::KeyAttributes> {
104 &self.key_attributes
105 }
106 /// <p>The algorithm that Amazon Web Services Payment Cryptography uses to calculate the key check value (KCV). It is used to validate the key integrity.</p>
107 /// <p>For TDES keys, the KCV is computed by encrypting 8 bytes, each with value of zero, with the key to be checked and retaining the 3 highest order bytes of the encrypted result. For AES keys, the KCV is computed using a CMAC algorithm where the input data is 16 bytes of zero and retaining the 3 highest order bytes of the encrypted result.</p>
108 pub fn key_check_value_algorithm(mut self, input: crate::types::KeyCheckValueAlgorithm) -> Self {
109 self.key_check_value_algorithm = ::std::option::Option::Some(input);
110 self
111 }
112 /// <p>The algorithm that Amazon Web Services Payment Cryptography uses to calculate the key check value (KCV). It is used to validate the key integrity.</p>
113 /// <p>For TDES keys, the KCV is computed by encrypting 8 bytes, each with value of zero, with the key to be checked and retaining the 3 highest order bytes of the encrypted result. For AES keys, the KCV is computed using a CMAC algorithm where the input data is 16 bytes of zero and retaining the 3 highest order bytes of the encrypted result.</p>
114 pub fn set_key_check_value_algorithm(mut self, input: ::std::option::Option<crate::types::KeyCheckValueAlgorithm>) -> Self {
115 self.key_check_value_algorithm = input;
116 self
117 }
118 /// <p>The algorithm that Amazon Web Services Payment Cryptography uses to calculate the key check value (KCV). It is used to validate the key integrity.</p>
119 /// <p>For TDES keys, the KCV is computed by encrypting 8 bytes, each with value of zero, with the key to be checked and retaining the 3 highest order bytes of the encrypted result. For AES keys, the KCV is computed using a CMAC algorithm where the input data is 16 bytes of zero and retaining the 3 highest order bytes of the encrypted result.</p>
120 pub fn get_key_check_value_algorithm(&self) -> &::std::option::Option<crate::types::KeyCheckValueAlgorithm> {
121 &self.key_check_value_algorithm
122 }
123 /// <p>Specifies whether the key is exportable from the service.</p>
124 /// This field is required.
125 pub fn exportable(mut self, input: bool) -> Self {
126 self.exportable = ::std::option::Option::Some(input);
127 self
128 }
129 /// <p>Specifies whether the key is exportable from the service.</p>
130 pub fn set_exportable(mut self, input: ::std::option::Option<bool>) -> Self {
131 self.exportable = input;
132 self
133 }
134 /// <p>Specifies whether the key is exportable from the service.</p>
135 pub fn get_exportable(&self) -> &::std::option::Option<bool> {
136 &self.exportable
137 }
138 /// <p>Specifies whether to enable the key. If the key is enabled, it is activated for use within the service. If the key is not enabled, then it is created but not activated. The default value is enabled.</p>
139 pub fn enabled(mut self, input: bool) -> Self {
140 self.enabled = ::std::option::Option::Some(input);
141 self
142 }
143 /// <p>Specifies whether to enable the key. If the key is enabled, it is activated for use within the service. If the key is not enabled, then it is created but not activated. The default value is enabled.</p>
144 pub fn set_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
145 self.enabled = input;
146 self
147 }
148 /// <p>Specifies whether to enable the key. If the key is enabled, it is activated for use within the service. If the key is not enabled, then it is created but not activated. The default value is enabled.</p>
149 pub fn get_enabled(&self) -> &::std::option::Option<bool> {
150 &self.enabled
151 }
152 /// Appends an item to `tags`.
153 ///
154 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
155 ///
156 /// <p>Assigns one or more tags to the Amazon Web Services Payment Cryptography key. Use this parameter to tag a key when it is created. To tag an existing Amazon Web Services Payment Cryptography key, use the <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
157 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You can't have more than one tag on an Amazon Web Services Payment Cryptography key with the same tag key.</p><important>
158 /// <p>Don't include personal, confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
159 /// </important> <note>
160 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
161 /// </note>
162 pub fn tags(mut self, input: crate::types::Tag) -> Self {
163 let mut v = self.tags.unwrap_or_default();
164 v.push(input);
165 self.tags = ::std::option::Option::Some(v);
166 self
167 }
168 /// <p>Assigns one or more tags to the Amazon Web Services Payment Cryptography key. Use this parameter to tag a key when it is created. To tag an existing Amazon Web Services Payment Cryptography key, use the <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
169 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You can't have more than one tag on an Amazon Web Services Payment Cryptography key with the same tag key.</p><important>
170 /// <p>Don't include personal, confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
171 /// </important> <note>
172 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
173 /// </note>
174 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
175 self.tags = input;
176 self
177 }
178 /// <p>Assigns one or more tags to the Amazon Web Services Payment Cryptography key. Use this parameter to tag a key when it is created. To tag an existing Amazon Web Services Payment Cryptography key, use the <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>
179 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You can't have more than one tag on an Amazon Web Services Payment Cryptography key with the same tag key.</p><important>
180 /// <p>Don't include personal, confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
181 /// </important> <note>
182 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
183 /// </note>
184 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
185 &self.tags
186 }
187 /// <p>The intended cryptographic usage of keys derived from the ECC key pair to be created.</p>
188 /// <p>After creating an ECC key pair, you cannot change the intended cryptographic usage of keys derived from it using ECDH.</p>
189 pub fn derive_key_usage(mut self, input: crate::types::DeriveKeyUsage) -> Self {
190 self.derive_key_usage = ::std::option::Option::Some(input);
191 self
192 }
193 /// <p>The intended cryptographic usage of keys derived from the ECC key pair to be created.</p>
194 /// <p>After creating an ECC key pair, you cannot change the intended cryptographic usage of keys derived from it using ECDH.</p>
195 pub fn set_derive_key_usage(mut self, input: ::std::option::Option<crate::types::DeriveKeyUsage>) -> Self {
196 self.derive_key_usage = input;
197 self
198 }
199 /// <p>The intended cryptographic usage of keys derived from the ECC key pair to be created.</p>
200 /// <p>After creating an ECC key pair, you cannot change the intended cryptographic usage of keys derived from it using ECDH.</p>
201 pub fn get_derive_key_usage(&self) -> &::std::option::Option<crate::types::DeriveKeyUsage> {
202 &self.derive_key_usage
203 }
204 /// Appends an item to `replication_regions`.
205 ///
206 /// To override the contents of this collection use [`set_replication_regions`](Self::set_replication_regions).
207 ///
208 /// <p>A list of Amazon Web Services Regions for key replication operations.</p>
209 /// <p>Each region in the list must be a valid Amazon Web Services Region identifier where Amazon Web Services Payment Cryptography is available. This list is used to specify which regions should be added to or removed from a key's replication configuration.</p>
210 pub fn replication_regions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
211 let mut v = self.replication_regions.unwrap_or_default();
212 v.push(input.into());
213 self.replication_regions = ::std::option::Option::Some(v);
214 self
215 }
216 /// <p>A list of Amazon Web Services Regions for key replication operations.</p>
217 /// <p>Each region in the list must be a valid Amazon Web Services Region identifier where Amazon Web Services Payment Cryptography is available. This list is used to specify which regions should be added to or removed from a key's replication configuration.</p>
218 pub fn set_replication_regions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
219 self.replication_regions = input;
220 self
221 }
222 /// <p>A list of Amazon Web Services Regions for key replication operations.</p>
223 /// <p>Each region in the list must be a valid Amazon Web Services Region identifier where Amazon Web Services Payment Cryptography is available. This list is used to specify which regions should be added to or removed from a key's replication configuration.</p>
224 pub fn get_replication_regions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
225 &self.replication_regions
226 }
227 /// Consumes the builder and constructs a [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
228 pub fn build(self) -> ::std::result::Result<crate::operation::create_key::CreateKeyInput, ::aws_smithy_types::error::operation::BuildError> {
229 ::std::result::Result::Ok(crate::operation::create_key::CreateKeyInput {
230 key_attributes: self.key_attributes,
231 key_check_value_algorithm: self.key_check_value_algorithm,
232 exportable: self.exportable,
233 enabled: self.enabled,
234 tags: self.tags,
235 derive_key_usage: self.derive_key_usage,
236 replication_regions: self.replication_regions,
237 })
238 }
239}