aws_sdk_ec2/operation/describe_scheduled_instance_availability/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::describe_scheduled_instance_availability::_describe_scheduled_instance_availability_output::DescribeScheduledInstanceAvailabilityOutputBuilder;
3
4pub use crate::operation::describe_scheduled_instance_availability::_describe_scheduled_instance_availability_input::DescribeScheduledInstanceAvailabilityInputBuilder;
5
6impl crate::operation::describe_scheduled_instance_availability::builders::DescribeScheduledInstanceAvailabilityInputBuilder {
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_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.describe_scheduled_instance_availability();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DescribeScheduledInstanceAvailability`.
24///
25/// <p>Finds available schedules that meet the specified criteria.</p>
26/// <p>You can search for an available schedule no more than 3 months in advance. You must meet the minimum required duration of 1,200 hours per year. For example, the minimum daily schedule is 4 hours, the minimum weekly schedule is 24 hours, and the minimum monthly schedule is 100 hours.</p>
27/// <p>After you find a schedule that meets your needs, call <code>PurchaseScheduledInstances</code> to purchase Scheduled Instances with that schedule.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct DescribeScheduledInstanceAvailabilityFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::describe_scheduled_instance_availability::builders::DescribeScheduledInstanceAvailabilityInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityOutput,
37        crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityError,
38    > for DescribeScheduledInstanceAvailabilityFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityOutput,
46            crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl DescribeScheduledInstanceAvailabilityFluentBuilder {
53    /// Creates a new `DescribeScheduledInstanceAvailabilityFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the DescribeScheduledInstanceAvailability as a reference.
62    pub fn as_input(
63        &self,
64    ) -> &crate::operation::describe_scheduled_instance_availability::builders::DescribeScheduledInstanceAvailabilityInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins =
89            crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailability::operation_runtime_plugins(
90                self.handle.runtime_plugins.clone(),
91                &self.handle.conf,
92                self.config_override,
93            );
94        crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailability::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityOutput,
102        crate::operation::describe_scheduled_instance_availability::DescribeScheduledInstanceAvailabilityError,
103        Self,
104    > {
105        crate::client::customize::CustomizableOperation::new(self)
106    }
107    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108        self.set_config_override(::std::option::Option::Some(config_override.into()));
109        self
110    }
111
112    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113        self.config_override = config_override;
114        self
115    }
116    /// Create a paginator for this request
117    ///
118    /// Paginators are used by calling [`send().await`](crate::operation::describe_scheduled_instance_availability::paginator::DescribeScheduledInstanceAvailabilityPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
119    pub fn into_paginator(
120        self,
121    ) -> crate::operation::describe_scheduled_instance_availability::paginator::DescribeScheduledInstanceAvailabilityPaginator {
122        crate::operation::describe_scheduled_instance_availability::paginator::DescribeScheduledInstanceAvailabilityPaginator::new(
123            self.handle,
124            self.inner,
125        )
126    }
127    /// <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>
128    pub fn dry_run(mut self, input: bool) -> Self {
129        self.inner = self.inner.dry_run(input);
130        self
131    }
132    /// <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>
133    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
134        self.inner = self.inner.set_dry_run(input);
135        self
136    }
137    /// <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>
138    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
139        self.inner.get_dry_run()
140    }
141    ///
142    /// Appends an item to `Filters`.
143    ///
144    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
145    ///
146    /// <p>The filters.</p>
147    /// <ul>
148    /// <li>
149    /// <p><code>availability-zone</code> - The Availability Zone (for example, <code>us-west-2a</code>).</p></li>
150    /// <li>
151    /// <p><code>instance-type</code> - The instance type (for example, <code>c4.large</code>).</p></li>
152    /// <li>
153    /// <p><code>platform</code> - The platform (<code>Linux/UNIX</code> or <code>Windows</code>).</p></li>
154    /// </ul>
155    pub fn filters(mut self, input: crate::types::Filter) -> Self {
156        self.inner = self.inner.filters(input);
157        self
158    }
159    /// <p>The filters.</p>
160    /// <ul>
161    /// <li>
162    /// <p><code>availability-zone</code> - The Availability Zone (for example, <code>us-west-2a</code>).</p></li>
163    /// <li>
164    /// <p><code>instance-type</code> - The instance type (for example, <code>c4.large</code>).</p></li>
165    /// <li>
166    /// <p><code>platform</code> - The platform (<code>Linux/UNIX</code> or <code>Windows</code>).</p></li>
167    /// </ul>
168    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
169        self.inner = self.inner.set_filters(input);
170        self
171    }
172    /// <p>The filters.</p>
173    /// <ul>
174    /// <li>
175    /// <p><code>availability-zone</code> - The Availability Zone (for example, <code>us-west-2a</code>).</p></li>
176    /// <li>
177    /// <p><code>instance-type</code> - The instance type (for example, <code>c4.large</code>).</p></li>
178    /// <li>
179    /// <p><code>platform</code> - The platform (<code>Linux/UNIX</code> or <code>Windows</code>).</p></li>
180    /// </ul>
181    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
182        self.inner.get_filters()
183    }
184    /// <p>The time period for the first schedule to start.</p>
185    pub fn first_slot_start_time_range(mut self, input: crate::types::SlotDateTimeRangeRequest) -> Self {
186        self.inner = self.inner.first_slot_start_time_range(input);
187        self
188    }
189    /// <p>The time period for the first schedule to start.</p>
190    pub fn set_first_slot_start_time_range(mut self, input: ::std::option::Option<crate::types::SlotDateTimeRangeRequest>) -> Self {
191        self.inner = self.inner.set_first_slot_start_time_range(input);
192        self
193    }
194    /// <p>The time period for the first schedule to start.</p>
195    pub fn get_first_slot_start_time_range(&self) -> &::std::option::Option<crate::types::SlotDateTimeRangeRequest> {
196        self.inner.get_first_slot_start_time_range()
197    }
198    /// <p>The maximum number of results to return in a single call. This value can be between 5 and 300. The default value is 300. To retrieve the remaining results, make another call with the returned <code>NextToken</code> value.</p>
199    pub fn max_results(mut self, input: i32) -> Self {
200        self.inner = self.inner.max_results(input);
201        self
202    }
203    /// <p>The maximum number of results to return in a single call. This value can be between 5 and 300. The default value is 300. To retrieve the remaining results, make another call with the returned <code>NextToken</code> value.</p>
204    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
205        self.inner = self.inner.set_max_results(input);
206        self
207    }
208    /// <p>The maximum number of results to return in a single call. This value can be between 5 and 300. The default value is 300. To retrieve the remaining results, make another call with the returned <code>NextToken</code> value.</p>
209    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
210        self.inner.get_max_results()
211    }
212    /// <p>The maximum available duration, in hours. This value must be greater than <code>MinSlotDurationInHours</code> and less than 1,720.</p>
213    pub fn max_slot_duration_in_hours(mut self, input: i32) -> Self {
214        self.inner = self.inner.max_slot_duration_in_hours(input);
215        self
216    }
217    /// <p>The maximum available duration, in hours. This value must be greater than <code>MinSlotDurationInHours</code> and less than 1,720.</p>
218    pub fn set_max_slot_duration_in_hours(mut self, input: ::std::option::Option<i32>) -> Self {
219        self.inner = self.inner.set_max_slot_duration_in_hours(input);
220        self
221    }
222    /// <p>The maximum available duration, in hours. This value must be greater than <code>MinSlotDurationInHours</code> and less than 1,720.</p>
223    pub fn get_max_slot_duration_in_hours(&self) -> &::std::option::Option<i32> {
224        self.inner.get_max_slot_duration_in_hours()
225    }
226    /// <p>The minimum available duration, in hours. The minimum required duration is 1,200 hours per year. For example, the minimum daily schedule is 4 hours, the minimum weekly schedule is 24 hours, and the minimum monthly schedule is 100 hours.</p>
227    pub fn min_slot_duration_in_hours(mut self, input: i32) -> Self {
228        self.inner = self.inner.min_slot_duration_in_hours(input);
229        self
230    }
231    /// <p>The minimum available duration, in hours. The minimum required duration is 1,200 hours per year. For example, the minimum daily schedule is 4 hours, the minimum weekly schedule is 24 hours, and the minimum monthly schedule is 100 hours.</p>
232    pub fn set_min_slot_duration_in_hours(mut self, input: ::std::option::Option<i32>) -> Self {
233        self.inner = self.inner.set_min_slot_duration_in_hours(input);
234        self
235    }
236    /// <p>The minimum available duration, in hours. The minimum required duration is 1,200 hours per year. For example, the minimum daily schedule is 4 hours, the minimum weekly schedule is 24 hours, and the minimum monthly schedule is 100 hours.</p>
237    pub fn get_min_slot_duration_in_hours(&self) -> &::std::option::Option<i32> {
238        self.inner.get_min_slot_duration_in_hours()
239    }
240    /// <p>The token for the next set of results.</p>
241    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
242        self.inner = self.inner.next_token(input.into());
243        self
244    }
245    /// <p>The token for the next set of results.</p>
246    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
247        self.inner = self.inner.set_next_token(input);
248        self
249    }
250    /// <p>The token for the next set of results.</p>
251    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
252        self.inner.get_next_token()
253    }
254    /// <p>The schedule recurrence.</p>
255    pub fn recurrence(mut self, input: crate::types::ScheduledInstanceRecurrenceRequest) -> Self {
256        self.inner = self.inner.recurrence(input);
257        self
258    }
259    /// <p>The schedule recurrence.</p>
260    pub fn set_recurrence(mut self, input: ::std::option::Option<crate::types::ScheduledInstanceRecurrenceRequest>) -> Self {
261        self.inner = self.inner.set_recurrence(input);
262        self
263    }
264    /// <p>The schedule recurrence.</p>
265    pub fn get_recurrence(&self) -> &::std::option::Option<crate::types::ScheduledInstanceRecurrenceRequest> {
266        self.inner.get_recurrence()
267    }
268}