Skip to content

list_game_servers async

list_game_servers(
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    game_server_group_name: Optional[GameServerGroupNameOrArn] = None,
    sort_order: Optional[SortOrder] = None,
    limit: Optional[PositiveInteger] = None,
    next_token: Optional[NonZeroAndMaxString] = None,
) -> ListGameServersOutput

This API works with the following fleet types: EC2 (FleetIQ)

Retrieves information on all game servers that are currently active in a specified game server group. You can opt to sort the list by game server age. Use the pagination parameters to retrieve results in a set of sequential segments.

Learn more

Amazon GameLift Servers FleetIQ Guide

Parameters:

  • game_server_group_name (Optional[GameServerGroupNameOrArn], default: None ) –

    An identifier for the game server group to retrieve a list of game servers from. Use either the name or ARN value.

  • sort_order (Optional[SortOrder], default: None ) –

    Indicates how to sort the returned data based on game server registration timestamp. Use ASCENDING to retrieve oldest game servers first, or use DESCENDING to retrieve newest game servers first. If this parameter is left empty, game servers are returned in no particular order.

  • 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.

  • 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.

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.

  • 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 list_game_servers(
    self,
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    game_server_group_name: Optional[
        "capo_gamelift.types.game_server_group_name_or_arn.GameServerGroupNameOrArn"
    ] = None,
    sort_order: Optional["capo_gamelift.types.sort_order.SortOrder"] = 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.list_game_servers_output.ListGameServersOutput":
    """<p> <b>This API works with the following fleet types:</b> EC2 (FleetIQ)</p> <p>Retrieves information on all game servers that are currently active in a specified game server group. You can opt to sort the list by game server age. Use the pagination parameters to retrieve results in a set of sequential segments. </p> <p> <b>Learn more</b> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html">Amazon GameLift Servers FleetIQ Guide</a> </p>

    Args:
        game_server_group_name: <p>An identifier for the game server group to retrieve a list of game servers from. Use either the name or ARN value.</p>
        sort_order: <p>Indicates how to sort the returned data based on game server registration timestamp. Use <code>ASCENDING</code> to retrieve oldest game servers first, or use <code>DESCENDING</code> to retrieve newest game servers first. If this parameter is left empty, game servers are returned in no particular order.</p>
        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.</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.</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.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.list_game_servers_input.ListGameServersInput]",
    ) -> AsyncOperationResponse[
        "capo_gamelift.types.list_game_servers_output.ListGameServersOutput"
    ]:
        import capo_gamelift._operations.game_lift.list_game_servers

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

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

        return capo_gamelift.types.list_game_servers_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListGameServers", redact_output=_redact_output),
    )
    input_: capo_gamelift.types.list_game_servers_input.ListGameServersInput = {}
    if game_server_group_name is not None:
        input_["game_server_group_name"] = game_server_group_name
    if sort_order is not None:
        input_["sort_order"] = sort_order
    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