aws_sdk_gamelift/operation/start_game_session_placement/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_game_session_placement::_start_game_session_placement_output::StartGameSessionPlacementOutputBuilder;
3
4pub use crate::operation::start_game_session_placement::_start_game_session_placement_input::StartGameSessionPlacementInputBuilder;
5
6impl crate::operation::start_game_session_placement::builders::StartGameSessionPlacementInputBuilder {
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::start_game_session_placement::StartGameSessionPlacementOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::start_game_session_placement::StartGameSessionPlacementError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.start_game_session_placement();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `StartGameSessionPlacement`.
24///
25/// <p><b>This API works with the following fleet types:</b> EC2, Anywhere, Container</p>
26/// <p>Makes a request to start a new game session using a game session queue. When processing a placement request, Amazon GameLift Servers looks for the best possible available resource to host the game session, based on how the queue is configured to prioritize factors such as resource cost, latency, and location. After selecting an available resource, Amazon GameLift Servers prompts the resource to start a game session. A placement request can include a list of players to create a set of player sessions. The request can also include information to pass to the new game session, such as to specify a game map or other options.</p>
27/// <p><b>Request options</b></p>
28/// <p>Use this operation to make the following types of requests.</p>
29/// <ul>
30/// <li>
31/// <p>Request a placement using the queue's default prioritization process (see the default prioritization described in <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_PriorityConfiguration.html">PriorityConfiguration</a>). Include these required parameters:</p>
32/// <ul>
33/// <li>
34/// <p><code>GameSessionQueueName</code></p></li>
35/// <li>
36/// <p><code>MaximumPlayerSessionCount</code></p></li>
37/// <li>
38/// <p><code>PlacementID</code></p></li>
39/// </ul></li>
40/// <li>
41/// <p>Request a placement and prioritize based on latency. Include these parameters:</p>
42/// <ul>
43/// <li>
44/// <p>Required parameters <code>GameSessionQueueName</code>, <code>MaximumPlayerSessionCount</code>, <code>PlacementID</code>.</p></li>
45/// <li>
46/// <p><code>PlayerLatencies</code>. Include a set of latency values for destinations in the queue. When a request includes latency data, Amazon GameLift Servers automatically reorder the queue's locations priority list based on lowest available latency values. If a request includes latency data for multiple players, Amazon GameLift Servers calculates each location's average latency for all players and reorders to find the lowest latency across all players.</p></li>
47/// <li>
48/// <p>Don't include <code>PriorityConfigurationOverride</code>.</p></li>
49/// </ul>
50/// <ul>
51/// <li>
52/// <p>Prioritize based on a custom list of locations. If you're using a queue that's configured to prioritize location first (see <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_PriorityConfiguration.html">PriorityConfiguration</a> for game session queues), you can optionally use the <i>PriorityConfigurationOverride</i> parameter to substitute a different location priority list for this placement request. Amazon GameLift Servers searches each location on the priority override list to find an available hosting resource for the new game session. Specify a fallback strategy to use in the event that Amazon GameLift Servers fails to place the game session in any of the locations on the override list.</p></li>
53/// </ul></li>
54/// <li>
55/// <p>Request a placement and prioritized based on a custom list of locations.</p></li>
56/// <li>
57/// <p>You can request new player sessions for a group of players. Include the <i>DesiredPlayerSessions</i> parameter and include at minimum a unique player ID for each. You can also include player-specific data to pass to the new game session.</p></li>
58/// </ul>
59/// <p><b>Result</b></p>
60/// <p>If successful, this operation generates a new game session placement request and adds it to the game session queue for processing. You can track the status of individual placement requests by calling <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_DescribeGameSessionPlacement.html">DescribeGameSessionPlacement</a> or by monitoring queue notifications. When the request status is <code>FULFILLED</code>, a new game session has started and the placement request is updated with connection information for the game session (IP address and port). If the request included player session data, Amazon GameLift Servers creates a player session for each player ID in the request.</p>
61/// <p>The request results in a <code>InvalidRequestException</code> in the following situations:</p>
62/// <ul>
63/// <li>
64/// <p>If the request includes both <i>PlayerLatencies</i> and <i>PriorityConfigurationOverride</i> parameters.</p></li>
65/// <li>
66/// <p>If the request includes the <i>PriorityConfigurationOverride</i> parameter and specifies a queue that doesn't prioritize locations.</p></li>
67/// </ul>
68/// <p>Amazon GameLift Servers continues to retry each placement request until it reaches the queue's timeout setting. If a request times out, you can resubmit the request to the same queue or try a different queue.</p>
69#[derive(::std::clone::Clone, ::std::fmt::Debug)]
70pub struct StartGameSessionPlacementFluentBuilder {
71 handle: ::std::sync::Arc<crate::client::Handle>,
72 inner: crate::operation::start_game_session_placement::builders::StartGameSessionPlacementInputBuilder,
73 config_override: ::std::option::Option<crate::config::Builder>,
74}
75impl
76 crate::client::customize::internal::CustomizableSend<
77 crate::operation::start_game_session_placement::StartGameSessionPlacementOutput,
78 crate::operation::start_game_session_placement::StartGameSessionPlacementError,
79 > for StartGameSessionPlacementFluentBuilder
80{
81 fn send(
82 self,
83 config_override: crate::config::Builder,
84 ) -> crate::client::customize::internal::BoxFuture<
85 crate::client::customize::internal::SendResult<
86 crate::operation::start_game_session_placement::StartGameSessionPlacementOutput,
87 crate::operation::start_game_session_placement::StartGameSessionPlacementError,
88 >,
89 > {
90 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
91 }
92}
93impl StartGameSessionPlacementFluentBuilder {
94 /// Creates a new `StartGameSessionPlacementFluentBuilder`.
95 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
96 Self {
97 handle,
98 inner: ::std::default::Default::default(),
99 config_override: ::std::option::Option::None,
100 }
101 }
102 /// Access the StartGameSessionPlacement as a reference.
103 pub fn as_input(&self) -> &crate::operation::start_game_session_placement::builders::StartGameSessionPlacementInputBuilder {
104 &self.inner
105 }
106 /// Sends the request and returns the response.
107 ///
108 /// If an error occurs, an `SdkError` will be returned with additional details that
109 /// can be matched against.
110 ///
111 /// By default, any retryable failures will be retried twice. Retry behavior
112 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
113 /// set when configuring the client.
114 pub async fn send(
115 self,
116 ) -> ::std::result::Result<
117 crate::operation::start_game_session_placement::StartGameSessionPlacementOutput,
118 ::aws_smithy_runtime_api::client::result::SdkError<
119 crate::operation::start_game_session_placement::StartGameSessionPlacementError,
120 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
121 >,
122 > {
123 let input = self
124 .inner
125 .build()
126 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
127 let runtime_plugins = crate::operation::start_game_session_placement::StartGameSessionPlacement::operation_runtime_plugins(
128 self.handle.runtime_plugins.clone(),
129 &self.handle.conf,
130 self.config_override,
131 );
132 crate::operation::start_game_session_placement::StartGameSessionPlacement::orchestrate(&runtime_plugins, input).await
133 }
134
135 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
136 pub fn customize(
137 self,
138 ) -> crate::client::customize::CustomizableOperation<
139 crate::operation::start_game_session_placement::StartGameSessionPlacementOutput,
140 crate::operation::start_game_session_placement::StartGameSessionPlacementError,
141 Self,
142 > {
143 crate::client::customize::CustomizableOperation::new(self)
144 }
145 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
146 self.set_config_override(::std::option::Option::Some(config_override.into()));
147 self
148 }
149
150 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
151 self.config_override = config_override;
152 self
153 }
154 /// <p>A unique identifier to assign to the new game session placement. This value is developer-defined. The value must be unique across all Regions and cannot be reused.</p>
155 pub fn placement_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156 self.inner = self.inner.placement_id(input.into());
157 self
158 }
159 /// <p>A unique identifier to assign to the new game session placement. This value is developer-defined. The value must be unique across all Regions and cannot be reused.</p>
160 pub fn set_placement_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161 self.inner = self.inner.set_placement_id(input);
162 self
163 }
164 /// <p>A unique identifier to assign to the new game session placement. This value is developer-defined. The value must be unique across all Regions and cannot be reused.</p>
165 pub fn get_placement_id(&self) -> &::std::option::Option<::std::string::String> {
166 self.inner.get_placement_id()
167 }
168 /// <p>Name of the queue to use to place the new game session. You can use either the queue name or ARN value.</p>
169 pub fn game_session_queue_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170 self.inner = self.inner.game_session_queue_name(input.into());
171 self
172 }
173 /// <p>Name of the queue to use to place the new game session. You can use either the queue name or ARN value.</p>
174 pub fn set_game_session_queue_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175 self.inner = self.inner.set_game_session_queue_name(input);
176 self
177 }
178 /// <p>Name of the queue to use to place the new game session. You can use either the queue name or ARN value.</p>
179 pub fn get_game_session_queue_name(&self) -> &::std::option::Option<::std::string::String> {
180 self.inner.get_game_session_queue_name()
181 }
182 ///
183 /// Appends an item to `GameProperties`.
184 ///
185 /// To override the contents of this collection use [`set_game_properties`](Self::set_game_properties).
186 ///
187 /// <p>A set of key-value pairs that can store custom data in a game session. For example: <code>{"Key": "difficulty", "Value": "novice"}</code>.</p>
188 pub fn game_properties(mut self, input: crate::types::GameProperty) -> Self {
189 self.inner = self.inner.game_properties(input);
190 self
191 }
192 /// <p>A set of key-value pairs that can store custom data in a game session. For example: <code>{"Key": "difficulty", "Value": "novice"}</code>.</p>
193 pub fn set_game_properties(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GameProperty>>) -> Self {
194 self.inner = self.inner.set_game_properties(input);
195 self
196 }
197 /// <p>A set of key-value pairs that can store custom data in a game session. For example: <code>{"Key": "difficulty", "Value": "novice"}</code>.</p>
198 pub fn get_game_properties(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GameProperty>> {
199 self.inner.get_game_properties()
200 }
201 /// <p>The maximum number of players that can be connected simultaneously to the game session.</p>
202 pub fn maximum_player_session_count(mut self, input: i32) -> Self {
203 self.inner = self.inner.maximum_player_session_count(input);
204 self
205 }
206 /// <p>The maximum number of players that can be connected simultaneously to the game session.</p>
207 pub fn set_maximum_player_session_count(mut self, input: ::std::option::Option<i32>) -> Self {
208 self.inner = self.inner.set_maximum_player_session_count(input);
209 self
210 }
211 /// <p>The maximum number of players that can be connected simultaneously to the game session.</p>
212 pub fn get_maximum_player_session_count(&self) -> &::std::option::Option<i32> {
213 self.inner.get_maximum_player_session_count()
214 }
215 /// <p>A descriptive label that is associated with a game session. Session names do not need to be unique.</p>
216 pub fn game_session_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217 self.inner = self.inner.game_session_name(input.into());
218 self
219 }
220 /// <p>A descriptive label that is associated with a game session. Session names do not need to be unique.</p>
221 pub fn set_game_session_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222 self.inner = self.inner.set_game_session_name(input);
223 self
224 }
225 /// <p>A descriptive label that is associated with a game session. Session names do not need to be unique.</p>
226 pub fn get_game_session_name(&self) -> &::std::option::Option<::std::string::String> {
227 self.inner.get_game_session_name()
228 }
229 ///
230 /// Appends an item to `PlayerLatencies`.
231 ///
232 /// To override the contents of this collection use [`set_player_latencies`](Self::set_player_latencies).
233 ///
234 /// <p>A set of values, expressed in milliseconds, that indicates the amount of latency that a player experiences when connected to Amazon Web Services Regions. This information is used to try to place the new game session where it can offer the best possible gameplay experience for the players.</p>
235 pub fn player_latencies(mut self, input: crate::types::PlayerLatency) -> Self {
236 self.inner = self.inner.player_latencies(input);
237 self
238 }
239 /// <p>A set of values, expressed in milliseconds, that indicates the amount of latency that a player experiences when connected to Amazon Web Services Regions. This information is used to try to place the new game session where it can offer the best possible gameplay experience for the players.</p>
240 pub fn set_player_latencies(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PlayerLatency>>) -> Self {
241 self.inner = self.inner.set_player_latencies(input);
242 self
243 }
244 /// <p>A set of values, expressed in milliseconds, that indicates the amount of latency that a player experiences when connected to Amazon Web Services Regions. This information is used to try to place the new game session where it can offer the best possible gameplay experience for the players.</p>
245 pub fn get_player_latencies(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PlayerLatency>> {
246 self.inner.get_player_latencies()
247 }
248 ///
249 /// Appends an item to `DesiredPlayerSessions`.
250 ///
251 /// To override the contents of this collection use [`set_desired_player_sessions`](Self::set_desired_player_sessions).
252 ///
253 /// <p>Set of information on each player to create a player session for.</p>
254 pub fn desired_player_sessions(mut self, input: crate::types::DesiredPlayerSession) -> Self {
255 self.inner = self.inner.desired_player_sessions(input);
256 self
257 }
258 /// <p>Set of information on each player to create a player session for.</p>
259 pub fn set_desired_player_sessions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DesiredPlayerSession>>) -> Self {
260 self.inner = self.inner.set_desired_player_sessions(input);
261 self
262 }
263 /// <p>Set of information on each player to create a player session for.</p>
264 pub fn get_desired_player_sessions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DesiredPlayerSession>> {
265 self.inner.get_desired_player_sessions()
266 }
267 /// <p>A set of custom game session properties, formatted as a single string value. This data is passed to a game server process with a request to start a new game session. For more information, see <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession">Start a game session</a>.</p>
268 pub fn game_session_data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
269 self.inner = self.inner.game_session_data(input.into());
270 self
271 }
272 /// <p>A set of custom game session properties, formatted as a single string value. This data is passed to a game server process with a request to start a new game session. For more information, see <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession">Start a game session</a>.</p>
273 pub fn set_game_session_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
274 self.inner = self.inner.set_game_session_data(input);
275 self
276 }
277 /// <p>A set of custom game session properties, formatted as a single string value. This data is passed to a game server process with a request to start a new game session. For more information, see <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html#gamelift-sdk-server-startsession">Start a game session</a>.</p>
278 pub fn get_game_session_data(&self) -> &::std::option::Option<::std::string::String> {
279 self.inner.get_game_session_data()
280 }
281 /// <p>A prioritized list of locations to use for the game session placement and instructions on how to use it. This list overrides a queue's prioritized location list for this game session placement request only. You can include Amazon Web Services Regions, local zones, and custom locations (for Anywhere fleets). You can choose to limit placements to locations on the override list only, or you can prioritize locations on the override list first and then fall back to the queue's other locations if needed. Choose a fallback strategy to use in the event that Amazon GameLift Servers fails to place a game session in any of the locations on the priority override list.</p>
282 pub fn priority_configuration_override(mut self, input: crate::types::PriorityConfigurationOverride) -> Self {
283 self.inner = self.inner.priority_configuration_override(input);
284 self
285 }
286 /// <p>A prioritized list of locations to use for the game session placement and instructions on how to use it. This list overrides a queue's prioritized location list for this game session placement request only. You can include Amazon Web Services Regions, local zones, and custom locations (for Anywhere fleets). You can choose to limit placements to locations on the override list only, or you can prioritize locations on the override list first and then fall back to the queue's other locations if needed. Choose a fallback strategy to use in the event that Amazon GameLift Servers fails to place a game session in any of the locations on the priority override list.</p>
287 pub fn set_priority_configuration_override(mut self, input: ::std::option::Option<crate::types::PriorityConfigurationOverride>) -> Self {
288 self.inner = self.inner.set_priority_configuration_override(input);
289 self
290 }
291 /// <p>A prioritized list of locations to use for the game session placement and instructions on how to use it. This list overrides a queue's prioritized location list for this game session placement request only. You can include Amazon Web Services Regions, local zones, and custom locations (for Anywhere fleets). You can choose to limit placements to locations on the override list only, or you can prioritize locations on the override list first and then fall back to the queue's other locations if needed. Choose a fallback strategy to use in the event that Amazon GameLift Servers fails to place a game session in any of the locations on the priority override list.</p>
292 pub fn get_priority_configuration_override(&self) -> &::std::option::Option<crate::types::PriorityConfigurationOverride> {
293 self.inner.get_priority_configuration_override()
294 }
295}