aws_sdk_paymentcryptographydata/operation/re_encrypt_data/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::re_encrypt_data::_re_encrypt_data_output::ReEncryptDataOutputBuilder;
3
4pub use crate::operation::re_encrypt_data::_re_encrypt_data_input::ReEncryptDataInputBuilder;
5
6impl crate::operation::re_encrypt_data::builders::ReEncryptDataInputBuilder {
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::re_encrypt_data::ReEncryptDataOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::re_encrypt_data::ReEncryptDataError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.re_encrypt_data();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ReEncryptData`.
24///
25/// <p>Re-encrypt ciphertext using DUKPT or Symmetric data encryption keys.</p>
26/// <p>You can either generate an encryption key within Amazon Web Services Payment Cryptography by calling <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_CreateKey.html">CreateKey</a> or import your own encryption key by calling <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ImportKey.html">ImportKey</a>. The <code>KeyArn</code> for use with this operation must be in a compatible key state with <code>KeyModesOfUse</code> set to <code>Encrypt</code>.</p>
27/// <p>This operation also supports dynamic keys, allowing you to pass a dynamic encryption key as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To re-encrypt using dynamic keys, the <code>keyARN</code> is the Key Encryption Key (KEK) of the TR-31 wrapped encryption key material. The incoming wrapped key shall have a key purpose of D0 with a mode of use of B or D. For more information, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/use-cases-acquirers-dynamickeys.html">Using Dynamic Keys</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.</p>
28/// <p>For symmetric and DUKPT encryption, Amazon Web Services Payment Cryptography supports <code>TDES</code> and <code>AES</code> algorithms. To encrypt using DUKPT, a DUKPT key must already exist within your account with <code>KeyModesOfUse</code> set to <code>DeriveKey</code> or a new DUKPT can be generated by calling <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_CreateKey.html">CreateKey</a>.</p>
29/// <p>For information about valid keys for this operation, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/keys-validattributes.html">Understanding key attributes</a> and <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/crypto-ops-validkeys-ops.html">Key types for specific data operations</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.</p>
30/// <p><b>Cross-account use</b>: This operation can't be used across different Amazon Web Services accounts.</p>
31/// <p><b>Related operations:</b></p>
32/// <ul>
33/// <li>
34/// <p><code>DecryptData</code></p></li>
35/// <li>
36/// <p><code>EncryptData</code></p></li>
37/// <li>
38/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_GetPublicKeyCertificate.html">GetPublicCertificate</a></p></li>
39/// <li>
40/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ImportKey.html">ImportKey</a></p></li>
41/// </ul>
42#[derive(::std::clone::Clone, ::std::fmt::Debug)]
43pub struct ReEncryptDataFluentBuilder {
44    handle: ::std::sync::Arc<crate::client::Handle>,
45    inner: crate::operation::re_encrypt_data::builders::ReEncryptDataInputBuilder,
46    config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49    crate::client::customize::internal::CustomizableSend<
50        crate::operation::re_encrypt_data::ReEncryptDataOutput,
51        crate::operation::re_encrypt_data::ReEncryptDataError,
52    > for ReEncryptDataFluentBuilder
53{
54    fn send(
55        self,
56        config_override: crate::config::Builder,
57    ) -> crate::client::customize::internal::BoxFuture<
58        crate::client::customize::internal::SendResult<
59            crate::operation::re_encrypt_data::ReEncryptDataOutput,
60            crate::operation::re_encrypt_data::ReEncryptDataError,
61        >,
62    > {
63        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64    }
65}
66impl ReEncryptDataFluentBuilder {
67    /// Creates a new `ReEncryptDataFluentBuilder`.
68    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
69        Self {
70            handle,
71            inner: ::std::default::Default::default(),
72            config_override: ::std::option::Option::None,
73        }
74    }
75    /// Access the ReEncryptData as a reference.
76    pub fn as_input(&self) -> &crate::operation::re_encrypt_data::builders::ReEncryptDataInputBuilder {
77        &self.inner
78    }
79    /// Sends the request and returns the response.
80    ///
81    /// If an error occurs, an `SdkError` will be returned with additional details that
82    /// can be matched against.
83    ///
84    /// By default, any retryable failures will be retried twice. Retry behavior
85    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
86    /// set when configuring the client.
87    pub async fn send(
88        self,
89    ) -> ::std::result::Result<
90        crate::operation::re_encrypt_data::ReEncryptDataOutput,
91        ::aws_smithy_runtime_api::client::result::SdkError<
92            crate::operation::re_encrypt_data::ReEncryptDataError,
93            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
94        >,
95    > {
96        let input = self
97            .inner
98            .build()
99            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
100        let runtime_plugins = crate::operation::re_encrypt_data::ReEncryptData::operation_runtime_plugins(
101            self.handle.runtime_plugins.clone(),
102            &self.handle.conf,
103            self.config_override,
104        );
105        crate::operation::re_encrypt_data::ReEncryptData::orchestrate(&runtime_plugins, input).await
106    }
107
108    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
109    pub fn customize(
110        self,
111    ) -> crate::client::customize::CustomizableOperation<
112        crate::operation::re_encrypt_data::ReEncryptDataOutput,
113        crate::operation::re_encrypt_data::ReEncryptDataError,
114        Self,
115    > {
116        crate::client::customize::CustomizableOperation::new(self)
117    }
118    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
119        self.set_config_override(::std::option::Option::Some(config_override.into()));
120        self
121    }
122
123    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
124        self.config_override = config_override;
125        self
126    }
127    /// <p>The <code>keyARN</code> of the encryption key of incoming ciphertext data.</p>
128    /// <p>When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation.</p>
129    pub fn incoming_key_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.incoming_key_identifier(input.into());
131        self
132    }
133    /// <p>The <code>keyARN</code> of the encryption key of incoming ciphertext data.</p>
134    /// <p>When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation.</p>
135    pub fn set_incoming_key_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_incoming_key_identifier(input);
137        self
138    }
139    /// <p>The <code>keyARN</code> of the encryption key of incoming ciphertext data.</p>
140    /// <p>When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation.</p>
141    pub fn get_incoming_key_identifier(&self) -> &::std::option::Option<::std::string::String> {
142        self.inner.get_incoming_key_identifier()
143    }
144    /// <p>The <code>keyARN</code> of the encryption key of outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography.</p>
145    pub fn outgoing_key_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.outgoing_key_identifier(input.into());
147        self
148    }
149    /// <p>The <code>keyARN</code> of the encryption key of outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography.</p>
150    pub fn set_outgoing_key_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_outgoing_key_identifier(input);
152        self
153    }
154    /// <p>The <code>keyARN</code> of the encryption key of outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography.</p>
155    pub fn get_outgoing_key_identifier(&self) -> &::std::option::Option<::std::string::String> {
156        self.inner.get_outgoing_key_identifier()
157    }
158    /// <p>Ciphertext to be encrypted. The minimum allowed length is 16 bytes and maximum allowed length is 4096 bytes.</p>
159    pub fn cipher_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.cipher_text(input.into());
161        self
162    }
163    /// <p>Ciphertext to be encrypted. The minimum allowed length is 16 bytes and maximum allowed length is 4096 bytes.</p>
164    pub fn set_cipher_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.inner = self.inner.set_cipher_text(input);
166        self
167    }
168    /// <p>Ciphertext to be encrypted. The minimum allowed length is 16 bytes and maximum allowed length is 4096 bytes.</p>
169    pub fn get_cipher_text(&self) -> &::std::option::Option<::std::string::String> {
170        self.inner.get_cipher_text()
171    }
172    /// <p>The attributes and values for incoming ciphertext.</p>
173    pub fn incoming_encryption_attributes(mut self, input: crate::types::ReEncryptionAttributes) -> Self {
174        self.inner = self.inner.incoming_encryption_attributes(input);
175        self
176    }
177    /// <p>The attributes and values for incoming ciphertext.</p>
178    pub fn set_incoming_encryption_attributes(mut self, input: ::std::option::Option<crate::types::ReEncryptionAttributes>) -> Self {
179        self.inner = self.inner.set_incoming_encryption_attributes(input);
180        self
181    }
182    /// <p>The attributes and values for incoming ciphertext.</p>
183    pub fn get_incoming_encryption_attributes(&self) -> &::std::option::Option<crate::types::ReEncryptionAttributes> {
184        self.inner.get_incoming_encryption_attributes()
185    }
186    /// <p>The attributes and values for outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography.</p>
187    pub fn outgoing_encryption_attributes(mut self, input: crate::types::ReEncryptionAttributes) -> Self {
188        self.inner = self.inner.outgoing_encryption_attributes(input);
189        self
190    }
191    /// <p>The attributes and values for outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography.</p>
192    pub fn set_outgoing_encryption_attributes(mut self, input: ::std::option::Option<crate::types::ReEncryptionAttributes>) -> Self {
193        self.inner = self.inner.set_outgoing_encryption_attributes(input);
194        self
195    }
196    /// <p>The attributes and values for outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography.</p>
197    pub fn get_outgoing_encryption_attributes(&self) -> &::std::option::Option<crate::types::ReEncryptionAttributes> {
198        self.inner.get_outgoing_encryption_attributes()
199    }
200    /// <p>The WrappedKeyBlock containing the encryption key of incoming ciphertext data.</p>
201    pub fn incoming_wrapped_key(mut self, input: crate::types::WrappedKey) -> Self {
202        self.inner = self.inner.incoming_wrapped_key(input);
203        self
204    }
205    /// <p>The WrappedKeyBlock containing the encryption key of incoming ciphertext data.</p>
206    pub fn set_incoming_wrapped_key(mut self, input: ::std::option::Option<crate::types::WrappedKey>) -> Self {
207        self.inner = self.inner.set_incoming_wrapped_key(input);
208        self
209    }
210    /// <p>The WrappedKeyBlock containing the encryption key of incoming ciphertext data.</p>
211    pub fn get_incoming_wrapped_key(&self) -> &::std::option::Option<crate::types::WrappedKey> {
212        self.inner.get_incoming_wrapped_key()
213    }
214    /// <p>The WrappedKeyBlock containing the encryption key of outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography.</p>
215    pub fn outgoing_wrapped_key(mut self, input: crate::types::WrappedKey) -> Self {
216        self.inner = self.inner.outgoing_wrapped_key(input);
217        self
218    }
219    /// <p>The WrappedKeyBlock containing the encryption key of outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography.</p>
220    pub fn set_outgoing_wrapped_key(mut self, input: ::std::option::Option<crate::types::WrappedKey>) -> Self {
221        self.inner = self.inner.set_outgoing_wrapped_key(input);
222        self
223    }
224    /// <p>The WrappedKeyBlock containing the encryption key of outgoing ciphertext data after encryption by Amazon Web Services Payment Cryptography.</p>
225    pub fn get_outgoing_wrapped_key(&self) -> &::std::option::Option<crate::types::WrappedKey> {
226        self.inner.get_outgoing_wrapped_key()
227    }
228}