Skip to content

/AWS1/CL_GML=>LISTGAMESERVERS()

About ListGameServers

This operation is used with the Amazon GameLift FleetIQ solution and game server groups.

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 FleetIQ Guide

Method Signature

IMPORTING

Required arguments:

iv_gameservergroupname TYPE /AWS1/GMLGAMESERVERGRNAMEORARN /AWS1/GMLGAMESERVERGRNAMEORARN

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

Optional arguments:

iv_sortorder TYPE /AWS1/GMLSORTORDER /AWS1/GMLSORTORDER

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.

iv_limit TYPE /AWS1/GMLPOSITIVEINTEGER /AWS1/GMLPOSITIVEINTEGER

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

iv_nexttoken TYPE /AWS1/GMLNONZEROANDMAXSTRING /AWS1/GMLNONZEROANDMAXSTRING

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.

RETURNING

oo_output TYPE REF TO /aws1/cl_gmllistgameserversout /AWS1/CL_GMLLISTGAMESERVERSOUT

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_gml~listgameservers(
  iv_gameservergroupname = |string|
  iv_limit = 123
  iv_nexttoken = |string|
  iv_sortorder = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_gameservers( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_gameservergroupname = lo_row_1->get_gameservergroupname( ).
      lv_gameservergrouparn = lo_row_1->get_gameservergrouparn( ).
      lv_gameserverid = lo_row_1->get_gameserverid( ).
      lv_gameserverinstanceid = lo_row_1->get_instanceid( ).
      lv_gameserverconnectioninf = lo_row_1->get_connectioninfo( ).
      lv_gameserverdata = lo_row_1->get_gameserverdata( ).
      lv_gameserverclaimstatus = lo_row_1->get_claimstatus( ).
      lv_gameserverutilizationst = lo_row_1->get_utilizationstatus( ).
      lv_timestamp = lo_row_1->get_registrationtime( ).
      lv_timestamp = lo_row_1->get_lastclaimtime( ).
      lv_timestamp = lo_row_1->get_lasthealthchecktime( ).
    ENDIF.
  ENDLOOP.
  lv_nonzeroandmaxstring = lo_result->get_nexttoken( ).
ENDIF.