Skip to content

/AWS1/IF_PRP=>CREATESUBSCRIPTION()

About CreateSubscription

Creates a flat-rate pricing subscription for the specified resources.

When approvalMode is set to MANUAL, paid-tier subscriptions are created in PENDING_APPROVAL status and require a separate ApprovePaidSubscription call before billing starts. Free-tier subscriptions are always activated immediately regardless of approval mode.

When approvalMode is set to IMMEDIATE or is not specified, the subscription is activated immediately.

Method Signature

METHODS /AWS1/IF_PRP~CREATESUBSCRIPTION
  IMPORTING
    !IV_PLANFAMILY TYPE /AWS1/PRPSTRING OPTIONAL
    !IV_PLANTIER TYPE /AWS1/PRPSTRING OPTIONAL
    !IV_USAGELEVEL TYPE /AWS1/PRPSTRING OPTIONAL
    !IT_RESOURCEARNS TYPE /AWS1/CL_PRPRESOURCEARNS_W=>TT_RESOURCEARNS OPTIONAL
    !IV_APPROVALMODE TYPE /AWS1/PRPAPPROVALMODE OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/PRPIDEMPOTENCYTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_prpcreatesubscroutput
  RAISING
    /AWS1/CX_PRPACCESSDENIEDEX
    /AWS1/CX_PRPCONFLICTEXCEPTION
    /AWS1/CX_PRPINTERNALSERVEREX
    /AWS1/CX_PRPRESOURCENOTFOUNDEX
    /AWS1/CX_PRPSERVICEQUOTAEXCDEX
    /AWS1/CX_PRPTHROTTLINGEX
    /AWS1/CX_PRPVLDTNEXCEPTION
    /AWS1/CX_PRPCLIENTEXC
    /AWS1/CX_PRPSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_planfamily TYPE /AWS1/PRPSTRING /AWS1/PRPSTRING

The pricing plan family to subscribe to, such as CloudFront.

iv_plantier TYPE /AWS1/PRPSTRING /AWS1/PRPSTRING

The tier level for the subscription, such as FREE, PRO, BUSINESS, or PREMIUM.

it_resourcearns TYPE /AWS1/CL_PRPRESOURCEARNS_W=>TT_RESOURCEARNS TT_RESOURCEARNS

The ARNs of the AWS resources to include in the subscription. Specify one or more supported resources.

For subscriptions in the CloudFront plan family, the resources must include exactly one Amazon CloudFront distribution and exactly one AWS WAF web ACL. You can also include other supported resources, such as Amazon Route 53 hosted zones and CloudFront KeyValueStores.

Optional arguments:

iv_usagelevel TYPE /AWS1/PRPSTRING /AWS1/PRPSTRING

The usage level within the plan tier. Specify DEFAULT for the base configuration, or a higher level if your plan tier supports it.

iv_approvalmode TYPE /AWS1/PRPAPPROVALMODE /AWS1/PRPAPPROVALMODE

Determines whether the subscription requires explicit approval before billing starts. Set to MANUAL to require a separate ApprovePaidSubscription call, or IMMEDIATE to activate the subscription right away. Defaults to IMMEDIATE if not specified.

iv_clienttoken TYPE /AWS1/PRPIDEMPOTENCYTOKEN /AWS1/PRPIDEMPOTENCYTOKEN

A unique, case-sensitive identifier that you provide to ensure that the request is handled only once. If you send the same request with the same client token, the API returns the original response without creating a duplicate subscription.

RETURNING

oo_output TYPE REF TO /aws1/cl_prpcreatesubscroutput /AWS1/CL_PRPCREATESUBSCROUTPUT

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->createsubscription(
  it_resourcearns = VALUE /aws1/cl_prpresourcearns_w=>tt_resourcearns(
    ( new /aws1/cl_prpresourcearns_w( |string| ) )
  )
  iv_approvalmode = |string|
  iv_clienttoken = |string|
  iv_planfamily = |string|
  iv_plantier = |string|
  iv_usagelevel = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_subscription = lo_result->get_subscription( ).
  IF lo_subscription IS NOT INITIAL.
    lv_subscriptionarn = lo_subscription->get_arn( ).
    lv_string = lo_subscription->get_planfamily( ).
    lv_string = lo_subscription->get_plantier( ).
    lv_string = lo_subscription->get_usagelevel( ).
    lo_scheduledchange = lo_subscription->get_scheduledchange( ).
    IF lo_scheduledchange IS NOT INITIAL.
      lv_scheduledchangetype = lo_scheduledchange->get_changetype( ).
      lv_timestamp = lo_scheduledchange->get_effectivedate( ).
      lv_string = lo_scheduledchange->get_plantier( ).
      lv_string = lo_scheduledchange->get_usagelevel( ).
    ENDIF.
    lv_status = lo_subscription->get_status( ).
    lv_string = lo_subscription->get_statusreason( ).
    LOOP AT lo_subscription->get_resourcearns( ) into lo_row.
      lo_row_1 = lo_row.
      IF lo_row_1 IS NOT INITIAL.
        lv_string = lo_row_1->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_timestamp = lo_subscription->get_createdat( ).
    lv_timestamp = lo_subscription->get_updatedat( ).
  ENDIF.
  lv_string = lo_result->get_etag( ).
ENDIF.

Create a flat-rate pricing subscription (deferred approval)

Create a flat-rate pricing subscription (deferred approval)

DATA(lo_result) = lo_client->createsubscription(
  it_resourcearns = VALUE /aws1/cl_prpresourcearns_w=>tt_resourcearns(
    ( new /aws1/cl_prpresourcearns_w( |arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE| ) )
    ( new /aws1/cl_prpresourcearns_w( |arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/a1b2c3d4| ) )
  )
  iv_approvalmode = |MANUAL|
  iv_planfamily = |CloudFront|
  iv_plantier = |PRO|
).

Create a subscription with approval mode

Create a subscription with approval mode

DATA(lo_result) = lo_client->createsubscription(
  it_resourcearns = VALUE /aws1/cl_prpresourcearns_w=>tt_resourcearns(
    ( new /aws1/cl_prpresourcearns_w( |arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE| ) )
    ( new /aws1/cl_prpresourcearns_w( |arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/a1b2c3d4| ) )
  )
  iv_approvalmode = |IMMEDIATE|
  iv_planfamily = |CloudFront|
  iv_plantier = |PRO|
).