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::accept_match::_accept_match_output::AcceptMatchOutputBuilder;

pub use crate::operation::accept_match::_accept_match_input::AcceptMatchInputBuilder;

/// Fluent builder constructing a request to `AcceptMatch`.
///
/// <p>Registers a player's acceptance or rejection of a proposed FlexMatch match. A matchmaking configuration may require player acceptance; if so, then matches built with that configuration cannot be completed unless all players accept the proposed match within a specified time limit. </p>
/// <p>When FlexMatch builds a match, all the matchmaking tickets involved in the proposed match are placed into status <code>REQUIRES_ACCEPTANCE</code>. This is a trigger for your game to get acceptance from all players in the ticket. Acceptances are only valid for tickets when they are in this status; all other acceptances result in an error.</p>
/// <p>To register acceptance, specify the ticket ID, a response, and one or more players. Once all players have registered acceptance, the matchmaking tickets advance to status <code>PLACING</code>, where a new game session is created for the match. </p>
/// <p>If any player rejects the match, or if acceptances are not received before a specified timeout, the proposed match is dropped. The matchmaking tickets are then handled in one of two ways: For tickets where one or more players rejected the match or failed to respond, the ticket status is set to <code>CANCELLED</code>, and processing is terminated. For tickets where players have accepted or not yet responded, the ticket status is returned to <code>SEARCHING</code> to find a new match. A new matchmaking request for these players can be submitted as needed. </p>
/// <p> <b>Learn more</b> </p>
/// <p> <a href="https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-client.html"> Add FlexMatch to a game client</a> </p>
/// <p> <a href="https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-events.html"> FlexMatch events</a> (reference)</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct AcceptMatchFluentBuilder {
    handle: std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::accept_match::builders::AcceptMatchInputBuilder,
}
impl AcceptMatchFluentBuilder {
    /// Creates a new `AcceptMatch`.
    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::accept_match::AcceptMatch,
            aws_http::retry::AwsResponseRetryClassifier,
        >,
        aws_smithy_http::result::SdkError<crate::operation::accept_match::AcceptMatchError>,
    > {
        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::accept_match::AcceptMatchOutput,
        aws_smithy_http::result::SdkError<crate::operation::accept_match::AcceptMatchError>,
    > {
        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 a matchmaking ticket. The ticket must be in status <code>REQUIRES_ACCEPTANCE</code>; otherwise this request will fail.</p>
    pub fn ticket_id(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.ticket_id(input.into());
        self
    }
    /// <p>A unique identifier for a matchmaking ticket. The ticket must be in status <code>REQUIRES_ACCEPTANCE</code>; otherwise this request will fail.</p>
    pub fn set_ticket_id(mut self, input: std::option::Option<std::string::String>) -> Self {
        self.inner = self.inner.set_ticket_id(input);
        self
    }
    /// Appends an item to `PlayerIds`.
    ///
    /// To override the contents of this collection use [`set_player_ids`](Self::set_player_ids).
    ///
    /// <p>A unique identifier for a player delivering the response. This parameter can include one or multiple player IDs.</p>
    pub fn player_ids(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.player_ids(input.into());
        self
    }
    /// <p>A unique identifier for a player delivering the response. This parameter can include one or multiple player IDs.</p>
    pub fn set_player_ids(
        mut self,
        input: std::option::Option<std::vec::Vec<std::string::String>>,
    ) -> Self {
        self.inner = self.inner.set_player_ids(input);
        self
    }
    /// <p>Player response to the proposed match.</p>
    pub fn acceptance_type(mut self, input: crate::types::AcceptanceType) -> Self {
        self.inner = self.inner.acceptance_type(input);
        self
    }
    /// <p>Player response to the proposed match.</p>
    pub fn set_acceptance_type(
        mut self,
        input: std::option::Option<crate::types::AcceptanceType>,
    ) -> Self {
        self.inner = self.inner.set_acceptance_type(input);
        self
    }
}