aws_sdk_kms/operation/delete_alias/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::delete_alias::_delete_alias_output::DeleteAliasOutputBuilder;
3
4pub use crate::operation::delete_alias::_delete_alias_input::DeleteAliasInputBuilder;
5
6impl crate::operation::delete_alias::builders::DeleteAliasInputBuilder {
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::delete_alias::DeleteAliasOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::delete_alias::DeleteAliasError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.delete_alias();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DeleteAlias`.
24///
25/// <p>Deletes the specified alias.</p><note>
26/// <p>Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/abac.html">ABAC for KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
27/// </note>
28/// <p>Because an alias is not a property of a KMS key, you can delete and change the aliases of a KMS key without affecting the KMS key. Also, aliases do not appear in the response from the <code>DescribeKey</code> operation. To get the aliases of all KMS keys, use the <code>ListAliases</code> operation.</p>
29/// <p>Each KMS key can have multiple aliases. To change the alias of a KMS key, use <code>DeleteAlias</code> to delete the current alias and <code>CreateAlias</code> to create a new alias. To associate an existing alias with a different KMS key, call <code>UpdateAlias</code>.</p>
30/// <p><b>Cross-account use</b>: No. You cannot perform this operation on an alias in a different Amazon Web Services account.</p>
31/// <p><b>Required permissions</b></p>
32/// <ul>
33/// <li>
34/// <p><a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:DeleteAlias</a> on the alias (IAM policy).</p></li>
35/// <li>
36/// <p><a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:DeleteAlias</a> on the KMS key (key policy).</p></li>
37/// </ul>
38/// <p>For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html#alias-access">Controlling access to aliases</a> in the <i>Key Management Service Developer Guide</i>.</p>
39/// <p><b>Related operations:</b></p>
40/// <ul>
41/// <li>
42/// <p><code>CreateAlias</code></p></li>
43/// <li>
44/// <p><code>ListAliases</code></p></li>
45/// <li>
46/// <p><code>UpdateAlias</code></p></li>
47/// </ul>
48/// <p><b>Eventual consistency</b>: The KMS API follows an eventual consistency model. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html">KMS eventual consistency</a>.</p>
49#[derive(::std::clone::Clone, ::std::fmt::Debug)]
50pub struct DeleteAliasFluentBuilder {
51    handle: ::std::sync::Arc<crate::client::Handle>,
52    inner: crate::operation::delete_alias::builders::DeleteAliasInputBuilder,
53    config_override: ::std::option::Option<crate::config::Builder>,
54}
55impl
56    crate::client::customize::internal::CustomizableSend<
57        crate::operation::delete_alias::DeleteAliasOutput,
58        crate::operation::delete_alias::DeleteAliasError,
59    > for DeleteAliasFluentBuilder
60{
61    fn send(
62        self,
63        config_override: crate::config::Builder,
64    ) -> crate::client::customize::internal::BoxFuture<
65        crate::client::customize::internal::SendResult<
66            crate::operation::delete_alias::DeleteAliasOutput,
67            crate::operation::delete_alias::DeleteAliasError,
68        >,
69    > {
70        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
71    }
72}
73impl DeleteAliasFluentBuilder {
74    /// Creates a new `DeleteAliasFluentBuilder`.
75    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
76        Self {
77            handle,
78            inner: ::std::default::Default::default(),
79            config_override: ::std::option::Option::None,
80        }
81    }
82    /// Access the DeleteAlias as a reference.
83    pub fn as_input(&self) -> &crate::operation::delete_alias::builders::DeleteAliasInputBuilder {
84        &self.inner
85    }
86    /// Sends the request and returns the response.
87    ///
88    /// If an error occurs, an `SdkError` will be returned with additional details that
89    /// can be matched against.
90    ///
91    /// By default, any retryable failures will be retried twice. Retry behavior
92    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
93    /// set when configuring the client.
94    pub async fn send(
95        self,
96    ) -> ::std::result::Result<
97        crate::operation::delete_alias::DeleteAliasOutput,
98        ::aws_smithy_runtime_api::client::result::SdkError<
99            crate::operation::delete_alias::DeleteAliasError,
100            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
101        >,
102    > {
103        let input = self
104            .inner
105            .build()
106            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
107        let runtime_plugins = crate::operation::delete_alias::DeleteAlias::operation_runtime_plugins(
108            self.handle.runtime_plugins.clone(),
109            &self.handle.conf,
110            self.config_override,
111        );
112        crate::operation::delete_alias::DeleteAlias::orchestrate(&runtime_plugins, input).await
113    }
114
115    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
116    pub fn customize(
117        self,
118    ) -> crate::client::customize::CustomizableOperation<
119        crate::operation::delete_alias::DeleteAliasOutput,
120        crate::operation::delete_alias::DeleteAliasError,
121        Self,
122    > {
123        crate::client::customize::CustomizableOperation::new(self)
124    }
125    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
126        self.set_config_override(::std::option::Option::Some(config_override.into()));
127        self
128    }
129
130    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
131        self.config_override = config_override;
132        self
133    }
134    /// <p>The alias to be deleted. The alias name must begin with <code>alias/</code> followed by the alias name, such as <code>alias/ExampleAlias</code>.</p>
135    pub fn alias_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136        self.inner = self.inner.alias_name(input.into());
137        self
138    }
139    /// <p>The alias to be deleted. The alias name must begin with <code>alias/</code> followed by the alias name, such as <code>alias/ExampleAlias</code>.</p>
140    pub fn set_alias_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_alias_name(input);
142        self
143    }
144    /// <p>The alias to be deleted. The alias name must begin with <code>alias/</code> followed by the alias name, such as <code>alias/ExampleAlias</code>.</p>
145    pub fn get_alias_name(&self) -> &::std::option::Option<::std::string::String> {
146        self.inner.get_alias_name()
147    }
148}