aws_sdk_ec2/operation/describe_volumes/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::describe_volumes::_describe_volumes_output::DescribeVolumesOutputBuilder;
3
4pub use crate::operation::describe_volumes::_describe_volumes_input::DescribeVolumesInputBuilder;
5
6impl crate::operation::describe_volumes::builders::DescribeVolumesInputBuilder {
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_volumes::DescribeVolumesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::describe_volumes::DescribeVolumesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.describe_volumes();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DescribeVolumes`.
24///
25/// <p>Describes the specified EBS volumes or all of your EBS volumes.</p>
26/// <p>If you are describing a long list of volumes, we recommend that you paginate the output to make the list more manageable. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
27/// <p>For more information about EBS volumes, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volumes.html">Amazon EBS volumes</a> in the <i>Amazon EBS User Guide</i>.</p><important>
28/// <p>We strongly recommend using only paginated requests. Unpaginated requests are susceptible to throttling and timeouts.</p>
29/// </important> <note>
30/// <p>The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.</p>
31/// </note>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct DescribeVolumesFluentBuilder {
34    handle: ::std::sync::Arc<crate::client::Handle>,
35    inner: crate::operation::describe_volumes::builders::DescribeVolumesInputBuilder,
36    config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39    crate::client::customize::internal::CustomizableSend<
40        crate::operation::describe_volumes::DescribeVolumesOutput,
41        crate::operation::describe_volumes::DescribeVolumesError,
42    > for DescribeVolumesFluentBuilder
43{
44    fn send(
45        self,
46        config_override: crate::config::Builder,
47    ) -> crate::client::customize::internal::BoxFuture<
48        crate::client::customize::internal::SendResult<
49            crate::operation::describe_volumes::DescribeVolumesOutput,
50            crate::operation::describe_volumes::DescribeVolumesError,
51        >,
52    > {
53        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54    }
55}
56impl DescribeVolumesFluentBuilder {
57    /// Creates a new `DescribeVolumesFluentBuilder`.
58    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59        Self {
60            handle,
61            inner: ::std::default::Default::default(),
62            config_override: ::std::option::Option::None,
63        }
64    }
65    /// Access the DescribeVolumes as a reference.
66    pub fn as_input(&self) -> &crate::operation::describe_volumes::builders::DescribeVolumesInputBuilder {
67        &self.inner
68    }
69    /// Sends the request and returns the response.
70    ///
71    /// If an error occurs, an `SdkError` will be returned with additional details that
72    /// can be matched against.
73    ///
74    /// By default, any retryable failures will be retried twice. Retry behavior
75    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76    /// set when configuring the client.
77    pub async fn send(
78        self,
79    ) -> ::std::result::Result<
80        crate::operation::describe_volumes::DescribeVolumesOutput,
81        ::aws_smithy_runtime_api::client::result::SdkError<
82            crate::operation::describe_volumes::DescribeVolumesError,
83            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84        >,
85    > {
86        let input = self
87            .inner
88            .build()
89            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90        let runtime_plugins = crate::operation::describe_volumes::DescribeVolumes::operation_runtime_plugins(
91            self.handle.runtime_plugins.clone(),
92            &self.handle.conf,
93            self.config_override,
94        );
95        crate::operation::describe_volumes::DescribeVolumes::orchestrate(&runtime_plugins, input).await
96    }
97
98    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99    pub fn customize(
100        self,
101    ) -> crate::client::customize::CustomizableOperation<
102        crate::operation::describe_volumes::DescribeVolumesOutput,
103        crate::operation::describe_volumes::DescribeVolumesError,
104        Self,
105    > {
106        crate::client::customize::CustomizableOperation::new(self)
107    }
108    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109        self.set_config_override(::std::option::Option::Some(config_override.into()));
110        self
111    }
112
113    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114        self.config_override = config_override;
115        self
116    }
117    /// Create a paginator for this request
118    ///
119    /// Paginators are used by calling [`send().await`](crate::operation::describe_volumes::paginator::DescribeVolumesPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
120    pub fn into_paginator(self) -> crate::operation::describe_volumes::paginator::DescribeVolumesPaginator {
121        crate::operation::describe_volumes::paginator::DescribeVolumesPaginator::new(self.handle, self.inner)
122    }
123    ///
124    /// Appends an item to `VolumeIds`.
125    ///
126    /// To override the contents of this collection use [`set_volume_ids`](Self::set_volume_ids).
127    ///
128    /// <p>The volume IDs. If not specified, then all volumes are included in the response.</p>
129    pub fn volume_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.volume_ids(input.into());
131        self
132    }
133    /// <p>The volume IDs. If not specified, then all volumes are included in the response.</p>
134    pub fn set_volume_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
135        self.inner = self.inner.set_volume_ids(input);
136        self
137    }
138    /// <p>The volume IDs. If not specified, then all volumes are included in the response.</p>
139    pub fn get_volume_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
140        self.inner.get_volume_ids()
141    }
142    /// <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>
143    pub fn dry_run(mut self, input: bool) -> Self {
144        self.inner = self.inner.dry_run(input);
145        self
146    }
147    /// <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>
148    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
149        self.inner = self.inner.set_dry_run(input);
150        self
151    }
152    /// <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>
153    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
154        self.inner.get_dry_run()
155    }
156    ///
157    /// Appends an item to `Filters`.
158    ///
159    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
160    ///
161    /// <p>The filters.</p>
162    /// <ul>
163    /// <li>
164    /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
165    /// <li>
166    /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
167    /// <li>
168    /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
169    /// <li>
170    /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
171    /// <li>
172    /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
173    /// <li>
174    /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
175    /// <li>
176    /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
177    /// <li>
178    /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
179    /// <li>
180    /// <p><code>fast-restored</code> - Indicates whether the volume was created from a snapshot that is enabled for fast snapshot restore (<code>true</code> | <code>false</code>).</p></li>
181    /// <li>
182    /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
183    /// <li>
184    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
185    /// <li>
186    /// <p><code>operator.principal</code> - The principal that manages the volume. Only valid for managed volumes, where <code>managed</code> is <code>true</code>.</p></li>
187    /// <li>
188    /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
189    /// <li>
190    /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
191    /// <li>
192    /// <p><code>status</code> - The state of the volume (<code>creating</code> | <code>available</code> | <code>in-use</code> | <code>deleting</code> | <code>deleted</code> | <code>error</code>).</p></li>
193    /// <li>
194    /// <p><code>tag</code>:<key>
195    /// - 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
196    /// <code>Owner</code> and the value
197    /// <code>TeamA</code>, specify
198    /// <code>tag:Owner</code> for the filter name and
199    /// <code>TeamA</code> for the filter value.
200    /// </key></p></li>
201    /// <li>
202    /// <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>
203    /// <li>
204    /// <p><code>volume-id</code> - The volume ID.</p></li>
205    /// <li>
206    /// <p><code>volume-type</code> - The Amazon EBS volume type (<code>gp2</code> | <code>gp3</code> | <code>io1</code> | <code>io2</code> | <code>st1</code> | <code>sc1</code>| <code>standard</code>)</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>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
216    /// <li>
217    /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
218    /// <li>
219    /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
220    /// <li>
221    /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
222    /// <li>
223    /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
224    /// <li>
225    /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
226    /// <li>
227    /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
228    /// <li>
229    /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
230    /// <li>
231    /// <p><code>fast-restored</code> - Indicates whether the volume was created from a snapshot that is enabled for fast snapshot restore (<code>true</code> | <code>false</code>).</p></li>
232    /// <li>
233    /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
234    /// <li>
235    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
236    /// <li>
237    /// <p><code>operator.principal</code> - The principal that manages the volume. Only valid for managed volumes, where <code>managed</code> is <code>true</code>.</p></li>
238    /// <li>
239    /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
240    /// <li>
241    /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
242    /// <li>
243    /// <p><code>status</code> - The state of the volume (<code>creating</code> | <code>available</code> | <code>in-use</code> | <code>deleting</code> | <code>deleted</code> | <code>error</code>).</p></li>
244    /// <li>
245    /// <p><code>tag</code>:<key>
246    /// - 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
247    /// <code>Owner</code> and the value
248    /// <code>TeamA</code>, specify
249    /// <code>tag:Owner</code> for the filter name and
250    /// <code>TeamA</code> for the filter value.
251    /// </key></p></li>
252    /// <li>
253    /// <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>
254    /// <li>
255    /// <p><code>volume-id</code> - The volume ID.</p></li>
256    /// <li>
257    /// <p><code>volume-type</code> - The Amazon EBS volume type (<code>gp2</code> | <code>gp3</code> | <code>io1</code> | <code>io2</code> | <code>st1</code> | <code>sc1</code>| <code>standard</code>)</p></li>
258    /// </ul>
259    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
260        self.inner = self.inner.set_filters(input);
261        self
262    }
263    /// <p>The filters.</p>
264    /// <ul>
265    /// <li>
266    /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
267    /// <li>
268    /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
269    /// <li>
270    /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
271    /// <li>
272    /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
273    /// <li>
274    /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
275    /// <li>
276    /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
277    /// <li>
278    /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
279    /// <li>
280    /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
281    /// <li>
282    /// <p><code>fast-restored</code> - Indicates whether the volume was created from a snapshot that is enabled for fast snapshot restore (<code>true</code> | <code>false</code>).</p></li>
283    /// <li>
284    /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
285    /// <li>
286    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
287    /// <li>
288    /// <p><code>operator.principal</code> - The principal that manages the volume. Only valid for managed volumes, where <code>managed</code> is <code>true</code>.</p></li>
289    /// <li>
290    /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
291    /// <li>
292    /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
293    /// <li>
294    /// <p><code>status</code> - The state of the volume (<code>creating</code> | <code>available</code> | <code>in-use</code> | <code>deleting</code> | <code>deleted</code> | <code>error</code>).</p></li>
295    /// <li>
296    /// <p><code>tag</code>:<key>
297    /// - 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
298    /// <code>Owner</code> and the value
299    /// <code>TeamA</code>, specify
300    /// <code>tag:Owner</code> for the filter name and
301    /// <code>TeamA</code> for the filter value.
302    /// </key></p></li>
303    /// <li>
304    /// <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>
305    /// <li>
306    /// <p><code>volume-id</code> - The volume ID.</p></li>
307    /// <li>
308    /// <p><code>volume-type</code> - The Amazon EBS volume type (<code>gp2</code> | <code>gp3</code> | <code>io1</code> | <code>io2</code> | <code>st1</code> | <code>sc1</code>| <code>standard</code>)</p></li>
309    /// </ul>
310    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
311        self.inner.get_filters()
312    }
313    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
314    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
315        self.inner = self.inner.next_token(input.into());
316        self
317    }
318    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
319    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
320        self.inner = self.inner.set_next_token(input);
321        self
322    }
323    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
324    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
325        self.inner.get_next_token()
326    }
327    /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
328    pub fn max_results(mut self, input: i32) -> Self {
329        self.inner = self.inner.max_results(input);
330        self
331    }
332    /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
333    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
334        self.inner = self.inner.set_max_results(input);
335        self
336    }
337    /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
338    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
339        self.inner.get_max_results()
340    }
341}