Skip to content

/AWS1/IF_IOP=>GETCONNECTION()

About GetConnection

Retrieves connection information for the specified MQTT client.

Requires permission to access the GetConnection action.

Method Signature

METHODS /AWS1/IF_IOP~GETCONNECTION
  IMPORTING
    !IV_CLIENTID TYPE /AWS1/IOPCLIENTID OPTIONAL
    !IV_INCLUDESOCKETINFORMATION TYPE /AWS1/IOPINCLUDESOCKETINFO OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_iopgetconnresponse
  RAISING
    /AWS1/CX_IOPFORBIDDENEXCEPTION
    /AWS1/CX_IOPINTERNALFAILUREEX
    /AWS1/CX_IOPINVALIDREQUESTEX
    /AWS1/CX_IOPRESOURCENOTFOUNDEX
    /AWS1/CX_IOPTHROTTLINGEX
    /AWS1/CX_IOPCLIENTEXC
    /AWS1/CX_IOPSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_clientid TYPE /AWS1/IOPCLIENTID /AWS1/IOPCLIENTID

The unique identifier of the MQTT client to retrieve connection information. The client ID can't start with a dollar sign ($).

MQTT client IDs must be URL encoded (percent-encoded) when they contain characters that are not valid in HTTP requests, such as spaces, forward slashes (/), and UTF-8 characters.

Optional arguments:

iv_includesocketinformation TYPE /AWS1/IOPINCLUDESOCKETINFO /AWS1/IOPINCLUDESOCKETINFO

Specifies if socket information (sourcePort, targetPort, sourceIp, targetIp) should be included in the GetConnection response. Set to TRUE to include socket information. Set to FALSE to omit socket information. By default, this is set to FALSE. See the developer guide for how to authorize this parameter.

RETURNING

oo_output TYPE REF TO /aws1/cl_iopgetconnresponse /AWS1/CL_IOPGETCONNRESPONSE

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->getconnection(
  iv_clientid = |string|
  iv_includesocketinformation = ABAP_TRUE
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_connected = lo_result->get_connected( ).
  lv_thingname = lo_result->get_thingname( ).
  lv_cleansession = lo_result->get_cleansession( ).
  lv_sourceip = lo_result->get_sourceip( ).
  lv_sourceport = lo_result->get_sourceport( ).
  lv_targetip = lo_result->get_targetip( ).
  lv_targetport = lo_result->get_targetport( ).
  lv_keepaliveduration = lo_result->get_keepaliveduration( ).
  lv_timestamp = lo_result->get_connectedsince( ).
  lv_timestamp = lo_result->get_disconnectedsince( ).
  lv_disconnectreason = lo_result->get_disconnectreason( ).
  lv_sessionexpiry = lo_result->get_sessionexpiry( ).
  lv_clientid = lo_result->get_clientid( ).
  lv_vpcendpointid = lo_result->get_vpcendpointid( ).
ENDIF.