aws_sdk_gamelift/operation/claim_game_server/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::claim_game_server::_claim_game_server_output::ClaimGameServerOutputBuilder;
3
4pub use crate::operation::claim_game_server::_claim_game_server_input::ClaimGameServerInputBuilder;
5
6impl crate::operation::claim_game_server::builders::ClaimGameServerInputBuilder {
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::claim_game_server::ClaimGameServerOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::claim_game_server::ClaimGameServerError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.claim_game_server();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ClaimGameServer`.
24///
25/// <p><b>This API works with the following fleet types:</b> EC2 (FleetIQ)</p>
26/// <p>Locates an available game server and temporarily reserves it to host gameplay and players. This operation is called from a game client or client service (such as a matchmaker) to request hosting resources for a new game session. In response, Amazon GameLift Servers FleetIQ locates an available game server, places it in <code>CLAIMED</code> status for 60 seconds, and returns connection information that players can use to connect to the game server.</p>
27/// <p>To claim a game server, identify a game server group. You can also specify a game server ID, although this approach bypasses Amazon GameLift Servers FleetIQ placement optimization. Optionally, include game data to pass to the game server at the start of a game session, such as a game map or player information. Add filter options to further restrict how a game server is chosen, such as only allowing game servers on <code>ACTIVE</code> instances to be claimed.</p>
28/// <p>When a game server is successfully claimed, connection information is returned. A claimed game server's utilization status remains <code>AVAILABLE</code> while the claim status is set to <code>CLAIMED</code> for up to 60 seconds. This time period gives the game server time to update its status to <code>UTILIZED</code> after players join. If the game server's status is not updated within 60 seconds, the game server reverts to unclaimed status and is available to be claimed by another request. The claim time period is a fixed value and is not configurable.</p>
29/// <p>If you try to claim a specific game server, this request will fail in the following cases:</p>
30/// <ul>
31/// <li>
32/// <p>If the game server utilization status is <code>UTILIZED</code>.</p></li>
33/// <li>
34/// <p>If the game server claim status is <code>CLAIMED</code>.</p></li>
35/// <li>
36/// <p>If the game server is running on an instance in <code>DRAINING</code> status and the provided filter option does not allow placing on <code>DRAINING</code> instances.</p></li>
37/// </ul>
38/// <p><b>Learn more</b></p>
39/// <p><a href="https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html">Amazon GameLift Servers FleetIQ Guide</a></p>
40#[derive(::std::clone::Clone, ::std::fmt::Debug)]
41pub struct ClaimGameServerFluentBuilder {
42 handle: ::std::sync::Arc<crate::client::Handle>,
43 inner: crate::operation::claim_game_server::builders::ClaimGameServerInputBuilder,
44 config_override: ::std::option::Option<crate::config::Builder>,
45}
46impl
47 crate::client::customize::internal::CustomizableSend<
48 crate::operation::claim_game_server::ClaimGameServerOutput,
49 crate::operation::claim_game_server::ClaimGameServerError,
50 > for ClaimGameServerFluentBuilder
51{
52 fn send(
53 self,
54 config_override: crate::config::Builder,
55 ) -> crate::client::customize::internal::BoxFuture<
56 crate::client::customize::internal::SendResult<
57 crate::operation::claim_game_server::ClaimGameServerOutput,
58 crate::operation::claim_game_server::ClaimGameServerError,
59 >,
60 > {
61 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
62 }
63}
64impl ClaimGameServerFluentBuilder {
65 /// Creates a new `ClaimGameServerFluentBuilder`.
66 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
67 Self {
68 handle,
69 inner: ::std::default::Default::default(),
70 config_override: ::std::option::Option::None,
71 }
72 }
73 /// Access the ClaimGameServer as a reference.
74 pub fn as_input(&self) -> &crate::operation::claim_game_server::builders::ClaimGameServerInputBuilder {
75 &self.inner
76 }
77 /// Sends the request and returns the response.
78 ///
79 /// If an error occurs, an `SdkError` will be returned with additional details that
80 /// can be matched against.
81 ///
82 /// By default, any retryable failures will be retried twice. Retry behavior
83 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
84 /// set when configuring the client.
85 pub async fn send(
86 self,
87 ) -> ::std::result::Result<
88 crate::operation::claim_game_server::ClaimGameServerOutput,
89 ::aws_smithy_runtime_api::client::result::SdkError<
90 crate::operation::claim_game_server::ClaimGameServerError,
91 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
92 >,
93 > {
94 let input = self
95 .inner
96 .build()
97 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
98 let runtime_plugins = crate::operation::claim_game_server::ClaimGameServer::operation_runtime_plugins(
99 self.handle.runtime_plugins.clone(),
100 &self.handle.conf,
101 self.config_override,
102 );
103 crate::operation::claim_game_server::ClaimGameServer::orchestrate(&runtime_plugins, input).await
104 }
105
106 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
107 pub fn customize(
108 self,
109 ) -> crate::client::customize::CustomizableOperation<
110 crate::operation::claim_game_server::ClaimGameServerOutput,
111 crate::operation::claim_game_server::ClaimGameServerError,
112 Self,
113 > {
114 crate::client::customize::CustomizableOperation::new(self)
115 }
116 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
117 self.set_config_override(::std::option::Option::Some(config_override.into()));
118 self
119 }
120
121 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
122 self.config_override = config_override;
123 self
124 }
125 /// <p>A unique identifier for the game server group where the game server is running. If you are not specifying a game server to claim, this value identifies where you want Amazon GameLift Servers FleetIQ to look for an available game server to claim.</p>
126 pub fn game_server_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127 self.inner = self.inner.game_server_group_name(input.into());
128 self
129 }
130 /// <p>A unique identifier for the game server group where the game server is running. If you are not specifying a game server to claim, this value identifies where you want Amazon GameLift Servers FleetIQ to look for an available game server to claim.</p>
131 pub fn set_game_server_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132 self.inner = self.inner.set_game_server_group_name(input);
133 self
134 }
135 /// <p>A unique identifier for the game server group where the game server is running. If you are not specifying a game server to claim, this value identifies where you want Amazon GameLift Servers FleetIQ to look for an available game server to claim.</p>
136 pub fn get_game_server_group_name(&self) -> &::std::option::Option<::std::string::String> {
137 self.inner.get_game_server_group_name()
138 }
139 /// <p>A custom string that uniquely identifies the game server to claim. If this parameter is left empty, Amazon GameLift Servers FleetIQ searches for an available game server in the specified game server group.</p>
140 pub fn game_server_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141 self.inner = self.inner.game_server_id(input.into());
142 self
143 }
144 /// <p>A custom string that uniquely identifies the game server to claim. If this parameter is left empty, Amazon GameLift Servers FleetIQ searches for an available game server in the specified game server group.</p>
145 pub fn set_game_server_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146 self.inner = self.inner.set_game_server_id(input);
147 self
148 }
149 /// <p>A custom string that uniquely identifies the game server to claim. If this parameter is left empty, Amazon GameLift Servers FleetIQ searches for an available game server in the specified game server group.</p>
150 pub fn get_game_server_id(&self) -> &::std::option::Option<::std::string::String> {
151 self.inner.get_game_server_id()
152 }
153 /// <p>A set of custom game server properties, formatted as a single string value. This data is passed to a game client or service when it requests information on game servers.</p>
154 pub fn game_server_data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155 self.inner = self.inner.game_server_data(input.into());
156 self
157 }
158 /// <p>A set of custom game server properties, formatted as a single string value. This data is passed to a game client or service when it requests information on game servers.</p>
159 pub fn set_game_server_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160 self.inner = self.inner.set_game_server_data(input);
161 self
162 }
163 /// <p>A set of custom game server properties, formatted as a single string value. This data is passed to a game client or service when it requests information on game servers.</p>
164 pub fn get_game_server_data(&self) -> &::std::option::Option<::std::string::String> {
165 self.inner.get_game_server_data()
166 }
167 /// <p>Object that restricts how a claimed game server is chosen.</p>
168 pub fn filter_option(mut self, input: crate::types::ClaimFilterOption) -> Self {
169 self.inner = self.inner.filter_option(input);
170 self
171 }
172 /// <p>Object that restricts how a claimed game server is chosen.</p>
173 pub fn set_filter_option(mut self, input: ::std::option::Option<crate::types::ClaimFilterOption>) -> Self {
174 self.inner = self.inner.set_filter_option(input);
175 self
176 }
177 /// <p>Object that restricts how a claimed game server is chosen.</p>
178 pub fn get_filter_option(&self) -> &::std::option::Option<crate::types::ClaimFilterOption> {
179 self.inner.get_filter_option()
180 }
181}