Skip to content

/AWS1/CL_APY=>CREATEDATASOURCE()

About CreateDataSource

Creates a DataSource object.

Method Signature

IMPORTING

Required arguments:

iv_apiid TYPE /AWS1/APYSTRING /AWS1/APYSTRING

The API ID for the GraphQL API for the DataSource.

iv_name TYPE /AWS1/APYRESOURCENAME /AWS1/APYRESOURCENAME

A user-supplied name for the DataSource.

iv_type TYPE /AWS1/APYDATASOURCETYPE /AWS1/APYDATASOURCETYPE

The type of the DataSource.

Optional arguments:

iv_description TYPE /AWS1/APYSTRING /AWS1/APYSTRING

A description of the DataSource.

iv_servicerolearn TYPE /AWS1/APYSTRING /AWS1/APYSTRING

The Identity and Access Management (IAM) service role Amazon Resource Name (ARN) for the data source. The system assumes this role when accessing the data source.

io_dynamodbconfig TYPE REF TO /AWS1/CL_APYDYNAMODBDATASRCCFG /AWS1/CL_APYDYNAMODBDATASRCCFG

Amazon DynamoDB settings.

io_lambdaconfig TYPE REF TO /AWS1/CL_APYLAMBDADATASRCCFG /AWS1/CL_APYLAMBDADATASRCCFG

Lambda settings.

io_elasticsearchconfig TYPE REF TO /AWS1/CL_APYELASTICSRCHDATAS00 /AWS1/CL_APYELASTICSRCHDATAS00

Amazon OpenSearch Service settings.

As of September 2021, Amazon Elasticsearch service is Amazon OpenSearch Service. This configuration is deprecated. For new data sources, use CreateDataSourceRequest$openSearchServiceConfig to create an OpenSearch data source.

io_opensearchserviceconfig TYPE REF TO /AWS1/CL_APYOPENSRCHSVCDATAS00 /AWS1/CL_APYOPENSRCHSVCDATAS00

Amazon OpenSearch Service settings.

io_httpconfig TYPE REF TO /AWS1/CL_APYHTTPDATASOURCECFG /AWS1/CL_APYHTTPDATASOURCECFG

HTTP endpoint settings.

io_relationaldatabaseconfig TYPE REF TO /AWS1/CL_APYRELATIONALDATABA00 /AWS1/CL_APYRELATIONALDATABA00

Relational database settings.

io_eventbridgeconfig TYPE REF TO /AWS1/CL_APYEVTBRIDGEDATASRC00 /AWS1/CL_APYEVTBRIDGEDATASRC00

Amazon EventBridge settings.

iv_metricsconfig TYPE /AWS1/APYDATASOURCELEVELMETCFG /AWS1/APYDATASOURCELEVELMETCFG

Enables or disables enhanced data source metrics for specified data sources. Note that metricsConfig won't be used unless the dataSourceLevelMetricsBehavior value is set to PER_DATA_SOURCE_METRICS. If the dataSourceLevelMetricsBehavior is set to FULL_REQUEST_DATA_SOURCE_METRICS instead, metricsConfig will be ignored. However, you can still set its value.

metricsConfig can be ENABLED or DISABLED.

RETURNING

oo_output TYPE REF TO /aws1/cl_apycreatedatasrcrsp /AWS1/CL_APYCREATEDATASRCRSP

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_apy~createdatasource(
  io_dynamodbconfig = new /aws1/cl_apydynamodbdatasrccfg(
    io_deltasyncconfig = new /aws1/cl_apydeltasyncconfig(
      iv_basetablettl = 123
      iv_deltasynctablename = |string|
      iv_deltasynctablettl = 123
    )
    iv_awsregion = |string|
    iv_tablename = |string|
    iv_usecallercredentials = ABAP_TRUE
    iv_versioned = ABAP_TRUE
  )
  io_elasticsearchconfig = new /aws1/cl_apyelasticsrchdatas00(
    iv_awsregion = |string|
    iv_endpoint = |string|
  )
  io_eventbridgeconfig = new /aws1/cl_apyevtbridgedatasrc00( |string| )
  io_httpconfig = new /aws1/cl_apyhttpdatasourcecfg(
    io_authorizationconfig = new /aws1/cl_apyauthconfig(
      io_awsiamconfig = new /aws1/cl_apyawsiamconfig(
        iv_signingregion = |string|
        iv_signingservicename = |string|
      )
      iv_authorizationtype = |string|
    )
    iv_endpoint = |string|
  )
  io_lambdaconfig = new /aws1/cl_apylambdadatasrccfg( |string| )
  io_opensearchserviceconfig = new /aws1/cl_apyopensrchsvcdatas00(
    iv_awsregion = |string|
    iv_endpoint = |string|
  )
  io_relationaldatabaseconfig = new /aws1/cl_apyrelationaldataba00(
    io_rdshttpendpointconfig = new /aws1/cl_apyrdshttpendptconfig(
      iv_awsregion = |string|
      iv_awssecretstorearn = |string|
      iv_databasename = |string|
      iv_dbclusteridentifier = |string|
      iv_schema = |string|
    )
    iv_relationaldatabasesrctype = |string|
  )
  iv_apiid = |string|
  iv_description = |string|
  iv_metricsconfig = |string|
  iv_name = |string|
  iv_servicerolearn = |string|
  iv_type = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_datasource = lo_result->get_datasource( ).
  IF lo_datasource IS NOT INITIAL.
    lv_string = lo_datasource->get_datasourcearn( ).
    lv_resourcename = lo_datasource->get_name( ).
    lv_string = lo_datasource->get_description( ).
    lv_datasourcetype = lo_datasource->get_type( ).
    lv_string = lo_datasource->get_servicerolearn( ).
    lo_dynamodbdatasourceconfi = lo_datasource->get_dynamodbconfig( ).
    IF lo_dynamodbdatasourceconfi IS NOT INITIAL.
      lv_string = lo_dynamodbdatasourceconfi->get_tablename( ).
      lv_string = lo_dynamodbdatasourceconfi->get_awsregion( ).
      lv_boolean = lo_dynamodbdatasourceconfi->get_usecallercredentials( ).
      lo_deltasyncconfig = lo_dynamodbdatasourceconfi->get_deltasyncconfig( ).
      IF lo_deltasyncconfig IS NOT INITIAL.
        lv_long = lo_deltasyncconfig->get_basetablettl( ).
        lv_string = lo_deltasyncconfig->get_deltasynctablename( ).
        lv_long = lo_deltasyncconfig->get_deltasynctablettl( ).
      ENDIF.
      lv_boolean = lo_dynamodbdatasourceconfi->get_versioned( ).
    ENDIF.
    lo_lambdadatasourceconfig = lo_datasource->get_lambdaconfig( ).
    IF lo_lambdadatasourceconfig IS NOT INITIAL.
      lv_string = lo_lambdadatasourceconfig->get_lambdafunctionarn( ).
    ENDIF.
    lo_elasticsearchdatasource = lo_datasource->get_elasticsearchconfig( ).
    IF lo_elasticsearchdatasource IS NOT INITIAL.
      lv_string = lo_elasticsearchdatasource->get_endpoint( ).
      lv_string = lo_elasticsearchdatasource->get_awsregion( ).
    ENDIF.
    lo_opensearchservicedataso = lo_datasource->get_opensearchserviceconfig( ).
    IF lo_opensearchservicedataso IS NOT INITIAL.
      lv_string = lo_opensearchservicedataso->get_endpoint( ).
      lv_string = lo_opensearchservicedataso->get_awsregion( ).
    ENDIF.
    lo_httpdatasourceconfig = lo_datasource->get_httpconfig( ).
    IF lo_httpdatasourceconfig IS NOT INITIAL.
      lv_string = lo_httpdatasourceconfig->get_endpoint( ).
      lo_authorizationconfig = lo_httpdatasourceconfig->get_authorizationconfig( ).
      IF lo_authorizationconfig IS NOT INITIAL.
        lv_authorizationtype = lo_authorizationconfig->get_authorizationtype( ).
        lo_awsiamconfig = lo_authorizationconfig->get_awsiamconfig( ).
        IF lo_awsiamconfig IS NOT INITIAL.
          lv_string = lo_awsiamconfig->get_signingregion( ).
          lv_string = lo_awsiamconfig->get_signingservicename( ).
        ENDIF.
      ENDIF.
    ENDIF.
    lo_relationaldatabasedatas = lo_datasource->get_relationaldatabaseconfig( ).
    IF lo_relationaldatabasedatas IS NOT INITIAL.
      lv_relationaldatabasesourc = lo_relationaldatabasedatas->get_relationaldatabasesrct00( ).
      lo_rdshttpendpointconfig = lo_relationaldatabasedatas->get_rdshttpendpointconfig( ).
      IF lo_rdshttpendpointconfig IS NOT INITIAL.
        lv_string = lo_rdshttpendpointconfig->get_awsregion( ).
        lv_string = lo_rdshttpendpointconfig->get_dbclusteridentifier( ).
        lv_string = lo_rdshttpendpointconfig->get_databasename( ).
        lv_string = lo_rdshttpendpointconfig->get_schema( ).
        lv_string = lo_rdshttpendpointconfig->get_awssecretstorearn( ).
      ENDIF.
    ENDIF.
    lo_eventbridgedatasourceco = lo_datasource->get_eventbridgeconfig( ).
    IF lo_eventbridgedatasourceco IS NOT INITIAL.
      lv_string = lo_eventbridgedatasourceco->get_eventbusarn( ).
    ENDIF.
    lv_datasourcelevelmetricsc = lo_datasource->get_metricsconfig( ).
  ENDIF.
ENDIF.