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