Skip to content

list_fleets

list_fleets(
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    build_id: Optional[BuildIdOrArn] = None,
    script_id: Optional[ScriptIdOrArn] = None,
    limit: Optional[PositiveInteger] = None,
    next_token: Optional[NonZeroAndMaxString] = None,
) -> ListFleetsOutput

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

Retrieves a collection of fleet resources in an Amazon Web Services Region. You can filter the result set to find only those fleets that are deployed with a specific build or script. For fleets that have multiple locations, this operation retrieves fleets based on their home Region only.

You can use this operation in the following ways:

  • To get a list of all fleets in a Region, don't provide a build or script identifier.

  • To get a list of all fleets where a specific game build is deployed, provide the build ID.

  • To get a list of all Amazon GameLift Servers Realtime fleets with a specific configuration script, provide the script ID.

Use the pagination parameters to retrieve results as a set of sequential pages.

If successful, this operation returns a list of fleet IDs that match the request parameters. A NextToken value is also returned if there are more result pages to retrieve.

Fleet IDs are returned in no particular order.

Parameters:

  • build_id (Optional[BuildIdOrArn], default: None ) –

    A unique identifier for the build to request fleets for. Use this parameter to return only fleets using a specified build. Use either the build ID or ARN value.

  • script_id (Optional[ScriptIdOrArn], default: None ) –

    A unique identifier for the Realtime script to request fleets for. Use this parameter to return only fleets using a specified script. Use either the script ID or ARN value.

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

  • 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/game_lift.py
def list_fleets(
    self,
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    build_id: Optional["capo_gamelift.types.build_id_or_arn.BuildIdOrArn"] = None,
    script_id: Optional[
        "capo_gamelift.types.script_id_or_arn.ScriptIdOrArn"
    ] = 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_fleets_output.ListFleetsOutput":
    """<p> <b>This API works with the following fleet types:</b> EC2, Anywhere, Container</p> <p>Retrieves a collection of fleet resources in an Amazon Web Services Region. You can filter the result set to find only those fleets that are deployed with a specific build or script. For fleets that have multiple locations, this operation retrieves fleets based on their home Region only.</p> <p>You can use this operation in the following ways: </p> <ul> <li> <p>To get a list of all fleets in a Region, don't provide a build or script identifier.</p> </li> <li> <p>To get a list of all fleets where a specific game build is deployed, provide the build ID.</p> </li> <li> <p>To get a list of all Amazon GameLift Servers Realtime fleets with a specific configuration script, provide the script ID. </p> </li> </ul> <p>Use the pagination parameters to retrieve results as a set of sequential pages. </p> <p>If successful, this operation returns a list of fleet IDs that match the request parameters. A NextToken value is also returned if there are more result pages to retrieve.</p> <note> <p>Fleet IDs are returned in no particular order.</p> </note>

    Args:
        build_id: <p>A unique identifier for the build to request fleets for. Use this parameter to return only fleets using a specified build. Use either the build ID or ARN value.</p>
        script_id: <p>A unique identifier for the Realtime script to request fleets for. Use this parameter to return only fleets using a specified script. Use either the script ID or ARN value.</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.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.
    """

    def _handler(
        req: "OperationRequest[capo_gamelift.types.list_fleets_input.ListFleetsInput]",
    ) -> OperationResponse[
        "capo_gamelift.types.list_fleets_output.ListFleetsOutput"
    ]:
        import capo_gamelift._operations.game_lift.list_fleets

        output, http_response = (
            capo_gamelift._operations.game_lift.list_fleets.list_fleets(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListFleets")
    )
    input_: capo_gamelift.types.list_fleets_input.ListFleetsInput = {}
    if build_id is not None:
        input_["build_id"] = build_id
    if script_id is not None:
        input_["script_id"] = script_id
    if limit is not None:
        input_["limit"] = limit
    if next_token is not None:
        input_["next_token"] = next_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output