Skip to content

/AWS1/IF_EC2=>CREATECAPMANAGERDATAEXPORT()

About CreateCapacityManagerDataExport

Creates a new data export configuration for EC2 Capacity Manager. This allows you to automatically export capacity usage data to an S3 bucket on a scheduled basis. The exported data includes metrics for On-Demand, Spot, and Capacity Reservations usage across your organization.

Method Signature

METHODS /AWS1/IF_EC2~CREATECAPMANAGERDATAEXPORT
  IMPORTING
    !IV_S3BUCKETNAME TYPE /AWS1/EC2STRING OPTIONAL
    !IV_S3BUCKETPREFIX TYPE /AWS1/EC2STRING OPTIONAL
    !IV_SCHEDULE TYPE /AWS1/EC2SCHEDULE OPTIONAL
    !IV_OUTPUTFORMAT TYPE /AWS1/EC2OUTPUTFORMAT OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/EC2STRING OPTIONAL
    !IV_DRYRUN TYPE /AWS1/EC2BOOLEAN OPTIONAL
    !IT_TAGSPECIFICATIONS TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ec2crecapmanagerdat01
  RAISING
    /AWS1/CX_EC2CLIENTEXC
    /AWS1/CX_EC2SERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_s3bucketname TYPE /AWS1/EC2STRING /AWS1/EC2STRING

The name of the S3 bucket where the capacity data export files will be delivered. The bucket must exist and you must have write permissions to it.

iv_schedule TYPE /AWS1/EC2SCHEDULE /AWS1/EC2SCHEDULE

The frequency at which data exports are generated.

iv_outputformat TYPE /AWS1/EC2OUTPUTFORMAT /AWS1/EC2OUTPUTFORMAT

The file format for the exported data. Parquet format is recommended for large datasets and better compression.

Optional arguments:

iv_s3bucketprefix TYPE /AWS1/EC2STRING /AWS1/EC2STRING

The S3 key prefix for the exported data files. This allows you to organize exports in a specific folder structure within your bucket. If not specified, files are placed at the bucket root.

iv_clienttoken TYPE /AWS1/EC2STRING /AWS1/EC2STRING

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.

iv_dryrun TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

it_tagspecifications TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST TT_TAGSPECIFICATIONLIST

The tags to apply to the data export configuration. You can tag the export for organization and cost tracking purposes.

RETURNING

oo_output TYPE REF TO /aws1/cl_ec2crecapmanagerdat01 /AWS1/CL_EC2CRECAPMANAGERDAT01

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->createcapmanagerdataexport(
  it_tagspecifications = VALUE /aws1/cl_ec2tagspecification=>tt_tagspecificationlist(
    (
      new /aws1/cl_ec2tagspecification(
        it_tags = VALUE /aws1/cl_ec2tag=>tt_taglist(
          (
            new /aws1/cl_ec2tag(
              iv_key = |string|
              iv_value = |string|
            )
          )
        )
        iv_resourcetype = |string|
      )
    )
  )
  iv_clienttoken = |string|
  iv_dryrun = ABAP_TRUE
  iv_outputformat = |string|
  iv_s3bucketname = |string|
  iv_s3bucketprefix = |string|
  iv_schedule = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_capacitymanagerdataexpo = lo_result->get_capmanagerdataexportid( ).
ENDIF.