aws-sdk-gamelift 0.26.0

AWS SDK for Amazon GameLift
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::claim_game_server::_claim_game_server_output::ClaimGameServerOutputBuilder;

pub use crate::operation::claim_game_server::_claim_game_server_input::ClaimGameServerInputBuilder;

/// Fluent builder constructing a request to `ClaimGameServer`.
///
/// <p> <b>This operation is used with the GameLift FleetIQ solution and game server groups.</b> </p>
/// <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, GameLift 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>
/// <p>To claim a game server, identify a game server group. You can also specify a game server ID, although this approach bypasses GameLift 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. </p>
/// <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>
/// <p>If you try to claim a specific game server, this request will fail in the following cases:</p>
/// <ul>
/// <li> <p>If the game server utilization status is <code>UTILIZED</code>.</p> </li>
/// <li> <p>If the game server claim status is <code>CLAIMED</code>.</p> </li>
/// </ul> <note>
/// <p>When claiming a specific game server, this request will succeed even if the game server is running on an instance in <code>DRAINING</code> status. To avoid this, first check the instance status by calling <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_DescribeGameServerInstances.html">DescribeGameServerInstances</a> .</p>
/// </note>
/// <p> <b>Learn more</b> </p>
/// <p> <a href="https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html">GameLift FleetIQ Guide</a> </p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct ClaimGameServerFluentBuilder {
    handle: std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::claim_game_server::builders::ClaimGameServerInputBuilder,
}
impl ClaimGameServerFluentBuilder {
    /// Creates a new `ClaimGameServer`.
    pub(crate) fn new(handle: std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: Default::default(),
        }
    }

    /// Consume this builder, creating a customizable operation that can be modified before being
    /// sent. The operation's inner [http::Request] can be modified as well.
    pub async fn customize(
        self,
    ) -> std::result::Result<
        crate::client::customize::CustomizableOperation<
            crate::operation::claim_game_server::ClaimGameServer,
            aws_http::retry::AwsResponseRetryClassifier,
        >,
        aws_smithy_http::result::SdkError<
            crate::operation::claim_game_server::ClaimGameServerError,
        >,
    > {
        let handle = self.handle.clone();
        let operation = self
            .inner
            .build()
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?
            .make_operation(&handle.conf)
            .await
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
        Ok(crate::client::customize::CustomizableOperation { handle, operation })
    }

    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> std::result::Result<
        crate::operation::claim_game_server::ClaimGameServerOutput,
        aws_smithy_http::result::SdkError<
            crate::operation::claim_game_server::ClaimGameServerError,
        >,
    > {
        let op = self
            .inner
            .build()
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?
            .make_operation(&self.handle.conf)
            .await
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
        self.handle.client.call(op).await
    }
    /// <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 GameLift FleetIQ to look for an available game server to claim. </p>
    pub fn game_server_group_name(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.game_server_group_name(input.into());
        self
    }
    /// <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 GameLift FleetIQ to look for an available game server to claim. </p>
    pub fn set_game_server_group_name(
        mut self,
        input: std::option::Option<std::string::String>,
    ) -> Self {
        self.inner = self.inner.set_game_server_group_name(input);
        self
    }
    /// <p>A custom string that uniquely identifies the game server to claim. If this parameter is left empty, GameLift FleetIQ searches for an available game server in the specified game server group.</p>
    pub fn game_server_id(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.game_server_id(input.into());
        self
    }
    /// <p>A custom string that uniquely identifies the game server to claim. If this parameter is left empty, GameLift FleetIQ searches for an available game server in the specified game server group.</p>
    pub fn set_game_server_id(mut self, input: std::option::Option<std::string::String>) -> Self {
        self.inner = self.inner.set_game_server_id(input);
        self
    }
    /// <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>
    pub fn game_server_data(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.game_server_data(input.into());
        self
    }
    /// <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>
    pub fn set_game_server_data(mut self, input: std::option::Option<std::string::String>) -> Self {
        self.inner = self.inner.set_game_server_data(input);
        self
    }
}