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}
26impl CreateKeyInput {
27 /// <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>
28 pub fn key_attributes(&self) -> ::std::option::Option<&crate::types::KeyAttributes> {
29 self.key_attributes.as_ref()
30 }
31 /// <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>
32 /// <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>
33 pub fn key_check_value_algorithm(&self) -> ::std::option::Option<&crate::types::KeyCheckValueAlgorithm> {
34 self.key_check_value_algorithm.as_ref()
35 }
36 /// <p>Specifies whether the key is exportable from the service.</p>
37 pub fn exportable(&self) -> ::std::option::Option<bool> {
38 self.exportable
39 }
40 /// <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>
41 pub fn enabled(&self) -> ::std::option::Option<bool> {
42 self.enabled
43 }
44 /// <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>
45 /// <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>
46 /// <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>
47 /// </important> <note>
48 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
49 /// </note>
50 ///
51 /// 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()`.
52 pub fn tags(&self) -> &[crate::types::Tag] {
53 self.tags.as_deref().unwrap_or_default()
54 }
55 /// <p>The intended cryptographic usage of keys derived from the ECC key pair to be created.</p>
56 /// <p>After creating an ECC key pair, you cannot change the intended cryptographic usage of keys derived from it using ECDH.</p>
57 pub fn derive_key_usage(&self) -> ::std::option::Option<&crate::types::DeriveKeyUsage> {
58 self.derive_key_usage.as_ref()
59 }
60}
61impl CreateKeyInput {
62 /// Creates a new builder-style object to manufacture [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
63 pub fn builder() -> crate::operation::create_key::builders::CreateKeyInputBuilder {
64 crate::operation::create_key::builders::CreateKeyInputBuilder::default()
65 }
66}
67
68/// A builder for [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
69#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
70#[non_exhaustive]
71pub struct CreateKeyInputBuilder {
72 pub(crate) key_attributes: ::std::option::Option<crate::types::KeyAttributes>,
73 pub(crate) key_check_value_algorithm: ::std::option::Option<crate::types::KeyCheckValueAlgorithm>,
74 pub(crate) exportable: ::std::option::Option<bool>,
75 pub(crate) enabled: ::std::option::Option<bool>,
76 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
77 pub(crate) derive_key_usage: ::std::option::Option<crate::types::DeriveKeyUsage>,
78}
79impl CreateKeyInputBuilder {
80 /// <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>
81 /// This field is required.
82 pub fn key_attributes(mut self, input: crate::types::KeyAttributes) -> Self {
83 self.key_attributes = ::std::option::Option::Some(input);
84 self
85 }
86 /// <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>
87 pub fn set_key_attributes(mut self, input: ::std::option::Option<crate::types::KeyAttributes>) -> Self {
88 self.key_attributes = input;
89 self
90 }
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 pub fn get_key_attributes(&self) -> &::std::option::Option<crate::types::KeyAttributes> {
93 &self.key_attributes
94 }
95 /// <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>
96 /// <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>
97 pub fn key_check_value_algorithm(mut self, input: crate::types::KeyCheckValueAlgorithm) -> Self {
98 self.key_check_value_algorithm = ::std::option::Option::Some(input);
99 self
100 }
101 /// <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>
102 /// <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>
103 pub fn set_key_check_value_algorithm(mut self, input: ::std::option::Option<crate::types::KeyCheckValueAlgorithm>) -> Self {
104 self.key_check_value_algorithm = input;
105 self
106 }
107 /// <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>
108 /// <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>
109 pub fn get_key_check_value_algorithm(&self) -> &::std::option::Option<crate::types::KeyCheckValueAlgorithm> {
110 &self.key_check_value_algorithm
111 }
112 /// <p>Specifies whether the key is exportable from the service.</p>
113 /// This field is required.
114 pub fn exportable(mut self, input: bool) -> Self {
115 self.exportable = ::std::option::Option::Some(input);
116 self
117 }
118 /// <p>Specifies whether the key is exportable from the service.</p>
119 pub fn set_exportable(mut self, input: ::std::option::Option<bool>) -> Self {
120 self.exportable = input;
121 self
122 }
123 /// <p>Specifies whether the key is exportable from the service.</p>
124 pub fn get_exportable(&self) -> &::std::option::Option<bool> {
125 &self.exportable
126 }
127 /// <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>
128 pub fn enabled(mut self, input: bool) -> Self {
129 self.enabled = ::std::option::Option::Some(input);
130 self
131 }
132 /// <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>
133 pub fn set_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
134 self.enabled = input;
135 self
136 }
137 /// <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>
138 pub fn get_enabled(&self) -> &::std::option::Option<bool> {
139 &self.enabled
140 }
141 /// Appends an item to `tags`.
142 ///
143 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
144 ///
145 /// <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>
146 /// <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>
147 /// <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>
148 /// </important> <note>
149 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
150 /// </note>
151 pub fn tags(mut self, input: crate::types::Tag) -> Self {
152 let mut v = self.tags.unwrap_or_default();
153 v.push(input);
154 self.tags = ::std::option::Option::Some(v);
155 self
156 }
157 /// <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>
158 /// <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>
159 /// <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>
160 /// </important> <note>
161 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
162 /// </note>
163 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
164 self.tags = input;
165 self
166 }
167 /// <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>
168 /// <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>
169 /// <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>
170 /// </important> <note>
171 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
172 /// </note>
173 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
174 &self.tags
175 }
176 /// <p>The intended cryptographic usage of keys derived from the ECC key pair to be created.</p>
177 /// <p>After creating an ECC key pair, you cannot change the intended cryptographic usage of keys derived from it using ECDH.</p>
178 pub fn derive_key_usage(mut self, input: crate::types::DeriveKeyUsage) -> Self {
179 self.derive_key_usage = ::std::option::Option::Some(input);
180 self
181 }
182 /// <p>The intended cryptographic usage of keys derived from the ECC key pair to be created.</p>
183 /// <p>After creating an ECC key pair, you cannot change the intended cryptographic usage of keys derived from it using ECDH.</p>
184 pub fn set_derive_key_usage(mut self, input: ::std::option::Option<crate::types::DeriveKeyUsage>) -> Self {
185 self.derive_key_usage = input;
186 self
187 }
188 /// <p>The intended cryptographic usage of keys derived from the ECC key pair to be created.</p>
189 /// <p>After creating an ECC key pair, you cannot change the intended cryptographic usage of keys derived from it using ECDH.</p>
190 pub fn get_derive_key_usage(&self) -> &::std::option::Option<crate::types::DeriveKeyUsage> {
191 &self.derive_key_usage
192 }
193 /// Consumes the builder and constructs a [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
194 pub fn build(self) -> ::std::result::Result<crate::operation::create_key::CreateKeyInput, ::aws_smithy_types::error::operation::BuildError> {
195 ::std::result::Result::Ok(crate::operation::create_key::CreateKeyInput {
196 key_attributes: self.key_attributes,
197 key_check_value_algorithm: self.key_check_value_algorithm,
198 exportable: self.exportable,
199 enabled: self.enabled,
200 tags: self.tags,
201 derive_key_usage: self.derive_key_usage,
202 })
203 }
204}