aws_sdk_kms/operation/list_key_policies/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_key_policies::_list_key_policies_output::ListKeyPoliciesOutputBuilder;
3
4pub use crate::operation::list_key_policies::_list_key_policies_input::ListKeyPoliciesInputBuilder;
5
6impl crate::operation::list_key_policies::builders::ListKeyPoliciesInputBuilder {
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_key_policies::ListKeyPoliciesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::list_key_policies::ListKeyPoliciesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.list_key_policies();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ListKeyPolicies`.
24///
25/// <p>Gets the names of the key policies that are attached to a KMS key. This operation is designed to get policy names that you can use in a <code>GetKeyPolicy</code> operation. However, the only valid policy name is <code>default</code>.</p>
26/// <p><b>Cross-account use</b>: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.</p>
27/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:ListKeyPolicies</a> (key policy)</p>
28/// <p><b>Related operations:</b></p>
29/// <ul>
30/// <li>
31/// <p><code>GetKeyPolicy</code></p></li>
32/// <li>
33/// <p><a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html">PutKeyPolicy</a></p></li>
34/// </ul>
35/// <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>
36#[derive(::std::clone::Clone, ::std::fmt::Debug)]
37pub struct ListKeyPoliciesFluentBuilder {
38    handle: ::std::sync::Arc<crate::client::Handle>,
39    inner: crate::operation::list_key_policies::builders::ListKeyPoliciesInputBuilder,
40    config_override: ::std::option::Option<crate::config::Builder>,
41}
42impl
43    crate::client::customize::internal::CustomizableSend<
44        crate::operation::list_key_policies::ListKeyPoliciesOutput,
45        crate::operation::list_key_policies::ListKeyPoliciesError,
46    > for ListKeyPoliciesFluentBuilder
47{
48    fn send(
49        self,
50        config_override: crate::config::Builder,
51    ) -> crate::client::customize::internal::BoxFuture<
52        crate::client::customize::internal::SendResult<
53            crate::operation::list_key_policies::ListKeyPoliciesOutput,
54            crate::operation::list_key_policies::ListKeyPoliciesError,
55        >,
56    > {
57        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
58    }
59}
60impl ListKeyPoliciesFluentBuilder {
61    /// Creates a new `ListKeyPoliciesFluentBuilder`.
62    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
63        Self {
64            handle,
65            inner: ::std::default::Default::default(),
66            config_override: ::std::option::Option::None,
67        }
68    }
69    /// Access the ListKeyPolicies as a reference.
70    pub fn as_input(&self) -> &crate::operation::list_key_policies::builders::ListKeyPoliciesInputBuilder {
71        &self.inner
72    }
73    /// Sends the request and returns the response.
74    ///
75    /// If an error occurs, an `SdkError` will be returned with additional details that
76    /// can be matched against.
77    ///
78    /// By default, any retryable failures will be retried twice. Retry behavior
79    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
80    /// set when configuring the client.
81    pub async fn send(
82        self,
83    ) -> ::std::result::Result<
84        crate::operation::list_key_policies::ListKeyPoliciesOutput,
85        ::aws_smithy_runtime_api::client::result::SdkError<
86            crate::operation::list_key_policies::ListKeyPoliciesError,
87            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
88        >,
89    > {
90        let input = self
91            .inner
92            .build()
93            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
94        let runtime_plugins = crate::operation::list_key_policies::ListKeyPolicies::operation_runtime_plugins(
95            self.handle.runtime_plugins.clone(),
96            &self.handle.conf,
97            self.config_override,
98        );
99        crate::operation::list_key_policies::ListKeyPolicies::orchestrate(&runtime_plugins, input).await
100    }
101
102    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
103    pub fn customize(
104        self,
105    ) -> crate::client::customize::CustomizableOperation<
106        crate::operation::list_key_policies::ListKeyPoliciesOutput,
107        crate::operation::list_key_policies::ListKeyPoliciesError,
108        Self,
109    > {
110        crate::client::customize::CustomizableOperation::new(self)
111    }
112    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
113        self.set_config_override(::std::option::Option::Some(config_override.into()));
114        self
115    }
116
117    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
118        self.config_override = config_override;
119        self
120    }
121    /// Create a paginator for this request
122    ///
123    /// Paginators are used by calling [`send().await`](crate::operation::list_key_policies::paginator::ListKeyPoliciesPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
124    pub fn into_paginator(self) -> crate::operation::list_key_policies::paginator::ListKeyPoliciesPaginator {
125        crate::operation::list_key_policies::paginator::ListKeyPoliciesPaginator::new(self.handle, self.inner)
126    }
127    /// <p>Gets the names of key policies for the specified KMS key.</p>
128    /// <p>Specify the key ID or key ARN of the KMS key.</p>
129    /// <p>For example:</p>
130    /// <ul>
131    /// <li>
132    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
133    /// <li>
134    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
135    /// </ul>
136    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
137    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.inner = self.inner.key_id(input.into());
139        self
140    }
141    /// <p>Gets the names of key policies for the specified KMS key.</p>
142    /// <p>Specify the key ID or key ARN of the KMS key.</p>
143    /// <p>For example:</p>
144    /// <ul>
145    /// <li>
146    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
147    /// <li>
148    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
149    /// </ul>
150    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
151    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_key_id(input);
153        self
154    }
155    /// <p>Gets the names of key policies for the specified KMS key.</p>
156    /// <p>Specify the key ID or key ARN of the KMS key.</p>
157    /// <p>For example:</p>
158    /// <ul>
159    /// <li>
160    /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
161    /// <li>
162    /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
163    /// </ul>
164    /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
165    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
166        self.inner.get_key_id()
167    }
168    /// <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>
169    /// <p>This value is optional. If you include a value, it must be between 1 and 1000, inclusive. If you do not include a value, it defaults to 100.</p>
170    /// <p>Only one policy can be attached to a key.</p>
171    pub fn limit(mut self, input: i32) -> Self {
172        self.inner = self.inner.limit(input);
173        self
174    }
175    /// <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>
176    /// <p>This value is optional. If you include a value, it must be between 1 and 1000, inclusive. If you do not include a value, it defaults to 100.</p>
177    /// <p>Only one policy can be attached to a key.</p>
178    pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
179        self.inner = self.inner.set_limit(input);
180        self
181    }
182    /// <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>
183    /// <p>This value is optional. If you include a value, it must be between 1 and 1000, inclusive. If you do not include a value, it defaults to 100.</p>
184    /// <p>Only one policy can be attached to a key.</p>
185    pub fn get_limit(&self) -> &::std::option::Option<i32> {
186        self.inner.get_limit()
187    }
188    /// <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>
189    pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
190        self.inner = self.inner.marker(input.into());
191        self
192    }
193    /// <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>
194    pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
195        self.inner = self.inner.set_marker(input);
196        self
197    }
198    /// <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>
199    pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
200        self.inner.get_marker()
201    }
202}