1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The configuration that defines an instance fleet.</p><note>
/// <p>The instance fleet configuration is available only in Amazon EMR releases 4.8.0 and later, excluding 5.0.x versions.</p>
/// </note>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct InstanceFleetConfig {
    /// <p>The friendly name of the instance fleet.</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>The node type that the instance fleet hosts. Valid values are MASTER, CORE, and TASK.</p>
    pub instance_fleet_type: ::std::option::Option<crate::types::InstanceFleetType>,
    /// <p>The target capacity of On-Demand units for the instance fleet, which determines how many On-Demand Instances to provision. When the instance fleet launches, Amazon EMR tries to provision On-Demand Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When an On-Demand Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only Spot Instances are provisioned for the instance fleet using <code>TargetSpotCapacity</code>. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub target_on_demand_capacity: ::std::option::Option<i32>,
    /// <p>The target capacity of Spot units for the instance fleet, which determines how many Spot Instances to provision. When the instance fleet launches, Amazon EMR tries to provision Spot Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When a Spot Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only On-Demand Instances are provisioned for the instance fleet. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub target_spot_capacity: ::std::option::Option<i32>,
    /// <p>The instance type configurations that define the Amazon EC2 instances in the instance fleet.</p>
    pub instance_type_configs: ::std::option::Option<::std::vec::Vec<crate::types::InstanceTypeConfig>>,
    /// <p>The launch specification for the instance fleet.</p>
    pub launch_specifications: ::std::option::Option<crate::types::InstanceFleetProvisioningSpecifications>,
    /// <p>The resize specification for the instance fleet.</p>
    pub resize_specifications: ::std::option::Option<crate::types::InstanceFleetResizingSpecifications>,
}
impl InstanceFleetConfig {
    /// <p>The friendly name of the instance fleet.</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>The node type that the instance fleet hosts. Valid values are MASTER, CORE, and TASK.</p>
    pub fn instance_fleet_type(&self) -> ::std::option::Option<&crate::types::InstanceFleetType> {
        self.instance_fleet_type.as_ref()
    }
    /// <p>The target capacity of On-Demand units for the instance fleet, which determines how many On-Demand Instances to provision. When the instance fleet launches, Amazon EMR tries to provision On-Demand Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When an On-Demand Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only Spot Instances are provisioned for the instance fleet using <code>TargetSpotCapacity</code>. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub fn target_on_demand_capacity(&self) -> ::std::option::Option<i32> {
        self.target_on_demand_capacity
    }
    /// <p>The target capacity of Spot units for the instance fleet, which determines how many Spot Instances to provision. When the instance fleet launches, Amazon EMR tries to provision Spot Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When a Spot Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only On-Demand Instances are provisioned for the instance fleet. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub fn target_spot_capacity(&self) -> ::std::option::Option<i32> {
        self.target_spot_capacity
    }
    /// <p>The instance type configurations that define the Amazon EC2 instances in the instance fleet.</p>
    ///
    /// 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_type_configs.is_none()`.
    pub fn instance_type_configs(&self) -> &[crate::types::InstanceTypeConfig] {
        self.instance_type_configs.as_deref().unwrap_or_default()
    }
    /// <p>The launch specification for the instance fleet.</p>
    pub fn launch_specifications(&self) -> ::std::option::Option<&crate::types::InstanceFleetProvisioningSpecifications> {
        self.launch_specifications.as_ref()
    }
    /// <p>The resize specification for the instance fleet.</p>
    pub fn resize_specifications(&self) -> ::std::option::Option<&crate::types::InstanceFleetResizingSpecifications> {
        self.resize_specifications.as_ref()
    }
}
impl InstanceFleetConfig {
    /// Creates a new builder-style object to manufacture [`InstanceFleetConfig`](crate::types::InstanceFleetConfig).
    pub fn builder() -> crate::types::builders::InstanceFleetConfigBuilder {
        crate::types::builders::InstanceFleetConfigBuilder::default()
    }
}

/// A builder for [`InstanceFleetConfig`](crate::types::InstanceFleetConfig).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct InstanceFleetConfigBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) instance_fleet_type: ::std::option::Option<crate::types::InstanceFleetType>,
    pub(crate) target_on_demand_capacity: ::std::option::Option<i32>,
    pub(crate) target_spot_capacity: ::std::option::Option<i32>,
    pub(crate) instance_type_configs: ::std::option::Option<::std::vec::Vec<crate::types::InstanceTypeConfig>>,
    pub(crate) launch_specifications: ::std::option::Option<crate::types::InstanceFleetProvisioningSpecifications>,
    pub(crate) resize_specifications: ::std::option::Option<crate::types::InstanceFleetResizingSpecifications>,
}
impl InstanceFleetConfigBuilder {
    /// <p>The friendly name of the instance fleet.</p>
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The friendly name of the instance fleet.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The friendly name of the instance fleet.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>The node type that the instance fleet hosts. Valid values are MASTER, CORE, and TASK.</p>
    /// This field is required.
    pub fn instance_fleet_type(mut self, input: crate::types::InstanceFleetType) -> Self {
        self.instance_fleet_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The node type that the instance fleet hosts. Valid values are MASTER, CORE, and TASK.</p>
    pub fn set_instance_fleet_type(mut self, input: ::std::option::Option<crate::types::InstanceFleetType>) -> Self {
        self.instance_fleet_type = input;
        self
    }
    /// <p>The node type that the instance fleet hosts. Valid values are MASTER, CORE, and TASK.</p>
    pub fn get_instance_fleet_type(&self) -> &::std::option::Option<crate::types::InstanceFleetType> {
        &self.instance_fleet_type
    }
    /// <p>The target capacity of On-Demand units for the instance fleet, which determines how many On-Demand Instances to provision. When the instance fleet launches, Amazon EMR tries to provision On-Demand Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When an On-Demand Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only Spot Instances are provisioned for the instance fleet using <code>TargetSpotCapacity</code>. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub fn target_on_demand_capacity(mut self, input: i32) -> Self {
        self.target_on_demand_capacity = ::std::option::Option::Some(input);
        self
    }
    /// <p>The target capacity of On-Demand units for the instance fleet, which determines how many On-Demand Instances to provision. When the instance fleet launches, Amazon EMR tries to provision On-Demand Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When an On-Demand Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only Spot Instances are provisioned for the instance fleet using <code>TargetSpotCapacity</code>. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub fn set_target_on_demand_capacity(mut self, input: ::std::option::Option<i32>) -> Self {
        self.target_on_demand_capacity = input;
        self
    }
    /// <p>The target capacity of On-Demand units for the instance fleet, which determines how many On-Demand Instances to provision. When the instance fleet launches, Amazon EMR tries to provision On-Demand Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When an On-Demand Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only Spot Instances are provisioned for the instance fleet using <code>TargetSpotCapacity</code>. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub fn get_target_on_demand_capacity(&self) -> &::std::option::Option<i32> {
        &self.target_on_demand_capacity
    }
    /// <p>The target capacity of Spot units for the instance fleet, which determines how many Spot Instances to provision. When the instance fleet launches, Amazon EMR tries to provision Spot Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When a Spot Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only On-Demand Instances are provisioned for the instance fleet. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub fn target_spot_capacity(mut self, input: i32) -> Self {
        self.target_spot_capacity = ::std::option::Option::Some(input);
        self
    }
    /// <p>The target capacity of Spot units for the instance fleet, which determines how many Spot Instances to provision. When the instance fleet launches, Amazon EMR tries to provision Spot Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When a Spot Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only On-Demand Instances are provisioned for the instance fleet. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub fn set_target_spot_capacity(mut self, input: ::std::option::Option<i32>) -> Self {
        self.target_spot_capacity = input;
        self
    }
    /// <p>The target capacity of Spot units for the instance fleet, which determines how many Spot Instances to provision. When the instance fleet launches, Amazon EMR tries to provision Spot Instances as specified by <code>InstanceTypeConfig</code>. Each instance configuration has a specified <code>WeightedCapacity</code>. When a Spot Instance is provisioned, the <code>WeightedCapacity</code> units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a <code>WeightedCapacity</code> of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.</p><note>
    /// <p>If not specified or set to 0, only On-Demand Instances are provisioned for the instance fleet. At least one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> should be greater than 0. For a master instance fleet, only one of <code>TargetSpotCapacity</code> and <code>TargetOnDemandCapacity</code> can be specified, and its value must be 1.</p>
    /// </note>
    pub fn get_target_spot_capacity(&self) -> &::std::option::Option<i32> {
        &self.target_spot_capacity
    }
    /// Appends an item to `instance_type_configs`.
    ///
    /// To override the contents of this collection use [`set_instance_type_configs`](Self::set_instance_type_configs).
    ///
    /// <p>The instance type configurations that define the Amazon EC2 instances in the instance fleet.</p>
    pub fn instance_type_configs(mut self, input: crate::types::InstanceTypeConfig) -> Self {
        let mut v = self.instance_type_configs.unwrap_or_default();
        v.push(input);
        self.instance_type_configs = ::std::option::Option::Some(v);
        self
    }
    /// <p>The instance type configurations that define the Amazon EC2 instances in the instance fleet.</p>
    pub fn set_instance_type_configs(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::InstanceTypeConfig>>) -> Self {
        self.instance_type_configs = input;
        self
    }
    /// <p>The instance type configurations that define the Amazon EC2 instances in the instance fleet.</p>
    pub fn get_instance_type_configs(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::InstanceTypeConfig>> {
        &self.instance_type_configs
    }
    /// <p>The launch specification for the instance fleet.</p>
    pub fn launch_specifications(mut self, input: crate::types::InstanceFleetProvisioningSpecifications) -> Self {
        self.launch_specifications = ::std::option::Option::Some(input);
        self
    }
    /// <p>The launch specification for the instance fleet.</p>
    pub fn set_launch_specifications(mut self, input: ::std::option::Option<crate::types::InstanceFleetProvisioningSpecifications>) -> Self {
        self.launch_specifications = input;
        self
    }
    /// <p>The launch specification for the instance fleet.</p>
    pub fn get_launch_specifications(&self) -> &::std::option::Option<crate::types::InstanceFleetProvisioningSpecifications> {
        &self.launch_specifications
    }
    /// <p>The resize specification for the instance fleet.</p>
    pub fn resize_specifications(mut self, input: crate::types::InstanceFleetResizingSpecifications) -> Self {
        self.resize_specifications = ::std::option::Option::Some(input);
        self
    }
    /// <p>The resize specification for the instance fleet.</p>
    pub fn set_resize_specifications(mut self, input: ::std::option::Option<crate::types::InstanceFleetResizingSpecifications>) -> Self {
        self.resize_specifications = input;
        self
    }
    /// <p>The resize specification for the instance fleet.</p>
    pub fn get_resize_specifications(&self) -> &::std::option::Option<crate::types::InstanceFleetResizingSpecifications> {
        &self.resize_specifications
    }
    /// Consumes the builder and constructs a [`InstanceFleetConfig`](crate::types::InstanceFleetConfig).
    pub fn build(self) -> crate::types::InstanceFleetConfig {
        crate::types::InstanceFleetConfig {
            name: self.name,
            instance_fleet_type: self.instance_fleet_type,
            target_on_demand_capacity: self.target_on_demand_capacity,
            target_spot_capacity: self.target_spot_capacity,
            instance_type_configs: self.instance_type_configs,
            launch_specifications: self.launch_specifications,
            resize_specifications: self.resize_specifications,
        }
    }
}