Skip to content

list_compute async

list_compute(
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    fleet_id: Optional[FleetIdOrArn] = None,
    location: Optional[LocationStringModel] = None,
    container_group_definition_name: Optional[ContainerGroupDefinitionNameOrArn] = None,
    compute_status: Optional[ListComputeInputStatus] = None,
    limit: Optional[PositiveInteger] = None,
    next_token: Optional[NonZeroAndMaxString] = None,
) -> ListComputeOutput

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

Retrieves information on the compute resources in an Amazon GameLift Servers fleet. Use the pagination parameters to retrieve results in a set of sequential pages.

Request options

  • Retrieve a list of all computes in a fleet. Specify a fleet ID.

  • Retrieve a list of all computes in a specific fleet location. Specify a fleet ID and location.

Results

If successful, this operation returns information on a set of computes. Depending on the type of fleet, the result includes the following information:

  • For a managed EC2 fleet (compute type EC2), this operation returns information about the EC2 instance. Compute names are EC2 instance IDs.

  • For an Anywhere fleet (compute type ANYWHERE), this operation returns compute names and details from when the compute was registered with RegisterCompute. This includes GameLiftServiceSdkEndpoint or GameLiftAgentEndpoint.

Parameters:

  • fleet_id (Optional[FleetIdOrArn], default: None ) –

    A unique identifier for the fleet to retrieve compute resources for.

  • location (Optional[LocationStringModel], default: None ) –

    The name of a location to retrieve compute resources for. For an Amazon GameLift Servers Anywhere fleet, use a custom location. For a managed fleet, provide a Amazon Web Services Region or Local Zone code (for example: us-west-2 or us-west-2-lax-1).

  • container_group_definition_name (Optional[ContainerGroupDefinitionNameOrArn], default: None ) –

    For computes in a managed container fleet, the name of the deployed container group definition.

  • compute_status (Optional[ListComputeInputStatus], default: None ) –

    The status of computes in a managed container fleet, based on the success of the latest update deployment.

    • ACTIVE -- The compute is deployed with the correct container definitions. It is ready to process game servers and host game sessions.

    • IMPAIRED -- An update deployment to the compute failed, and the compute is deployed with incorrect container definitions.

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

  • UnsupportedRegionException –

    The requested operation is not supported in the Region specified.

  • 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_compute(
    self,
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    fleet_id: Optional["capo_gamelift.types.fleet_id_or_arn.FleetIdOrArn"] = None,
    location: Optional[
        "capo_gamelift.types.location_string_model.LocationStringModel"
    ] = None,
    container_group_definition_name: Optional[
        "capo_gamelift.types.container_group_definition_name_or_arn.ContainerGroupDefinitionNameOrArn"
    ] = None,
    compute_status: Optional[
        "capo_gamelift.types.list_compute_input_status.ListComputeInputStatus"
    ] = 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_compute_output.ListComputeOutput":
    """<p> <b>This API works with the following fleet types:</b> EC2, Anywhere, Container</p> <p>Retrieves information on the compute resources in an Amazon GameLift Servers fleet. Use the pagination parameters to retrieve results in a set of sequential pages.</p> <p> <b>Request options</b> </p> <ul> <li> <p>Retrieve a list of all computes in a fleet. Specify a fleet ID. </p> </li> <li> <p>Retrieve a list of all computes in a specific fleet location. Specify a fleet ID and location.</p> </li> </ul> <p> <b>Results</b> </p> <p>If successful, this operation returns information on a set of computes. Depending on the type of fleet, the result includes the following information: </p> <ul> <li> <p>For a managed EC2 fleet (compute type <code>EC2</code>), this operation returns information about the EC2 instance. Compute names are EC2 instance IDs.</p> </li> <li> <p>For an Anywhere fleet (compute type <code>ANYWHERE</code>), this operation returns compute names and details from when the compute was registered with <code>RegisterCompute</code>. This includes <code>GameLiftServiceSdkEndpoint</code> or <code>GameLiftAgentEndpoint</code>.</p> </li> </ul>

    Args:
        fleet_id: <p>A unique identifier for the fleet to retrieve compute resources for.</p>
        location: <p>The name of a location to retrieve compute resources for. For an Amazon GameLift Servers Anywhere fleet, use a custom location. For a managed fleet, provide a Amazon Web Services Region or Local Zone code (for example: <code>us-west-2</code> or <code>us-west-2-lax-1</code>).</p>
        container_group_definition_name: <p>For computes in a managed container fleet, the name of the deployed container group definition. </p>
        compute_status: <p>The status of computes in a managed container fleet, based on the success of the latest update deployment.</p> <ul> <li> <p> <code>ACTIVE</code> -- The compute is deployed with the correct container definitions. It is ready to process game servers and host game sessions.</p> </li> <li> <p> <code>IMPAIRED</code> -- An update deployment to the compute failed, and the compute is deployed with incorrect container definitions.</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.</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.unsupported_region_exception.UnsupportedRegionException: <p>The requested operation is not supported in the Region specified.</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_compute_input.ListComputeInput]",
    ) -> AsyncOperationResponse[
        "capo_gamelift.types.list_compute_output.ListComputeOutput"
    ]:
        import capo_gamelift._operations.game_lift.list_compute

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

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

        return capo_gamelift.types.list_compute_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListCompute", redact_output=_redact_output),
    )
    input_: capo_gamelift.types.list_compute_input.ListComputeInput = {}
    if fleet_id is not None:
        input_["fleet_id"] = fleet_id
    if location is not None:
        input_["location"] = location
    if container_group_definition_name is not None:
        input_["container_group_definition_name"] = container_group_definition_name
    if compute_status is not None:
        input_["compute_status"] = compute_status
    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