aws_sdk_ec2/operation/delete_fleets/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::delete_fleets::_delete_fleets_output::DeleteFleetsOutputBuilder;
3
4pub use crate::operation::delete_fleets::_delete_fleets_input::DeleteFleetsInputBuilder;
5
6impl crate::operation::delete_fleets::builders::DeleteFleetsInputBuilder {
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::delete_fleets::DeleteFleetsOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::delete_fleets::DeleteFleetsError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.delete_fleets();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `DeleteFleets`.
24///
25/// <p>Deletes the specified EC2 Fleet request.</p>
26/// <p>After you delete an EC2 Fleet request, it launches no new instances.</p>
27/// <p>You must also specify whether a deleted EC2 Fleet request should terminate its instances. If you choose to terminate the instances, the EC2 Fleet request enters the <code>deleted_terminating</code> state. Otherwise, it enters the <code>deleted_running</code> state, and the instances continue to run until they are interrupted or you terminate them manually.</p>
28/// <p>A deleted <code>instant</code> fleet with running instances is not supported. When you delete an <code>instant</code> fleet, Amazon EC2 automatically terminates all its instances. For fleets with more than 1000 instances, the deletion request might fail. If your fleet has more than 1000 instances, first terminate most of the instances manually, leaving 1000 or fewer. Then delete the fleet, and the remaining instances will be terminated automatically.</p>
29/// <p class="title"><b>Restrictions</b></p>
30/// <ul>
31/// <li>
32/// <p>You can delete up to 25 fleets of type <code>instant</code> in a single request.</p></li>
33/// <li>
34/// <p>You can delete up to 100 fleets of type <code>maintain</code> or <code>request</code> in a single request.</p></li>
35/// <li>
36/// <p>You can delete up to 125 fleets in a single request, provided you do not exceed the quota for each fleet type, as specified above.</p></li>
37/// <li>
38/// <p>If you exceed the specified number of fleets to delete, no fleets are deleted.</p></li>
39/// </ul>
40/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/delete-fleet.html">Delete an EC2 Fleet request and the instances in the fleet</a> in the <i>Amazon EC2 User Guide</i>.</p>
41#[derive(::std::clone::Clone, ::std::fmt::Debug)]
42pub struct DeleteFleetsFluentBuilder {
43 handle: ::std::sync::Arc<crate::client::Handle>,
44 inner: crate::operation::delete_fleets::builders::DeleteFleetsInputBuilder,
45 config_override: ::std::option::Option<crate::config::Builder>,
46}
47impl
48 crate::client::customize::internal::CustomizableSend<
49 crate::operation::delete_fleets::DeleteFleetsOutput,
50 crate::operation::delete_fleets::DeleteFleetsError,
51 > for DeleteFleetsFluentBuilder
52{
53 fn send(
54 self,
55 config_override: crate::config::Builder,
56 ) -> crate::client::customize::internal::BoxFuture<
57 crate::client::customize::internal::SendResult<
58 crate::operation::delete_fleets::DeleteFleetsOutput,
59 crate::operation::delete_fleets::DeleteFleetsError,
60 >,
61 > {
62 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
63 }
64}
65impl DeleteFleetsFluentBuilder {
66 /// Creates a new `DeleteFleetsFluentBuilder`.
67 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
68 Self {
69 handle,
70 inner: ::std::default::Default::default(),
71 config_override: ::std::option::Option::None,
72 }
73 }
74 /// Access the DeleteFleets as a reference.
75 pub fn as_input(&self) -> &crate::operation::delete_fleets::builders::DeleteFleetsInputBuilder {
76 &self.inner
77 }
78 /// Sends the request and returns the response.
79 ///
80 /// If an error occurs, an `SdkError` will be returned with additional details that
81 /// can be matched against.
82 ///
83 /// By default, any retryable failures will be retried twice. Retry behavior
84 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
85 /// set when configuring the client.
86 pub async fn send(
87 self,
88 ) -> ::std::result::Result<
89 crate::operation::delete_fleets::DeleteFleetsOutput,
90 ::aws_smithy_runtime_api::client::result::SdkError<
91 crate::operation::delete_fleets::DeleteFleetsError,
92 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
93 >,
94 > {
95 let input = self
96 .inner
97 .build()
98 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
99 let runtime_plugins = crate::operation::delete_fleets::DeleteFleets::operation_runtime_plugins(
100 self.handle.runtime_plugins.clone(),
101 &self.handle.conf,
102 self.config_override,
103 );
104 crate::operation::delete_fleets::DeleteFleets::orchestrate(&runtime_plugins, input).await
105 }
106
107 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
108 pub fn customize(
109 self,
110 ) -> crate::client::customize::CustomizableOperation<
111 crate::operation::delete_fleets::DeleteFleetsOutput,
112 crate::operation::delete_fleets::DeleteFleetsError,
113 Self,
114 > {
115 crate::client::customize::CustomizableOperation::new(self)
116 }
117 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
118 self.set_config_override(::std::option::Option::Some(config_override.into()));
119 self
120 }
121
122 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
123 self.config_override = config_override;
124 self
125 }
126 /// <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>
127 pub fn dry_run(mut self, input: bool) -> Self {
128 self.inner = self.inner.dry_run(input);
129 self
130 }
131 /// <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>
132 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
133 self.inner = self.inner.set_dry_run(input);
134 self
135 }
136 /// <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>
137 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
138 self.inner.get_dry_run()
139 }
140 ///
141 /// Appends an item to `FleetIds`.
142 ///
143 /// To override the contents of this collection use [`set_fleet_ids`](Self::set_fleet_ids).
144 ///
145 /// <p>The IDs of the EC2 Fleets.</p>
146 /// <p>Constraints: In a single request, you can specify up to 25 <code>instant</code> fleet IDs and up to 100 <code>maintain</code> or <code>request</code> fleet IDs.</p>
147 pub fn fleet_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148 self.inner = self.inner.fleet_ids(input.into());
149 self
150 }
151 /// <p>The IDs of the EC2 Fleets.</p>
152 /// <p>Constraints: In a single request, you can specify up to 25 <code>instant</code> fleet IDs and up to 100 <code>maintain</code> or <code>request</code> fleet IDs.</p>
153 pub fn set_fleet_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
154 self.inner = self.inner.set_fleet_ids(input);
155 self
156 }
157 /// <p>The IDs of the EC2 Fleets.</p>
158 /// <p>Constraints: In a single request, you can specify up to 25 <code>instant</code> fleet IDs and up to 100 <code>maintain</code> or <code>request</code> fleet IDs.</p>
159 pub fn get_fleet_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
160 self.inner.get_fleet_ids()
161 }
162 /// <p>Indicates whether to terminate the associated instances when the EC2 Fleet is deleted. The default is to terminate the instances.</p>
163 /// <p>To let the instances continue to run after the EC2 Fleet is deleted, specify <code>no-terminate-instances</code>. Supported only for fleets of type <code>maintain</code> and <code>request</code>.</p>
164 /// <p>For <code>instant</code> fleets, you cannot specify <code>NoTerminateInstances</code>. A deleted <code>instant</code> fleet with running instances is not supported.</p>
165 pub fn terminate_instances(mut self, input: bool) -> Self {
166 self.inner = self.inner.terminate_instances(input);
167 self
168 }
169 /// <p>Indicates whether to terminate the associated instances when the EC2 Fleet is deleted. The default is to terminate the instances.</p>
170 /// <p>To let the instances continue to run after the EC2 Fleet is deleted, specify <code>no-terminate-instances</code>. Supported only for fleets of type <code>maintain</code> and <code>request</code>.</p>
171 /// <p>For <code>instant</code> fleets, you cannot specify <code>NoTerminateInstances</code>. A deleted <code>instant</code> fleet with running instances is not supported.</p>
172 pub fn set_terminate_instances(mut self, input: ::std::option::Option<bool>) -> Self {
173 self.inner = self.inner.set_terminate_instances(input);
174 self
175 }
176 /// <p>Indicates whether to terminate the associated instances when the EC2 Fleet is deleted. The default is to terminate the instances.</p>
177 /// <p>To let the instances continue to run after the EC2 Fleet is deleted, specify <code>no-terminate-instances</code>. Supported only for fleets of type <code>maintain</code> and <code>request</code>.</p>
178 /// <p>For <code>instant</code> fleets, you cannot specify <code>NoTerminateInstances</code>. A deleted <code>instant</code> fleet with running instances is not supported.</p>
179 pub fn get_terminate_instances(&self) -> &::std::option::Option<bool> {
180 self.inner.get_terminate_instances()
181 }
182}