Skip to content

/AWS1/CL_SDY=>GETINSTANCESHEALTHSTATUS()

About GetInstancesHealthStatus

Gets the current health status (Healthy, Unhealthy, or Unknown) of one or more instances that are associated with a specified service.

There's a brief delay between when you register an instance and when the health status for the instance is available.

Method Signature

IMPORTING

Required arguments:

iv_serviceid TYPE /AWS1/SDYRESOURCEID /AWS1/SDYRESOURCEID

The ID of the service that the instance is associated with.

Optional arguments:

it_instances TYPE /AWS1/CL_SDYINSTANCEIDLIST_W=>TT_INSTANCEIDLIST TT_INSTANCEIDLIST

An array that contains the IDs of all the instances that you want to get the health status for.

If you omit Instances, Cloud Map returns the health status for all the instances that are associated with the specified service.

To get the IDs for the instances that you've registered by using a specified service, submit a ListInstances request.

iv_maxresults TYPE /AWS1/SDYMAXRESULTS /AWS1/SDYMAXRESULTS

The maximum number of instances that you want Cloud Map to return in the response to a GetInstancesHealthStatus request. If you don't specify a value for MaxResults, Cloud Map returns up to 100 instances.

iv_nexttoken TYPE /AWS1/SDYNEXTTOKEN /AWS1/SDYNEXTTOKEN

For the first GetInstancesHealthStatus request, omit this value.

If more than MaxResults instances match the specified criteria, you can submit another GetInstancesHealthStatus request to get the next group of results. Specify the value of NextToken from the previous response in the next request.

RETURNING

oo_output TYPE REF TO /aws1/cl_sdygetinstshealthst01 /AWS1/CL_SDYGETINSTSHEALTHST01

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_sdy~getinstanceshealthstatus(
  it_instances = VALUE /aws1/cl_sdyinstanceidlist_w=>tt_instanceidlist(
    ( new /aws1/cl_sdyinstanceidlist_w( |string| ) )
  )
  iv_maxresults = 123
  iv_nexttoken = |string|
  iv_serviceid = |string|
).

This is an example of reading all possible response values

LOOP AT lo_result->get_status( ) into ls_row.
  lv_key = ls_row-key.
  lv_healthstatus = lo_value->get_value( ).
ENDLOOP.
lv_nexttoken = lo_result->get_nexttoken( ).

GetInstancesHealthStatus example

This example gets the current health status of one or more instances that are associate with a specified service.

DATA(lo_result) = lo_client->/aws1/if_sdy~getinstanceshealthstatus( iv_serviceid = |srv-e4anhexample0004| ) .