aws_sdk_ec2/operation/allocate_hosts/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::allocate_hosts::_allocate_hosts_output::AllocateHostsOutputBuilder;
3
4pub use crate::operation::allocate_hosts::_allocate_hosts_input::AllocateHostsInputBuilder;
5
6impl crate::operation::allocate_hosts::builders::AllocateHostsInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::allocate_hosts::AllocateHostsOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::allocate_hosts::AllocateHostsError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.allocate_hosts();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `AllocateHosts`.
24///
25/// <p>Allocates a Dedicated Host to your account. At a minimum, specify the supported instance type or instance family, the Availability Zone in which to allocate the host, and the number of hosts to allocate.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct AllocateHostsFluentBuilder {
28 handle: ::std::sync::Arc<crate::client::Handle>,
29 inner: crate::operation::allocate_hosts::builders::AllocateHostsInputBuilder,
30 config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33 crate::client::customize::internal::CustomizableSend<
34 crate::operation::allocate_hosts::AllocateHostsOutput,
35 crate::operation::allocate_hosts::AllocateHostsError,
36 > for AllocateHostsFluentBuilder
37{
38 fn send(
39 self,
40 config_override: crate::config::Builder,
41 ) -> crate::client::customize::internal::BoxFuture<
42 crate::client::customize::internal::SendResult<
43 crate::operation::allocate_hosts::AllocateHostsOutput,
44 crate::operation::allocate_hosts::AllocateHostsError,
45 >,
46 > {
47 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48 }
49}
50impl AllocateHostsFluentBuilder {
51 /// Creates a new `AllocateHostsFluentBuilder`.
52 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53 Self {
54 handle,
55 inner: ::std::default::Default::default(),
56 config_override: ::std::option::Option::None,
57 }
58 }
59 /// Access the AllocateHosts as a reference.
60 pub fn as_input(&self) -> &crate::operation::allocate_hosts::builders::AllocateHostsInputBuilder {
61 &self.inner
62 }
63 /// Sends the request and returns the response.
64 ///
65 /// If an error occurs, an `SdkError` will be returned with additional details that
66 /// can be matched against.
67 ///
68 /// By default, any retryable failures will be retried twice. Retry behavior
69 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70 /// set when configuring the client.
71 pub async fn send(
72 self,
73 ) -> ::std::result::Result<
74 crate::operation::allocate_hosts::AllocateHostsOutput,
75 ::aws_smithy_runtime_api::client::result::SdkError<
76 crate::operation::allocate_hosts::AllocateHostsError,
77 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78 >,
79 > {
80 let input = self
81 .inner
82 .build()
83 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84 let runtime_plugins = crate::operation::allocate_hosts::AllocateHosts::operation_runtime_plugins(
85 self.handle.runtime_plugins.clone(),
86 &self.handle.conf,
87 self.config_override,
88 );
89 crate::operation::allocate_hosts::AllocateHosts::orchestrate(&runtime_plugins, input).await
90 }
91
92 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93 pub fn customize(
94 self,
95 ) -> crate::client::customize::CustomizableOperation<
96 crate::operation::allocate_hosts::AllocateHostsOutput,
97 crate::operation::allocate_hosts::AllocateHostsError,
98 Self,
99 > {
100 crate::client::customize::CustomizableOperation::new(self)
101 }
102 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103 self.set_config_override(::std::option::Option::Some(config_override.into()));
104 self
105 }
106
107 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108 self.config_override = config_override;
109 self
110 }
111 /// <p>Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family, the Dedicated Hosts support multiple instance types within that instance family.</p>
112 /// <p>If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify <b>InstanceType</b> instead. You cannot specify <b>InstanceFamily</b> and <b>InstanceType</b> in the same request.</p>
113 pub fn instance_family(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114 self.inner = self.inner.instance_family(input.into());
115 self
116 }
117 /// <p>Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family, the Dedicated Hosts support multiple instance types within that instance family.</p>
118 /// <p>If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify <b>InstanceType</b> instead. You cannot specify <b>InstanceFamily</b> and <b>InstanceType</b> in the same request.</p>
119 pub fn set_instance_family(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120 self.inner = self.inner.set_instance_family(input);
121 self
122 }
123 /// <p>Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family, the Dedicated Hosts support multiple instance types within that instance family.</p>
124 /// <p>If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify <b>InstanceType</b> instead. You cannot specify <b>InstanceFamily</b> and <b>InstanceType</b> in the same request.</p>
125 pub fn get_instance_family(&self) -> &::std::option::Option<::std::string::String> {
126 self.inner.get_instance_family()
127 }
128 ///
129 /// Appends an item to `TagSpecifications`.
130 ///
131 /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
132 ///
133 /// <p>The tags to apply to the Dedicated Host during creation.</p>
134 pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
135 self.inner = self.inner.tag_specifications(input);
136 self
137 }
138 /// <p>The tags to apply to the Dedicated Host during creation.</p>
139 pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
140 self.inner = self.inner.set_tag_specifications(input);
141 self
142 }
143 /// <p>The tags to apply to the Dedicated Host during creation.</p>
144 pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
145 self.inner.get_tag_specifications()
146 }
147 /// <p>Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-recovery.html"> Host recovery</a> in the <i>Amazon EC2 User Guide</i>.</p>
148 /// <p>Default: <code>off</code></p>
149 pub fn host_recovery(mut self, input: crate::types::HostRecovery) -> Self {
150 self.inner = self.inner.host_recovery(input);
151 self
152 }
153 /// <p>Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-recovery.html"> Host recovery</a> in the <i>Amazon EC2 User Guide</i>.</p>
154 /// <p>Default: <code>off</code></p>
155 pub fn set_host_recovery(mut self, input: ::std::option::Option<crate::types::HostRecovery>) -> Self {
156 self.inner = self.inner.set_host_recovery(input);
157 self
158 }
159 /// <p>Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-recovery.html"> Host recovery</a> in the <i>Amazon EC2 User Guide</i>.</p>
160 /// <p>Default: <code>off</code></p>
161 pub fn get_host_recovery(&self) -> &::std::option::Option<crate::types::HostRecovery> {
162 self.inner.get_host_recovery()
163 }
164 /// <p>The Amazon Resource Name (ARN) of the Amazon Web Services Outpost on which to allocate the Dedicated Host. If you specify <b>OutpostArn</b>, you can optionally specify <b>AssetIds</b>.</p>
165 /// <p>If you are allocating the Dedicated Host in a Region, omit this parameter.</p>
166 pub fn outpost_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167 self.inner = self.inner.outpost_arn(input.into());
168 self
169 }
170 /// <p>The Amazon Resource Name (ARN) of the Amazon Web Services Outpost on which to allocate the Dedicated Host. If you specify <b>OutpostArn</b>, you can optionally specify <b>AssetIds</b>.</p>
171 /// <p>If you are allocating the Dedicated Host in a Region, omit this parameter.</p>
172 pub fn set_outpost_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
173 self.inner = self.inner.set_outpost_arn(input);
174 self
175 }
176 /// <p>The Amazon Resource Name (ARN) of the Amazon Web Services Outpost on which to allocate the Dedicated Host. If you specify <b>OutpostArn</b>, you can optionally specify <b>AssetIds</b>.</p>
177 /// <p>If you are allocating the Dedicated Host in a Region, omit this parameter.</p>
178 pub fn get_outpost_arn(&self) -> &::std::option::Option<::std::string::String> {
179 self.inner.get_outpost_arn()
180 }
181 /// <p>Indicates whether to enable or disable host maintenance for the Dedicated Host. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-maintenance.html">Host maintenance</a> in the <i>Amazon EC2 User Guide</i>.</p>
182 pub fn host_maintenance(mut self, input: crate::types::HostMaintenance) -> Self {
183 self.inner = self.inner.host_maintenance(input);
184 self
185 }
186 /// <p>Indicates whether to enable or disable host maintenance for the Dedicated Host. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-maintenance.html">Host maintenance</a> in the <i>Amazon EC2 User Guide</i>.</p>
187 pub fn set_host_maintenance(mut self, input: ::std::option::Option<crate::types::HostMaintenance>) -> Self {
188 self.inner = self.inner.set_host_maintenance(input);
189 self
190 }
191 /// <p>Indicates whether to enable or disable host maintenance for the Dedicated Host. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-maintenance.html">Host maintenance</a> in the <i>Amazon EC2 User Guide</i>.</p>
192 pub fn get_host_maintenance(&self) -> &::std::option::Option<crate::types::HostMaintenance> {
193 self.inner.get_host_maintenance()
194 }
195 ///
196 /// Appends an item to `AssetIds`.
197 ///
198 /// To override the contents of this collection use [`set_asset_ids`](Self::set_asset_ids).
199 ///
200 /// <p>The IDs of the Outpost hardware assets on which to allocate the Dedicated Hosts. Targeting specific hardware assets on an Outpost can help to minimize latency between your workloads. This parameter is supported only if you specify <b>OutpostArn</b>. If you are allocating the Dedicated Hosts in a Region, omit this parameter.</p>
201 /// <ul>
202 /// <li>
203 /// <p>If you specify this parameter, you can omit <b>Quantity</b>. In this case, Amazon EC2 allocates a Dedicated Host on each specified hardware asset.</p></li>
204 /// <li>
205 /// <p>If you specify both <b>AssetIds</b> and <b>Quantity</b>, then the value for <b>Quantity</b> must be equal to the number of asset IDs specified.</p></li>
206 /// </ul>
207 pub fn asset_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
208 self.inner = self.inner.asset_ids(input.into());
209 self
210 }
211 /// <p>The IDs of the Outpost hardware assets on which to allocate the Dedicated Hosts. Targeting specific hardware assets on an Outpost can help to minimize latency between your workloads. This parameter is supported only if you specify <b>OutpostArn</b>. If you are allocating the Dedicated Hosts in a Region, omit this parameter.</p>
212 /// <ul>
213 /// <li>
214 /// <p>If you specify this parameter, you can omit <b>Quantity</b>. In this case, Amazon EC2 allocates a Dedicated Host on each specified hardware asset.</p></li>
215 /// <li>
216 /// <p>If you specify both <b>AssetIds</b> and <b>Quantity</b>, then the value for <b>Quantity</b> must be equal to the number of asset IDs specified.</p></li>
217 /// </ul>
218 pub fn set_asset_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
219 self.inner = self.inner.set_asset_ids(input);
220 self
221 }
222 /// <p>The IDs of the Outpost hardware assets on which to allocate the Dedicated Hosts. Targeting specific hardware assets on an Outpost can help to minimize latency between your workloads. This parameter is supported only if you specify <b>OutpostArn</b>. If you are allocating the Dedicated Hosts in a Region, omit this parameter.</p>
223 /// <ul>
224 /// <li>
225 /// <p>If you specify this parameter, you can omit <b>Quantity</b>. In this case, Amazon EC2 allocates a Dedicated Host on each specified hardware asset.</p></li>
226 /// <li>
227 /// <p>If you specify both <b>AssetIds</b> and <b>Quantity</b>, then the value for <b>Quantity</b> must be equal to the number of asset IDs specified.</p></li>
228 /// </ul>
229 pub fn get_asset_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
230 self.inner.get_asset_ids()
231 }
232 /// <p>The ID of the Availability Zone.</p>
233 pub fn availability_zone_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
234 self.inner = self.inner.availability_zone_id(input.into());
235 self
236 }
237 /// <p>The ID of the Availability Zone.</p>
238 pub fn set_availability_zone_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
239 self.inner = self.inner.set_availability_zone_id(input);
240 self
241 }
242 /// <p>The ID of the Availability Zone.</p>
243 pub fn get_availability_zone_id(&self) -> &::std::option::Option<::std::string::String> {
244 self.inner.get_availability_zone_id()
245 }
246 /// <p>Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-dedicated-hosts-work.html#dedicated-hosts-understanding"> Understanding auto-placement and affinity</a> in the <i>Amazon EC2 User Guide</i>.</p>
247 /// <p>Default: <code>off</code></p>
248 pub fn auto_placement(mut self, input: crate::types::AutoPlacement) -> Self {
249 self.inner = self.inner.auto_placement(input);
250 self
251 }
252 /// <p>Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-dedicated-hosts-work.html#dedicated-hosts-understanding"> Understanding auto-placement and affinity</a> in the <i>Amazon EC2 User Guide</i>.</p>
253 /// <p>Default: <code>off</code></p>
254 pub fn set_auto_placement(mut self, input: ::std::option::Option<crate::types::AutoPlacement>) -> Self {
255 self.inner = self.inner.set_auto_placement(input);
256 self
257 }
258 /// <p>Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-dedicated-hosts-work.html#dedicated-hosts-understanding"> Understanding auto-placement and affinity</a> in the <i>Amazon EC2 User Guide</i>.</p>
259 /// <p>Default: <code>off</code></p>
260 pub fn get_auto_placement(&self) -> &::std::option::Option<crate::types::AutoPlacement> {
261 self.inner.get_auto_placement()
262 }
263 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring Idempotency</a>.</p>
264 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
265 self.inner = self.inner.client_token(input.into());
266 self
267 }
268 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring Idempotency</a>.</p>
269 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
270 self.inner = self.inner.set_client_token(input);
271 self
272 }
273 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring Idempotency</a>.</p>
274 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
275 self.inner.get_client_token()
276 }
277 /// <p>Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the Dedicated Hosts support instances of the specified instance type only.</p>
278 /// <p>If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit this parameter and specify <b>InstanceFamily</b> instead. You cannot specify <b>InstanceType</b> and <b>InstanceFamily</b> in the same request.</p>
279 pub fn instance_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
280 self.inner = self.inner.instance_type(input.into());
281 self
282 }
283 /// <p>Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the Dedicated Hosts support instances of the specified instance type only.</p>
284 /// <p>If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit this parameter and specify <b>InstanceFamily</b> instead. You cannot specify <b>InstanceType</b> and <b>InstanceFamily</b> in the same request.</p>
285 pub fn set_instance_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
286 self.inner = self.inner.set_instance_type(input);
287 self
288 }
289 /// <p>Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the Dedicated Hosts support instances of the specified instance type only.</p>
290 /// <p>If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit this parameter and specify <b>InstanceFamily</b> instead. You cannot specify <b>InstanceType</b> and <b>InstanceFamily</b> in the same request.</p>
291 pub fn get_instance_type(&self) -> &::std::option::Option<::std::string::String> {
292 self.inner.get_instance_type()
293 }
294 /// <p>The number of Dedicated Hosts to allocate to your account with these parameters. If you are allocating the Dedicated Hosts on an Outpost, and you specify <b>AssetIds</b>, you can omit this parameter. In this case, Amazon EC2 allocates a Dedicated Host on each specified hardware asset. If you specify both <b>AssetIds</b> and <b>Quantity</b>, then the value that you specify for <b>Quantity</b> must be equal to the number of asset IDs specified.</p>
295 pub fn quantity(mut self, input: i32) -> Self {
296 self.inner = self.inner.quantity(input);
297 self
298 }
299 /// <p>The number of Dedicated Hosts to allocate to your account with these parameters. If you are allocating the Dedicated Hosts on an Outpost, and you specify <b>AssetIds</b>, you can omit this parameter. In this case, Amazon EC2 allocates a Dedicated Host on each specified hardware asset. If you specify both <b>AssetIds</b> and <b>Quantity</b>, then the value that you specify for <b>Quantity</b> must be equal to the number of asset IDs specified.</p>
300 pub fn set_quantity(mut self, input: ::std::option::Option<i32>) -> Self {
301 self.inner = self.inner.set_quantity(input);
302 self
303 }
304 /// <p>The number of Dedicated Hosts to allocate to your account with these parameters. If you are allocating the Dedicated Hosts on an Outpost, and you specify <b>AssetIds</b>, you can omit this parameter. In this case, Amazon EC2 allocates a Dedicated Host on each specified hardware asset. If you specify both <b>AssetIds</b> and <b>Quantity</b>, then the value that you specify for <b>Quantity</b> must be equal to the number of asset IDs specified.</p>
305 pub fn get_quantity(&self) -> &::std::option::Option<i32> {
306 self.inner.get_quantity()
307 }
308 /// <p>The Availability Zone in which to allocate the Dedicated Host.</p>
309 pub fn availability_zone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
310 self.inner = self.inner.availability_zone(input.into());
311 self
312 }
313 /// <p>The Availability Zone in which to allocate the Dedicated Host.</p>
314 pub fn set_availability_zone(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
315 self.inner = self.inner.set_availability_zone(input);
316 self
317 }
318 /// <p>The Availability Zone in which to allocate the Dedicated Host.</p>
319 pub fn get_availability_zone(&self) -> &::std::option::Option<::std::string::String> {
320 self.inner.get_availability_zone()
321 }
322}