Skip to content

/AWS1/IF_CWS=>LISTSERVICESTATES()

About ListServiceStates

Returns information about the last deployment and other change states of services. This API provides visibility into recent changes that may have affected service performance, helping with troubleshooting and change correlation.

Method Signature

METHODS /AWS1/IF_CWS~LISTSERVICESTATES
  IMPORTING
    !IV_STARTTIME TYPE /AWS1/CWSTIMESTAMP OPTIONAL
    !IV_ENDTIME TYPE /AWS1/CWSTIMESTAMP OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/CWSLISTSVCSTATESMAXRSLTS OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/CWSNEXTTOKEN OPTIONAL
    !IV_INCLUDELINKEDACCOUNTS TYPE /AWS1/CWSBOOLEAN OPTIONAL
    !IV_AWSACCOUNTID TYPE /AWS1/CWSAWSACCOUNTID OPTIONAL
    !IT_ATTRIBUTEFILTERS TYPE /AWS1/CL_CWSATTRIBUTEFILTER=>TT_ATTRIBUTEFILTERS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_cwslistsvcstatesout
  RAISING
    /AWS1/CX_CWSTHROTTLINGEX
    /AWS1/CX_CWSVALIDATIONEX
    /AWS1/CX_CWSCLIENTEXC
    /AWS1/CX_CWSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_starttime TYPE /AWS1/CWSTIMESTAMP /AWS1/CWSTIMESTAMP

The start of the time period to retrieve service state information for. When used in a raw HTTP Query API, it is formatted as epoch time in seconds. For example, 1698778057.

iv_endtime TYPE /AWS1/CWSTIMESTAMP /AWS1/CWSTIMESTAMP

The end of the time period to retrieve service state information for. When used in a raw HTTP Query API, it is formatted as epoch time in seconds. For example, 1698778057.

Optional arguments:

iv_maxresults TYPE /AWS1/CWSLISTSVCSTATESMAXRSLTS /AWS1/CWSLISTSVCSTATESMAXRSLTS

The maximum number of service states to return in one operation. If you omit this parameter, the default of 20 is used.

iv_nexttoken TYPE /AWS1/CWSNEXTTOKEN /AWS1/CWSNEXTTOKEN

Include this value, if it was returned by the previous operation, to get the next set of service states.

iv_includelinkedaccounts TYPE /AWS1/CWSBOOLEAN /AWS1/CWSBOOLEAN

If you are using this operation in a monitoring account, specify true to include service states from source accounts in the returned data.

iv_awsaccountid TYPE /AWS1/CWSAWSACCOUNTID /AWS1/CWSAWSACCOUNTID

The Amazon Web Services account ID to filter service states by. Use this to limit results to services from a specific account.

it_attributefilters TYPE /AWS1/CL_CWSATTRIBUTEFILTER=>TT_ATTRIBUTEFILTERS TT_ATTRIBUTEFILTERS

A list of attribute filters to narrow down the services. You can filter by platform, environment, or other service attributes.

RETURNING

oo_output TYPE REF TO /aws1/cl_cwslistsvcstatesout /AWS1/CL_CWSLISTSVCSTATESOUT

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->listservicestates(
  it_attributefilters = VALUE /aws1/cl_cwsattributefilter=>tt_attributefilters(
    (
      new /aws1/cl_cwsattributefilter(
        it_attributefiltervalues = VALUE /aws1/cl_cwsattrfiltervalues_w=>tt_attributefiltervalues(
          ( new /aws1/cl_cwsattrfiltervalues_w( |string| ) )
        )
        iv_attributefiltername = |string|
      )
    )
  )
  iv_awsaccountid = |string|
  iv_endtime = '20150101000000.0000000'
  iv_includelinkedaccounts = ABAP_TRUE
  iv_maxresults = 123
  iv_nexttoken = |string|
  iv_starttime = '20150101000000.0000000'
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_timestamp = lo_result->get_starttime( ).
  lv_timestamp = lo_result->get_endtime( ).
  LOOP AT lo_result->get_servicestates( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      LOOP AT lo_row_1->get_attributefilters( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_attributefiltername = lo_row_3->get_attributefiltername( ).
          LOOP AT lo_row_3->get_attributefiltervalues( ) into lo_row_4.
            lo_row_5 = lo_row_4.
            IF lo_row_5 IS NOT INITIAL.
              lv_attributefiltervalue = lo_row_5->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
      LOOP AT lo_row_1->get_service( ) into ls_row_6.
        lv_key = ls_row_6-key.
        lo_value = ls_row_6-value.
        IF lo_value IS NOT INITIAL.
          lv_keyattributevalue = lo_value->get_value( ).
        ENDIF.
      ENDLOOP.
      LOOP AT lo_row_1->get_latestchangeevents( ) into lo_row_7.
        lo_row_8 = lo_row_7.
        IF lo_row_8 IS NOT INITIAL.
          lv_timestamp = lo_row_8->get_timestamp( ).
          lv_awsaccountid = lo_row_8->get_accountid( ).
          lv_string = lo_row_8->get_region( ).
          LOOP AT lo_row_8->get_entity( ) into ls_row_6.
            lv_key = ls_row_6-key.
            lo_value = ls_row_6-value.
            IF lo_value IS NOT INITIAL.
              lv_keyattributevalue = lo_value->get_value( ).
            ENDIF.
          ENDLOOP.
          lv_changeeventtype = lo_row_8->get_changeeventtype( ).
          lv_string = lo_row_8->get_eventid( ).
          lv_string = lo_row_8->get_username( ).
          lv_string = lo_row_8->get_eventname( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.