aws_sdk_ec2/operation/cancel_spot_fleet_requests/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::cancel_spot_fleet_requests::_cancel_spot_fleet_requests_output::CancelSpotFleetRequestsOutputBuilder;
3
4pub use crate::operation::cancel_spot_fleet_requests::_cancel_spot_fleet_requests_input::CancelSpotFleetRequestsInputBuilder;
5
6impl crate::operation::cancel_spot_fleet_requests::builders::CancelSpotFleetRequestsInputBuilder {
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::cancel_spot_fleet_requests::CancelSpotFleetRequestsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.cancel_spot_fleet_requests();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CancelSpotFleetRequests`.
24///
25/// <p>Cancels the specified Spot Fleet requests.</p>
26/// <p>After you cancel a Spot Fleet request, the Spot Fleet launches no new instances.</p>
27/// <p>You must also specify whether a canceled Spot Fleet request should terminate its instances. If you choose to terminate the instances, the Spot Fleet request enters the <code>cancelled_terminating</code> state. Otherwise, the Spot Fleet request enters the <code>cancelled_running</code> state and the instances continue to run until they are interrupted or you terminate them manually.</p><important>
28/// <p><b>Terminating an instance is permanent and irreversible.</b></p>
29/// <p>After you terminate an instance, you can no longer connect to it, and it can't be recovered. All attached Amazon EBS volumes that are configured to be deleted on termination are also permanently deleted and can't be recovered. All data stored on instance store volumes is permanently lost. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-ec2-instance-termination-works.html"> How instance termination works</a>.</p>
30/// <p>Before you terminate an instance, ensure that you have backed up all data that you need to retain after the termination to persistent storage.</p>
31/// </important>
32/// <p class="title"><b>Restrictions</b></p>
33/// <ul>
34/// <li>
35/// <p>You can delete up to 100 fleets in a single request. If you exceed the specified number, no fleets are deleted.</p></li>
36/// </ul>
37#[derive(::std::clone::Clone, ::std::fmt::Debug)]
38pub struct CancelSpotFleetRequestsFluentBuilder {
39    handle: ::std::sync::Arc<crate::client::Handle>,
40    inner: crate::operation::cancel_spot_fleet_requests::builders::CancelSpotFleetRequestsInputBuilder,
41    config_override: ::std::option::Option<crate::config::Builder>,
42}
43impl
44    crate::client::customize::internal::CustomizableSend<
45        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsOutput,
46        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsError,
47    > for CancelSpotFleetRequestsFluentBuilder
48{
49    fn send(
50        self,
51        config_override: crate::config::Builder,
52    ) -> crate::client::customize::internal::BoxFuture<
53        crate::client::customize::internal::SendResult<
54            crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsOutput,
55            crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsError,
56        >,
57    > {
58        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
59    }
60}
61impl CancelSpotFleetRequestsFluentBuilder {
62    /// Creates a new `CancelSpotFleetRequestsFluentBuilder`.
63    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
64        Self {
65            handle,
66            inner: ::std::default::Default::default(),
67            config_override: ::std::option::Option::None,
68        }
69    }
70    /// Access the CancelSpotFleetRequests as a reference.
71    pub fn as_input(&self) -> &crate::operation::cancel_spot_fleet_requests::builders::CancelSpotFleetRequestsInputBuilder {
72        &self.inner
73    }
74    /// Sends the request and returns the response.
75    ///
76    /// If an error occurs, an `SdkError` will be returned with additional details that
77    /// can be matched against.
78    ///
79    /// By default, any retryable failures will be retried twice. Retry behavior
80    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
81    /// set when configuring the client.
82    pub async fn send(
83        self,
84    ) -> ::std::result::Result<
85        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsOutput,
86        ::aws_smithy_runtime_api::client::result::SdkError<
87            crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsError,
88            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
89        >,
90    > {
91        let input = self
92            .inner
93            .build()
94            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
95        let runtime_plugins = crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequests::operation_runtime_plugins(
96            self.handle.runtime_plugins.clone(),
97            &self.handle.conf,
98            self.config_override,
99        );
100        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequests::orchestrate(&runtime_plugins, input).await
101    }
102
103    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
104    pub fn customize(
105        self,
106    ) -> crate::client::customize::CustomizableOperation<
107        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsOutput,
108        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsError,
109        Self,
110    > {
111        crate::client::customize::CustomizableOperation::new(self)
112    }
113    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
114        self.set_config_override(::std::option::Option::Some(config_override.into()));
115        self
116    }
117
118    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
119        self.config_override = config_override;
120        self
121    }
122    /// <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>
123    pub fn dry_run(mut self, input: bool) -> Self {
124        self.inner = self.inner.dry_run(input);
125        self
126    }
127    /// <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>
128    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
129        self.inner = self.inner.set_dry_run(input);
130        self
131    }
132    /// <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>
133    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
134        self.inner.get_dry_run()
135    }
136    ///
137    /// Appends an item to `SpotFleetRequestIds`.
138    ///
139    /// To override the contents of this collection use [`set_spot_fleet_request_ids`](Self::set_spot_fleet_request_ids).
140    ///
141    /// <p>The IDs of the Spot Fleet requests.</p>
142    /// <p>Constraint: You can specify up to 100 IDs in a single request.</p>
143    pub fn spot_fleet_request_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        self.inner = self.inner.spot_fleet_request_ids(input.into());
145        self
146    }
147    /// <p>The IDs of the Spot Fleet requests.</p>
148    /// <p>Constraint: You can specify up to 100 IDs in a single request.</p>
149    pub fn set_spot_fleet_request_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
150        self.inner = self.inner.set_spot_fleet_request_ids(input);
151        self
152    }
153    /// <p>The IDs of the Spot Fleet requests.</p>
154    /// <p>Constraint: You can specify up to 100 IDs in a single request.</p>
155    pub fn get_spot_fleet_request_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
156        self.inner.get_spot_fleet_request_ids()
157    }
158    /// <p>Indicates whether to terminate the associated instances when the Spot Fleet request is canceled. The default is to terminate the instances.</p>
159    /// <p>To let the instances continue to run after the Spot Fleet request is canceled, specify <code>no-terminate-instances</code>.</p>
160    pub fn terminate_instances(mut self, input: bool) -> Self {
161        self.inner = self.inner.terminate_instances(input);
162        self
163    }
164    /// <p>Indicates whether to terminate the associated instances when the Spot Fleet request is canceled. The default is to terminate the instances.</p>
165    /// <p>To let the instances continue to run after the Spot Fleet request is canceled, specify <code>no-terminate-instances</code>.</p>
166    pub fn set_terminate_instances(mut self, input: ::std::option::Option<bool>) -> Self {
167        self.inner = self.inner.set_terminate_instances(input);
168        self
169    }
170    /// <p>Indicates whether to terminate the associated instances when the Spot Fleet request is canceled. The default is to terminate the instances.</p>
171    /// <p>To let the instances continue to run after the Spot Fleet request is canceled, specify <code>no-terminate-instances</code>.</p>
172    pub fn get_terminate_instances(&self) -> &::std::option::Option<bool> {
173        self.inner.get_terminate_instances()
174    }
175}