aws_sdk_paymentcryptography/operation/create_key/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_key::_create_key_output::CreateKeyOutputBuilder;
3
4pub use crate::operation::create_key::_create_key_input::CreateKeyInputBuilder;
5
6impl crate::operation::create_key::builders::CreateKeyInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::create_key::CreateKeyOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_key::CreateKeyError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_key();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateKey`.
24///
25/// <p>Creates an Amazon Web Services Payment Cryptography key, a logical representation of a cryptographic key, that is unique in your account and Amazon Web Services Region. You use keys for cryptographic functions such as encryption and decryption.</p>
26/// <p>In addition to the key material used in cryptographic operations, an Amazon Web Services Payment Cryptography key includes metadata such as the key ARN, key usage, key origin, creation date, description, and key state.</p>
27/// <p>When you create a key, you specify both immutable and mutable data about the key. The immutable data contains key attributes that define the scope and cryptographic operations that you can perform using the key, for example key class (example: <code>SYMMETRIC_KEY</code>), key algorithm (example: <code>TDES_2KEY</code>), key usage (example: <code>TR31_P0_PIN_ENCRYPTION_KEY</code>) and key modes of use (example: <code>Encrypt</code>). For information about valid combinations of key attributes, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/keys-validattributes.html">Understanding key attributes</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>. The mutable data contained within a key includes usage timestamp and key deletion timestamp and can be modified after creation.</p>
28/// <p>Amazon Web Services Payment Cryptography binds key attributes to keys using key blocks when you store or export them. Amazon Web Services Payment Cryptography stores the key contents wrapped and never stores or transmits them in the clear.</p>
29/// <p><b>Cross-account use</b>: This operation can't be used across different Amazon Web Services accounts.</p>
30/// <p><b>Related operations:</b></p>
31/// <ul>
32/// <li>
33/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_DeleteKey.html">DeleteKey</a></p></li>
34/// <li>
35/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_GetKey.html">GetKey</a></p></li>
36/// <li>
37/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ListKeys.html">ListKeys</a></p></li>
38/// </ul>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct CreateKeyFluentBuilder {
41 handle: ::std::sync::Arc<crate::client::Handle>,
42 inner: crate::operation::create_key::builders::CreateKeyInputBuilder,
43 config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl crate::client::customize::internal::CustomizableSend<crate::operation::create_key::CreateKeyOutput, crate::operation::create_key::CreateKeyError>
46 for CreateKeyFluentBuilder
47{
48 fn send(
49 self,
50 config_override: crate::config::Builder,
51 ) -> crate::client::customize::internal::BoxFuture<
52 crate::client::customize::internal::SendResult<crate::operation::create_key::CreateKeyOutput, crate::operation::create_key::CreateKeyError>,
53 > {
54 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55 }
56}
57impl CreateKeyFluentBuilder {
58 /// Creates a new `CreateKeyFluentBuilder`.
59 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
60 Self {
61 handle,
62 inner: ::std::default::Default::default(),
63 config_override: ::std::option::Option::None,
64 }
65 }
66 /// Access the CreateKey as a reference.
67 pub fn as_input(&self) -> &crate::operation::create_key::builders::CreateKeyInputBuilder {
68 &self.inner
69 }
70 /// Sends the request and returns the response.
71 ///
72 /// If an error occurs, an `SdkError` will be returned with additional details that
73 /// can be matched against.
74 ///
75 /// By default, any retryable failures will be retried twice. Retry behavior
76 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77 /// set when configuring the client.
78 pub async fn send(
79 self,
80 ) -> ::std::result::Result<
81 crate::operation::create_key::CreateKeyOutput,
82 ::aws_smithy_runtime_api::client::result::SdkError<
83 crate::operation::create_key::CreateKeyError,
84 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85 >,
86 > {
87 let input = self
88 .inner
89 .build()
90 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91 let runtime_plugins = crate::operation::create_key::CreateKey::operation_runtime_plugins(
92 self.handle.runtime_plugins.clone(),
93 &self.handle.conf,
94 self.config_override,
95 );
96 crate::operation::create_key::CreateKey::orchestrate(&runtime_plugins, input).await
97 }
98
99 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100 pub fn customize(
101 self,
102 ) -> crate::client::customize::CustomizableOperation<
103 crate::operation::create_key::CreateKeyOutput,
104 crate::operation::create_key::CreateKeyError,
105 Self,
106 > {
107 crate::client::customize::CustomizableOperation::new(self)
108 }
109 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110 self.set_config_override(::std::option::Option::Some(config_override.into()));
111 self
112 }
113
114 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115 self.config_override = config_override;
116 self
117 }
118 /// <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>
119 pub fn key_attributes(mut self, input: crate::types::KeyAttributes) -> Self {
120 self.inner = self.inner.key_attributes(input);
121 self
122 }
123 /// <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>
124 pub fn set_key_attributes(mut self, input: ::std::option::Option<crate::types::KeyAttributes>) -> Self {
125 self.inner = self.inner.set_key_attributes(input);
126 self
127 }
128 /// <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>
129 pub fn get_key_attributes(&self) -> &::std::option::Option<crate::types::KeyAttributes> {
130 self.inner.get_key_attributes()
131 }
132 /// <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>
133 /// <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>
134 pub fn key_check_value_algorithm(mut self, input: crate::types::KeyCheckValueAlgorithm) -> Self {
135 self.inner = self.inner.key_check_value_algorithm(input);
136 self
137 }
138 /// <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>
139 /// <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>
140 pub fn set_key_check_value_algorithm(mut self, input: ::std::option::Option<crate::types::KeyCheckValueAlgorithm>) -> Self {
141 self.inner = self.inner.set_key_check_value_algorithm(input);
142 self
143 }
144 /// <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>
145 /// <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>
146 pub fn get_key_check_value_algorithm(&self) -> &::std::option::Option<crate::types::KeyCheckValueAlgorithm> {
147 self.inner.get_key_check_value_algorithm()
148 }
149 /// <p>Specifies whether the key is exportable from the service.</p>
150 pub fn exportable(mut self, input: bool) -> Self {
151 self.inner = self.inner.exportable(input);
152 self
153 }
154 /// <p>Specifies whether the key is exportable from the service.</p>
155 pub fn set_exportable(mut self, input: ::std::option::Option<bool>) -> Self {
156 self.inner = self.inner.set_exportable(input);
157 self
158 }
159 /// <p>Specifies whether the key is exportable from the service.</p>
160 pub fn get_exportable(&self) -> &::std::option::Option<bool> {
161 self.inner.get_exportable()
162 }
163 /// <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>
164 pub fn enabled(mut self, input: bool) -> Self {
165 self.inner = self.inner.enabled(input);
166 self
167 }
168 /// <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>
169 pub fn set_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
170 self.inner = self.inner.set_enabled(input);
171 self
172 }
173 /// <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>
174 pub fn get_enabled(&self) -> &::std::option::Option<bool> {
175 self.inner.get_enabled()
176 }
177 ///
178 /// Appends an item to `Tags`.
179 ///
180 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
181 ///
182 /// <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>
183 /// <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>
184 /// <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>
185 /// </important> <note>
186 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
187 /// </note>
188 pub fn tags(mut self, input: crate::types::Tag) -> Self {
189 self.inner = self.inner.tags(input);
190 self
191 }
192 /// <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>
193 /// <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>
194 /// <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>
195 /// </important> <note>
196 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
197 /// </note>
198 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
199 self.inner = self.inner.set_tags(input);
200 self
201 }
202 /// <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>
203 /// <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>
204 /// <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>
205 /// </important> <note>
206 /// <p>Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or deny permission to the key.</p>
207 /// </note>
208 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
209 self.inner.get_tags()
210 }
211}