aws_sdk_ec2/operation/describe_snapshots/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::describe_snapshots::_describe_snapshots_output::DescribeSnapshotsOutputBuilder;
3
4pub use crate::operation::describe_snapshots::_describe_snapshots_input::DescribeSnapshotsInputBuilder;
5
6impl crate::operation::describe_snapshots::builders::DescribeSnapshotsInputBuilder {
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_snapshots::DescribeSnapshotsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::describe_snapshots::DescribeSnapshotsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.describe_snapshots();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DescribeSnapshots`.
24///
25/// <p>Describes the specified EBS snapshots available to you or all of the EBS snapshots available to you.</p>
26/// <p>The snapshots available to you include public snapshots, private snapshots that you own, and private snapshots owned by other Amazon Web Services accounts for which you have explicit create volume permissions.</p>
27/// <p>The create volume permissions fall into the following categories:</p>
28/// <ul>
29/// <li>
30/// <p><i>public</i>: The owner of the snapshot granted create volume permissions for the snapshot to the <code>all</code> group. All Amazon Web Services accounts have create volume permissions for these snapshots.</p></li>
31/// <li>
32/// <p><i>explicit</i>: The owner of the snapshot granted create volume permissions to a specific Amazon Web Services account.</p></li>
33/// <li>
34/// <p><i>implicit</i>: An Amazon Web Services account has implicit create volume permissions for all snapshots it owns.</p></li>
35/// </ul>
36/// <p>The list of snapshots returned can be filtered by specifying snapshot IDs, snapshot owners, or Amazon Web Services accounts with create volume permissions. If no options are specified, Amazon EC2 returns all snapshots for which you have create volume permissions.</p>
37/// <p>If you specify one or more snapshot IDs, only snapshots that have the specified IDs are returned. If you specify an invalid snapshot ID, an error is returned. If you specify a snapshot ID for which you do not have access, it is not included in the returned results.</p>
38/// <p>If you specify one or more snapshot owners using the <code>OwnerIds</code> option, only snapshots from the specified owners and for which you have access are returned. The results can include the Amazon Web Services account IDs of the specified owners, <code>amazon</code> for snapshots owned by Amazon, or <code>self</code> for snapshots that you own.</p>
39/// <p>If you specify a list of restorable users, only snapshots with create snapshot permissions for those users are returned. You can specify Amazon Web Services account IDs (if you own the snapshots), <code>self</code> for snapshots for which you own or have explicit permissions, or <code>all</code> for public snapshots.</p>
40/// <p>If you are describing a long list of snapshots, 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>
41/// <p>For more information about EBS snapshots, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-snapshots.html">Amazon EBS snapshots</a> in the <i>Amazon EBS User Guide</i>.</p><important>
42/// <p>We strongly recommend using only paginated requests. Unpaginated requests are susceptible to throttling and timeouts.</p>
43/// </important>
44#[derive(::std::clone::Clone, ::std::fmt::Debug)]
45pub struct DescribeSnapshotsFluentBuilder {
46    handle: ::std::sync::Arc<crate::client::Handle>,
47    inner: crate::operation::describe_snapshots::builders::DescribeSnapshotsInputBuilder,
48    config_override: ::std::option::Option<crate::config::Builder>,
49}
50impl
51    crate::client::customize::internal::CustomizableSend<
52        crate::operation::describe_snapshots::DescribeSnapshotsOutput,
53        crate::operation::describe_snapshots::DescribeSnapshotsError,
54    > for DescribeSnapshotsFluentBuilder
55{
56    fn send(
57        self,
58        config_override: crate::config::Builder,
59    ) -> crate::client::customize::internal::BoxFuture<
60        crate::client::customize::internal::SendResult<
61            crate::operation::describe_snapshots::DescribeSnapshotsOutput,
62            crate::operation::describe_snapshots::DescribeSnapshotsError,
63        >,
64    > {
65        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
66    }
67}
68impl DescribeSnapshotsFluentBuilder {
69    /// Creates a new `DescribeSnapshotsFluentBuilder`.
70    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
71        Self {
72            handle,
73            inner: ::std::default::Default::default(),
74            config_override: ::std::option::Option::None,
75        }
76    }
77    /// Access the DescribeSnapshots as a reference.
78    pub fn as_input(&self) -> &crate::operation::describe_snapshots::builders::DescribeSnapshotsInputBuilder {
79        &self.inner
80    }
81    /// Sends the request and returns the response.
82    ///
83    /// If an error occurs, an `SdkError` will be returned with additional details that
84    /// can be matched against.
85    ///
86    /// By default, any retryable failures will be retried twice. Retry behavior
87    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
88    /// set when configuring the client.
89    pub async fn send(
90        self,
91    ) -> ::std::result::Result<
92        crate::operation::describe_snapshots::DescribeSnapshotsOutput,
93        ::aws_smithy_runtime_api::client::result::SdkError<
94            crate::operation::describe_snapshots::DescribeSnapshotsError,
95            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
96        >,
97    > {
98        let input = self
99            .inner
100            .build()
101            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
102        let runtime_plugins = crate::operation::describe_snapshots::DescribeSnapshots::operation_runtime_plugins(
103            self.handle.runtime_plugins.clone(),
104            &self.handle.conf,
105            self.config_override,
106        );
107        crate::operation::describe_snapshots::DescribeSnapshots::orchestrate(&runtime_plugins, input).await
108    }
109
110    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
111    pub fn customize(
112        self,
113    ) -> crate::client::customize::CustomizableOperation<
114        crate::operation::describe_snapshots::DescribeSnapshotsOutput,
115        crate::operation::describe_snapshots::DescribeSnapshotsError,
116        Self,
117    > {
118        crate::client::customize::CustomizableOperation::new(self)
119    }
120    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
121        self.set_config_override(::std::option::Option::Some(config_override.into()));
122        self
123    }
124
125    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
126        self.config_override = config_override;
127        self
128    }
129    /// Create a paginator for this request
130    ///
131    /// Paginators are used by calling [`send().await`](crate::operation::describe_snapshots::paginator::DescribeSnapshotsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
132    pub fn into_paginator(self) -> crate::operation::describe_snapshots::paginator::DescribeSnapshotsPaginator {
133        crate::operation::describe_snapshots::paginator::DescribeSnapshotsPaginator::new(self.handle, self.inner)
134    }
135    /// <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>
136    pub fn max_results(mut self, input: i32) -> Self {
137        self.inner = self.inner.max_results(input);
138        self
139    }
140    /// <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>
141    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
142        self.inner = self.inner.set_max_results(input);
143        self
144    }
145    /// <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>
146    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
147        self.inner.get_max_results()
148    }
149    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
150    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151        self.inner = self.inner.next_token(input.into());
152        self
153    }
154    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
155    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
156        self.inner = self.inner.set_next_token(input);
157        self
158    }
159    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
160    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
161        self.inner.get_next_token()
162    }
163    ///
164    /// Appends an item to `OwnerIds`.
165    ///
166    /// To override the contents of this collection use [`set_owner_ids`](Self::set_owner_ids).
167    ///
168    /// <p>Scopes the results to snapshots with the specified owners. You can specify a combination of Amazon Web Services account IDs, <code>self</code>, and <code>amazon</code>.</p>
169    pub fn owner_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170        self.inner = self.inner.owner_ids(input.into());
171        self
172    }
173    /// <p>Scopes the results to snapshots with the specified owners. You can specify a combination of Amazon Web Services account IDs, <code>self</code>, and <code>amazon</code>.</p>
174    pub fn set_owner_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
175        self.inner = self.inner.set_owner_ids(input);
176        self
177    }
178    /// <p>Scopes the results to snapshots with the specified owners. You can specify a combination of Amazon Web Services account IDs, <code>self</code>, and <code>amazon</code>.</p>
179    pub fn get_owner_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
180        self.inner.get_owner_ids()
181    }
182    ///
183    /// Appends an item to `RestorableByUserIds`.
184    ///
185    /// To override the contents of this collection use [`set_restorable_by_user_ids`](Self::set_restorable_by_user_ids).
186    ///
187    /// <p>The IDs of the Amazon Web Services accounts that can create volumes from the snapshot.</p>
188    pub fn restorable_by_user_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189        self.inner = self.inner.restorable_by_user_ids(input.into());
190        self
191    }
192    /// <p>The IDs of the Amazon Web Services accounts that can create volumes from the snapshot.</p>
193    pub fn set_restorable_by_user_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
194        self.inner = self.inner.set_restorable_by_user_ids(input);
195        self
196    }
197    /// <p>The IDs of the Amazon Web Services accounts that can create volumes from the snapshot.</p>
198    pub fn get_restorable_by_user_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
199        self.inner.get_restorable_by_user_ids()
200    }
201    ///
202    /// Appends an item to `SnapshotIds`.
203    ///
204    /// To override the contents of this collection use [`set_snapshot_ids`](Self::set_snapshot_ids).
205    ///
206    /// <p>The snapshot IDs.</p>
207    /// <p>Default: Describes the snapshots for which you have create volume permissions.</p>
208    pub fn snapshot_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209        self.inner = self.inner.snapshot_ids(input.into());
210        self
211    }
212    /// <p>The snapshot IDs.</p>
213    /// <p>Default: Describes the snapshots for which you have create volume permissions.</p>
214    pub fn set_snapshot_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
215        self.inner = self.inner.set_snapshot_ids(input);
216        self
217    }
218    /// <p>The snapshot IDs.</p>
219    /// <p>Default: Describes the snapshots for which you have create volume permissions.</p>
220    pub fn get_snapshot_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
221        self.inner.get_snapshot_ids()
222    }
223    /// <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>
224    pub fn dry_run(mut self, input: bool) -> Self {
225        self.inner = self.inner.dry_run(input);
226        self
227    }
228    /// <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>
229    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
230        self.inner = self.inner.set_dry_run(input);
231        self
232    }
233    /// <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>
234    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
235        self.inner.get_dry_run()
236    }
237    ///
238    /// Appends an item to `Filters`.
239    ///
240    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
241    ///
242    /// <p>The filters.</p>
243    /// <ul>
244    /// <li>
245    /// <p><code>description</code> - A description of the snapshot.</p></li>
246    /// <li>
247    /// <p><code>encrypted</code> - Indicates whether the snapshot is encrypted (<code>true</code> | <code>false</code>)</p></li>
248    /// <li>
249    /// <p><code>owner-alias</code> - The owner alias, from an Amazon-maintained list (<code>amazon</code>). This is not the user-configured Amazon Web Services account alias set using the IAM console. We recommend that you use the related parameter instead of this filter.</p></li>
250    /// <li>
251    /// <p><code>owner-id</code> - The Amazon Web Services account ID of the owner. We recommend that you use the related parameter instead of this filter.</p></li>
252    /// <li>
253    /// <p><code>progress</code> - The progress of the snapshot, as a percentage (for example, 80%).</p></li>
254    /// <li>
255    /// <p><code>snapshot-id</code> - The snapshot ID.</p></li>
256    /// <li>
257    /// <p><code>start-time</code> - The time stamp when the snapshot was initiated.</p></li>
258    /// <li>
259    /// <p><code>status</code> - The status of the snapshot (<code>pending</code> | <code>completed</code> | <code>error</code>).</p></li>
260    /// <li>
261    /// <p><code>storage-tier</code> - The storage tier of the snapshot (<code>archive</code> | <code>standard</code>).</p></li>
262    /// <li>
263    /// <p><code>transfer-type</code> - The type of operation used to create the snapshot (<code>time-based</code> | <code>standard</code>).</p></li>
264    /// <li>
265    /// <p><code>tag</code>:<key>
266    /// - 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
267    /// <code>Owner</code> and the value
268    /// <code>TeamA</code>, specify
269    /// <code>tag:Owner</code> for the filter name and
270    /// <code>TeamA</code> for the filter value.
271    /// </key></p></li>
272    /// <li>
273    /// <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>
274    /// <li>
275    /// <p><code>volume-id</code> - The ID of the volume the snapshot is for.</p></li>
276    /// <li>
277    /// <p><code>volume-size</code> - The size of the volume, in GiB.</p></li>
278    /// </ul>
279    pub fn filters(mut self, input: crate::types::Filter) -> Self {
280        self.inner = self.inner.filters(input);
281        self
282    }
283    /// <p>The filters.</p>
284    /// <ul>
285    /// <li>
286    /// <p><code>description</code> - A description of the snapshot.</p></li>
287    /// <li>
288    /// <p><code>encrypted</code> - Indicates whether the snapshot is encrypted (<code>true</code> | <code>false</code>)</p></li>
289    /// <li>
290    /// <p><code>owner-alias</code> - The owner alias, from an Amazon-maintained list (<code>amazon</code>). This is not the user-configured Amazon Web Services account alias set using the IAM console. We recommend that you use the related parameter instead of this filter.</p></li>
291    /// <li>
292    /// <p><code>owner-id</code> - The Amazon Web Services account ID of the owner. We recommend that you use the related parameter instead of this filter.</p></li>
293    /// <li>
294    /// <p><code>progress</code> - The progress of the snapshot, as a percentage (for example, 80%).</p></li>
295    /// <li>
296    /// <p><code>snapshot-id</code> - The snapshot ID.</p></li>
297    /// <li>
298    /// <p><code>start-time</code> - The time stamp when the snapshot was initiated.</p></li>
299    /// <li>
300    /// <p><code>status</code> - The status of the snapshot (<code>pending</code> | <code>completed</code> | <code>error</code>).</p></li>
301    /// <li>
302    /// <p><code>storage-tier</code> - The storage tier of the snapshot (<code>archive</code> | <code>standard</code>).</p></li>
303    /// <li>
304    /// <p><code>transfer-type</code> - The type of operation used to create the snapshot (<code>time-based</code> | <code>standard</code>).</p></li>
305    /// <li>
306    /// <p><code>tag</code>:<key>
307    /// - 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
308    /// <code>Owner</code> and the value
309    /// <code>TeamA</code>, specify
310    /// <code>tag:Owner</code> for the filter name and
311    /// <code>TeamA</code> for the filter value.
312    /// </key></p></li>
313    /// <li>
314    /// <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>
315    /// <li>
316    /// <p><code>volume-id</code> - The ID of the volume the snapshot is for.</p></li>
317    /// <li>
318    /// <p><code>volume-size</code> - The size of the volume, in GiB.</p></li>
319    /// </ul>
320    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
321        self.inner = self.inner.set_filters(input);
322        self
323    }
324    /// <p>The filters.</p>
325    /// <ul>
326    /// <li>
327    /// <p><code>description</code> - A description of the snapshot.</p></li>
328    /// <li>
329    /// <p><code>encrypted</code> - Indicates whether the snapshot is encrypted (<code>true</code> | <code>false</code>)</p></li>
330    /// <li>
331    /// <p><code>owner-alias</code> - The owner alias, from an Amazon-maintained list (<code>amazon</code>). This is not the user-configured Amazon Web Services account alias set using the IAM console. We recommend that you use the related parameter instead of this filter.</p></li>
332    /// <li>
333    /// <p><code>owner-id</code> - The Amazon Web Services account ID of the owner. We recommend that you use the related parameter instead of this filter.</p></li>
334    /// <li>
335    /// <p><code>progress</code> - The progress of the snapshot, as a percentage (for example, 80%).</p></li>
336    /// <li>
337    /// <p><code>snapshot-id</code> - The snapshot ID.</p></li>
338    /// <li>
339    /// <p><code>start-time</code> - The time stamp when the snapshot was initiated.</p></li>
340    /// <li>
341    /// <p><code>status</code> - The status of the snapshot (<code>pending</code> | <code>completed</code> | <code>error</code>).</p></li>
342    /// <li>
343    /// <p><code>storage-tier</code> - The storage tier of the snapshot (<code>archive</code> | <code>standard</code>).</p></li>
344    /// <li>
345    /// <p><code>transfer-type</code> - The type of operation used to create the snapshot (<code>time-based</code> | <code>standard</code>).</p></li>
346    /// <li>
347    /// <p><code>tag</code>:<key>
348    /// - 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
349    /// <code>Owner</code> and the value
350    /// <code>TeamA</code>, specify
351    /// <code>tag:Owner</code> for the filter name and
352    /// <code>TeamA</code> for the filter value.
353    /// </key></p></li>
354    /// <li>
355    /// <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>
356    /// <li>
357    /// <p><code>volume-id</code> - The ID of the volume the snapshot is for.</p></li>
358    /// <li>
359    /// <p><code>volume-size</code> - The size of the volume, in GiB.</p></li>
360    /// </ul>
361    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
362        self.inner.get_filters()
363    }
364}