aws_sdk_ec2/operation/describe_instance_credit_specifications/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::describe_instance_credit_specifications::_describe_instance_credit_specifications_output::DescribeInstanceCreditSpecificationsOutputBuilder;
3
4pub use crate::operation::describe_instance_credit_specifications::_describe_instance_credit_specifications_input::DescribeInstanceCreditSpecificationsInputBuilder;
5
6impl crate::operation::describe_instance_credit_specifications::builders::DescribeInstanceCreditSpecificationsInputBuilder {
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_instance_credit_specifications::DescribeInstanceCreditSpecificationsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecificationsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.describe_instance_credit_specifications();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DescribeInstanceCreditSpecifications`.
24///
25/// <p>Describes the credit option for CPU usage of the specified burstable performance instances. The credit options are <code>standard</code> and <code>unlimited</code>.</p>
26/// <p>If you do not specify an instance ID, Amazon EC2 returns burstable performance instances with the <code>unlimited</code> credit option, as well as instances that were previously configured as T2, T3, and T3a with the <code>unlimited</code> credit option. For example, if you resize a T2 instance, while it is configured as <code>unlimited</code>, to an M4 instance, Amazon EC2 returns the M4 instance.</p>
27/// <p>If you specify one or more instance IDs, Amazon EC2 returns the credit option (<code>standard</code> or <code>unlimited</code>) of those instances. If you specify an instance ID that is not valid, such as an instance that is not a burstable performance instance, an error is returned.</p>
28/// <p>Recently terminated instances might appear in the returned results. This interval is usually less than one hour.</p>
29/// <p>If an Availability Zone is experiencing a service disruption and you specify instance IDs in the affected zone, or do not specify any instance IDs at all, the call fails. If you specify only instance IDs in an unaffected zone, the call works normally.</p>
30/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html">Burstable performance instances</a> in the <i>Amazon EC2 User Guide</i>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct DescribeInstanceCreditSpecificationsFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::describe_instance_credit_specifications::builders::DescribeInstanceCreditSpecificationsInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecificationsOutput,
40        crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecificationsError,
41    > for DescribeInstanceCreditSpecificationsFluentBuilder
42{
43    fn send(
44        self,
45        config_override: crate::config::Builder,
46    ) -> crate::client::customize::internal::BoxFuture<
47        crate::client::customize::internal::SendResult<
48            crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecificationsOutput,
49            crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecificationsError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl DescribeInstanceCreditSpecificationsFluentBuilder {
56    /// Creates a new `DescribeInstanceCreditSpecificationsFluentBuilder`.
57    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58        Self {
59            handle,
60            inner: ::std::default::Default::default(),
61            config_override: ::std::option::Option::None,
62        }
63    }
64    /// Access the DescribeInstanceCreditSpecifications as a reference.
65    pub fn as_input(&self) -> &crate::operation::describe_instance_credit_specifications::builders::DescribeInstanceCreditSpecificationsInputBuilder {
66        &self.inner
67    }
68    /// Sends the request and returns the response.
69    ///
70    /// If an error occurs, an `SdkError` will be returned with additional details that
71    /// can be matched against.
72    ///
73    /// By default, any retryable failures will be retried twice. Retry behavior
74    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75    /// set when configuring the client.
76    pub async fn send(
77        self,
78    ) -> ::std::result::Result<
79        crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecificationsOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecificationsError,
82            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83        >,
84    > {
85        let input = self
86            .inner
87            .build()
88            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89        let runtime_plugins =
90            crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecifications::operation_runtime_plugins(
91                self.handle.runtime_plugins.clone(),
92                &self.handle.conf,
93                self.config_override,
94            );
95        crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecifications::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_instance_credit_specifications::DescribeInstanceCreditSpecificationsOutput,
103        crate::operation::describe_instance_credit_specifications::DescribeInstanceCreditSpecificationsError,
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_instance_credit_specifications::paginator::DescribeInstanceCreditSpecificationsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
120    pub fn into_paginator(
121        self,
122    ) -> crate::operation::describe_instance_credit_specifications::paginator::DescribeInstanceCreditSpecificationsPaginator {
123        crate::operation::describe_instance_credit_specifications::paginator::DescribeInstanceCreditSpecificationsPaginator::new(
124            self.handle,
125            self.inner,
126        )
127    }
128    /// <p>Checks whether you have the required permissions for the operation, 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>
129    pub fn dry_run(mut self, input: bool) -> Self {
130        self.inner = self.inner.dry_run(input);
131        self
132    }
133    /// <p>Checks whether you have the required permissions for the operation, 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>
134    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
135        self.inner = self.inner.set_dry_run(input);
136        self
137    }
138    /// <p>Checks whether you have the required permissions for the operation, 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>
139    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
140        self.inner.get_dry_run()
141    }
142    ///
143    /// Appends an item to `Filters`.
144    ///
145    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
146    ///
147    /// <p>The filters.</p>
148    /// <ul>
149    /// <li>
150    /// <p><code>instance-id</code> - The ID of the instance.</p></li>
151    /// </ul>
152    pub fn filters(mut self, input: crate::types::Filter) -> Self {
153        self.inner = self.inner.filters(input);
154        self
155    }
156    /// <p>The filters.</p>
157    /// <ul>
158    /// <li>
159    /// <p><code>instance-id</code> - The ID of the instance.</p></li>
160    /// </ul>
161    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
162        self.inner = self.inner.set_filters(input);
163        self
164    }
165    /// <p>The filters.</p>
166    /// <ul>
167    /// <li>
168    /// <p><code>instance-id</code> - The ID of the instance.</p></li>
169    /// </ul>
170    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
171        self.inner.get_filters()
172    }
173    ///
174    /// Appends an item to `InstanceIds`.
175    ///
176    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
177    ///
178    /// <p>The instance IDs.</p>
179    /// <p>Default: Describes all your instances.</p>
180    /// <p>Constraints: Maximum 1000 explicitly specified instance IDs.</p>
181    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
182        self.inner = self.inner.instance_ids(input.into());
183        self
184    }
185    /// <p>The instance IDs.</p>
186    /// <p>Default: Describes all your instances.</p>
187    /// <p>Constraints: Maximum 1000 explicitly specified instance IDs.</p>
188    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
189        self.inner = self.inner.set_instance_ids(input);
190        self
191    }
192    /// <p>The instance IDs.</p>
193    /// <p>Default: Describes all your instances.</p>
194    /// <p>Constraints: Maximum 1000 explicitly specified instance IDs.</p>
195    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
196        self.inner.get_instance_ids()
197    }
198    /// <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>
199    /// <p>You cannot specify this parameter and the instance IDs parameter in the same call.</p>
200    pub fn max_results(mut self, input: i32) -> Self {
201        self.inner = self.inner.max_results(input);
202        self
203    }
204    /// <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>
205    /// <p>You cannot specify this parameter and the instance IDs parameter in the same call.</p>
206    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
207        self.inner = self.inner.set_max_results(input);
208        self
209    }
210    /// <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>
211    /// <p>You cannot specify this parameter and the instance IDs parameter in the same call.</p>
212    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
213        self.inner.get_max_results()
214    }
215    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
216    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217        self.inner = self.inner.next_token(input.into());
218        self
219    }
220    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
221    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222        self.inner = self.inner.set_next_token(input);
223        self
224    }
225    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
226    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
227        self.inner.get_next_token()
228    }
229}