aws_sdk_ec2/operation/modify_fleet/
_modify_fleet_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct ModifyFleetInput {
6    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
7    pub dry_run: ::std::option::Option<bool>,
8    /// <p>Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.</p>
9    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
10    pub excess_capacity_termination_policy: ::std::option::Option<crate::types::FleetExcessCapacityTerminationPolicy>,
11    /// <p>The launch template and overrides.</p>
12    pub launch_template_configs: ::std::option::Option<::std::vec::Vec<crate::types::FleetLaunchTemplateConfigRequest>>,
13    /// <p>The ID of the EC2 Fleet.</p>
14    pub fleet_id: ::std::option::Option<::std::string::String>,
15    /// <p>The size of the EC2 Fleet.</p>
16    pub target_capacity_specification: ::std::option::Option<crate::types::TargetCapacitySpecificationRequest>,
17    /// <p>Reserved.</p>
18    pub context: ::std::option::Option<::std::string::String>,
19}
20impl ModifyFleetInput {
21    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
22    pub fn dry_run(&self) -> ::std::option::Option<bool> {
23        self.dry_run
24    }
25    /// <p>Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.</p>
26    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
27    pub fn excess_capacity_termination_policy(&self) -> ::std::option::Option<&crate::types::FleetExcessCapacityTerminationPolicy> {
28        self.excess_capacity_termination_policy.as_ref()
29    }
30    /// <p>The launch template and overrides.</p>
31    ///
32    /// 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()`.
33    pub fn launch_template_configs(&self) -> &[crate::types::FleetLaunchTemplateConfigRequest] {
34        self.launch_template_configs.as_deref().unwrap_or_default()
35    }
36    /// <p>The ID of the EC2 Fleet.</p>
37    pub fn fleet_id(&self) -> ::std::option::Option<&str> {
38        self.fleet_id.as_deref()
39    }
40    /// <p>The size of the EC2 Fleet.</p>
41    pub fn target_capacity_specification(&self) -> ::std::option::Option<&crate::types::TargetCapacitySpecificationRequest> {
42        self.target_capacity_specification.as_ref()
43    }
44    /// <p>Reserved.</p>
45    pub fn context(&self) -> ::std::option::Option<&str> {
46        self.context.as_deref()
47    }
48}
49impl ModifyFleetInput {
50    /// Creates a new builder-style object to manufacture [`ModifyFleetInput`](crate::operation::modify_fleet::ModifyFleetInput).
51    pub fn builder() -> crate::operation::modify_fleet::builders::ModifyFleetInputBuilder {
52        crate::operation::modify_fleet::builders::ModifyFleetInputBuilder::default()
53    }
54}
55
56/// A builder for [`ModifyFleetInput`](crate::operation::modify_fleet::ModifyFleetInput).
57#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
58#[non_exhaustive]
59pub struct ModifyFleetInputBuilder {
60    pub(crate) dry_run: ::std::option::Option<bool>,
61    pub(crate) excess_capacity_termination_policy: ::std::option::Option<crate::types::FleetExcessCapacityTerminationPolicy>,
62    pub(crate) launch_template_configs: ::std::option::Option<::std::vec::Vec<crate::types::FleetLaunchTemplateConfigRequest>>,
63    pub(crate) fleet_id: ::std::option::Option<::std::string::String>,
64    pub(crate) target_capacity_specification: ::std::option::Option<crate::types::TargetCapacitySpecificationRequest>,
65    pub(crate) context: ::std::option::Option<::std::string::String>,
66}
67impl ModifyFleetInputBuilder {
68    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
69    pub fn dry_run(mut self, input: bool) -> Self {
70        self.dry_run = ::std::option::Option::Some(input);
71        self
72    }
73    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
74    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
75        self.dry_run = input;
76        self
77    }
78    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
79    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
80        &self.dry_run
81    }
82    /// <p>Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.</p>
83    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
84    pub fn excess_capacity_termination_policy(mut self, input: crate::types::FleetExcessCapacityTerminationPolicy) -> Self {
85        self.excess_capacity_termination_policy = ::std::option::Option::Some(input);
86        self
87    }
88    /// <p>Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.</p>
89    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
90    pub fn set_excess_capacity_termination_policy(
91        mut self,
92        input: ::std::option::Option<crate::types::FleetExcessCapacityTerminationPolicy>,
93    ) -> Self {
94        self.excess_capacity_termination_policy = input;
95        self
96    }
97    /// <p>Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.</p>
98    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
99    pub fn get_excess_capacity_termination_policy(&self) -> &::std::option::Option<crate::types::FleetExcessCapacityTerminationPolicy> {
100        &self.excess_capacity_termination_policy
101    }
102    /// Appends an item to `launch_template_configs`.
103    ///
104    /// To override the contents of this collection use [`set_launch_template_configs`](Self::set_launch_template_configs).
105    ///
106    /// <p>The launch template and overrides.</p>
107    pub fn launch_template_configs(mut self, input: crate::types::FleetLaunchTemplateConfigRequest) -> Self {
108        let mut v = self.launch_template_configs.unwrap_or_default();
109        v.push(input);
110        self.launch_template_configs = ::std::option::Option::Some(v);
111        self
112    }
113    /// <p>The launch template and overrides.</p>
114    pub fn set_launch_template_configs(
115        mut self,
116        input: ::std::option::Option<::std::vec::Vec<crate::types::FleetLaunchTemplateConfigRequest>>,
117    ) -> Self {
118        self.launch_template_configs = input;
119        self
120    }
121    /// <p>The launch template and overrides.</p>
122    pub fn get_launch_template_configs(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FleetLaunchTemplateConfigRequest>> {
123        &self.launch_template_configs
124    }
125    /// <p>The ID of the EC2 Fleet.</p>
126    /// This field is required.
127    pub fn fleet_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.fleet_id = ::std::option::Option::Some(input.into());
129        self
130    }
131    /// <p>The ID of the EC2 Fleet.</p>
132    pub fn set_fleet_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.fleet_id = input;
134        self
135    }
136    /// <p>The ID of the EC2 Fleet.</p>
137    pub fn get_fleet_id(&self) -> &::std::option::Option<::std::string::String> {
138        &self.fleet_id
139    }
140    /// <p>The size of the EC2 Fleet.</p>
141    pub fn target_capacity_specification(mut self, input: crate::types::TargetCapacitySpecificationRequest) -> Self {
142        self.target_capacity_specification = ::std::option::Option::Some(input);
143        self
144    }
145    /// <p>The size of the EC2 Fleet.</p>
146    pub fn set_target_capacity_specification(mut self, input: ::std::option::Option<crate::types::TargetCapacitySpecificationRequest>) -> Self {
147        self.target_capacity_specification = input;
148        self
149    }
150    /// <p>The size of the EC2 Fleet.</p>
151    pub fn get_target_capacity_specification(&self) -> &::std::option::Option<crate::types::TargetCapacitySpecificationRequest> {
152        &self.target_capacity_specification
153    }
154    /// <p>Reserved.</p>
155    pub fn context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.context = ::std::option::Option::Some(input.into());
157        self
158    }
159    /// <p>Reserved.</p>
160    pub fn set_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.context = input;
162        self
163    }
164    /// <p>Reserved.</p>
165    pub fn get_context(&self) -> &::std::option::Option<::std::string::String> {
166        &self.context
167    }
168    /// Consumes the builder and constructs a [`ModifyFleetInput`](crate::operation::modify_fleet::ModifyFleetInput).
169    pub fn build(self) -> ::std::result::Result<crate::operation::modify_fleet::ModifyFleetInput, ::aws_smithy_types::error::operation::BuildError> {
170        ::std::result::Result::Ok(crate::operation::modify_fleet::ModifyFleetInput {
171            dry_run: self.dry_run,
172            excess_capacity_termination_policy: self.excess_capacity_termination_policy,
173            launch_template_configs: self.launch_template_configs,
174            fleet_id: self.fleet_id,
175            target_capacity_specification: self.target_capacity_specification,
176            context: self.context,
177        })
178    }
179}