Skip to main content

aws_sdk_ec2/operation/modify_spot_fleet_request/
_modify_spot_fleet_request_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the parameters for ModifySpotFleetRequest.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ModifySpotFleetRequestInput {
7    /// <p>The launch template and overrides. You can only use this parameter if you specified a launch template (<code>LaunchTemplateConfigs</code>) in your Spot Fleet request. If you specified <code>LaunchSpecifications</code> in your Spot Fleet request, then omit this parameter.</p>
8    pub launch_template_configs: ::std::option::Option<::std::vec::Vec<crate::types::LaunchTemplateConfig>>,
9    /// <p>The number of On-Demand Instances in the fleet.</p>
10    pub on_demand_target_capacity: ::std::option::Option<i32>,
11    /// <p>Reserved.</p>
12    pub context: ::std::option::Option<::std::string::String>,
13    /// <p>The ID of the Spot Fleet request.</p>
14    pub spot_fleet_request_id: ::std::option::Option<::std::string::String>,
15    /// <p>The size of the fleet.</p>
16    pub target_capacity: ::std::option::Option<i32>,
17    /// <p>Indicates whether running instances should be terminated if the target capacity of the Spot Fleet request is decreased below the current size of the Spot Fleet.</p>
18    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
19    pub excess_capacity_termination_policy: ::std::option::Option<crate::types::ExcessCapacityTerminationPolicy>,
20}
21impl ModifySpotFleetRequestInput {
22    /// <p>The launch template and overrides. You can only use this parameter if you specified a launch template (<code>LaunchTemplateConfigs</code>) in your Spot Fleet request. If you specified <code>LaunchSpecifications</code> in your Spot Fleet request, then omit this parameter.</p>
23    ///
24    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.launch_template_configs.is_none()`.
25    pub fn launch_template_configs(&self) -> &[crate::types::LaunchTemplateConfig] {
26        self.launch_template_configs.as_deref().unwrap_or_default()
27    }
28    /// <p>The number of On-Demand Instances in the fleet.</p>
29    pub fn on_demand_target_capacity(&self) -> ::std::option::Option<i32> {
30        self.on_demand_target_capacity
31    }
32    /// <p>Reserved.</p>
33    pub fn context(&self) -> ::std::option::Option<&str> {
34        self.context.as_deref()
35    }
36    /// <p>The ID of the Spot Fleet request.</p>
37    pub fn spot_fleet_request_id(&self) -> ::std::option::Option<&str> {
38        self.spot_fleet_request_id.as_deref()
39    }
40    /// <p>The size of the fleet.</p>
41    pub fn target_capacity(&self) -> ::std::option::Option<i32> {
42        self.target_capacity
43    }
44    /// <p>Indicates whether running instances should be terminated if the target capacity of the Spot Fleet request is decreased below the current size of the Spot Fleet.</p>
45    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
46    pub fn excess_capacity_termination_policy(&self) -> ::std::option::Option<&crate::types::ExcessCapacityTerminationPolicy> {
47        self.excess_capacity_termination_policy.as_ref()
48    }
49}
50impl ModifySpotFleetRequestInput {
51    /// Creates a new builder-style object to manufacture [`ModifySpotFleetRequestInput`](crate::operation::modify_spot_fleet_request::ModifySpotFleetRequestInput).
52    pub fn builder() -> crate::operation::modify_spot_fleet_request::builders::ModifySpotFleetRequestInputBuilder {
53        crate::operation::modify_spot_fleet_request::builders::ModifySpotFleetRequestInputBuilder::default()
54    }
55}
56
57/// A builder for [`ModifySpotFleetRequestInput`](crate::operation::modify_spot_fleet_request::ModifySpotFleetRequestInput).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59#[non_exhaustive]
60pub struct ModifySpotFleetRequestInputBuilder {
61    pub(crate) launch_template_configs: ::std::option::Option<::std::vec::Vec<crate::types::LaunchTemplateConfig>>,
62    pub(crate) on_demand_target_capacity: ::std::option::Option<i32>,
63    pub(crate) context: ::std::option::Option<::std::string::String>,
64    pub(crate) spot_fleet_request_id: ::std::option::Option<::std::string::String>,
65    pub(crate) target_capacity: ::std::option::Option<i32>,
66    pub(crate) excess_capacity_termination_policy: ::std::option::Option<crate::types::ExcessCapacityTerminationPolicy>,
67}
68impl ModifySpotFleetRequestInputBuilder {
69    /// Appends an item to `launch_template_configs`.
70    ///
71    /// To override the contents of this collection use [`set_launch_template_configs`](Self::set_launch_template_configs).
72    ///
73    /// <p>The launch template and overrides. You can only use this parameter if you specified a launch template (<code>LaunchTemplateConfigs</code>) in your Spot Fleet request. If you specified <code>LaunchSpecifications</code> in your Spot Fleet request, then omit this parameter.</p>
74    pub fn launch_template_configs(mut self, input: crate::types::LaunchTemplateConfig) -> Self {
75        let mut v = self.launch_template_configs.unwrap_or_default();
76        v.push(input);
77        self.launch_template_configs = ::std::option::Option::Some(v);
78        self
79    }
80    /// <p>The launch template and overrides. You can only use this parameter if you specified a launch template (<code>LaunchTemplateConfigs</code>) in your Spot Fleet request. If you specified <code>LaunchSpecifications</code> in your Spot Fleet request, then omit this parameter.</p>
81    pub fn set_launch_template_configs(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::LaunchTemplateConfig>>) -> Self {
82        self.launch_template_configs = input;
83        self
84    }
85    /// <p>The launch template and overrides. You can only use this parameter if you specified a launch template (<code>LaunchTemplateConfigs</code>) in your Spot Fleet request. If you specified <code>LaunchSpecifications</code> in your Spot Fleet request, then omit this parameter.</p>
86    pub fn get_launch_template_configs(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::LaunchTemplateConfig>> {
87        &self.launch_template_configs
88    }
89    /// <p>The number of On-Demand Instances in the fleet.</p>
90    pub fn on_demand_target_capacity(mut self, input: i32) -> Self {
91        self.on_demand_target_capacity = ::std::option::Option::Some(input);
92        self
93    }
94    /// <p>The number of On-Demand Instances in the fleet.</p>
95    pub fn set_on_demand_target_capacity(mut self, input: ::std::option::Option<i32>) -> Self {
96        self.on_demand_target_capacity = input;
97        self
98    }
99    /// <p>The number of On-Demand Instances in the fleet.</p>
100    pub fn get_on_demand_target_capacity(&self) -> &::std::option::Option<i32> {
101        &self.on_demand_target_capacity
102    }
103    /// <p>Reserved.</p>
104    pub fn context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.context = ::std::option::Option::Some(input.into());
106        self
107    }
108    /// <p>Reserved.</p>
109    pub fn set_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110        self.context = input;
111        self
112    }
113    /// <p>Reserved.</p>
114    pub fn get_context(&self) -> &::std::option::Option<::std::string::String> {
115        &self.context
116    }
117    /// <p>The ID of the Spot Fleet request.</p>
118    /// This field is required.
119    pub fn spot_fleet_request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.spot_fleet_request_id = ::std::option::Option::Some(input.into());
121        self
122    }
123    /// <p>The ID of the Spot Fleet request.</p>
124    pub fn set_spot_fleet_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125        self.spot_fleet_request_id = input;
126        self
127    }
128    /// <p>The ID of the Spot Fleet request.</p>
129    pub fn get_spot_fleet_request_id(&self) -> &::std::option::Option<::std::string::String> {
130        &self.spot_fleet_request_id
131    }
132    /// <p>The size of the fleet.</p>
133    pub fn target_capacity(mut self, input: i32) -> Self {
134        self.target_capacity = ::std::option::Option::Some(input);
135        self
136    }
137    /// <p>The size of the fleet.</p>
138    pub fn set_target_capacity(mut self, input: ::std::option::Option<i32>) -> Self {
139        self.target_capacity = input;
140        self
141    }
142    /// <p>The size of the fleet.</p>
143    pub fn get_target_capacity(&self) -> &::std::option::Option<i32> {
144        &self.target_capacity
145    }
146    /// <p>Indicates whether running instances should be terminated if the target capacity of the Spot Fleet request is decreased below the current size of the Spot Fleet.</p>
147    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
148    pub fn excess_capacity_termination_policy(mut self, input: crate::types::ExcessCapacityTerminationPolicy) -> Self {
149        self.excess_capacity_termination_policy = ::std::option::Option::Some(input);
150        self
151    }
152    /// <p>Indicates whether running instances should be terminated if the target capacity of the Spot Fleet request is decreased below the current size of the Spot Fleet.</p>
153    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
154    pub fn set_excess_capacity_termination_policy(mut self, input: ::std::option::Option<crate::types::ExcessCapacityTerminationPolicy>) -> Self {
155        self.excess_capacity_termination_policy = input;
156        self
157    }
158    /// <p>Indicates whether running instances should be terminated if the target capacity of the Spot Fleet request is decreased below the current size of the Spot Fleet.</p>
159    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
160    pub fn get_excess_capacity_termination_policy(&self) -> &::std::option::Option<crate::types::ExcessCapacityTerminationPolicy> {
161        &self.excess_capacity_termination_policy
162    }
163    /// Consumes the builder and constructs a [`ModifySpotFleetRequestInput`](crate::operation::modify_spot_fleet_request::ModifySpotFleetRequestInput).
164    pub fn build(
165        self,
166    ) -> ::std::result::Result<
167        crate::operation::modify_spot_fleet_request::ModifySpotFleetRequestInput,
168        ::aws_smithy_types::error::operation::BuildError,
169    > {
170        ::std::result::Result::Ok(crate::operation::modify_spot_fleet_request::ModifySpotFleetRequestInput {
171            launch_template_configs: self.launch_template_configs,
172            on_demand_target_capacity: self.on_demand_target_capacity,
173            context: self.context,
174            spot_fleet_request_id: self.spot_fleet_request_id,
175            target_capacity: self.target_capacity,
176            excess_capacity_termination_policy: self.excess_capacity_termination_policy,
177        })
178    }
179}