aws_sdk_ec2/operation/describe_hosts/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::describe_hosts::_describe_hosts_output::DescribeHostsOutputBuilder;
3
4pub use crate::operation::describe_hosts::_describe_hosts_input::DescribeHostsInputBuilder;
5
6impl crate::operation::describe_hosts::builders::DescribeHostsInputBuilder {
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_hosts::DescribeHostsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::describe_hosts::DescribeHostsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.describe_hosts();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DescribeHosts`.
24///
25/// <p>Describes the specified Dedicated Hosts or all your Dedicated Hosts.</p>
26/// <p>The results describe only the Dedicated Hosts in the Region you're currently using. All listed instances consume capacity on your Dedicated Host. Dedicated Hosts that have recently been released are listed with the state <code>released</code>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct DescribeHostsFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::describe_hosts::builders::DescribeHostsInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::describe_hosts::DescribeHostsOutput,
36        crate::operation::describe_hosts::DescribeHostsError,
37    > for DescribeHostsFluentBuilder
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_hosts::DescribeHostsOutput,
45            crate::operation::describe_hosts::DescribeHostsError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl DescribeHostsFluentBuilder {
52    /// Creates a new `DescribeHostsFluentBuilder`.
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 DescribeHosts as a reference.
61    pub fn as_input(&self) -> &crate::operation::describe_hosts::builders::DescribeHostsInputBuilder {
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_hosts::DescribeHostsOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::describe_hosts::DescribeHostsError,
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_hosts::DescribeHosts::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::describe_hosts::DescribeHosts::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_hosts::DescribeHostsOutput,
98        crate::operation::describe_hosts::DescribeHostsError,
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    /// Create a paginator for this request
113    ///
114    /// Paginators are used by calling [`send().await`](crate::operation::describe_hosts::paginator::DescribeHostsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
115    pub fn into_paginator(self) -> crate::operation::describe_hosts::paginator::DescribeHostsPaginator {
116        crate::operation::describe_hosts::paginator::DescribeHostsPaginator::new(self.handle, self.inner)
117    }
118    ///
119    /// Appends an item to `HostIds`.
120    ///
121    /// To override the contents of this collection use [`set_host_ids`](Self::set_host_ids).
122    ///
123    /// <p>The IDs of the Dedicated Hosts. The IDs are used for targeted instance launches.</p>
124    pub fn host_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.inner = self.inner.host_ids(input.into());
126        self
127    }
128    /// <p>The IDs of the Dedicated Hosts. The IDs are used for targeted instance launches.</p>
129    pub fn set_host_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
130        self.inner = self.inner.set_host_ids(input);
131        self
132    }
133    /// <p>The IDs of the Dedicated Hosts. The IDs are used for targeted instance launches.</p>
134    pub fn get_host_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
135        self.inner.get_host_ids()
136    }
137    /// <p>The token to use to retrieve the next page of results.</p>
138    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.inner = self.inner.next_token(input.into());
140        self
141    }
142    /// <p>The token to use to retrieve the next page of results.</p>
143    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144        self.inner = self.inner.set_next_token(input);
145        self
146    }
147    /// <p>The token to use to retrieve the next page of results.</p>
148    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
149        self.inner.get_next_token()
150    }
151    /// <p>The maximum number of results to return for the request in a single page. The remaining results can be seen by sending another request with the returned <code>nextToken</code> value. This value can be between 5 and 500. If <code>maxResults</code> is given a larger value than 500, you receive an error.</p>
152    /// <p>You cannot specify this parameter and the host IDs parameter in the same request.</p>
153    pub fn max_results(mut self, input: i32) -> Self {
154        self.inner = self.inner.max_results(input);
155        self
156    }
157    /// <p>The maximum number of results to return for the request in a single page. The remaining results can be seen by sending another request with the returned <code>nextToken</code> value. This value can be between 5 and 500. If <code>maxResults</code> is given a larger value than 500, you receive an error.</p>
158    /// <p>You cannot specify this parameter and the host IDs parameter in the same request.</p>
159    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
160        self.inner = self.inner.set_max_results(input);
161        self
162    }
163    /// <p>The maximum number of results to return for the request in a single page. The remaining results can be seen by sending another request with the returned <code>nextToken</code> value. This value can be between 5 and 500. If <code>maxResults</code> is given a larger value than 500, you receive an error.</p>
164    /// <p>You cannot specify this parameter and the host IDs parameter in the same request.</p>
165    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
166        self.inner.get_max_results()
167    }
168    ///
169    /// Appends an item to `Filter`.
170    ///
171    /// To override the contents of this collection use [`set_filter`](Self::set_filter).
172    ///
173    /// <p>The filters.</p>
174    /// <ul>
175    /// <li>
176    /// <p><code>auto-placement</code> - Whether auto-placement is enabled or disabled (<code>on</code> | <code>off</code>).</p></li>
177    /// <li>
178    /// <p><code>availability-zone</code> - The Availability Zone of the host.</p></li>
179    /// <li>
180    /// <p><code>client-token</code> - The idempotency token that you provided when you allocated the host.</p></li>
181    /// <li>
182    /// <p><code>host-reservation-id</code> - The ID of the reservation assigned to this host.</p></li>
183    /// <li>
184    /// <p><code>instance-type</code> - The instance type size that the Dedicated Host is configured to support.</p></li>
185    /// <li>
186    /// <p><code>state</code> - The allocation state of the Dedicated Host (<code>available</code> | <code>under-assessment</code> | <code>permanent-failure</code> | <code>released</code> | <code>released-permanent-failure</code>).</p></li>
187    /// <li>
188    /// <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>
189    /// </ul>
190    pub fn filter(mut self, input: crate::types::Filter) -> Self {
191        self.inner = self.inner.filter(input);
192        self
193    }
194    /// <p>The filters.</p>
195    /// <ul>
196    /// <li>
197    /// <p><code>auto-placement</code> - Whether auto-placement is enabled or disabled (<code>on</code> | <code>off</code>).</p></li>
198    /// <li>
199    /// <p><code>availability-zone</code> - The Availability Zone of the host.</p></li>
200    /// <li>
201    /// <p><code>client-token</code> - The idempotency token that you provided when you allocated the host.</p></li>
202    /// <li>
203    /// <p><code>host-reservation-id</code> - The ID of the reservation assigned to this host.</p></li>
204    /// <li>
205    /// <p><code>instance-type</code> - The instance type size that the Dedicated Host is configured to support.</p></li>
206    /// <li>
207    /// <p><code>state</code> - The allocation state of the Dedicated Host (<code>available</code> | <code>under-assessment</code> | <code>permanent-failure</code> | <code>released</code> | <code>released-permanent-failure</code>).</p></li>
208    /// <li>
209    /// <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>
210    /// </ul>
211    pub fn set_filter(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
212        self.inner = self.inner.set_filter(input);
213        self
214    }
215    /// <p>The filters.</p>
216    /// <ul>
217    /// <li>
218    /// <p><code>auto-placement</code> - Whether auto-placement is enabled or disabled (<code>on</code> | <code>off</code>).</p></li>
219    /// <li>
220    /// <p><code>availability-zone</code> - The Availability Zone of the host.</p></li>
221    /// <li>
222    /// <p><code>client-token</code> - The idempotency token that you provided when you allocated the host.</p></li>
223    /// <li>
224    /// <p><code>host-reservation-id</code> - The ID of the reservation assigned to this host.</p></li>
225    /// <li>
226    /// <p><code>instance-type</code> - The instance type size that the Dedicated Host is configured to support.</p></li>
227    /// <li>
228    /// <p><code>state</code> - The allocation state of the Dedicated Host (<code>available</code> | <code>under-assessment</code> | <code>permanent-failure</code> | <code>released</code> | <code>released-permanent-failure</code>).</p></li>
229    /// <li>
230    /// <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>
231    /// </ul>
232    pub fn get_filter(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
233        self.inner.get_filter()
234    }
235}