Skip to content

describe_player_sessions async

describe_player_sessions(
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    game_session_id: Optional[ArnStringModel] = None,
    player_id: Optional[PlayerId] = None,
    player_session_id: Optional[PlayerSessionId] = None,
    player_session_status_filter: Optional[NonZeroAndMaxString] = None,
    limit: Optional[PositiveInteger] = None,
    next_token: Optional[NonZeroAndMaxString] = None,
) -> DescribePlayerSessionsOutput

This API works with the following fleet types: EC2, Anywhere, Container

Retrieves properties for one or more player sessions.

This action can be used in the following ways:

  • To retrieve a specific player session, provide the player session ID only.

  • To retrieve all player sessions in a game session, provide the game session ID only.

  • To retrieve all player sessions for a specific player, provide a player ID only.

To request player sessions, specify either a player session ID, game session ID, or player ID. You can filter this request by player session status. If you provide a specific PlayerSessionId or PlayerId, Amazon GameLift Servers ignores the filter criteria. Use the pagination parameters to retrieve results as a set of sequential pages.

If successful, a PlayerSession object is returned for each session that matches the request.

Related actions

All APIs by task

Parameters:

  • game_session_id (Optional[ArnStringModel], default: None ) –

    An identifier for the game session that is unique across all regions to retrieve player sessions for. The value is always a full ARN in the following format: For Home Region game session - arn:aws:gamelift:::gamesession//. For Remote Location game session - arn:aws:gamelift:::gamesession///.

  • player_id (Optional[PlayerId], default: None ) –

    A unique identifier for a player to retrieve player sessions for.

  • player_session_id (Optional[PlayerSessionId], default: None ) –

    A unique identifier for a player session to retrieve.

  • player_session_status_filter (Optional[NonZeroAndMaxString], default: None ) –

    Player session status to filter results on. Note that when a PlayerSessionId or PlayerId is provided in a DescribePlayerSessions request, then the PlayerSessionStatusFilter has no effect on the response.

    Possible player session statuses include the following:

    • RESERVED -- The player session request has been received, but the player has not yet connected to the server process and/or been validated.

    • ACTIVE -- The player has been validated by the server process and is currently connected.

    • COMPLETED -- The player connection has been dropped.

    • TIMEDOUT -- A player session request was received, but the player did not connect and/or was not validated within the timeout limit (60 seconds).

  • limit (Optional[PositiveInteger], default: None ) –

    The maximum number of results to return. Use this parameter with NextToken to get results as a set of sequential pages. If a player session ID is specified, this parameter is ignored.

  • next_token (Optional[NonZeroAndMaxString], default: None ) –

    A token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this operation. To start at the beginning of the result set, do not specify a value. If a player session ID is specified, this parameter is ignored.

Raises:

  • InternalServiceException –

    The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.

  • InvalidRequestException –

    One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

  • NotFoundException –

    The requested resource was not found. The resource was either not created yet or deleted.

  • UnauthorizedException –

    The client failed authentication. Clients should not retry such requests.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_gamelift/_services/async_game_lift.py
async def describe_player_sessions(
    self,
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    game_session_id: Optional[
        "capo_gamelift.types.arn_string_model.ArnStringModel"
    ] = None,
    player_id: Optional["capo_gamelift.types.player_id.PlayerId"] = None,
    player_session_id: Optional[
        "capo_gamelift.types.player_session_id.PlayerSessionId"
    ] = None,
    player_session_status_filter: Optional[
        "capo_gamelift.types.non_zero_and_max_string.NonZeroAndMaxString"
    ] = None,
    limit: Optional["capo_gamelift.types.positive_integer.PositiveInteger"] = None,
    next_token: Optional[
        "capo_gamelift.types.non_zero_and_max_string.NonZeroAndMaxString"
    ] = None,
) -> "capo_gamelift.types.describe_player_sessions_output.DescribePlayerSessionsOutput":
    """<p> <b>This API works with the following fleet types:</b> EC2, Anywhere, Container</p> <p>Retrieves properties for one or more player sessions. </p> <p>This action can be used in the following ways: </p> <ul> <li> <p>To retrieve a specific player session, provide the player session ID only.</p> </li> <li> <p>To retrieve all player sessions in a game session, provide the game session ID only.</p> </li> <li> <p>To retrieve all player sessions for a specific player, provide a player ID only.</p> </li> </ul> <p>To request player sessions, specify either a player session ID, game session ID, or player ID. You can filter this request by player session status. If you provide a specific <code>PlayerSessionId</code> or <code>PlayerId</code>, Amazon GameLift Servers ignores the filter criteria. Use the pagination parameters to retrieve results as a set of sequential pages. </p> <p>If successful, a <code>PlayerSession</code> object is returned for each session that matches the request.</p> <p> <b>Related actions</b> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets">All APIs by task</a> </p>

    Args:
        game_session_id: <p>An identifier for the game session that is unique across all regions to retrieve player sessions for. The value is always a full ARN in the following format: For Home Region game session - <code>arn:aws:gamelift:<home_region>::gamesession/<fleet ID>/<ID string></code>. For Remote Location game session - <code>arn:aws:gamelift:<home_region>::gamesession/<fleet ID>/<location>/<ID string></code>.</p>
        player_id: <p>A unique identifier for a player to retrieve player sessions for.</p>
        player_session_id: <p>A unique identifier for a player session to retrieve.</p>
        player_session_status_filter: <p>Player session status to filter results on. Note that when a PlayerSessionId or PlayerId is provided in a DescribePlayerSessions request, then the PlayerSessionStatusFilter has no effect on the response.</p> <p>Possible player session statuses include the following:</p> <ul> <li> <p> <b>RESERVED</b> -- The player session request has been received, but the player has not yet connected to the server process and/or been validated. </p> </li> <li> <p> <b>ACTIVE</b> -- The player has been validated by the server process and is currently connected.</p> </li> <li> <p> <b>COMPLETED</b> -- The player connection has been dropped.</p> </li> <li> <p> <b>TIMEDOUT</b> -- A player session request was received, but the player did not connect and/or was not validated within the timeout limit (60 seconds).</p> </li> </ul>
        limit: <p>The maximum number of results to return. Use this parameter with <code>NextToken</code> to get results as a set of sequential pages. If a player session ID is specified, this parameter is ignored.</p>
        next_token: <p>A token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this operation. To start at the beginning of the result set, do not specify a value. If a player session ID is specified, this parameter is ignored.</p>

    Raises:
        capo_gamelift.errors.internal_service_exception.InternalServiceException: <p>The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.</p>
        capo_gamelift.errors.invalid_request_exception.InvalidRequestException: <p>One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.</p>
        capo_gamelift.errors.not_found_exception.NotFoundException: <p>The requested resource was not found. The resource was either not created yet or deleted.</p>
        capo_gamelift.errors.unauthorized_exception.UnauthorizedException: <p>The client failed authentication. Clients should not retry such requests.</p>
        capo_gamelift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_gamelift.types.describe_player_sessions_input.DescribePlayerSessionsInput]",
    ) -> AsyncOperationResponse[
        "capo_gamelift.types.describe_player_sessions_output.DescribePlayerSessionsOutput"
    ]:
        import capo_gamelift._operations.game_lift.describe_player_sessions

        (
            output,
            http_response,
        ) = await capo_gamelift._operations.game_lift.describe_player_sessions.async_describe_player_sessions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_gamelift.types.describe_player_sessions_input.DescribePlayerSessionsInput",
    ) -> dict[str, Any]:
        import capo_gamelift.types.describe_player_sessions_input

        return capo_gamelift.types.describe_player_sessions_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_gamelift.types.describe_player_sessions_output.DescribePlayerSessionsOutput",
    ) -> dict[str, Any]:
        import capo_gamelift.types.describe_player_sessions_output

        return capo_gamelift.types.describe_player_sessions_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "DescribePlayerSessions",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_gamelift.types.describe_player_sessions_input.DescribePlayerSessionsInput = {}
    if game_session_id is not None:
        input_["game_session_id"] = game_session_id
    if player_id is not None:
        input_["player_id"] = player_id
    if player_session_id is not None:
        input_["player_session_id"] = player_session_id
    if player_session_status_filter is not None:
        input_["player_session_status_filter"] = player_session_status_filter
    if limit is not None:
        input_["limit"] = limit
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output