aws_sdk_autoscaling/operation/launch_instances/
_launch_instances_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 LaunchInstancesInput {
6    /// <p>The name of the Auto Scaling group to launch instances into.</p>
7    pub auto_scaling_group_name: ::std::option::Option<::std::string::String>,
8    /// <p>The number of instances to launch. Although this value can exceed 100 for instance weights, the actual instance count is limited to 100 instances per launch.</p>
9    pub requested_capacity: ::std::option::Option<i32>,
10    /// <p>A unique, case-sensitive identifier to ensure idempotency of the request.</p>
11    pub client_token: ::std::option::Option<::std::string::String>,
12    /// <p>The Availability Zones for the instance launch. Must match or be included in the Auto Scaling group's Availability Zone configuration. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified for groups with multiple Availability Zone configurations.</p>
13    pub availability_zones: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
14    /// <p>A list of Availability Zone IDs where instances should be launched. Must match or be included in the group's AZ configuration. You cannot specify both AvailabilityZones and AvailabilityZoneIds. Required for multi-AZ groups, optional for single-AZ groups.</p>
15    pub availability_zone_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
16    /// <p>The subnet IDs for the instance launch. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified. If both are specified, the subnets must reside in the specified Availability Zones.</p>
17    pub subnet_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
18    /// <p>Specifies whether to retry asynchronously if the synchronous launch fails. Valid values are NONE (default, no async retry) and RETRY_WITH_GROUP_CONFIGURATION (increase desired capacity and retry with group configuration).</p>
19    pub retry_strategy: ::std::option::Option<crate::types::RetryStrategy>,
20}
21impl LaunchInstancesInput {
22    /// <p>The name of the Auto Scaling group to launch instances into.</p>
23    pub fn auto_scaling_group_name(&self) -> ::std::option::Option<&str> {
24        self.auto_scaling_group_name.as_deref()
25    }
26    /// <p>The number of instances to launch. Although this value can exceed 100 for instance weights, the actual instance count is limited to 100 instances per launch.</p>
27    pub fn requested_capacity(&self) -> ::std::option::Option<i32> {
28        self.requested_capacity
29    }
30    /// <p>A unique, case-sensitive identifier to ensure idempotency of the request.</p>
31    pub fn client_token(&self) -> ::std::option::Option<&str> {
32        self.client_token.as_deref()
33    }
34    /// <p>The Availability Zones for the instance launch. Must match or be included in the Auto Scaling group's Availability Zone configuration. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified for groups with multiple Availability Zone configurations.</p>
35    ///
36    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.availability_zones.is_none()`.
37    pub fn availability_zones(&self) -> &[::std::string::String] {
38        self.availability_zones.as_deref().unwrap_or_default()
39    }
40    /// <p>A list of Availability Zone IDs where instances should be launched. Must match or be included in the group's AZ configuration. You cannot specify both AvailabilityZones and AvailabilityZoneIds. Required for multi-AZ groups, optional for single-AZ groups.</p>
41    ///
42    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.availability_zone_ids.is_none()`.
43    pub fn availability_zone_ids(&self) -> &[::std::string::String] {
44        self.availability_zone_ids.as_deref().unwrap_or_default()
45    }
46    /// <p>The subnet IDs for the instance launch. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified. If both are specified, the subnets must reside in the specified Availability Zones.</p>
47    ///
48    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.subnet_ids.is_none()`.
49    pub fn subnet_ids(&self) -> &[::std::string::String] {
50        self.subnet_ids.as_deref().unwrap_or_default()
51    }
52    /// <p>Specifies whether to retry asynchronously if the synchronous launch fails. Valid values are NONE (default, no async retry) and RETRY_WITH_GROUP_CONFIGURATION (increase desired capacity and retry with group configuration).</p>
53    pub fn retry_strategy(&self) -> ::std::option::Option<&crate::types::RetryStrategy> {
54        self.retry_strategy.as_ref()
55    }
56}
57impl LaunchInstancesInput {
58    /// Creates a new builder-style object to manufacture [`LaunchInstancesInput`](crate::operation::launch_instances::LaunchInstancesInput).
59    pub fn builder() -> crate::operation::launch_instances::builders::LaunchInstancesInputBuilder {
60        crate::operation::launch_instances::builders::LaunchInstancesInputBuilder::default()
61    }
62}
63
64/// A builder for [`LaunchInstancesInput`](crate::operation::launch_instances::LaunchInstancesInput).
65#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
66#[non_exhaustive]
67pub struct LaunchInstancesInputBuilder {
68    pub(crate) auto_scaling_group_name: ::std::option::Option<::std::string::String>,
69    pub(crate) requested_capacity: ::std::option::Option<i32>,
70    pub(crate) client_token: ::std::option::Option<::std::string::String>,
71    pub(crate) availability_zones: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
72    pub(crate) availability_zone_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
73    pub(crate) subnet_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
74    pub(crate) retry_strategy: ::std::option::Option<crate::types::RetryStrategy>,
75}
76impl LaunchInstancesInputBuilder {
77    /// <p>The name of the Auto Scaling group to launch instances into.</p>
78    /// This field is required.
79    pub fn auto_scaling_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
80        self.auto_scaling_group_name = ::std::option::Option::Some(input.into());
81        self
82    }
83    /// <p>The name of the Auto Scaling group to launch instances into.</p>
84    pub fn set_auto_scaling_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
85        self.auto_scaling_group_name = input;
86        self
87    }
88    /// <p>The name of the Auto Scaling group to launch instances into.</p>
89    pub fn get_auto_scaling_group_name(&self) -> &::std::option::Option<::std::string::String> {
90        &self.auto_scaling_group_name
91    }
92    /// <p>The number of instances to launch. Although this value can exceed 100 for instance weights, the actual instance count is limited to 100 instances per launch.</p>
93    /// This field is required.
94    pub fn requested_capacity(mut self, input: i32) -> Self {
95        self.requested_capacity = ::std::option::Option::Some(input);
96        self
97    }
98    /// <p>The number of instances to launch. Although this value can exceed 100 for instance weights, the actual instance count is limited to 100 instances per launch.</p>
99    pub fn set_requested_capacity(mut self, input: ::std::option::Option<i32>) -> Self {
100        self.requested_capacity = input;
101        self
102    }
103    /// <p>The number of instances to launch. Although this value can exceed 100 for instance weights, the actual instance count is limited to 100 instances per launch.</p>
104    pub fn get_requested_capacity(&self) -> &::std::option::Option<i32> {
105        &self.requested_capacity
106    }
107    /// <p>A unique, case-sensitive identifier to ensure idempotency of the request.</p>
108    /// This field is required.
109    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
110        self.client_token = ::std::option::Option::Some(input.into());
111        self
112    }
113    /// <p>A unique, case-sensitive identifier to ensure idempotency of the request.</p>
114    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
115        self.client_token = input;
116        self
117    }
118    /// <p>A unique, case-sensitive identifier to ensure idempotency of the request.</p>
119    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
120        &self.client_token
121    }
122    /// Appends an item to `availability_zones`.
123    ///
124    /// To override the contents of this collection use [`set_availability_zones`](Self::set_availability_zones).
125    ///
126    /// <p>The Availability Zones for the instance launch. Must match or be included in the Auto Scaling group's Availability Zone configuration. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified for groups with multiple Availability Zone configurations.</p>
127    pub fn availability_zones(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        let mut v = self.availability_zones.unwrap_or_default();
129        v.push(input.into());
130        self.availability_zones = ::std::option::Option::Some(v);
131        self
132    }
133    /// <p>The Availability Zones for the instance launch. Must match or be included in the Auto Scaling group's Availability Zone configuration. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified for groups with multiple Availability Zone configurations.</p>
134    pub fn set_availability_zones(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
135        self.availability_zones = input;
136        self
137    }
138    /// <p>The Availability Zones for the instance launch. Must match or be included in the Auto Scaling group's Availability Zone configuration. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified for groups with multiple Availability Zone configurations.</p>
139    pub fn get_availability_zones(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
140        &self.availability_zones
141    }
142    /// Appends an item to `availability_zone_ids`.
143    ///
144    /// To override the contents of this collection use [`set_availability_zone_ids`](Self::set_availability_zone_ids).
145    ///
146    /// <p>A list of Availability Zone IDs where instances should be launched. Must match or be included in the group's AZ configuration. You cannot specify both AvailabilityZones and AvailabilityZoneIds. Required for multi-AZ groups, optional for single-AZ groups.</p>
147    pub fn availability_zone_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        let mut v = self.availability_zone_ids.unwrap_or_default();
149        v.push(input.into());
150        self.availability_zone_ids = ::std::option::Option::Some(v);
151        self
152    }
153    /// <p>A list of Availability Zone IDs where instances should be launched. Must match or be included in the group's AZ configuration. You cannot specify both AvailabilityZones and AvailabilityZoneIds. Required for multi-AZ groups, optional for single-AZ groups.</p>
154    pub fn set_availability_zone_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
155        self.availability_zone_ids = input;
156        self
157    }
158    /// <p>A list of Availability Zone IDs where instances should be launched. Must match or be included in the group's AZ configuration. You cannot specify both AvailabilityZones and AvailabilityZoneIds. Required for multi-AZ groups, optional for single-AZ groups.</p>
159    pub fn get_availability_zone_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
160        &self.availability_zone_ids
161    }
162    /// Appends an item to `subnet_ids`.
163    ///
164    /// To override the contents of this collection use [`set_subnet_ids`](Self::set_subnet_ids).
165    ///
166    /// <p>The subnet IDs for the instance launch. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified. If both are specified, the subnets must reside in the specified Availability Zones.</p>
167    pub fn subnet_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
168        let mut v = self.subnet_ids.unwrap_or_default();
169        v.push(input.into());
170        self.subnet_ids = ::std::option::Option::Some(v);
171        self
172    }
173    /// <p>The subnet IDs for the instance launch. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified. If both are specified, the subnets must reside in the specified Availability Zones.</p>
174    pub fn set_subnet_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
175        self.subnet_ids = input;
176        self
177    }
178    /// <p>The subnet IDs for the instance launch. Either <code>AvailabilityZones</code> or <code>SubnetIds</code> must be specified. If both are specified, the subnets must reside in the specified Availability Zones.</p>
179    pub fn get_subnet_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
180        &self.subnet_ids
181    }
182    /// <p>Specifies whether to retry asynchronously if the synchronous launch fails. Valid values are NONE (default, no async retry) and RETRY_WITH_GROUP_CONFIGURATION (increase desired capacity and retry with group configuration).</p>
183    pub fn retry_strategy(mut self, input: crate::types::RetryStrategy) -> Self {
184        self.retry_strategy = ::std::option::Option::Some(input);
185        self
186    }
187    /// <p>Specifies whether to retry asynchronously if the synchronous launch fails. Valid values are NONE (default, no async retry) and RETRY_WITH_GROUP_CONFIGURATION (increase desired capacity and retry with group configuration).</p>
188    pub fn set_retry_strategy(mut self, input: ::std::option::Option<crate::types::RetryStrategy>) -> Self {
189        self.retry_strategy = input;
190        self
191    }
192    /// <p>Specifies whether to retry asynchronously if the synchronous launch fails. Valid values are NONE (default, no async retry) and RETRY_WITH_GROUP_CONFIGURATION (increase desired capacity and retry with group configuration).</p>
193    pub fn get_retry_strategy(&self) -> &::std::option::Option<crate::types::RetryStrategy> {
194        &self.retry_strategy
195    }
196    /// Consumes the builder and constructs a [`LaunchInstancesInput`](crate::operation::launch_instances::LaunchInstancesInput).
197    pub fn build(
198        self,
199    ) -> ::std::result::Result<crate::operation::launch_instances::LaunchInstancesInput, ::aws_smithy_types::error::operation::BuildError> {
200        ::std::result::Result::Ok(crate::operation::launch_instances::LaunchInstancesInput {
201            auto_scaling_group_name: self.auto_scaling_group_name,
202            requested_capacity: self.requested_capacity,
203            client_token: self.client_token,
204            availability_zones: self.availability_zones,
205            availability_zone_ids: self.availability_zone_ids,
206            subnet_ids: self.subnet_ids,
207            retry_strategy: self.retry_strategy,
208        })
209    }
210}