aws_sdk_kms/operation/list_aliases/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_aliases::_list_aliases_output::ListAliasesOutputBuilder;
3
4pub use crate::operation::list_aliases::_list_aliases_input::ListAliasesInputBuilder;
5
6impl crate::operation::list_aliases::builders::ListAliasesInputBuilder {
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::list_aliases::ListAliasesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::list_aliases::ListAliasesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.list_aliases();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ListAliases`.
24///
25/// <p>Gets a list of aliases in the caller's Amazon Web Services account and region. For more information about aliases, see <code>CreateAlias</code>.</p>
26/// <p>By default, the <code>ListAliases</code> operation returns all aliases in the account and region. To get only the aliases associated with a particular KMS key, use the <code>KeyId</code> parameter.</p>
27/// <p>The <code>ListAliases</code> response can include aliases that you created and associated with your customer managed keys, and aliases that Amazon Web Services created and associated with Amazon Web Services managed keys in your account. You can recognize Amazon Web Services aliases because their names have the format <code>aws/<service-name></service-name></code>, such as <code>aws/dynamodb</code>.</p>
28/// <p>The response might also include aliases that have no <code>TargetKeyId</code> field. These are predefined aliases that Amazon Web Services has created but has not yet associated with a KMS key. Aliases that Amazon Web Services creates in your account, including predefined aliases, do not count against your <a href="https://docs.aws.amazon.com/kms/latest/developerguide/limits.html#aliases-limit">KMS aliases quota</a>.</p>
29/// <p><b>Cross-account use</b>: No. <code>ListAliases</code> does not return aliases in other Amazon Web Services accounts.</p>
30/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:ListAliases</a> (IAM policy)</p>
31/// <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>
32/// <p><b>Related operations:</b></p>
33/// <ul>
34/// <li>
35/// <p><code>CreateAlias</code></p></li>
36/// <li>
37/// <p><code>DeleteAlias</code></p></li>
38/// <li>
39/// <p><code>UpdateAlias</code></p></li>
40/// </ul>
41/// <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>
42#[derive(::std::clone::Clone, ::std::fmt::Debug)]
43pub struct ListAliasesFluentBuilder {
44    handle: ::std::sync::Arc<crate::client::Handle>,
45    inner: crate::operation::list_aliases::builders::ListAliasesInputBuilder,
46    config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49    crate::client::customize::internal::CustomizableSend<
50        crate::operation::list_aliases::ListAliasesOutput,
51        crate::operation::list_aliases::ListAliasesError,
52    > for ListAliasesFluentBuilder
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::list_aliases::ListAliasesOutput,
60            crate::operation::list_aliases::ListAliasesError,
61        >,
62    > {
63        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64    }
65}
66impl ListAliasesFluentBuilder {
67    /// Creates a new `ListAliasesFluentBuilder`.
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 ListAliases as a reference.
76    pub fn as_input(&self) -> &crate::operation::list_aliases::builders::ListAliasesInputBuilder {
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::list_aliases::ListAliasesOutput,
91        ::aws_smithy_runtime_api::client::result::SdkError<
92            crate::operation::list_aliases::ListAliasesError,
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::list_aliases::ListAliases::operation_runtime_plugins(
101            self.handle.runtime_plugins.clone(),
102            &self.handle.conf,
103            self.config_override,
104        );
105        crate::operation::list_aliases::ListAliases::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::list_aliases::ListAliasesOutput,
113        crate::operation::list_aliases::ListAliasesError,
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    /// Create a paginator for this request
128    ///
129    /// Paginators are used by calling [`send().await`](crate::operation::list_aliases::paginator::ListAliasesPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
130    pub fn into_paginator(self) -> crate::operation::list_aliases::paginator::ListAliasesPaginator {
131        crate::operation::list_aliases::paginator::ListAliasesPaginator::new(self.handle, self.inner)
132    }
133    /// <p>Lists only aliases that are associated with the specified KMS key. Enter a KMS key in your Amazon Web Services account.</p>
134    /// <p>This parameter is optional. If you omit it, <code>ListAliases</code> returns all aliases in the account and Region.</p>
135    /// <p>Specify the key ID or key ARN of the KMS key.</p>
136    /// <p>For example:</p>
137    /// <ul>
138    /// <li>
139    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
140    /// <li>
141    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
142    /// </ul>
143    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
144    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.key_id(input.into());
146        self
147    }
148    /// <p>Lists only aliases that are associated with the specified KMS key. Enter a KMS key in your Amazon Web Services account.</p>
149    /// <p>This parameter is optional. If you omit it, <code>ListAliases</code> returns all aliases in the account and Region.</p>
150    /// <p>Specify the key ID or key ARN of the KMS key.</p>
151    /// <p>For example:</p>
152    /// <ul>
153    /// <li>
154    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
155    /// <li>
156    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
157    /// </ul>
158    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
159    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160        self.inner = self.inner.set_key_id(input);
161        self
162    }
163    /// <p>Lists only aliases that are associated with the specified KMS key. Enter a KMS key in your Amazon Web Services account.</p>
164    /// <p>This parameter is optional. If you omit it, <code>ListAliases</code> returns all aliases in the account and Region.</p>
165    /// <p>Specify the key ID or key ARN of the KMS key.</p>
166    /// <p>For example:</p>
167    /// <ul>
168    /// <li>
169    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
170    /// <li>
171    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
172    /// </ul>
173    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
174    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
175        self.inner.get_key_id()
176    }
177    /// <p>Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.</p>
178    /// <p>This value is optional. If you include a value, it must be between 1 and 100, inclusive. If you do not include a value, it defaults to 50.</p>
179    pub fn limit(mut self, input: i32) -> Self {
180        self.inner = self.inner.limit(input);
181        self
182    }
183    /// <p>Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.</p>
184    /// <p>This value is optional. If you include a value, it must be between 1 and 100, inclusive. If you do not include a value, it defaults to 50.</p>
185    pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
186        self.inner = self.inner.set_limit(input);
187        self
188    }
189    /// <p>Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.</p>
190    /// <p>This value is optional. If you include a value, it must be between 1 and 100, inclusive. If you do not include a value, it defaults to 50.</p>
191    pub fn get_limit(&self) -> &::std::option::Option<i32> {
192        self.inner.get_limit()
193    }
194    /// <p>Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of <code>NextMarker</code> from the truncated response you just received.</p>
195    pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
196        self.inner = self.inner.marker(input.into());
197        self
198    }
199    /// <p>Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of <code>NextMarker</code> from the truncated response you just received.</p>
200    pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
201        self.inner = self.inner.set_marker(input);
202        self
203    }
204    /// <p>Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of <code>NextMarker</code> from the truncated response you just received.</p>
205    pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
206        self.inner.get_marker()
207    }
208}