aws_sdk_paymentcryptography/operation/create_alias/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_alias::_create_alias_output::CreateAliasOutputBuilder;
3
4pub use crate::operation::create_alias::_create_alias_input::CreateAliasInputBuilder;
5
6impl crate::operation::create_alias::builders::CreateAliasInputBuilder {
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_alias::CreateAliasOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_alias::CreateAliasError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_alias();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateAlias`.
24///
25/// <p>Creates an <i>alias</i>, or a friendly name, for an Amazon Web Services Payment Cryptography key. You can use an alias to identify a key in the console and when you call cryptographic operations such as <a href="https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_EncryptData.html">EncryptData</a> or <a href="https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_DecryptData.html">DecryptData</a>.</p>
26/// <p>You can associate the alias with any key in the same Amazon Web Services Region. Each alias is associated with only one key at a time, but a key can have multiple aliases. You can't create an alias without a key. The alias must be unique in the account and Amazon Web Services Region, but you can create another alias with the same name in a different Amazon Web Services Region.</p>
27/// <p>To change the key that's associated with the alias, call <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_UpdateAlias.html">UpdateAlias</a>. To delete the alias, call <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_DeleteAlias.html">DeleteAlias</a>. These operations don't affect the underlying key. To get the alias that you created, call <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ListAliases.html">ListAliases</a>.</p>
28/// <p><b>Cross-account use</b>: This operation can't be used across different Amazon Web Services accounts.</p>
29/// <p><b>Related operations:</b></p>
30/// <ul>
31/// <li>
32/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_DeleteAlias.html">DeleteAlias</a></p></li>
33/// <li>
34/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_GetAlias.html">GetAlias</a></p></li>
35/// <li>
36/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ListAliases.html">ListAliases</a></p></li>
37/// <li>
38/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_UpdateAlias.html">UpdateAlias</a></p></li>
39/// </ul>
40#[derive(::std::clone::Clone, ::std::fmt::Debug)]
41pub struct CreateAliasFluentBuilder {
42    handle: ::std::sync::Arc<crate::client::Handle>,
43    inner: crate::operation::create_alias::builders::CreateAliasInputBuilder,
44    config_override: ::std::option::Option<crate::config::Builder>,
45}
46impl
47    crate::client::customize::internal::CustomizableSend<
48        crate::operation::create_alias::CreateAliasOutput,
49        crate::operation::create_alias::CreateAliasError,
50    > for CreateAliasFluentBuilder
51{
52    fn send(
53        self,
54        config_override: crate::config::Builder,
55    ) -> crate::client::customize::internal::BoxFuture<
56        crate::client::customize::internal::SendResult<
57            crate::operation::create_alias::CreateAliasOutput,
58            crate::operation::create_alias::CreateAliasError,
59        >,
60    > {
61        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
62    }
63}
64impl CreateAliasFluentBuilder {
65    /// Creates a new `CreateAliasFluentBuilder`.
66    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
67        Self {
68            handle,
69            inner: ::std::default::Default::default(),
70            config_override: ::std::option::Option::None,
71        }
72    }
73    /// Access the CreateAlias as a reference.
74    pub fn as_input(&self) -> &crate::operation::create_alias::builders::CreateAliasInputBuilder {
75        &self.inner
76    }
77    /// Sends the request and returns the response.
78    ///
79    /// If an error occurs, an `SdkError` will be returned with additional details that
80    /// can be matched against.
81    ///
82    /// By default, any retryable failures will be retried twice. Retry behavior
83    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
84    /// set when configuring the client.
85    pub async fn send(
86        self,
87    ) -> ::std::result::Result<
88        crate::operation::create_alias::CreateAliasOutput,
89        ::aws_smithy_runtime_api::client::result::SdkError<
90            crate::operation::create_alias::CreateAliasError,
91            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
92        >,
93    > {
94        let input = self
95            .inner
96            .build()
97            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
98        let runtime_plugins = crate::operation::create_alias::CreateAlias::operation_runtime_plugins(
99            self.handle.runtime_plugins.clone(),
100            &self.handle.conf,
101            self.config_override,
102        );
103        crate::operation::create_alias::CreateAlias::orchestrate(&runtime_plugins, input).await
104    }
105
106    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
107    pub fn customize(
108        self,
109    ) -> crate::client::customize::CustomizableOperation<
110        crate::operation::create_alias::CreateAliasOutput,
111        crate::operation::create_alias::CreateAliasError,
112        Self,
113    > {
114        crate::client::customize::CustomizableOperation::new(self)
115    }
116    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
117        self.set_config_override(::std::option::Option::Some(config_override.into()));
118        self
119    }
120
121    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
122        self.config_override = config_override;
123        self
124    }
125    /// <p>A friendly name that you can use to refer to a key. An alias must begin with <code>alias/</code> followed by a name, for example <code>alias/ExampleAlias</code>. It can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-).</p><important>
126    /// <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>
127    /// </important>
128    pub fn alias_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.alias_name(input.into());
130        self
131    }
132    /// <p>A friendly name that you can use to refer to a key. An alias must begin with <code>alias/</code> followed by a name, for example <code>alias/ExampleAlias</code>. It can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-).</p><important>
133    /// <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>
134    /// </important>
135    pub fn set_alias_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_alias_name(input);
137        self
138    }
139    /// <p>A friendly name that you can use to refer to a key. An alias must begin with <code>alias/</code> followed by a name, for example <code>alias/ExampleAlias</code>. It can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-).</p><important>
140    /// <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>
141    /// </important>
142    pub fn get_alias_name(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_alias_name()
144    }
145    /// <p>The <code>KeyARN</code> of the key to associate with the alias.</p>
146    pub fn key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.key_arn(input.into());
148        self
149    }
150    /// <p>The <code>KeyARN</code> of the key to associate with the alias.</p>
151    pub fn set_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_key_arn(input);
153        self
154    }
155    /// <p>The <code>KeyARN</code> of the key to associate with the alias.</p>
156    pub fn get_key_arn(&self) -> &::std::option::Option<::std::string::String> {
157        self.inner.get_key_arn()
158    }
159}