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>
28/// <p class="title"><b>Restrictions</b></p>
29/// <ul>
30/// <li>
31/// <p>You can delete up to 100 fleets in a single request. If you exceed the specified number, no fleets are deleted.</p></li>
32/// </ul>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct CancelSpotFleetRequestsFluentBuilder {
35    handle: ::std::sync::Arc<crate::client::Handle>,
36    inner: crate::operation::cancel_spot_fleet_requests::builders::CancelSpotFleetRequestsInputBuilder,
37    config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40    crate::client::customize::internal::CustomizableSend<
41        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsOutput,
42        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsError,
43    > for CancelSpotFleetRequestsFluentBuilder
44{
45    fn send(
46        self,
47        config_override: crate::config::Builder,
48    ) -> crate::client::customize::internal::BoxFuture<
49        crate::client::customize::internal::SendResult<
50            crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsOutput,
51            crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsError,
52        >,
53    > {
54        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55    }
56}
57impl CancelSpotFleetRequestsFluentBuilder {
58    /// Creates a new `CancelSpotFleetRequestsFluentBuilder`.
59    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
60        Self {
61            handle,
62            inner: ::std::default::Default::default(),
63            config_override: ::std::option::Option::None,
64        }
65    }
66    /// Access the CancelSpotFleetRequests as a reference.
67    pub fn as_input(&self) -> &crate::operation::cancel_spot_fleet_requests::builders::CancelSpotFleetRequestsInputBuilder {
68        &self.inner
69    }
70    /// Sends the request and returns the response.
71    ///
72    /// If an error occurs, an `SdkError` will be returned with additional details that
73    /// can be matched against.
74    ///
75    /// By default, any retryable failures will be retried twice. Retry behavior
76    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77    /// set when configuring the client.
78    pub async fn send(
79        self,
80    ) -> ::std::result::Result<
81        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsOutput,
82        ::aws_smithy_runtime_api::client::result::SdkError<
83            crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsError,
84            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85        >,
86    > {
87        let input = self
88            .inner
89            .build()
90            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91        let runtime_plugins = crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequests::operation_runtime_plugins(
92            self.handle.runtime_plugins.clone(),
93            &self.handle.conf,
94            self.config_override,
95        );
96        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequests::orchestrate(&runtime_plugins, input).await
97    }
98
99    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100    pub fn customize(
101        self,
102    ) -> crate::client::customize::CustomizableOperation<
103        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsOutput,
104        crate::operation::cancel_spot_fleet_requests::CancelSpotFleetRequestsError,
105        Self,
106    > {
107        crate::client::customize::CustomizableOperation::new(self)
108    }
109    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110        self.set_config_override(::std::option::Option::Some(config_override.into()));
111        self
112    }
113
114    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115        self.config_override = config_override;
116        self
117    }
118    /// <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>
119    pub fn dry_run(mut self, input: bool) -> Self {
120        self.inner = self.inner.dry_run(input);
121        self
122    }
123    /// <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>
124    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
125        self.inner = self.inner.set_dry_run(input);
126        self
127    }
128    /// <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>
129    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
130        self.inner.get_dry_run()
131    }
132    ///
133    /// Appends an item to `SpotFleetRequestIds`.
134    ///
135    /// To override the contents of this collection use [`set_spot_fleet_request_ids`](Self::set_spot_fleet_request_ids).
136    ///
137    /// <p>The IDs of the Spot Fleet requests.</p>
138    /// <p>Constraint: You can specify up to 100 IDs in a single request.</p>
139    pub fn spot_fleet_request_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140        self.inner = self.inner.spot_fleet_request_ids(input.into());
141        self
142    }
143    /// <p>The IDs of the Spot Fleet requests.</p>
144    /// <p>Constraint: You can specify up to 100 IDs in a single request.</p>
145    pub fn set_spot_fleet_request_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
146        self.inner = self.inner.set_spot_fleet_request_ids(input);
147        self
148    }
149    /// <p>The IDs of the Spot Fleet requests.</p>
150    /// <p>Constraint: You can specify up to 100 IDs in a single request.</p>
151    pub fn get_spot_fleet_request_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
152        self.inner.get_spot_fleet_request_ids()
153    }
154    /// <p>Indicates whether to terminate the associated instances when the Spot Fleet request is canceled. The default is to terminate the instances.</p>
155    /// <p>To let the instances continue to run after the Spot Fleet request is canceled, specify <code>no-terminate-instances</code>.</p>
156    pub fn terminate_instances(mut self, input: bool) -> Self {
157        self.inner = self.inner.terminate_instances(input);
158        self
159    }
160    /// <p>Indicates whether to terminate the associated instances when the Spot Fleet request is canceled. The default is to terminate the instances.</p>
161    /// <p>To let the instances continue to run after the Spot Fleet request is canceled, specify <code>no-terminate-instances</code>.</p>
162    pub fn set_terminate_instances(mut self, input: ::std::option::Option<bool>) -> Self {
163        self.inner = self.inner.set_terminate_instances(input);
164        self
165    }
166    /// <p>Indicates whether to terminate the associated instances when the Spot Fleet request is canceled. The default is to terminate the instances.</p>
167    /// <p>To let the instances continue to run after the Spot Fleet request is canceled, specify <code>no-terminate-instances</code>.</p>
168    pub fn get_terminate_instances(&self) -> &::std::option::Option<bool> {
169        self.inner.get_terminate_instances()
170    }
171}