Skip to content

/AWS1/IF_EC2=>CREATEIMAGEUSAGEREPORT()

About CreateImageUsageReport

Creates a report that shows how your image is used across other Amazon Web Services accounts. The report provides visibility into which accounts are using the specified image, and how many resources (EC2 instances or launch templates) are referencing it.

For more information, see View your AMI usage in the Amazon EC2 User Guide.

Method Signature

IMPORTING

Required arguments:

iv_imageid TYPE /AWS1/EC2IMAGEID /AWS1/EC2IMAGEID

The ID of the image to report on.

it_resourcetypes TYPE /AWS1/CL_EC2IMAGEUSAGERESTYP00=>TT_IMAGEUSAGERESTYPEREQLIST TT_IMAGEUSAGERESTYPEREQLIST

The resource types to include in the report.

Optional arguments:

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_accountids TYPE /AWS1/CL_EC2IMAGEUSAGERPTUSE00=>TT_IMAGEUSAGERPTUSERIDSTRLIST TT_IMAGEUSAGERPTUSERIDSTRLIST

The Amazon Web Services account IDs to include in the report. To include all accounts, omit this parameter.

iv_clienttoken TYPE /AWS1/EC2STRING /AWS1/EC2STRING

A unique, case-sensitive identifier that you provide to ensure idempotency of the request.

it_tagspecifications TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST TT_TAGSPECIFICATIONLIST

The tags to apply to the report on creation. The ResourceType must be set to image-usage-report; any other value will cause the report creation to fail.

To tag a report after it has been created, see CreateTags.

RETURNING

oo_output TYPE REF TO /aws1/cl_ec2creimageusagerptrs /AWS1/CL_EC2CREIMAGEUSAGERPTRS

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_ec2~createimageusagereport(
  it_accountids = VALUE /aws1/cl_ec2imageusagerptuse00=>tt_imageusagerptuseridstrlist(
    ( new /aws1/cl_ec2imageusagerptuse00( |string| ) )
  )
  it_resourcetypes = VALUE /aws1/cl_ec2imageusagerestyp00=>tt_imageusagerestypereqlist(
    (
      new /aws1/cl_ec2imageusagerestyp00(
        it_resourcetypeoptions = VALUE /aws1/cl_ec2imageusagerestyp01=>tt_imageusagerestypeoptreqlist(
          (
            new /aws1/cl_ec2imageusagerestyp01(
              it_optionvalues = VALUE /aws1/cl_ec2imageusagerestyp02=>tt_imageusagerestypeoptvalslst(
                ( new /aws1/cl_ec2imageusagerestyp02( |string| ) )
              )
              iv_optionname = |string|
            )
          )
        )
        iv_resourcetype = |string|
      )
    )
  )
  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_imageid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_imageusagereportid = lo_result->get_reportid( ).
ENDIF.