aws_sdk_paymentcryptographydata/operation/translate_pin_data/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::translate_pin_data::_translate_pin_data_output::TranslatePinDataOutputBuilder;
3
4pub use crate::operation::translate_pin_data::_translate_pin_data_input::TranslatePinDataInputBuilder;
5
6impl crate::operation::translate_pin_data::builders::TranslatePinDataInputBuilder {
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::translate_pin_data::TranslatePinDataOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::translate_pin_data::TranslatePinDataError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.translate_pin_data();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `TranslatePinData`.
24///
25/// <p>Translates encrypted PIN block from and to ISO 9564 formats 0,1,3,4. For more information, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/translate-pin-data.html">Translate PIN data</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.</p>
26/// <p>PIN block translation involves changing a PIN block from one encryption key to another and optionally change its format. PIN block translation occurs entirely within the HSM boundary and PIN data never enters or leaves Amazon Web Services Payment Cryptography in clear text. The encryption key transformation can be from PEK (Pin Encryption Key) to BDK (Base Derivation Key) for DUKPT or from BDK for DUKPT to PEK.</p>
27/// <p>Amazon Web Services Payment Cryptography also supports use of dynamic keys and ECDH (Elliptic Curve Diffie-Hellman) based key exchange for this operation.</p>
28/// <p>Dynamic keys allow you to pass a PEK as a TR-31 WrappedKeyBlock. They 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 translate PIN block using dynamic keys, the <code>keyARN</code> is the Key Encryption Key (KEK) of the TR-31 wrapped PEK. The incoming wrapped key shall have a key purpose of P0 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>
29/// <p>Using ECDH key exchange, you can receive cardholder selectable PINs into Amazon Web Services Payment Cryptography. The ECDH derived key protects the incoming PIN block, which is translated to a PEK encrypted PIN block for use within the service. You can also use ECDH for reveal PIN, wherein the service translates the PIN block from PEK to a ECDH derived encryption key. For more information on establishing ECDH derived keys, see the <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/create-keys.html">Creating keys</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.</p>
30/// <p>The allowed combinations of PIN block format translations are guided by PCI. It is important to note that not all encrypted PIN block formats (example, format 1) require PAN (Primary Account Number) as input. And as such, PIN block format that requires PAN (example, formats 0,3,4) cannot be translated to a format (format 1) that does not require a PAN for generation.</p>
31/// <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><note>
32/// <p>Amazon Web Services Payment Cryptography currently supports ISO PIN block 4 translation for PIN block built using legacy PAN length. That is, PAN is the right most 12 digits excluding the check digits.</p>
33/// </note>
34/// <p><b>Cross-account use</b>: This operation can't be used across different Amazon Web Services accounts.</p>
35/// <p><b>Related operations:</b></p>
36/// <ul>
37/// <li>
38/// <p><code>GeneratePinData</code></p></li>
39/// <li>
40/// <p><code>VerifyPinData</code></p></li>
41/// </ul>
42#[derive(::std::clone::Clone, ::std::fmt::Debug)]
43pub struct TranslatePinDataFluentBuilder {
44    handle: ::std::sync::Arc<crate::client::Handle>,
45    inner: crate::operation::translate_pin_data::builders::TranslatePinDataInputBuilder,
46    config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49    crate::client::customize::internal::CustomizableSend<
50        crate::operation::translate_pin_data::TranslatePinDataOutput,
51        crate::operation::translate_pin_data::TranslatePinDataError,
52    > for TranslatePinDataFluentBuilder
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::translate_pin_data::TranslatePinDataOutput,
60            crate::operation::translate_pin_data::TranslatePinDataError,
61        >,
62    > {
63        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64    }
65}
66impl TranslatePinDataFluentBuilder {
67    /// Creates a new `TranslatePinDataFluentBuilder`.
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 TranslatePinData as a reference.
76    pub fn as_input(&self) -> &crate::operation::translate_pin_data::builders::TranslatePinDataInputBuilder {
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::translate_pin_data::TranslatePinDataOutput,
91        ::aws_smithy_runtime_api::client::result::SdkError<
92            crate::operation::translate_pin_data::TranslatePinDataError,
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::translate_pin_data::TranslatePinData::operation_runtime_plugins(
101            self.handle.runtime_plugins.clone(),
102            &self.handle.conf,
103            self.config_override,
104        );
105        crate::operation::translate_pin_data::TranslatePinData::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::translate_pin_data::TranslatePinDataOutput,
113        crate::operation::translate_pin_data::TranslatePinDataError,
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 under which incoming PIN block data is encrypted. This key type can be PEK or BDK.</p>
128    /// <p>For dynamic keys, it is the <code>keyARN</code> of KEK of the TR-31 wrapped PEK. For ECDH, it is the <code>keyARN</code> of the asymmetric ECC key.</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 under which incoming PIN block data is encrypted. This key type can be PEK or BDK.</p>
134    /// <p>For dynamic keys, it is the <code>keyARN</code> of KEK of the TR-31 wrapped PEK. For ECDH, it is the <code>keyARN</code> of the asymmetric ECC key.</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 under which incoming PIN block data is encrypted. This key type can be PEK or BDK.</p>
140    /// <p>For dynamic keys, it is the <code>keyARN</code> of KEK of the TR-31 wrapped PEK. For ECDH, it is the <code>keyARN</code> of the asymmetric ECC key.</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 for encrypting outgoing PIN block data. This key type can be PEK or BDK.</p>
145    /// <p>For ECDH, it is the <code>keyARN</code> of the asymmetric ECC key.</p>
146    pub fn outgoing_key_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.outgoing_key_identifier(input.into());
148        self
149    }
150    /// <p>The <code>keyARN</code> of the encryption key for encrypting outgoing PIN block data. This key type can be PEK or BDK.</p>
151    /// <p>For ECDH, it is the <code>keyARN</code> of the asymmetric ECC key.</p>
152    pub fn set_outgoing_key_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153        self.inner = self.inner.set_outgoing_key_identifier(input);
154        self
155    }
156    /// <p>The <code>keyARN</code> of the encryption key for encrypting outgoing PIN block data. This key type can be PEK or BDK.</p>
157    /// <p>For ECDH, it is the <code>keyARN</code> of the asymmetric ECC key.</p>
158    pub fn get_outgoing_key_identifier(&self) -> &::std::option::Option<::std::string::String> {
159        self.inner.get_outgoing_key_identifier()
160    }
161    /// <p>The format of the incoming PIN block data for translation within Amazon Web Services Payment Cryptography.</p>
162    pub fn incoming_translation_attributes(mut self, input: crate::types::TranslationIsoFormats) -> Self {
163        self.inner = self.inner.incoming_translation_attributes(input);
164        self
165    }
166    /// <p>The format of the incoming PIN block data for translation within Amazon Web Services Payment Cryptography.</p>
167    pub fn set_incoming_translation_attributes(mut self, input: ::std::option::Option<crate::types::TranslationIsoFormats>) -> Self {
168        self.inner = self.inner.set_incoming_translation_attributes(input);
169        self
170    }
171    /// <p>The format of the incoming PIN block data for translation within Amazon Web Services Payment Cryptography.</p>
172    pub fn get_incoming_translation_attributes(&self) -> &::std::option::Option<crate::types::TranslationIsoFormats> {
173        self.inner.get_incoming_translation_attributes()
174    }
175    /// <p>The format of the outgoing PIN block data after translation by Amazon Web Services Payment Cryptography.</p>
176    pub fn outgoing_translation_attributes(mut self, input: crate::types::TranslationIsoFormats) -> Self {
177        self.inner = self.inner.outgoing_translation_attributes(input);
178        self
179    }
180    /// <p>The format of the outgoing PIN block data after translation by Amazon Web Services Payment Cryptography.</p>
181    pub fn set_outgoing_translation_attributes(mut self, input: ::std::option::Option<crate::types::TranslationIsoFormats>) -> Self {
182        self.inner = self.inner.set_outgoing_translation_attributes(input);
183        self
184    }
185    /// <p>The format of the outgoing PIN block data after translation by Amazon Web Services Payment Cryptography.</p>
186    pub fn get_outgoing_translation_attributes(&self) -> &::std::option::Option<crate::types::TranslationIsoFormats> {
187        self.inner.get_outgoing_translation_attributes()
188    }
189    /// <p>The encrypted PIN block data that Amazon Web Services Payment Cryptography translates.</p>
190    pub fn encrypted_pin_block(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.inner = self.inner.encrypted_pin_block(input.into());
192        self
193    }
194    /// <p>The encrypted PIN block data that Amazon Web Services Payment Cryptography translates.</p>
195    pub fn set_encrypted_pin_block(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196        self.inner = self.inner.set_encrypted_pin_block(input);
197        self
198    }
199    /// <p>The encrypted PIN block data that Amazon Web Services Payment Cryptography translates.</p>
200    pub fn get_encrypted_pin_block(&self) -> &::std::option::Option<::std::string::String> {
201        self.inner.get_encrypted_pin_block()
202    }
203    /// <p>The attributes and values to use for incoming DUKPT encryption key for PIN block translation.</p>
204    pub fn incoming_dukpt_attributes(mut self, input: crate::types::DukptDerivationAttributes) -> Self {
205        self.inner = self.inner.incoming_dukpt_attributes(input);
206        self
207    }
208    /// <p>The attributes and values to use for incoming DUKPT encryption key for PIN block translation.</p>
209    pub fn set_incoming_dukpt_attributes(mut self, input: ::std::option::Option<crate::types::DukptDerivationAttributes>) -> Self {
210        self.inner = self.inner.set_incoming_dukpt_attributes(input);
211        self
212    }
213    /// <p>The attributes and values to use for incoming DUKPT encryption key for PIN block translation.</p>
214    pub fn get_incoming_dukpt_attributes(&self) -> &::std::option::Option<crate::types::DukptDerivationAttributes> {
215        self.inner.get_incoming_dukpt_attributes()
216    }
217    /// <p>The attributes and values to use for outgoing DUKPT encryption key after PIN block translation.</p>
218    pub fn outgoing_dukpt_attributes(mut self, input: crate::types::DukptDerivationAttributes) -> Self {
219        self.inner = self.inner.outgoing_dukpt_attributes(input);
220        self
221    }
222    /// <p>The attributes and values to use for outgoing DUKPT encryption key after PIN block translation.</p>
223    pub fn set_outgoing_dukpt_attributes(mut self, input: ::std::option::Option<crate::types::DukptDerivationAttributes>) -> Self {
224        self.inner = self.inner.set_outgoing_dukpt_attributes(input);
225        self
226    }
227    /// <p>The attributes and values to use for outgoing DUKPT encryption key after PIN block translation.</p>
228    pub fn get_outgoing_dukpt_attributes(&self) -> &::std::option::Option<crate::types::DukptDerivationAttributes> {
229        self.inner.get_outgoing_dukpt_attributes()
230    }
231    /// <p>The WrappedKeyBlock containing the encryption key under which incoming PIN block data is encrypted.</p>
232    pub fn incoming_wrapped_key(mut self, input: crate::types::WrappedKey) -> Self {
233        self.inner = self.inner.incoming_wrapped_key(input);
234        self
235    }
236    /// <p>The WrappedKeyBlock containing the encryption key under which incoming PIN block data is encrypted.</p>
237    pub fn set_incoming_wrapped_key(mut self, input: ::std::option::Option<crate::types::WrappedKey>) -> Self {
238        self.inner = self.inner.set_incoming_wrapped_key(input);
239        self
240    }
241    /// <p>The WrappedKeyBlock containing the encryption key under which incoming PIN block data is encrypted.</p>
242    pub fn get_incoming_wrapped_key(&self) -> &::std::option::Option<crate::types::WrappedKey> {
243        self.inner.get_incoming_wrapped_key()
244    }
245    /// <p>The WrappedKeyBlock containing the encryption key for encrypting outgoing PIN block data.</p>
246    pub fn outgoing_wrapped_key(mut self, input: crate::types::WrappedKey) -> Self {
247        self.inner = self.inner.outgoing_wrapped_key(input);
248        self
249    }
250    /// <p>The WrappedKeyBlock containing the encryption key for encrypting outgoing PIN block data.</p>
251    pub fn set_outgoing_wrapped_key(mut self, input: ::std::option::Option<crate::types::WrappedKey>) -> Self {
252        self.inner = self.inner.set_outgoing_wrapped_key(input);
253        self
254    }
255    /// <p>The WrappedKeyBlock containing the encryption key for encrypting outgoing PIN block data.</p>
256    pub fn get_outgoing_wrapped_key(&self) -> &::std::option::Option<crate::types::WrappedKey> {
257        self.inner.get_outgoing_wrapped_key()
258    }
259}