aws_sdk_ec2/operation/describe_key_pairs/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::describe_key_pairs::_describe_key_pairs_output::DescribeKeyPairsOutputBuilder;
3
4pub use crate::operation::describe_key_pairs::_describe_key_pairs_input::DescribeKeyPairsInputBuilder;
5
6impl crate::operation::describe_key_pairs::builders::DescribeKeyPairsInputBuilder {
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::describe_key_pairs::DescribeKeyPairsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::describe_key_pairs::DescribeKeyPairsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.describe_key_pairs();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DescribeKeyPairs`.
24///
25/// <p>Describes the specified key pairs or all of your key pairs.</p>
26/// <p>For more information about key pairs, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html">Amazon EC2 key pairs</a> in the <i>Amazon EC2 User Guide</i>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct DescribeKeyPairsFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::describe_key_pairs::builders::DescribeKeyPairsInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::describe_key_pairs::DescribeKeyPairsOutput,
36        crate::operation::describe_key_pairs::DescribeKeyPairsError,
37    > for DescribeKeyPairsFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::describe_key_pairs::DescribeKeyPairsOutput,
45            crate::operation::describe_key_pairs::DescribeKeyPairsError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl DescribeKeyPairsFluentBuilder {
52    /// Creates a new `DescribeKeyPairsFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the DescribeKeyPairs as a reference.
61    pub fn as_input(&self) -> &crate::operation::describe_key_pairs::builders::DescribeKeyPairsInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::describe_key_pairs::DescribeKeyPairsOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::describe_key_pairs::DescribeKeyPairsError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::describe_key_pairs::DescribeKeyPairs::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::describe_key_pairs::DescribeKeyPairs::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::describe_key_pairs::DescribeKeyPairsOutput,
98        crate::operation::describe_key_pairs::DescribeKeyPairsError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    ///
113    /// Appends an item to `KeyNames`.
114    ///
115    /// To override the contents of this collection use [`set_key_names`](Self::set_key_names).
116    ///
117    /// <p>The key pair names.</p>
118    /// <p>Default: Describes all of your key pairs.</p>
119    pub fn key_names(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.inner = self.inner.key_names(input.into());
121        self
122    }
123    /// <p>The key pair names.</p>
124    /// <p>Default: Describes all of your key pairs.</p>
125    pub fn set_key_names(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
126        self.inner = self.inner.set_key_names(input);
127        self
128    }
129    /// <p>The key pair names.</p>
130    /// <p>Default: Describes all of your key pairs.</p>
131    pub fn get_key_names(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
132        self.inner.get_key_names()
133    }
134    ///
135    /// Appends an item to `KeyPairIds`.
136    ///
137    /// To override the contents of this collection use [`set_key_pair_ids`](Self::set_key_pair_ids).
138    ///
139    /// <p>The IDs of the key pairs.</p>
140    pub fn key_pair_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.key_pair_ids(input.into());
142        self
143    }
144    /// <p>The IDs of the key pairs.</p>
145    pub fn set_key_pair_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
146        self.inner = self.inner.set_key_pair_ids(input);
147        self
148    }
149    /// <p>The IDs of the key pairs.</p>
150    pub fn get_key_pair_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
151        self.inner.get_key_pair_ids()
152    }
153    /// <p>If <code>true</code>, the public key material is included in the response.</p>
154    /// <p>Default: <code>false</code></p>
155    pub fn include_public_key(mut self, input: bool) -> Self {
156        self.inner = self.inner.include_public_key(input);
157        self
158    }
159    /// <p>If <code>true</code>, the public key material is included in the response.</p>
160    /// <p>Default: <code>false</code></p>
161    pub fn set_include_public_key(mut self, input: ::std::option::Option<bool>) -> Self {
162        self.inner = self.inner.set_include_public_key(input);
163        self
164    }
165    /// <p>If <code>true</code>, the public key material is included in the response.</p>
166    /// <p>Default: <code>false</code></p>
167    pub fn get_include_public_key(&self) -> &::std::option::Option<bool> {
168        self.inner.get_include_public_key()
169    }
170    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
171    pub fn dry_run(mut self, input: bool) -> Self {
172        self.inner = self.inner.dry_run(input);
173        self
174    }
175    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
176    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
177        self.inner = self.inner.set_dry_run(input);
178        self
179    }
180    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
181    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
182        self.inner.get_dry_run()
183    }
184    ///
185    /// Appends an item to `Filters`.
186    ///
187    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
188    ///
189    /// <p>The filters.</p>
190    /// <ul>
191    /// <li>
192    /// <p><code>key-pair-id</code> - The ID of the key pair.</p></li>
193    /// <li>
194    /// <p><code>fingerprint</code> - The fingerprint of the key pair.</p></li>
195    /// <li>
196    /// <p><code>key-name</code> - The name of the key pair.</p></li>
197    /// <li>
198    /// <p><code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p></li>
199    /// <li>
200    /// <p><code>tag</code>:<key>
201    /// - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key
202    /// <code>Owner</code> and the value
203    /// <code>TeamA</code>, specify
204    /// <code>tag:Owner</code> for the filter name and
205    /// <code>TeamA</code> for the filter value.
206    /// </key></p></li>
207    /// </ul>
208    pub fn filters(mut self, input: crate::types::Filter) -> Self {
209        self.inner = self.inner.filters(input);
210        self
211    }
212    /// <p>The filters.</p>
213    /// <ul>
214    /// <li>
215    /// <p><code>key-pair-id</code> - The ID of the key pair.</p></li>
216    /// <li>
217    /// <p><code>fingerprint</code> - The fingerprint of the key pair.</p></li>
218    /// <li>
219    /// <p><code>key-name</code> - The name of the key pair.</p></li>
220    /// <li>
221    /// <p><code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p></li>
222    /// <li>
223    /// <p><code>tag</code>:<key>
224    /// - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key
225    /// <code>Owner</code> and the value
226    /// <code>TeamA</code>, specify
227    /// <code>tag:Owner</code> for the filter name and
228    /// <code>TeamA</code> for the filter value.
229    /// </key></p></li>
230    /// </ul>
231    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
232        self.inner = self.inner.set_filters(input);
233        self
234    }
235    /// <p>The filters.</p>
236    /// <ul>
237    /// <li>
238    /// <p><code>key-pair-id</code> - The ID of the key pair.</p></li>
239    /// <li>
240    /// <p><code>fingerprint</code> - The fingerprint of the key pair.</p></li>
241    /// <li>
242    /// <p><code>key-name</code> - The name of the key pair.</p></li>
243    /// <li>
244    /// <p><code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p></li>
245    /// <li>
246    /// <p><code>tag</code>:<key>
247    /// - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key
248    /// <code>Owner</code> and the value
249    /// <code>TeamA</code>, specify
250    /// <code>tag:Owner</code> for the filter name and
251    /// <code>TeamA</code> for the filter value.
252    /// </key></p></li>
253    /// </ul>
254    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
255        self.inner.get_filters()
256    }
257}