Skip to main content

aws_sdk_ec2/types/
_spot_instance_request.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes a Spot Instance request.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct SpotInstanceRequest {
7    /// <p>Deprecated.</p>
8    pub actual_block_hourly_price: ::std::option::Option<::std::string::String>,
9    /// <p>The Availability Zone group. If you specify the same Availability Zone group for all Spot Instance requests, all Spot Instances are launched in the same Availability Zone.</p>
10    pub availability_zone_group: ::std::option::Option<::std::string::String>,
11    /// <p>Deprecated.</p>
12    pub block_duration_minutes: ::std::option::Option<i32>,
13    /// <p>The date and time when the Spot Instance request was created, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
14    pub create_time: ::std::option::Option<::aws_smithy_types::DateTime>,
15    /// <p>The fault codes for the Spot Instance request, if any.</p>
16    pub fault: ::std::option::Option<crate::types::SpotInstanceStateFault>,
17    /// <p>The instance ID, if an instance has been launched to fulfill the Spot Instance request.</p>
18    pub instance_id: ::std::option::Option<::std::string::String>,
19    /// <p>The instance launch group. Launch groups are Spot Instances that launch together and terminate together.</p>
20    pub launch_group: ::std::option::Option<::std::string::String>,
21    /// <p>Additional information for launching instances.</p>
22    pub launch_specification: ::std::option::Option<crate::types::LaunchSpecification>,
23    /// <p>The Availability Zone in which the request is launched.</p>
24    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
25    pub launched_availability_zone: ::std::option::Option<::std::string::String>,
26    /// <p>The ID of the Availability Zone in which the request is launched.</p>
27    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
28    pub launched_availability_zone_id: ::std::option::Option<::std::string::String>,
29    /// <p>The product description associated with the Spot Instance.</p>
30    pub product_description: ::std::option::Option<crate::types::RiProductDescription>,
31    /// <p>The ID of the Spot Instance request.</p>
32    pub spot_instance_request_id: ::std::option::Option<::std::string::String>,
33    /// <p>The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price.</p><important>
34    /// <p>If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify this parameter.</p>
35    /// </important>
36    pub spot_price: ::std::option::Option<::std::string::String>,
37    /// <p>The state of the Spot Instance request. Spot request status information helps track your Spot Instance requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-status.html">Spot request status</a> in the <i>Amazon EC2 User Guide</i>.</p>
38    pub state: ::std::option::Option<crate::types::SpotInstanceState>,
39    /// <p>The status code and status message describing the Spot Instance request.</p>
40    pub status: ::std::option::Option<crate::types::SpotInstanceStatus>,
41    /// <p>Any tags assigned to the resource.</p>
42    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
43    /// <p>The Spot Instance request type.</p>
44    pub r#type: ::std::option::Option<crate::types::SpotInstanceType>,
45    /// <p>The start date of the request, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z). The request becomes active at this date and time.</p>
46    pub valid_from: ::std::option::Option<::aws_smithy_types::DateTime>,
47    /// <p>The end date of the request, in UTC format (<i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
48    /// <ul>
49    /// <li>
50    /// <p>For a persistent request, the request remains active until the <code>validUntil</code> date and time is reached. Otherwise, the request remains active until you cancel it.</p></li>
51    /// <li>
52    /// <p>For a one-time request, the request remains active until all instances launch, the request is canceled, or the <code>validUntil</code> date and time is reached. By default, the request is valid for 7 days from the date the request was created.</p></li>
53    /// </ul>
54    pub valid_until: ::std::option::Option<::aws_smithy_types::DateTime>,
55    /// <p>The behavior when a Spot Instance is interrupted.</p>
56    pub instance_interruption_behavior: ::std::option::Option<crate::types::InstanceInterruptionBehavior>,
57}
58impl SpotInstanceRequest {
59    /// <p>Deprecated.</p>
60    pub fn actual_block_hourly_price(&self) -> ::std::option::Option<&str> {
61        self.actual_block_hourly_price.as_deref()
62    }
63    /// <p>The Availability Zone group. If you specify the same Availability Zone group for all Spot Instance requests, all Spot Instances are launched in the same Availability Zone.</p>
64    pub fn availability_zone_group(&self) -> ::std::option::Option<&str> {
65        self.availability_zone_group.as_deref()
66    }
67    /// <p>Deprecated.</p>
68    pub fn block_duration_minutes(&self) -> ::std::option::Option<i32> {
69        self.block_duration_minutes
70    }
71    /// <p>The date and time when the Spot Instance request was created, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
72    pub fn create_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
73        self.create_time.as_ref()
74    }
75    /// <p>The fault codes for the Spot Instance request, if any.</p>
76    pub fn fault(&self) -> ::std::option::Option<&crate::types::SpotInstanceStateFault> {
77        self.fault.as_ref()
78    }
79    /// <p>The instance ID, if an instance has been launched to fulfill the Spot Instance request.</p>
80    pub fn instance_id(&self) -> ::std::option::Option<&str> {
81        self.instance_id.as_deref()
82    }
83    /// <p>The instance launch group. Launch groups are Spot Instances that launch together and terminate together.</p>
84    pub fn launch_group(&self) -> ::std::option::Option<&str> {
85        self.launch_group.as_deref()
86    }
87    /// <p>Additional information for launching instances.</p>
88    pub fn launch_specification(&self) -> ::std::option::Option<&crate::types::LaunchSpecification> {
89        self.launch_specification.as_ref()
90    }
91    /// <p>The Availability Zone in which the request is launched.</p>
92    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
93    pub fn launched_availability_zone(&self) -> ::std::option::Option<&str> {
94        self.launched_availability_zone.as_deref()
95    }
96    /// <p>The ID of the Availability Zone in which the request is launched.</p>
97    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
98    pub fn launched_availability_zone_id(&self) -> ::std::option::Option<&str> {
99        self.launched_availability_zone_id.as_deref()
100    }
101    /// <p>The product description associated with the Spot Instance.</p>
102    pub fn product_description(&self) -> ::std::option::Option<&crate::types::RiProductDescription> {
103        self.product_description.as_ref()
104    }
105    /// <p>The ID of the Spot Instance request.</p>
106    pub fn spot_instance_request_id(&self) -> ::std::option::Option<&str> {
107        self.spot_instance_request_id.as_deref()
108    }
109    /// <p>The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price.</p><important>
110    /// <p>If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify this parameter.</p>
111    /// </important>
112    pub fn spot_price(&self) -> ::std::option::Option<&str> {
113        self.spot_price.as_deref()
114    }
115    /// <p>The state of the Spot Instance request. Spot request status information helps track your Spot Instance requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-status.html">Spot request status</a> in the <i>Amazon EC2 User Guide</i>.</p>
116    pub fn state(&self) -> ::std::option::Option<&crate::types::SpotInstanceState> {
117        self.state.as_ref()
118    }
119    /// <p>The status code and status message describing the Spot Instance request.</p>
120    pub fn status(&self) -> ::std::option::Option<&crate::types::SpotInstanceStatus> {
121        self.status.as_ref()
122    }
123    /// <p>Any tags assigned to the resource.</p>
124    ///
125    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
126    pub fn tags(&self) -> &[crate::types::Tag] {
127        self.tags.as_deref().unwrap_or_default()
128    }
129    /// <p>The Spot Instance request type.</p>
130    pub fn r#type(&self) -> ::std::option::Option<&crate::types::SpotInstanceType> {
131        self.r#type.as_ref()
132    }
133    /// <p>The start date of the request, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z). The request becomes active at this date and time.</p>
134    pub fn valid_from(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
135        self.valid_from.as_ref()
136    }
137    /// <p>The end date of the request, in UTC format (<i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
138    /// <ul>
139    /// <li>
140    /// <p>For a persistent request, the request remains active until the <code>validUntil</code> date and time is reached. Otherwise, the request remains active until you cancel it.</p></li>
141    /// <li>
142    /// <p>For a one-time request, the request remains active until all instances launch, the request is canceled, or the <code>validUntil</code> date and time is reached. By default, the request is valid for 7 days from the date the request was created.</p></li>
143    /// </ul>
144    pub fn valid_until(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
145        self.valid_until.as_ref()
146    }
147    /// <p>The behavior when a Spot Instance is interrupted.</p>
148    pub fn instance_interruption_behavior(&self) -> ::std::option::Option<&crate::types::InstanceInterruptionBehavior> {
149        self.instance_interruption_behavior.as_ref()
150    }
151}
152impl SpotInstanceRequest {
153    /// Creates a new builder-style object to manufacture [`SpotInstanceRequest`](crate::types::SpotInstanceRequest).
154    pub fn builder() -> crate::types::builders::SpotInstanceRequestBuilder {
155        crate::types::builders::SpotInstanceRequestBuilder::default()
156    }
157}
158
159/// A builder for [`SpotInstanceRequest`](crate::types::SpotInstanceRequest).
160#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
161#[non_exhaustive]
162pub struct SpotInstanceRequestBuilder {
163    pub(crate) actual_block_hourly_price: ::std::option::Option<::std::string::String>,
164    pub(crate) availability_zone_group: ::std::option::Option<::std::string::String>,
165    pub(crate) block_duration_minutes: ::std::option::Option<i32>,
166    pub(crate) create_time: ::std::option::Option<::aws_smithy_types::DateTime>,
167    pub(crate) fault: ::std::option::Option<crate::types::SpotInstanceStateFault>,
168    pub(crate) instance_id: ::std::option::Option<::std::string::String>,
169    pub(crate) launch_group: ::std::option::Option<::std::string::String>,
170    pub(crate) launch_specification: ::std::option::Option<crate::types::LaunchSpecification>,
171    pub(crate) launched_availability_zone: ::std::option::Option<::std::string::String>,
172    pub(crate) launched_availability_zone_id: ::std::option::Option<::std::string::String>,
173    pub(crate) product_description: ::std::option::Option<crate::types::RiProductDescription>,
174    pub(crate) spot_instance_request_id: ::std::option::Option<::std::string::String>,
175    pub(crate) spot_price: ::std::option::Option<::std::string::String>,
176    pub(crate) state: ::std::option::Option<crate::types::SpotInstanceState>,
177    pub(crate) status: ::std::option::Option<crate::types::SpotInstanceStatus>,
178    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
179    pub(crate) r#type: ::std::option::Option<crate::types::SpotInstanceType>,
180    pub(crate) valid_from: ::std::option::Option<::aws_smithy_types::DateTime>,
181    pub(crate) valid_until: ::std::option::Option<::aws_smithy_types::DateTime>,
182    pub(crate) instance_interruption_behavior: ::std::option::Option<crate::types::InstanceInterruptionBehavior>,
183}
184impl SpotInstanceRequestBuilder {
185    /// <p>Deprecated.</p>
186    pub fn actual_block_hourly_price(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
187        self.actual_block_hourly_price = ::std::option::Option::Some(input.into());
188        self
189    }
190    /// <p>Deprecated.</p>
191    pub fn set_actual_block_hourly_price(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
192        self.actual_block_hourly_price = input;
193        self
194    }
195    /// <p>Deprecated.</p>
196    pub fn get_actual_block_hourly_price(&self) -> &::std::option::Option<::std::string::String> {
197        &self.actual_block_hourly_price
198    }
199    /// <p>The Availability Zone group. If you specify the same Availability Zone group for all Spot Instance requests, all Spot Instances are launched in the same Availability Zone.</p>
200    pub fn availability_zone_group(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
201        self.availability_zone_group = ::std::option::Option::Some(input.into());
202        self
203    }
204    /// <p>The Availability Zone group. If you specify the same Availability Zone group for all Spot Instance requests, all Spot Instances are launched in the same Availability Zone.</p>
205    pub fn set_availability_zone_group(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
206        self.availability_zone_group = input;
207        self
208    }
209    /// <p>The Availability Zone group. If you specify the same Availability Zone group for all Spot Instance requests, all Spot Instances are launched in the same Availability Zone.</p>
210    pub fn get_availability_zone_group(&self) -> &::std::option::Option<::std::string::String> {
211        &self.availability_zone_group
212    }
213    /// <p>Deprecated.</p>
214    pub fn block_duration_minutes(mut self, input: i32) -> Self {
215        self.block_duration_minutes = ::std::option::Option::Some(input);
216        self
217    }
218    /// <p>Deprecated.</p>
219    pub fn set_block_duration_minutes(mut self, input: ::std::option::Option<i32>) -> Self {
220        self.block_duration_minutes = input;
221        self
222    }
223    /// <p>Deprecated.</p>
224    pub fn get_block_duration_minutes(&self) -> &::std::option::Option<i32> {
225        &self.block_duration_minutes
226    }
227    /// <p>The date and time when the Spot Instance request was created, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
228    pub fn create_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
229        self.create_time = ::std::option::Option::Some(input);
230        self
231    }
232    /// <p>The date and time when the Spot Instance request was created, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
233    pub fn set_create_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
234        self.create_time = input;
235        self
236    }
237    /// <p>The date and time when the Spot Instance request was created, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
238    pub fn get_create_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
239        &self.create_time
240    }
241    /// <p>The fault codes for the Spot Instance request, if any.</p>
242    pub fn fault(mut self, input: crate::types::SpotInstanceStateFault) -> Self {
243        self.fault = ::std::option::Option::Some(input);
244        self
245    }
246    /// <p>The fault codes for the Spot Instance request, if any.</p>
247    pub fn set_fault(mut self, input: ::std::option::Option<crate::types::SpotInstanceStateFault>) -> Self {
248        self.fault = input;
249        self
250    }
251    /// <p>The fault codes for the Spot Instance request, if any.</p>
252    pub fn get_fault(&self) -> &::std::option::Option<crate::types::SpotInstanceStateFault> {
253        &self.fault
254    }
255    /// <p>The instance ID, if an instance has been launched to fulfill the Spot Instance request.</p>
256    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
257        self.instance_id = ::std::option::Option::Some(input.into());
258        self
259    }
260    /// <p>The instance ID, if an instance has been launched to fulfill the Spot Instance request.</p>
261    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
262        self.instance_id = input;
263        self
264    }
265    /// <p>The instance ID, if an instance has been launched to fulfill the Spot Instance request.</p>
266    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
267        &self.instance_id
268    }
269    /// <p>The instance launch group. Launch groups are Spot Instances that launch together and terminate together.</p>
270    pub fn launch_group(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
271        self.launch_group = ::std::option::Option::Some(input.into());
272        self
273    }
274    /// <p>The instance launch group. Launch groups are Spot Instances that launch together and terminate together.</p>
275    pub fn set_launch_group(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
276        self.launch_group = input;
277        self
278    }
279    /// <p>The instance launch group. Launch groups are Spot Instances that launch together and terminate together.</p>
280    pub fn get_launch_group(&self) -> &::std::option::Option<::std::string::String> {
281        &self.launch_group
282    }
283    /// <p>Additional information for launching instances.</p>
284    pub fn launch_specification(mut self, input: crate::types::LaunchSpecification) -> Self {
285        self.launch_specification = ::std::option::Option::Some(input);
286        self
287    }
288    /// <p>Additional information for launching instances.</p>
289    pub fn set_launch_specification(mut self, input: ::std::option::Option<crate::types::LaunchSpecification>) -> Self {
290        self.launch_specification = input;
291        self
292    }
293    /// <p>Additional information for launching instances.</p>
294    pub fn get_launch_specification(&self) -> &::std::option::Option<crate::types::LaunchSpecification> {
295        &self.launch_specification
296    }
297    /// <p>The Availability Zone in which the request is launched.</p>
298    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
299    pub fn launched_availability_zone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
300        self.launched_availability_zone = ::std::option::Option::Some(input.into());
301        self
302    }
303    /// <p>The Availability Zone in which the request is launched.</p>
304    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
305    pub fn set_launched_availability_zone(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
306        self.launched_availability_zone = input;
307        self
308    }
309    /// <p>The Availability Zone in which the request is launched.</p>
310    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
311    pub fn get_launched_availability_zone(&self) -> &::std::option::Option<::std::string::String> {
312        &self.launched_availability_zone
313    }
314    /// <p>The ID of the Availability Zone in which the request is launched.</p>
315    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
316    pub fn launched_availability_zone_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
317        self.launched_availability_zone_id = ::std::option::Option::Some(input.into());
318        self
319    }
320    /// <p>The ID of the Availability Zone in which the request is launched.</p>
321    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
322    pub fn set_launched_availability_zone_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
323        self.launched_availability_zone_id = input;
324        self
325    }
326    /// <p>The ID of the Availability Zone in which the request is launched.</p>
327    /// <p>Either <code>launchedAvailabilityZone</code> or <code>launchedAvailabilityZoneId</code> can be specified, but not both</p>
328    pub fn get_launched_availability_zone_id(&self) -> &::std::option::Option<::std::string::String> {
329        &self.launched_availability_zone_id
330    }
331    /// <p>The product description associated with the Spot Instance.</p>
332    pub fn product_description(mut self, input: crate::types::RiProductDescription) -> Self {
333        self.product_description = ::std::option::Option::Some(input);
334        self
335    }
336    /// <p>The product description associated with the Spot Instance.</p>
337    pub fn set_product_description(mut self, input: ::std::option::Option<crate::types::RiProductDescription>) -> Self {
338        self.product_description = input;
339        self
340    }
341    /// <p>The product description associated with the Spot Instance.</p>
342    pub fn get_product_description(&self) -> &::std::option::Option<crate::types::RiProductDescription> {
343        &self.product_description
344    }
345    /// <p>The ID of the Spot Instance request.</p>
346    pub fn spot_instance_request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
347        self.spot_instance_request_id = ::std::option::Option::Some(input.into());
348        self
349    }
350    /// <p>The ID of the Spot Instance request.</p>
351    pub fn set_spot_instance_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
352        self.spot_instance_request_id = input;
353        self
354    }
355    /// <p>The ID of the Spot Instance request.</p>
356    pub fn get_spot_instance_request_id(&self) -> &::std::option::Option<::std::string::String> {
357        &self.spot_instance_request_id
358    }
359    /// <p>The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price.</p><important>
360    /// <p>If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify this parameter.</p>
361    /// </important>
362    pub fn spot_price(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
363        self.spot_price = ::std::option::Option::Some(input.into());
364        self
365    }
366    /// <p>The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price.</p><important>
367    /// <p>If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify this parameter.</p>
368    /// </important>
369    pub fn set_spot_price(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
370        self.spot_price = input;
371        self
372    }
373    /// <p>The maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price.</p><important>
374    /// <p>If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify this parameter.</p>
375    /// </important>
376    pub fn get_spot_price(&self) -> &::std::option::Option<::std::string::String> {
377        &self.spot_price
378    }
379    /// <p>The state of the Spot Instance request. Spot request status information helps track your Spot Instance requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-status.html">Spot request status</a> in the <i>Amazon EC2 User Guide</i>.</p>
380    pub fn state(mut self, input: crate::types::SpotInstanceState) -> Self {
381        self.state = ::std::option::Option::Some(input);
382        self
383    }
384    /// <p>The state of the Spot Instance request. Spot request status information helps track your Spot Instance requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-status.html">Spot request status</a> in the <i>Amazon EC2 User Guide</i>.</p>
385    pub fn set_state(mut self, input: ::std::option::Option<crate::types::SpotInstanceState>) -> Self {
386        self.state = input;
387        self
388    }
389    /// <p>The state of the Spot Instance request. Spot request status information helps track your Spot Instance requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-status.html">Spot request status</a> in the <i>Amazon EC2 User Guide</i>.</p>
390    pub fn get_state(&self) -> &::std::option::Option<crate::types::SpotInstanceState> {
391        &self.state
392    }
393    /// <p>The status code and status message describing the Spot Instance request.</p>
394    pub fn status(mut self, input: crate::types::SpotInstanceStatus) -> Self {
395        self.status = ::std::option::Option::Some(input);
396        self
397    }
398    /// <p>The status code and status message describing the Spot Instance request.</p>
399    pub fn set_status(mut self, input: ::std::option::Option<crate::types::SpotInstanceStatus>) -> Self {
400        self.status = input;
401        self
402    }
403    /// <p>The status code and status message describing the Spot Instance request.</p>
404    pub fn get_status(&self) -> &::std::option::Option<crate::types::SpotInstanceStatus> {
405        &self.status
406    }
407    /// Appends an item to `tags`.
408    ///
409    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
410    ///
411    /// <p>Any tags assigned to the resource.</p>
412    pub fn tags(mut self, input: crate::types::Tag) -> Self {
413        let mut v = self.tags.unwrap_or_default();
414        v.push(input);
415        self.tags = ::std::option::Option::Some(v);
416        self
417    }
418    /// <p>Any tags assigned to the resource.</p>
419    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
420        self.tags = input;
421        self
422    }
423    /// <p>Any tags assigned to the resource.</p>
424    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
425        &self.tags
426    }
427    /// <p>The Spot Instance request type.</p>
428    pub fn r#type(mut self, input: crate::types::SpotInstanceType) -> Self {
429        self.r#type = ::std::option::Option::Some(input);
430        self
431    }
432    /// <p>The Spot Instance request type.</p>
433    pub fn set_type(mut self, input: ::std::option::Option<crate::types::SpotInstanceType>) -> Self {
434        self.r#type = input;
435        self
436    }
437    /// <p>The Spot Instance request type.</p>
438    pub fn get_type(&self) -> &::std::option::Option<crate::types::SpotInstanceType> {
439        &self.r#type
440    }
441    /// <p>The start date of the request, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z). The request becomes active at this date and time.</p>
442    pub fn valid_from(mut self, input: ::aws_smithy_types::DateTime) -> Self {
443        self.valid_from = ::std::option::Option::Some(input);
444        self
445    }
446    /// <p>The start date of the request, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z). The request becomes active at this date and time.</p>
447    pub fn set_valid_from(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
448        self.valid_from = input;
449        self
450    }
451    /// <p>The start date of the request, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z). The request becomes active at this date and time.</p>
452    pub fn get_valid_from(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
453        &self.valid_from
454    }
455    /// <p>The end date of the request, in UTC format (<i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
456    /// <ul>
457    /// <li>
458    /// <p>For a persistent request, the request remains active until the <code>validUntil</code> date and time is reached. Otherwise, the request remains active until you cancel it.</p></li>
459    /// <li>
460    /// <p>For a one-time request, the request remains active until all instances launch, the request is canceled, or the <code>validUntil</code> date and time is reached. By default, the request is valid for 7 days from the date the request was created.</p></li>
461    /// </ul>
462    pub fn valid_until(mut self, input: ::aws_smithy_types::DateTime) -> Self {
463        self.valid_until = ::std::option::Option::Some(input);
464        self
465    }
466    /// <p>The end date of the request, in UTC format (<i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
467    /// <ul>
468    /// <li>
469    /// <p>For a persistent request, the request remains active until the <code>validUntil</code> date and time is reached. Otherwise, the request remains active until you cancel it.</p></li>
470    /// <li>
471    /// <p>For a one-time request, the request remains active until all instances launch, the request is canceled, or the <code>validUntil</code> date and time is reached. By default, the request is valid for 7 days from the date the request was created.</p></li>
472    /// </ul>
473    pub fn set_valid_until(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
474        self.valid_until = input;
475        self
476    }
477    /// <p>The end date of the request, in UTC format (<i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
478    /// <ul>
479    /// <li>
480    /// <p>For a persistent request, the request remains active until the <code>validUntil</code> date and time is reached. Otherwise, the request remains active until you cancel it.</p></li>
481    /// <li>
482    /// <p>For a one-time request, the request remains active until all instances launch, the request is canceled, or the <code>validUntil</code> date and time is reached. By default, the request is valid for 7 days from the date the request was created.</p></li>
483    /// </ul>
484    pub fn get_valid_until(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
485        &self.valid_until
486    }
487    /// <p>The behavior when a Spot Instance is interrupted.</p>
488    pub fn instance_interruption_behavior(mut self, input: crate::types::InstanceInterruptionBehavior) -> Self {
489        self.instance_interruption_behavior = ::std::option::Option::Some(input);
490        self
491    }
492    /// <p>The behavior when a Spot Instance is interrupted.</p>
493    pub fn set_instance_interruption_behavior(mut self, input: ::std::option::Option<crate::types::InstanceInterruptionBehavior>) -> Self {
494        self.instance_interruption_behavior = input;
495        self
496    }
497    /// <p>The behavior when a Spot Instance is interrupted.</p>
498    pub fn get_instance_interruption_behavior(&self) -> &::std::option::Option<crate::types::InstanceInterruptionBehavior> {
499        &self.instance_interruption_behavior
500    }
501    /// Consumes the builder and constructs a [`SpotInstanceRequest`](crate::types::SpotInstanceRequest).
502    pub fn build(self) -> crate::types::SpotInstanceRequest {
503        crate::types::SpotInstanceRequest {
504            actual_block_hourly_price: self.actual_block_hourly_price,
505            availability_zone_group: self.availability_zone_group,
506            block_duration_minutes: self.block_duration_minutes,
507            create_time: self.create_time,
508            fault: self.fault,
509            instance_id: self.instance_id,
510            launch_group: self.launch_group,
511            launch_specification: self.launch_specification,
512            launched_availability_zone: self.launched_availability_zone,
513            launched_availability_zone_id: self.launched_availability_zone_id,
514            product_description: self.product_description,
515            spot_instance_request_id: self.spot_instance_request_id,
516            spot_price: self.spot_price,
517            state: self.state,
518            status: self.status,
519            tags: self.tags,
520            r#type: self.r#type,
521            valid_from: self.valid_from,
522            valid_until: self.valid_until,
523            instance_interruption_behavior: self.instance_interruption_behavior,
524        }
525    }
526}