aws_sdk_ec2/operation/modify_fleet/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::modify_fleet::_modify_fleet_output::ModifyFleetOutputBuilder;
3
4pub use crate::operation::modify_fleet::_modify_fleet_input::ModifyFleetInputBuilder;
5
6impl crate::operation::modify_fleet::builders::ModifyFleetInputBuilder {
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::modify_fleet::ModifyFleetOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::modify_fleet::ModifyFleetError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.modify_fleet();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ModifyFleet`.
24///
25/// <p>Modifies the specified EC2 Fleet.</p>
26/// <p>You can only modify an EC2 Fleet request of type <code>maintain</code>.</p>
27/// <p>While the EC2 Fleet is being modified, it is in the <code>modifying</code> state.</p>
28/// <p>To scale up your EC2 Fleet, increase its target capacity. The EC2 Fleet launches the additional Spot Instances according to the allocation strategy for the EC2 Fleet request. If the allocation strategy is <code>lowest-price</code>, the EC2 Fleet launches instances using the Spot Instance pool with the lowest price. If the allocation strategy is <code>diversified</code>, the EC2 Fleet distributes the instances across the Spot Instance pools. If the allocation strategy is <code>capacity-optimized</code>, EC2 Fleet launches instances from Spot Instance pools with optimal capacity for the number of instances that are launching.</p>
29/// <p>To scale down your EC2 Fleet, decrease its target capacity. First, the EC2 Fleet cancels any open requests that exceed the new target capacity. You can request that the EC2 Fleet terminate Spot Instances until the size of the fleet no longer exceeds the new target capacity. If the allocation strategy is <code>lowest-price</code>, the EC2 Fleet terminates the instances with the highest price per unit. If the allocation strategy is <code>capacity-optimized</code>, the EC2 Fleet terminates the instances in the Spot Instance pools that have the least available Spot Instance capacity. If the allocation strategy is <code>diversified</code>, the EC2 Fleet terminates instances across the Spot Instance pools. Alternatively, you can request that the EC2 Fleet keep the fleet at its current size, but not replace any Spot Instances that are interrupted or that you terminate manually.</p>
30/// <p>If you are finished with your EC2 Fleet for now, but will use it again later, you can set the target capacity to 0.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct ModifyFleetFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::modify_fleet::builders::ModifyFleetInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::modify_fleet::ModifyFleetOutput,
40        crate::operation::modify_fleet::ModifyFleetError,
41    > for ModifyFleetFluentBuilder
42{
43    fn send(
44        self,
45        config_override: crate::config::Builder,
46    ) -> crate::client::customize::internal::BoxFuture<
47        crate::client::customize::internal::SendResult<
48            crate::operation::modify_fleet::ModifyFleetOutput,
49            crate::operation::modify_fleet::ModifyFleetError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl ModifyFleetFluentBuilder {
56    /// Creates a new `ModifyFleetFluentBuilder`.
57    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58        Self {
59            handle,
60            inner: ::std::default::Default::default(),
61            config_override: ::std::option::Option::None,
62        }
63    }
64    /// Access the ModifyFleet as a reference.
65    pub fn as_input(&self) -> &crate::operation::modify_fleet::builders::ModifyFleetInputBuilder {
66        &self.inner
67    }
68    /// Sends the request and returns the response.
69    ///
70    /// If an error occurs, an `SdkError` will be returned with additional details that
71    /// can be matched against.
72    ///
73    /// By default, any retryable failures will be retried twice. Retry behavior
74    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75    /// set when configuring the client.
76    pub async fn send(
77        self,
78    ) -> ::std::result::Result<
79        crate::operation::modify_fleet::ModifyFleetOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::modify_fleet::ModifyFleetError,
82            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83        >,
84    > {
85        let input = self
86            .inner
87            .build()
88            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89        let runtime_plugins = crate::operation::modify_fleet::ModifyFleet::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::modify_fleet::ModifyFleet::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::modify_fleet::ModifyFleetOutput,
102        crate::operation::modify_fleet::ModifyFleetError,
103        Self,
104    > {
105        crate::client::customize::CustomizableOperation::new(self)
106    }
107    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108        self.set_config_override(::std::option::Option::Some(config_override.into()));
109        self
110    }
111
112    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113        self.config_override = config_override;
114        self
115    }
116    /// <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>
117    pub fn dry_run(mut self, input: bool) -> Self {
118        self.inner = self.inner.dry_run(input);
119        self
120    }
121    /// <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>
122    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
123        self.inner = self.inner.set_dry_run(input);
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 get_dry_run(&self) -> &::std::option::Option<bool> {
128        self.inner.get_dry_run()
129    }
130    /// <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>
131    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
132    pub fn excess_capacity_termination_policy(mut self, input: crate::types::FleetExcessCapacityTerminationPolicy) -> Self {
133        self.inner = self.inner.excess_capacity_termination_policy(input);
134        self
135    }
136    /// <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>
137    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
138    pub fn set_excess_capacity_termination_policy(
139        mut self,
140        input: ::std::option::Option<crate::types::FleetExcessCapacityTerminationPolicy>,
141    ) -> Self {
142        self.inner = self.inner.set_excess_capacity_termination_policy(input);
143        self
144    }
145    /// <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>
146    /// <p>Supported only for fleets of type <code>maintain</code>.</p>
147    pub fn get_excess_capacity_termination_policy(&self) -> &::std::option::Option<crate::types::FleetExcessCapacityTerminationPolicy> {
148        self.inner.get_excess_capacity_termination_policy()
149    }
150    ///
151    /// Appends an item to `LaunchTemplateConfigs`.
152    ///
153    /// To override the contents of this collection use [`set_launch_template_configs`](Self::set_launch_template_configs).
154    ///
155    /// <p>The launch template and overrides.</p>
156    pub fn launch_template_configs(mut self, input: crate::types::FleetLaunchTemplateConfigRequest) -> Self {
157        self.inner = self.inner.launch_template_configs(input);
158        self
159    }
160    /// <p>The launch template and overrides.</p>
161    pub fn set_launch_template_configs(
162        mut self,
163        input: ::std::option::Option<::std::vec::Vec<crate::types::FleetLaunchTemplateConfigRequest>>,
164    ) -> Self {
165        self.inner = self.inner.set_launch_template_configs(input);
166        self
167    }
168    /// <p>The launch template and overrides.</p>
169    pub fn get_launch_template_configs(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FleetLaunchTemplateConfigRequest>> {
170        self.inner.get_launch_template_configs()
171    }
172    /// <p>The ID of the EC2 Fleet.</p>
173    pub fn fleet_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
174        self.inner = self.inner.fleet_id(input.into());
175        self
176    }
177    /// <p>The ID of the EC2 Fleet.</p>
178    pub fn set_fleet_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
179        self.inner = self.inner.set_fleet_id(input);
180        self
181    }
182    /// <p>The ID of the EC2 Fleet.</p>
183    pub fn get_fleet_id(&self) -> &::std::option::Option<::std::string::String> {
184        self.inner.get_fleet_id()
185    }
186    /// <p>The size of the EC2 Fleet.</p>
187    pub fn target_capacity_specification(mut self, input: crate::types::TargetCapacitySpecificationRequest) -> Self {
188        self.inner = self.inner.target_capacity_specification(input);
189        self
190    }
191    /// <p>The size of the EC2 Fleet.</p>
192    pub fn set_target_capacity_specification(mut self, input: ::std::option::Option<crate::types::TargetCapacitySpecificationRequest>) -> Self {
193        self.inner = self.inner.set_target_capacity_specification(input);
194        self
195    }
196    /// <p>The size of the EC2 Fleet.</p>
197    pub fn get_target_capacity_specification(&self) -> &::std::option::Option<crate::types::TargetCapacitySpecificationRequest> {
198        self.inner.get_target_capacity_specification()
199    }
200    /// <p>Reserved.</p>
201    pub fn context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
202        self.inner = self.inner.context(input.into());
203        self
204    }
205    /// <p>Reserved.</p>
206    pub fn set_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
207        self.inner = self.inner.set_context(input);
208        self
209    }
210    /// <p>Reserved.</p>
211    pub fn get_context(&self) -> &::std::option::Option<::std::string::String> {
212        self.inner.get_context()
213    }
214}