aws_sdk_ec2/operation/create_capacity_reservation_fleet/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_capacity_reservation_fleet::_create_capacity_reservation_fleet_output::CreateCapacityReservationFleetOutputBuilder;
3
4pub use crate::operation::create_capacity_reservation_fleet::_create_capacity_reservation_fleet_input::CreateCapacityReservationFleetInputBuilder;
5
6impl crate::operation::create_capacity_reservation_fleet::builders::CreateCapacityReservationFleetInputBuilder {
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::create_capacity_reservation_fleet::CreateCapacityReservationFleetOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_capacity_reservation_fleet();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateCapacityReservationFleet`.
24///
25/// <p>Creates a Capacity Reservation Fleet. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-cr-fleets.html#create-crfleet">Create a Capacity Reservation Fleet</a> in the <i>Amazon EC2 User Guide</i>.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateCapacityReservationFleetFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_capacity_reservation_fleet::builders::CreateCapacityReservationFleetInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetOutput,
35        crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError,
36    > for CreateCapacityReservationFleetFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetOutput,
44            crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreateCapacityReservationFleetFluentBuilder {
51    /// Creates a new `CreateCapacityReservationFleetFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the CreateCapacityReservationFleet as a reference.
60    pub fn as_input(&self) -> &crate::operation::create_capacity_reservation_fleet::builders::CreateCapacityReservationFleetInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleet::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleet::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetOutput,
97        crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The strategy used by the Capacity Reservation Fleet to determine which of the specified instance types to use. Currently, only the <code>prioritized</code> allocation strategy is supported. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#allocation-strategy"> Allocation strategy</a> in the <i>Amazon EC2 User Guide</i>.</p>
112    /// <p>Valid values: <code>prioritized</code></p>
113    pub fn allocation_strategy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.allocation_strategy(input.into());
115        self
116    }
117    /// <p>The strategy used by the Capacity Reservation Fleet to determine which of the specified instance types to use. Currently, only the <code>prioritized</code> allocation strategy is supported. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#allocation-strategy"> Allocation strategy</a> in the <i>Amazon EC2 User Guide</i>.</p>
118    /// <p>Valid values: <code>prioritized</code></p>
119    pub fn set_allocation_strategy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_allocation_strategy(input);
121        self
122    }
123    /// <p>The strategy used by the Capacity Reservation Fleet to determine which of the specified instance types to use. Currently, only the <code>prioritized</code> allocation strategy is supported. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#allocation-strategy"> Allocation strategy</a> in the <i>Amazon EC2 User Guide</i>.</p>
124    /// <p>Valid values: <code>prioritized</code></p>
125    pub fn get_allocation_strategy(&self) -> &::std::option::Option<::std::string::String> {
126        self.inner.get_allocation_strategy()
127    }
128    /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensure Idempotency</a>.</p>
129    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.client_token(input.into());
131        self
132    }
133    /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensure Idempotency</a>.</p>
134    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_client_token(input);
136        self
137    }
138    /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensure Idempotency</a>.</p>
139    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_client_token()
141    }
142    ///
143    /// Appends an item to `InstanceTypeSpecifications`.
144    ///
145    /// To override the contents of this collection use [`set_instance_type_specifications`](Self::set_instance_type_specifications).
146    ///
147    /// <p>Information about the instance types for which to reserve the capacity.</p>
148    pub fn instance_type_specifications(mut self, input: crate::types::ReservationFleetInstanceSpecification) -> Self {
149        self.inner = self.inner.instance_type_specifications(input);
150        self
151    }
152    /// <p>Information about the instance types for which to reserve the capacity.</p>
153    pub fn set_instance_type_specifications(
154        mut self,
155        input: ::std::option::Option<::std::vec::Vec<crate::types::ReservationFleetInstanceSpecification>>,
156    ) -> Self {
157        self.inner = self.inner.set_instance_type_specifications(input);
158        self
159    }
160    /// <p>Information about the instance types for which to reserve the capacity.</p>
161    pub fn get_instance_type_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ReservationFleetInstanceSpecification>> {
162        self.inner.get_instance_type_specifications()
163    }
164    /// <p>Indicates the tenancy of the Capacity Reservation Fleet. All Capacity Reservations in the Fleet inherit this tenancy. The Capacity Reservation Fleet can have one of the following tenancy settings:</p>
165    /// <ul>
166    /// <li>
167    /// <p><code>default</code> - The Capacity Reservation Fleet is created on hardware that is shared with other Amazon Web Services accounts.</p></li>
168    /// <li>
169    /// <p><code>dedicated</code> - The Capacity Reservations are created on single-tenant hardware that is dedicated to a single Amazon Web Services account.</p></li>
170    /// </ul>
171    pub fn tenancy(mut self, input: crate::types::FleetCapacityReservationTenancy) -> Self {
172        self.inner = self.inner.tenancy(input);
173        self
174    }
175    /// <p>Indicates the tenancy of the Capacity Reservation Fleet. All Capacity Reservations in the Fleet inherit this tenancy. The Capacity Reservation Fleet can have one of the following tenancy settings:</p>
176    /// <ul>
177    /// <li>
178    /// <p><code>default</code> - The Capacity Reservation Fleet is created on hardware that is shared with other Amazon Web Services accounts.</p></li>
179    /// <li>
180    /// <p><code>dedicated</code> - The Capacity Reservations are created on single-tenant hardware that is dedicated to a single Amazon Web Services account.</p></li>
181    /// </ul>
182    pub fn set_tenancy(mut self, input: ::std::option::Option<crate::types::FleetCapacityReservationTenancy>) -> Self {
183        self.inner = self.inner.set_tenancy(input);
184        self
185    }
186    /// <p>Indicates the tenancy of the Capacity Reservation Fleet. All Capacity Reservations in the Fleet inherit this tenancy. The Capacity Reservation Fleet can have one of the following tenancy settings:</p>
187    /// <ul>
188    /// <li>
189    /// <p><code>default</code> - The Capacity Reservation Fleet is created on hardware that is shared with other Amazon Web Services accounts.</p></li>
190    /// <li>
191    /// <p><code>dedicated</code> - The Capacity Reservations are created on single-tenant hardware that is dedicated to a single Amazon Web Services account.</p></li>
192    /// </ul>
193    pub fn get_tenancy(&self) -> &::std::option::Option<crate::types::FleetCapacityReservationTenancy> {
194        self.inner.get_tenancy()
195    }
196    /// <p>The total number of capacity units to be reserved by the Capacity Reservation Fleet. This value, together with the instance type weights that you assign to each instance type used by the Fleet determine the number of instances for which the Fleet reserves capacity. Both values are based on units that make sense for your workload. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#target-capacity">Total target capacity</a> in the <i>Amazon EC2 User Guide</i>.</p>
197    pub fn total_target_capacity(mut self, input: i32) -> Self {
198        self.inner = self.inner.total_target_capacity(input);
199        self
200    }
201    /// <p>The total number of capacity units to be reserved by the Capacity Reservation Fleet. This value, together with the instance type weights that you assign to each instance type used by the Fleet determine the number of instances for which the Fleet reserves capacity. Both values are based on units that make sense for your workload. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#target-capacity">Total target capacity</a> in the <i>Amazon EC2 User Guide</i>.</p>
202    pub fn set_total_target_capacity(mut self, input: ::std::option::Option<i32>) -> Self {
203        self.inner = self.inner.set_total_target_capacity(input);
204        self
205    }
206    /// <p>The total number of capacity units to be reserved by the Capacity Reservation Fleet. This value, together with the instance type weights that you assign to each instance type used by the Fleet determine the number of instances for which the Fleet reserves capacity. Both values are based on units that make sense for your workload. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#target-capacity">Total target capacity</a> in the <i>Amazon EC2 User Guide</i>.</p>
207    pub fn get_total_target_capacity(&self) -> &::std::option::Option<i32> {
208        self.inner.get_total_target_capacity()
209    }
210    /// <p>The date and time at which the Capacity Reservation Fleet expires. When the Capacity Reservation Fleet expires, its state changes to <code>expired</code> and all of the Capacity Reservations in the Fleet expire.</p>
211    /// <p>The Capacity Reservation Fleet expires within an hour after the specified time. For example, if you specify <code>5/31/2019</code>, <code>13:30:55</code>, the Capacity Reservation Fleet is guaranteed to expire between <code>13:30:55</code> and <code>14:30:55</code> on <code>5/31/2019</code>.</p>
212    pub fn end_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
213        self.inner = self.inner.end_date(input);
214        self
215    }
216    /// <p>The date and time at which the Capacity Reservation Fleet expires. When the Capacity Reservation Fleet expires, its state changes to <code>expired</code> and all of the Capacity Reservations in the Fleet expire.</p>
217    /// <p>The Capacity Reservation Fleet expires within an hour after the specified time. For example, if you specify <code>5/31/2019</code>, <code>13:30:55</code>, the Capacity Reservation Fleet is guaranteed to expire between <code>13:30:55</code> and <code>14:30:55</code> on <code>5/31/2019</code>.</p>
218    pub fn set_end_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
219        self.inner = self.inner.set_end_date(input);
220        self
221    }
222    /// <p>The date and time at which the Capacity Reservation Fleet expires. When the Capacity Reservation Fleet expires, its state changes to <code>expired</code> and all of the Capacity Reservations in the Fleet expire.</p>
223    /// <p>The Capacity Reservation Fleet expires within an hour after the specified time. For example, if you specify <code>5/31/2019</code>, <code>13:30:55</code>, the Capacity Reservation Fleet is guaranteed to expire between <code>13:30:55</code> and <code>14:30:55</code> on <code>5/31/2019</code>.</p>
224    pub fn get_end_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
225        self.inner.get_end_date()
226    }
227    /// <p>Indicates the type of instance launches that the Capacity Reservation Fleet accepts. All Capacity Reservations in the Fleet inherit this instance matching criteria.</p>
228    /// <p>Currently, Capacity Reservation Fleets support <code>open</code> instance matching criteria only. This means that instances that have matching attributes (instance type, platform, and Availability Zone) run in the Capacity Reservations automatically. Instances do not need to explicitly target a Capacity Reservation Fleet to use its reserved capacity.</p>
229    pub fn instance_match_criteria(mut self, input: crate::types::FleetInstanceMatchCriteria) -> Self {
230        self.inner = self.inner.instance_match_criteria(input);
231        self
232    }
233    /// <p>Indicates the type of instance launches that the Capacity Reservation Fleet accepts. All Capacity Reservations in the Fleet inherit this instance matching criteria.</p>
234    /// <p>Currently, Capacity Reservation Fleets support <code>open</code> instance matching criteria only. This means that instances that have matching attributes (instance type, platform, and Availability Zone) run in the Capacity Reservations automatically. Instances do not need to explicitly target a Capacity Reservation Fleet to use its reserved capacity.</p>
235    pub fn set_instance_match_criteria(mut self, input: ::std::option::Option<crate::types::FleetInstanceMatchCriteria>) -> Self {
236        self.inner = self.inner.set_instance_match_criteria(input);
237        self
238    }
239    /// <p>Indicates the type of instance launches that the Capacity Reservation Fleet accepts. All Capacity Reservations in the Fleet inherit this instance matching criteria.</p>
240    /// <p>Currently, Capacity Reservation Fleets support <code>open</code> instance matching criteria only. This means that instances that have matching attributes (instance type, platform, and Availability Zone) run in the Capacity Reservations automatically. Instances do not need to explicitly target a Capacity Reservation Fleet to use its reserved capacity.</p>
241    pub fn get_instance_match_criteria(&self) -> &::std::option::Option<crate::types::FleetInstanceMatchCriteria> {
242        self.inner.get_instance_match_criteria()
243    }
244    ///
245    /// Appends an item to `TagSpecifications`.
246    ///
247    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
248    ///
249    /// <p>The tags to assign to the Capacity Reservation Fleet. The tags are automatically assigned to the Capacity Reservations in the Fleet.</p>
250    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
251        self.inner = self.inner.tag_specifications(input);
252        self
253    }
254    /// <p>The tags to assign to the Capacity Reservation Fleet. The tags are automatically assigned to the Capacity Reservations in the Fleet.</p>
255    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
256        self.inner = self.inner.set_tag_specifications(input);
257        self
258    }
259    /// <p>The tags to assign to the Capacity Reservation Fleet. The tags are automatically assigned to the Capacity Reservations in the Fleet.</p>
260    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
261        self.inner.get_tag_specifications()
262    }
263    /// <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>
264    pub fn dry_run(mut self, input: bool) -> Self {
265        self.inner = self.inner.dry_run(input);
266        self
267    }
268    /// <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>
269    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
270        self.inner = self.inner.set_dry_run(input);
271        self
272    }
273    /// <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>
274    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
275        self.inner.get_dry_run()
276    }
277}