aws_sdk_ec2/types/
_on_demand_options.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes the configuration of On-Demand Instances in an EC2 Fleet.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct OnDemandOptions {
7    /// <p>The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.</p>
8    /// <p><code>lowest-price</code> - EC2 Fleet uses price to determine the order, launching the lowest price first.</p>
9    /// <p><code>prioritized</code> - EC2 Fleet uses the priority that you assigned to each launch template override, launching the highest priority first.</p>
10    /// <p>Default: <code>lowest-price</code></p>
11    pub allocation_strategy: ::std::option::Option<crate::types::FleetOnDemandAllocationStrategy>,
12    /// <p>The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.</p>
13    /// <p>Supported only for fleets of type <code>instant</code>.</p>
14    pub capacity_reservation_options: ::std::option::Option<crate::types::CapacityReservationOptions>,
15    /// <p>Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.</p>
16    /// <p>Supported only for fleets of type <code>instant</code>.</p>
17    pub single_instance_type: ::std::option::Option<bool>,
18    /// <p>Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.</p>
19    /// <p>Supported only for fleets of type <code>instant</code>.</p>
20    pub single_availability_zone: ::std::option::Option<bool>,
21    /// <p>The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no instances are launched.</p>
22    /// <p>Constraints: Maximum value of <code>1000</code>. Supported only for fleets of type <code>instant</code>.</p>
23    /// <p>At least one of the following must be specified: <code>SingleAvailabilityZone</code> | <code>SingleInstanceType</code></p>
24    pub min_target_capacity: ::std::option::Option<i32>,
25    /// <p>The maximum amount per hour for On-Demand Instances that you're willing to pay.</p><note>
26    /// <p>If your fleet includes T instances that are configured as <code>unlimited</code>, and if their average CPU usage exceeds the baseline utilization, you will incur a charge for surplus credits. The <code>maxTotalPrice</code> does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified for <code>maxTotalPrice</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-unlimited-mode-concepts.html#unlimited-mode-surplus-credits">Surplus credits can incur charges</a> in the <i>Amazon EC2 User Guide</i>.</p>
27    /// </note>
28    pub max_total_price: ::std::option::Option<::std::string::String>,
29}
30impl OnDemandOptions {
31    /// <p>The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.</p>
32    /// <p><code>lowest-price</code> - EC2 Fleet uses price to determine the order, launching the lowest price first.</p>
33    /// <p><code>prioritized</code> - EC2 Fleet uses the priority that you assigned to each launch template override, launching the highest priority first.</p>
34    /// <p>Default: <code>lowest-price</code></p>
35    pub fn allocation_strategy(&self) -> ::std::option::Option<&crate::types::FleetOnDemandAllocationStrategy> {
36        self.allocation_strategy.as_ref()
37    }
38    /// <p>The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.</p>
39    /// <p>Supported only for fleets of type <code>instant</code>.</p>
40    pub fn capacity_reservation_options(&self) -> ::std::option::Option<&crate::types::CapacityReservationOptions> {
41        self.capacity_reservation_options.as_ref()
42    }
43    /// <p>Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.</p>
44    /// <p>Supported only for fleets of type <code>instant</code>.</p>
45    pub fn single_instance_type(&self) -> ::std::option::Option<bool> {
46        self.single_instance_type
47    }
48    /// <p>Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.</p>
49    /// <p>Supported only for fleets of type <code>instant</code>.</p>
50    pub fn single_availability_zone(&self) -> ::std::option::Option<bool> {
51        self.single_availability_zone
52    }
53    /// <p>The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no instances are launched.</p>
54    /// <p>Constraints: Maximum value of <code>1000</code>. Supported only for fleets of type <code>instant</code>.</p>
55    /// <p>At least one of the following must be specified: <code>SingleAvailabilityZone</code> | <code>SingleInstanceType</code></p>
56    pub fn min_target_capacity(&self) -> ::std::option::Option<i32> {
57        self.min_target_capacity
58    }
59    /// <p>The maximum amount per hour for On-Demand Instances that you're willing to pay.</p><note>
60    /// <p>If your fleet includes T instances that are configured as <code>unlimited</code>, and if their average CPU usage exceeds the baseline utilization, you will incur a charge for surplus credits. The <code>maxTotalPrice</code> does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified for <code>maxTotalPrice</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-unlimited-mode-concepts.html#unlimited-mode-surplus-credits">Surplus credits can incur charges</a> in the <i>Amazon EC2 User Guide</i>.</p>
61    /// </note>
62    pub fn max_total_price(&self) -> ::std::option::Option<&str> {
63        self.max_total_price.as_deref()
64    }
65}
66impl OnDemandOptions {
67    /// Creates a new builder-style object to manufacture [`OnDemandOptions`](crate::types::OnDemandOptions).
68    pub fn builder() -> crate::types::builders::OnDemandOptionsBuilder {
69        crate::types::builders::OnDemandOptionsBuilder::default()
70    }
71}
72
73/// A builder for [`OnDemandOptions`](crate::types::OnDemandOptions).
74#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
75#[non_exhaustive]
76pub struct OnDemandOptionsBuilder {
77    pub(crate) allocation_strategy: ::std::option::Option<crate::types::FleetOnDemandAllocationStrategy>,
78    pub(crate) capacity_reservation_options: ::std::option::Option<crate::types::CapacityReservationOptions>,
79    pub(crate) single_instance_type: ::std::option::Option<bool>,
80    pub(crate) single_availability_zone: ::std::option::Option<bool>,
81    pub(crate) min_target_capacity: ::std::option::Option<i32>,
82    pub(crate) max_total_price: ::std::option::Option<::std::string::String>,
83}
84impl OnDemandOptionsBuilder {
85    /// <p>The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.</p>
86    /// <p><code>lowest-price</code> - EC2 Fleet uses price to determine the order, launching the lowest price first.</p>
87    /// <p><code>prioritized</code> - EC2 Fleet uses the priority that you assigned to each launch template override, launching the highest priority first.</p>
88    /// <p>Default: <code>lowest-price</code></p>
89    pub fn allocation_strategy(mut self, input: crate::types::FleetOnDemandAllocationStrategy) -> Self {
90        self.allocation_strategy = ::std::option::Option::Some(input);
91        self
92    }
93    /// <p>The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.</p>
94    /// <p><code>lowest-price</code> - EC2 Fleet uses price to determine the order, launching the lowest price first.</p>
95    /// <p><code>prioritized</code> - EC2 Fleet uses the priority that you assigned to each launch template override, launching the highest priority first.</p>
96    /// <p>Default: <code>lowest-price</code></p>
97    pub fn set_allocation_strategy(mut self, input: ::std::option::Option<crate::types::FleetOnDemandAllocationStrategy>) -> Self {
98        self.allocation_strategy = input;
99        self
100    }
101    /// <p>The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.</p>
102    /// <p><code>lowest-price</code> - EC2 Fleet uses price to determine the order, launching the lowest price first.</p>
103    /// <p><code>prioritized</code> - EC2 Fleet uses the priority that you assigned to each launch template override, launching the highest priority first.</p>
104    /// <p>Default: <code>lowest-price</code></p>
105    pub fn get_allocation_strategy(&self) -> &::std::option::Option<crate::types::FleetOnDemandAllocationStrategy> {
106        &self.allocation_strategy
107    }
108    /// <p>The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.</p>
109    /// <p>Supported only for fleets of type <code>instant</code>.</p>
110    pub fn capacity_reservation_options(mut self, input: crate::types::CapacityReservationOptions) -> Self {
111        self.capacity_reservation_options = ::std::option::Option::Some(input);
112        self
113    }
114    /// <p>The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.</p>
115    /// <p>Supported only for fleets of type <code>instant</code>.</p>
116    pub fn set_capacity_reservation_options(mut self, input: ::std::option::Option<crate::types::CapacityReservationOptions>) -> Self {
117        self.capacity_reservation_options = input;
118        self
119    }
120    /// <p>The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.</p>
121    /// <p>Supported only for fleets of type <code>instant</code>.</p>
122    pub fn get_capacity_reservation_options(&self) -> &::std::option::Option<crate::types::CapacityReservationOptions> {
123        &self.capacity_reservation_options
124    }
125    /// <p>Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.</p>
126    /// <p>Supported only for fleets of type <code>instant</code>.</p>
127    pub fn single_instance_type(mut self, input: bool) -> Self {
128        self.single_instance_type = ::std::option::Option::Some(input);
129        self
130    }
131    /// <p>Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.</p>
132    /// <p>Supported only for fleets of type <code>instant</code>.</p>
133    pub fn set_single_instance_type(mut self, input: ::std::option::Option<bool>) -> Self {
134        self.single_instance_type = input;
135        self
136    }
137    /// <p>Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.</p>
138    /// <p>Supported only for fleets of type <code>instant</code>.</p>
139    pub fn get_single_instance_type(&self) -> &::std::option::Option<bool> {
140        &self.single_instance_type
141    }
142    /// <p>Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.</p>
143    /// <p>Supported only for fleets of type <code>instant</code>.</p>
144    pub fn single_availability_zone(mut self, input: bool) -> Self {
145        self.single_availability_zone = ::std::option::Option::Some(input);
146        self
147    }
148    /// <p>Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.</p>
149    /// <p>Supported only for fleets of type <code>instant</code>.</p>
150    pub fn set_single_availability_zone(mut self, input: ::std::option::Option<bool>) -> Self {
151        self.single_availability_zone = input;
152        self
153    }
154    /// <p>Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.</p>
155    /// <p>Supported only for fleets of type <code>instant</code>.</p>
156    pub fn get_single_availability_zone(&self) -> &::std::option::Option<bool> {
157        &self.single_availability_zone
158    }
159    /// <p>The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no instances are launched.</p>
160    /// <p>Constraints: Maximum value of <code>1000</code>. Supported only for fleets of type <code>instant</code>.</p>
161    /// <p>At least one of the following must be specified: <code>SingleAvailabilityZone</code> | <code>SingleInstanceType</code></p>
162    pub fn min_target_capacity(mut self, input: i32) -> Self {
163        self.min_target_capacity = ::std::option::Option::Some(input);
164        self
165    }
166    /// <p>The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no instances are launched.</p>
167    /// <p>Constraints: Maximum value of <code>1000</code>. Supported only for fleets of type <code>instant</code>.</p>
168    /// <p>At least one of the following must be specified: <code>SingleAvailabilityZone</code> | <code>SingleInstanceType</code></p>
169    pub fn set_min_target_capacity(mut self, input: ::std::option::Option<i32>) -> Self {
170        self.min_target_capacity = input;
171        self
172    }
173    /// <p>The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no instances are launched.</p>
174    /// <p>Constraints: Maximum value of <code>1000</code>. Supported only for fleets of type <code>instant</code>.</p>
175    /// <p>At least one of the following must be specified: <code>SingleAvailabilityZone</code> | <code>SingleInstanceType</code></p>
176    pub fn get_min_target_capacity(&self) -> &::std::option::Option<i32> {
177        &self.min_target_capacity
178    }
179    /// <p>The maximum amount per hour for On-Demand Instances that you're willing to pay.</p><note>
180    /// <p>If your fleet includes T instances that are configured as <code>unlimited</code>, and if their average CPU usage exceeds the baseline utilization, you will incur a charge for surplus credits. The <code>maxTotalPrice</code> does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified for <code>maxTotalPrice</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-unlimited-mode-concepts.html#unlimited-mode-surplus-credits">Surplus credits can incur charges</a> in the <i>Amazon EC2 User Guide</i>.</p>
181    /// </note>
182    pub fn max_total_price(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
183        self.max_total_price = ::std::option::Option::Some(input.into());
184        self
185    }
186    /// <p>The maximum amount per hour for On-Demand Instances that you're willing to pay.</p><note>
187    /// <p>If your fleet includes T instances that are configured as <code>unlimited</code>, and if their average CPU usage exceeds the baseline utilization, you will incur a charge for surplus credits. The <code>maxTotalPrice</code> does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified for <code>maxTotalPrice</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-unlimited-mode-concepts.html#unlimited-mode-surplus-credits">Surplus credits can incur charges</a> in the <i>Amazon EC2 User Guide</i>.</p>
188    /// </note>
189    pub fn set_max_total_price(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
190        self.max_total_price = input;
191        self
192    }
193    /// <p>The maximum amount per hour for On-Demand Instances that you're willing to pay.</p><note>
194    /// <p>If your fleet includes T instances that are configured as <code>unlimited</code>, and if their average CPU usage exceeds the baseline utilization, you will incur a charge for surplus credits. The <code>maxTotalPrice</code> does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified for <code>maxTotalPrice</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-unlimited-mode-concepts.html#unlimited-mode-surplus-credits">Surplus credits can incur charges</a> in the <i>Amazon EC2 User Guide</i>.</p>
195    /// </note>
196    pub fn get_max_total_price(&self) -> &::std::option::Option<::std::string::String> {
197        &self.max_total_price
198    }
199    /// Consumes the builder and constructs a [`OnDemandOptions`](crate::types::OnDemandOptions).
200    pub fn build(self) -> crate::types::OnDemandOptions {
201        crate::types::OnDemandOptions {
202            allocation_strategy: self.allocation_strategy,
203            capacity_reservation_options: self.capacity_reservation_options,
204            single_instance_type: self.single_instance_type,
205            single_availability_zone: self.single_availability_zone,
206            min_target_capacity: self.min_target_capacity,
207            max_total_price: self.max_total_price,
208        }
209    }
210}