ListFleets - Amazon GameLift

ListFleets

Retrieves a collection of fleet resources in an AWS 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 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 Realtime Servers 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.

Note

Fleet IDs are returned in no particular order.

Request Syntax

{ "BuildId": "string", "Limit": number, "NextToken": "string", "ScriptId": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

BuildId

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.

Type: String

Pattern: ^build-\S+|^arn:.*:build\/build-\S+

Required: No

Limit

The maximum number of results to return. Use this parameter with NextToken to get results as a set of sequential pages.

Type: Integer

Valid Range: Minimum value of 1.

Required: No

NextToken

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.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

ScriptId

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.

Type: String

Pattern: ^script-\S+|^arn:.*:script\/script-\S+

Required: No

Response Syntax

{ "FleetIds": [ "string" ], "NextToken": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

FleetIds

A set of fleet IDs that match the list request.

Type: Array of strings

Array Members: Minimum number of 1 item.

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: ^[a-z]*fleet-[a-zA-Z0-9\-]+

NextToken

A token that indicates where to resume retrieving results on the next call to this operation. If no token is returned, these results represent the end of the list.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServiceException

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

HTTP Status Code: 500

InvalidRequestException

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

HTTP Status Code: 400

NotFoundException

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

HTTP Status Code: 400

UnauthorizedException

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

HTTP Status Code: 400

Examples

List fleets in a Region

This example retrieves the fleet IDs of all fleets with their home Region in the currently selected Region. It uses the pagination parameters to retrieve two fleet IDs at a time. The example response includes a NextToken, which indicates that there are still more results to retrieve.

HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.

Sample Request

{ "Limit": 2, "NextToken": "eyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjEXAMPLE1" }

Sample Response

{ "FleetIds": [ "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa" ], "NextToken": "eyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjEXAMPLE2" }

List all fleets in a Region with a specific build or script

This example retrieves the IDs of fleets in the currently selected Region that are deployed with a specified game build. If you're working with Realtime Servers, you can opt to provide a script ID in place of a build ID. This example does not specify the limit parameter, so results can include up to 16 fleet IDs.

HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.

Sample Request

{ "Build": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff" }

Sample Response

{ "FleetIds": ["fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa"] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: