Skip to main content

aws_sdk_gamelift/operation/stop_fleet_actions/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::stop_fleet_actions::_stop_fleet_actions_output::StopFleetActionsOutputBuilder;
3
4pub use crate::operation::stop_fleet_actions::_stop_fleet_actions_input::StopFleetActionsInputBuilder;
5
6impl crate::operation::stop_fleet_actions::builders::StopFleetActionsInputBuilder {
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::stop_fleet_actions::StopFleetActionsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::stop_fleet_actions::StopFleetActionsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.stop_fleet_actions();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StopFleetActions`.
24///
25/// <p><b>This API works with the following fleet types:</b> EC2, Container</p>
26/// <p>Suspends certain types of activity in a fleet location. Currently, this operation is used to stop auto-scaling activity. For multi-location fleets, fleet actions are managed separately for each location.</p>
27/// <p>Stopping fleet actions has several potential purposes. It allows you to temporarily stop auto-scaling activity but retain your scaling policies for use in the future. For multi-location fleets, you can set up fleet-wide auto-scaling, and then opt out of it for certain locations.</p>
28/// <p>This operation can be used in the following ways:</p>
29/// <ul>
30/// <li>
31/// <p>To stop actions on instances in the fleet's home Region, provide a fleet ID and the type of actions to suspend.</p></li>
32/// <li>
33/// <p>To stop actions on instances in one of the fleet's remote locations, provide a fleet ID, a location name, and the type of actions to suspend.</p></li>
34/// </ul>
35/// <p>If successful, Amazon GameLift Servers no longer initiates scaling events except in response to manual changes using <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_UpdateFleetCapacity.html">UpdateFleetCapacity</a>. To restart fleet actions again, call <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_StartFleetActions.html">StartFleetActions</a>.</p>
36/// <p><b>Learn more</b></p>
37/// <p><a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-intro.html">Setting up Amazon GameLift Servers Fleets</a></p>
38#[derive(::std::clone::Clone, ::std::fmt::Debug)]
39pub struct StopFleetActionsFluentBuilder {
40    handle: ::std::sync::Arc<crate::client::Handle>,
41    inner: crate::operation::stop_fleet_actions::builders::StopFleetActionsInputBuilder,
42    config_override: ::std::option::Option<crate::config::Builder>,
43}
44impl
45    crate::client::customize::internal::CustomizableSend<
46        crate::operation::stop_fleet_actions::StopFleetActionsOutput,
47        crate::operation::stop_fleet_actions::StopFleetActionsError,
48    > for StopFleetActionsFluentBuilder
49{
50    fn send(
51        self,
52        config_override: crate::config::Builder,
53    ) -> crate::client::customize::internal::BoxFuture<
54        crate::client::customize::internal::SendResult<
55            crate::operation::stop_fleet_actions::StopFleetActionsOutput,
56            crate::operation::stop_fleet_actions::StopFleetActionsError,
57        >,
58    > {
59        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
60    }
61}
62impl StopFleetActionsFluentBuilder {
63    /// Creates a new `StopFleetActionsFluentBuilder`.
64    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
65        Self {
66            handle,
67            inner: ::std::default::Default::default(),
68            config_override: ::std::option::Option::None,
69        }
70    }
71    /// Access the StopFleetActions as a reference.
72    pub fn as_input(&self) -> &crate::operation::stop_fleet_actions::builders::StopFleetActionsInputBuilder {
73        &self.inner
74    }
75    /// Sends the request and returns the response.
76    ///
77    /// If an error occurs, an `SdkError` will be returned with additional details that
78    /// can be matched against.
79    ///
80    /// By default, any retryable failures will be retried twice. Retry behavior
81    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
82    /// set when configuring the client.
83    pub async fn send(
84        self,
85    ) -> ::std::result::Result<
86        crate::operation::stop_fleet_actions::StopFleetActionsOutput,
87        ::aws_smithy_runtime_api::client::result::SdkError<
88            crate::operation::stop_fleet_actions::StopFleetActionsError,
89            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
90        >,
91    > {
92        let input = self
93            .inner
94            .build()
95            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
96        let runtime_plugins = crate::operation::stop_fleet_actions::StopFleetActions::operation_runtime_plugins(
97            self.handle.runtime_plugins.clone(),
98            &self.handle.conf,
99            self.config_override,
100        );
101        crate::operation::stop_fleet_actions::StopFleetActions::orchestrate(&runtime_plugins, input).await
102    }
103
104    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
105    pub fn customize(
106        self,
107    ) -> crate::client::customize::CustomizableOperation<
108        crate::operation::stop_fleet_actions::StopFleetActionsOutput,
109        crate::operation::stop_fleet_actions::StopFleetActionsError,
110        Self,
111    > {
112        crate::client::customize::CustomizableOperation::new(self)
113    }
114    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
115        self.set_config_override(::std::option::Option::Some(config_override.into()));
116        self
117    }
118
119    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
120        self.config_override = config_override;
121        self
122    }
123    /// <p>A unique identifier for the fleet to stop actions on. You can use either the fleet ID or ARN value.</p>
124    pub fn fleet_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.inner = self.inner.fleet_id(input.into());
126        self
127    }
128    /// <p>A unique identifier for the fleet to stop actions on. You can use either the fleet ID or ARN value.</p>
129    pub fn set_fleet_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.inner = self.inner.set_fleet_id(input);
131        self
132    }
133    /// <p>A unique identifier for the fleet to stop actions on. You can use either the fleet ID or ARN value.</p>
134    pub fn get_fleet_id(&self) -> &::std::option::Option<::std::string::String> {
135        self.inner.get_fleet_id()
136    }
137    ///
138    /// Appends an item to `Actions`.
139    ///
140    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
141    ///
142    /// <p>List of actions to suspend on the fleet.</p>
143    pub fn actions(mut self, input: crate::types::FleetAction) -> Self {
144        self.inner = self.inner.actions(input);
145        self
146    }
147    /// <p>List of actions to suspend on the fleet.</p>
148    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FleetAction>>) -> Self {
149        self.inner = self.inner.set_actions(input);
150        self
151    }
152    /// <p>List of actions to suspend on the fleet.</p>
153    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FleetAction>> {
154        self.inner.get_actions()
155    }
156    /// <p>The fleet location to stop fleet actions for. Specify a location in the form of an Amazon Web Services Region code, such as <code>us-west-2</code>.</p>
157    pub fn location(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158        self.inner = self.inner.location(input.into());
159        self
160    }
161    /// <p>The fleet location to stop fleet actions for. Specify a location in the form of an Amazon Web Services Region code, such as <code>us-west-2</code>.</p>
162    pub fn set_location(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163        self.inner = self.inner.set_location(input);
164        self
165    }
166    /// <p>The fleet location to stop fleet actions for. Specify a location in the form of an Amazon Web Services Region code, such as <code>us-west-2</code>.</p>
167    pub fn get_location(&self) -> &::std::option::Option<::std::string::String> {
168        self.inner.get_location()
169    }
170}