aws_sdk_paymentcryptographydata/operation/translate_key_material/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::translate_key_material::_translate_key_material_output::TranslateKeyMaterialOutputBuilder;
3
4pub use crate::operation::translate_key_material::_translate_key_material_input::TranslateKeyMaterialInputBuilder;
5
6impl crate::operation::translate_key_material::builders::TranslateKeyMaterialInputBuilder {
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_key_material::TranslateKeyMaterialOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::translate_key_material::TranslateKeyMaterialError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.translate_key_material();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `TranslateKeyMaterial`.
24///
25/// <p>Translates an encryption key between different wrapping keys without importing the key into Amazon Web Services Payment Cryptography.</p>
26/// <p>This operation can be used when key material is frequently rotated, such as during every card transaction, and there is a need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. It translates short-lived transaction keys such as Pin Encryption Key (PEK) generated for each transaction and wrapped with an ECDH (Elliptic Curve Diffie-Hellman) derived wrapping key to another KEK (Key Encryption Key) wrapping key.</p>
27/// <p>Before using this operation, you must first request the public key certificate of the ECC key pair generated within Amazon Web Services Payment Cryptography to establish an ECDH key agreement. In <code>TranslateKeyData</code>, the service uses its own ECC key pair, public certificate of receiving ECC key pair, and the key derivation parameters to generate a derived key. The service uses this derived key to unwrap the incoming transaction key received as a TR31WrappedKeyBlock and re-wrap using a user provided KEK to generate an outgoing Tr31WrappedKeyBlock. 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>
28/// <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>
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_CreateKey.html">CreateKey</a></p></li>
34/// <li>
35/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_GetPublicKeyCertificate.html">GetPublicCertificate</a></p></li>
36/// <li>
37/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ImportKey.html">ImportKey</a></p></li>
38/// </ul>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct TranslateKeyMaterialFluentBuilder {
41    handle: ::std::sync::Arc<crate::client::Handle>,
42    inner: crate::operation::translate_key_material::builders::TranslateKeyMaterialInputBuilder,
43    config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl
46    crate::client::customize::internal::CustomizableSend<
47        crate::operation::translate_key_material::TranslateKeyMaterialOutput,
48        crate::operation::translate_key_material::TranslateKeyMaterialError,
49    > for TranslateKeyMaterialFluentBuilder
50{
51    fn send(
52        self,
53        config_override: crate::config::Builder,
54    ) -> crate::client::customize::internal::BoxFuture<
55        crate::client::customize::internal::SendResult<
56            crate::operation::translate_key_material::TranslateKeyMaterialOutput,
57            crate::operation::translate_key_material::TranslateKeyMaterialError,
58        >,
59    > {
60        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
61    }
62}
63impl TranslateKeyMaterialFluentBuilder {
64    /// Creates a new `TranslateKeyMaterialFluentBuilder`.
65    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
66        Self {
67            handle,
68            inner: ::std::default::Default::default(),
69            config_override: ::std::option::Option::None,
70        }
71    }
72    /// Access the TranslateKeyMaterial as a reference.
73    pub fn as_input(&self) -> &crate::operation::translate_key_material::builders::TranslateKeyMaterialInputBuilder {
74        &self.inner
75    }
76    /// Sends the request and returns the response.
77    ///
78    /// If an error occurs, an `SdkError` will be returned with additional details that
79    /// can be matched against.
80    ///
81    /// By default, any retryable failures will be retried twice. Retry behavior
82    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
83    /// set when configuring the client.
84    pub async fn send(
85        self,
86    ) -> ::std::result::Result<
87        crate::operation::translate_key_material::TranslateKeyMaterialOutput,
88        ::aws_smithy_runtime_api::client::result::SdkError<
89            crate::operation::translate_key_material::TranslateKeyMaterialError,
90            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
91        >,
92    > {
93        let input = self
94            .inner
95            .build()
96            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
97        let runtime_plugins = crate::operation::translate_key_material::TranslateKeyMaterial::operation_runtime_plugins(
98            self.handle.runtime_plugins.clone(),
99            &self.handle.conf,
100            self.config_override,
101        );
102        crate::operation::translate_key_material::TranslateKeyMaterial::orchestrate(&runtime_plugins, input).await
103    }
104
105    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
106    pub fn customize(
107        self,
108    ) -> crate::client::customize::CustomizableOperation<
109        crate::operation::translate_key_material::TranslateKeyMaterialOutput,
110        crate::operation::translate_key_material::TranslateKeyMaterialError,
111        Self,
112    > {
113        crate::client::customize::CustomizableOperation::new(self)
114    }
115    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
116        self.set_config_override(::std::option::Option::Some(config_override.into()));
117        self
118    }
119
120    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
121        self.config_override = config_override;
122        self
123    }
124    /// <p>Parameter information of the TR31WrappedKeyBlock containing the transaction key.</p>
125    pub fn incoming_key_material(mut self, input: crate::types::IncomingKeyMaterial) -> Self {
126        self.inner = self.inner.incoming_key_material(input);
127        self
128    }
129    /// <p>Parameter information of the TR31WrappedKeyBlock containing the transaction key.</p>
130    pub fn set_incoming_key_material(mut self, input: ::std::option::Option<crate::types::IncomingKeyMaterial>) -> Self {
131        self.inner = self.inner.set_incoming_key_material(input);
132        self
133    }
134    /// <p>Parameter information of the TR31WrappedKeyBlock containing the transaction key.</p>
135    pub fn get_incoming_key_material(&self) -> &::std::option::Option<crate::types::IncomingKeyMaterial> {
136        self.inner.get_incoming_key_material()
137    }
138    /// <p>Parameter information of the wrapping key used to wrap the transaction key in the outgoing TR31WrappedKeyBlock.</p>
139    pub fn outgoing_key_material(mut self, input: crate::types::OutgoingKeyMaterial) -> Self {
140        self.inner = self.inner.outgoing_key_material(input);
141        self
142    }
143    /// <p>Parameter information of the wrapping key used to wrap the transaction key in the outgoing TR31WrappedKeyBlock.</p>
144    pub fn set_outgoing_key_material(mut self, input: ::std::option::Option<crate::types::OutgoingKeyMaterial>) -> Self {
145        self.inner = self.inner.set_outgoing_key_material(input);
146        self
147    }
148    /// <p>Parameter information of the wrapping key used to wrap the transaction key in the outgoing TR31WrappedKeyBlock.</p>
149    pub fn get_outgoing_key_material(&self) -> &::std::option::Option<crate::types::OutgoingKeyMaterial> {
150        self.inner.get_outgoing_key_material()
151    }
152    /// <p>The key check value (KCV) algorithm used for calculating the KCV.</p>
153    pub fn key_check_value_algorithm(mut self, input: crate::types::KeyCheckValueAlgorithm) -> Self {
154        self.inner = self.inner.key_check_value_algorithm(input);
155        self
156    }
157    /// <p>The key check value (KCV) algorithm used for calculating the KCV.</p>
158    pub fn set_key_check_value_algorithm(mut self, input: ::std::option::Option<crate::types::KeyCheckValueAlgorithm>) -> Self {
159        self.inner = self.inner.set_key_check_value_algorithm(input);
160        self
161    }
162    /// <p>The key check value (KCV) algorithm used for calculating the KCV.</p>
163    pub fn get_key_check_value_algorithm(&self) -> &::std::option::Option<crate::types::KeyCheckValueAlgorithm> {
164        self.inner.get_key_check_value_algorithm()
165    }
166}