Skip to content

/AWS1/IF_VL=>CREATELISTENER()

About CreateListener

Creates a listener for a service. Before you start using your Amazon VPC Lattice service, you must add one or more listeners. A listener is a process that checks for connection requests to your services. For more information, see Listeners in the Amazon VPC Lattice User Guide.

Method Signature

IMPORTING

Required arguments:

iv_serviceidentifier TYPE /AWS1/VL_SERVICEIDENTIFIER /AWS1/VL_SERVICEIDENTIFIER

The ID or ARN of the service.

iv_name TYPE /AWS1/VL_LISTENERNAME /AWS1/VL_LISTENERNAME

The name of the listener. A listener name must be unique within a service. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.

iv_protocol TYPE /AWS1/VL_LISTENERPROTOCOL /AWS1/VL_LISTENERPROTOCOL

The listener protocol.

io_defaultaction TYPE REF TO /AWS1/CL_VL_RULEACTION /AWS1/CL_VL_RULEACTION

The action for the default rule. Each listener has a default rule. The default rule is used if no other rules match.

Optional arguments:

iv_port TYPE /AWS1/VL_PORT /AWS1/VL_PORT

The listener port. You can specify a value from 1 to 65535. For HTTP, the default is 80. For HTTPS, the default is 443.

iv_clienttoken TYPE /AWS1/VL_CLIENTTOKEN /AWS1/VL_CLIENTTOKEN

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token and parameters, the retry succeeds without performing any actions. If the parameters aren't identical, the retry fails.

it_tags TYPE /AWS1/CL_VL_TAGMAP_W=>TT_TAGMAP TT_TAGMAP

The tags for the listener.

RETURNING

oo_output TYPE REF TO /aws1/cl_vl_createlistenerrsp /AWS1/CL_VL_CREATELISTENERRSP

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_vl~createlistener(
  io_defaultaction = new /aws1/cl_vl_ruleaction(
    io_fixedresponse = new /aws1/cl_vl_fixedrspaction( 123 )
    io_forward = new /aws1/cl_vl_forwardaction(
      it_targetgroups = VALUE /aws1/cl_vl_wttargetgroup=>tt_weightedtargetgrouplist(
        (
          new /aws1/cl_vl_wttargetgroup(
            iv_targetgroupidentifier = |string|
            iv_weight = 123
          )
        )
      )
    )
  )
  it_tags = VALUE /aws1/cl_vl_tagmap_w=>tt_tagmap(
    (
      VALUE /aws1/cl_vl_tagmap_w=>ts_tagmap_maprow(
        key = |string|
        value = new /aws1/cl_vl_tagmap_w( |string| )
      )
    )
  )
  iv_clienttoken = |string|
  iv_name = |string|
  iv_port = 123
  iv_protocol = |string|
  iv_serviceidentifier = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_listenerarn = lo_result->get_arn( ).
  lv_listenerid = lo_result->get_id( ).
  lv_listenername = lo_result->get_name( ).
  lv_listenerprotocol = lo_result->get_protocol( ).
  lv_port = lo_result->get_port( ).
  lv_servicearn = lo_result->get_servicearn( ).
  lv_serviceid = lo_result->get_serviceid( ).
  lo_ruleaction = lo_result->get_defaultaction( ).
  IF lo_ruleaction IS NOT INITIAL.
    lo_forwardaction = lo_ruleaction->get_forward( ).
    IF lo_forwardaction IS NOT INITIAL.
      LOOP AT lo_forwardaction->get_targetgroups( ) into lo_row.
        lo_row_1 = lo_row.
        IF lo_row_1 IS NOT INITIAL.
          lv_targetgroupidentifier = lo_row_1->get_targetgroupidentifier( ).
          lv_targetgroupweight = lo_row_1->get_weight( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
    lo_fixedresponseaction = lo_ruleaction->get_fixedresponse( ).
    IF lo_fixedresponseaction IS NOT INITIAL.
      lv_httpstatuscode = lo_fixedresponseaction->get_statuscode( ).
    ENDIF.
  ENDIF.
ENDIF.