Skip to main content

aws_sdk_ec2/types/
_create_fleet_instance.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes the instances that were launched by the fleet.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateFleetInstance {
7    /// <p>The launch templates and overrides that were used for launching the instances. The values that you specify in the Overrides replace the values in the launch template.</p>
8    pub launch_template_and_overrides: ::std::option::Option<crate::types::LaunchTemplateAndOverridesResponse>,
9    /// <p>Indicates if the instance that was launched is a Spot, On-Demand, Capacity Block, or Interruptible Capacity Reservation instance.</p>
10    pub lifecycle: ::std::option::Option<crate::types::InstanceLifecycle>,
11    /// <p>The IDs of the instances.</p>
12    pub instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
13    /// <p>The instance type.</p>
14    pub instance_type: ::std::option::Option<crate::types::InstanceType>,
15    /// <p>The value is <code>windows</code> for Windows instances in an EC2 Fleet. Otherwise, the value is blank.</p>
16    pub platform: ::std::option::Option<crate::types::PlatformValues>,
17}
18impl CreateFleetInstance {
19    /// <p>The launch templates and overrides that were used for launching the instances. The values that you specify in the Overrides replace the values in the launch template.</p>
20    pub fn launch_template_and_overrides(&self) -> ::std::option::Option<&crate::types::LaunchTemplateAndOverridesResponse> {
21        self.launch_template_and_overrides.as_ref()
22    }
23    /// <p>Indicates if the instance that was launched is a Spot, On-Demand, Capacity Block, or Interruptible Capacity Reservation instance.</p>
24    pub fn lifecycle(&self) -> ::std::option::Option<&crate::types::InstanceLifecycle> {
25        self.lifecycle.as_ref()
26    }
27    /// <p>The IDs of the instances.</p>
28    ///
29    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.instance_ids.is_none()`.
30    pub fn instance_ids(&self) -> &[::std::string::String] {
31        self.instance_ids.as_deref().unwrap_or_default()
32    }
33    /// <p>The instance type.</p>
34    pub fn instance_type(&self) -> ::std::option::Option<&crate::types::InstanceType> {
35        self.instance_type.as_ref()
36    }
37    /// <p>The value is <code>windows</code> for Windows instances in an EC2 Fleet. Otherwise, the value is blank.</p>
38    pub fn platform(&self) -> ::std::option::Option<&crate::types::PlatformValues> {
39        self.platform.as_ref()
40    }
41}
42impl CreateFleetInstance {
43    /// Creates a new builder-style object to manufacture [`CreateFleetInstance`](crate::types::CreateFleetInstance).
44    pub fn builder() -> crate::types::builders::CreateFleetInstanceBuilder {
45        crate::types::builders::CreateFleetInstanceBuilder::default()
46    }
47}
48
49/// A builder for [`CreateFleetInstance`](crate::types::CreateFleetInstance).
50#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
51#[non_exhaustive]
52pub struct CreateFleetInstanceBuilder {
53    pub(crate) launch_template_and_overrides: ::std::option::Option<crate::types::LaunchTemplateAndOverridesResponse>,
54    pub(crate) lifecycle: ::std::option::Option<crate::types::InstanceLifecycle>,
55    pub(crate) instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
56    pub(crate) instance_type: ::std::option::Option<crate::types::InstanceType>,
57    pub(crate) platform: ::std::option::Option<crate::types::PlatformValues>,
58}
59impl CreateFleetInstanceBuilder {
60    /// <p>The launch templates and overrides that were used for launching the instances. The values that you specify in the Overrides replace the values in the launch template.</p>
61    pub fn launch_template_and_overrides(mut self, input: crate::types::LaunchTemplateAndOverridesResponse) -> Self {
62        self.launch_template_and_overrides = ::std::option::Option::Some(input);
63        self
64    }
65    /// <p>The launch templates and overrides that were used for launching the instances. The values that you specify in the Overrides replace the values in the launch template.</p>
66    pub fn set_launch_template_and_overrides(mut self, input: ::std::option::Option<crate::types::LaunchTemplateAndOverridesResponse>) -> Self {
67        self.launch_template_and_overrides = input;
68        self
69    }
70    /// <p>The launch templates and overrides that were used for launching the instances. The values that you specify in the Overrides replace the values in the launch template.</p>
71    pub fn get_launch_template_and_overrides(&self) -> &::std::option::Option<crate::types::LaunchTemplateAndOverridesResponse> {
72        &self.launch_template_and_overrides
73    }
74    /// <p>Indicates if the instance that was launched is a Spot, On-Demand, Capacity Block, or Interruptible Capacity Reservation instance.</p>
75    pub fn lifecycle(mut self, input: crate::types::InstanceLifecycle) -> Self {
76        self.lifecycle = ::std::option::Option::Some(input);
77        self
78    }
79    /// <p>Indicates if the instance that was launched is a Spot, On-Demand, Capacity Block, or Interruptible Capacity Reservation instance.</p>
80    pub fn set_lifecycle(mut self, input: ::std::option::Option<crate::types::InstanceLifecycle>) -> Self {
81        self.lifecycle = input;
82        self
83    }
84    /// <p>Indicates if the instance that was launched is a Spot, On-Demand, Capacity Block, or Interruptible Capacity Reservation instance.</p>
85    pub fn get_lifecycle(&self) -> &::std::option::Option<crate::types::InstanceLifecycle> {
86        &self.lifecycle
87    }
88    /// Appends an item to `instance_ids`.
89    ///
90    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
91    ///
92    /// <p>The IDs of the instances.</p>
93    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
94        let mut v = self.instance_ids.unwrap_or_default();
95        v.push(input.into());
96        self.instance_ids = ::std::option::Option::Some(v);
97        self
98    }
99    /// <p>The IDs of the instances.</p>
100    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
101        self.instance_ids = input;
102        self
103    }
104    /// <p>The IDs of the instances.</p>
105    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
106        &self.instance_ids
107    }
108    /// <p>The instance type.</p>
109    pub fn instance_type(mut self, input: crate::types::InstanceType) -> Self {
110        self.instance_type = ::std::option::Option::Some(input);
111        self
112    }
113    /// <p>The instance type.</p>
114    pub fn set_instance_type(mut self, input: ::std::option::Option<crate::types::InstanceType>) -> Self {
115        self.instance_type = input;
116        self
117    }
118    /// <p>The instance type.</p>
119    pub fn get_instance_type(&self) -> &::std::option::Option<crate::types::InstanceType> {
120        &self.instance_type
121    }
122    /// <p>The value is <code>windows</code> for Windows instances in an EC2 Fleet. Otherwise, the value is blank.</p>
123    pub fn platform(mut self, input: crate::types::PlatformValues) -> Self {
124        self.platform = ::std::option::Option::Some(input);
125        self
126    }
127    /// <p>The value is <code>windows</code> for Windows instances in an EC2 Fleet. Otherwise, the value is blank.</p>
128    pub fn set_platform(mut self, input: ::std::option::Option<crate::types::PlatformValues>) -> Self {
129        self.platform = input;
130        self
131    }
132    /// <p>The value is <code>windows</code> for Windows instances in an EC2 Fleet. Otherwise, the value is blank.</p>
133    pub fn get_platform(&self) -> &::std::option::Option<crate::types::PlatformValues> {
134        &self.platform
135    }
136    /// Consumes the builder and constructs a [`CreateFleetInstance`](crate::types::CreateFleetInstance).
137    pub fn build(self) -> crate::types::CreateFleetInstance {
138        crate::types::CreateFleetInstance {
139            launch_template_and_overrides: self.launch_template_and_overrides,
140            lifecycle: self.lifecycle,
141            instance_ids: self.instance_ids,
142            instance_type: self.instance_type,
143            platform: self.platform,
144        }
145    }
146}