Invoke

Invoke #

Overview #

Allow the execution of a Lambda function.

AWS API Reference: https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html

Method #

INVOKE_FUNCTION

Import Parameters #

The request uses the following import parameters.

  • i_region

    Required: Yes.

    Name of the region.

  • i_function

    Required: Yes.

    Name of the function.

  • i_user_name

    You can enter the IAM user here or when using the constructor. The IAM user of AWS account.


Export Parameters #

This method use the following export parameters:

  • e_http_status

    HTTP Status code. Returns 200 if no errors found.

  • e_response_headers

    Returns information about the request in format Name/Value pair values.

  • e_response_content

    Response content in string format.


Example #

DATA: lo_lambda_function TYPE REF TO /lnkaws/cl_aws_lambda_function,
      lo_cx_aws_s3       TYPE REF TO /lnkaws/cx_aws_s3.
TRY.
    CREATE OBJECT lo_lambda_function.

    CALL METHOD lo_lambda_function->invoke_function
      EXPORTING
        i_user_name        = 'userawsconnector'
        i_region           = 'eu-west-1'
        i_function         = 'name of lambda funtion'
      IMPORTING
        e_http_status      = lv_http_status
        e_response_headers = lv_headers
        e_response_content = lv_content.
  CATCH /lnkaws/cx_aws_s3 INTO lo_cx_aws_s3.
    RAISE EXCEPTION lo_cx_aws_s3.
ENDTRY.