Skip to content

/AWS1/CL_IMG=>CREATEIMAGE()

About CreateImage

Creates a new image. This request will create a new image along with all of the configured output resources defined in the distribution configuration. You must specify exactly one recipe for your image, using either a ContainerRecipeArn or an ImageRecipeArn.

Method Signature

IMPORTING

Required arguments:

iv_infrastructureconfarn TYPE /AWS1/IMGINFRASTRUCTURECONFARN /AWS1/IMGINFRASTRUCTURECONFARN

The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your image will be built and tested.

iv_clienttoken TYPE /AWS1/IMGCLIENTTOKEN /AWS1/IMGCLIENTTOKEN

Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.

Optional arguments:

iv_imagerecipearn TYPE /AWS1/IMGIMAGERECIPEARN /AWS1/IMGIMAGERECIPEARN

The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed.

iv_containerrecipearn TYPE /AWS1/IMGCONTAINERRECIPEARN /AWS1/IMGCONTAINERRECIPEARN

The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested.

iv_distributionconfarn TYPE /AWS1/IMGDISTRIBUTIONCONFARN /AWS1/IMGDISTRIBUTIONCONFARN

The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your pipeline.

io_imagetestsconfiguration TYPE REF TO /AWS1/CL_IMGIMAGETESTSCONF /AWS1/CL_IMGIMAGETESTSCONF

The image tests configuration of the image.

iv_enhancedimagemetenabled TYPE /AWS1/IMGNULLABLEBOOLEAN /AWS1/IMGNULLABLEBOOLEAN

Collects additional information about the image being created, including the operating system (OS) version and package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by default.

it_tags TYPE /AWS1/CL_IMGTAGMAP_W=>TT_TAGMAP TT_TAGMAP

The tags of the image.

io_imagescanningconf TYPE REF TO /AWS1/CL_IMGIMAGESCANNINGCONF /AWS1/CL_IMGIMAGESCANNINGCONF

Contains settings for vulnerability scans.

it_workflows TYPE /AWS1/CL_IMGWORKFLOWCONF=>TT_WORKFLOWCONFIGURATIONLIST TT_WORKFLOWCONFIGURATIONLIST

Contains an array of workflow configuration objects.

iv_executionrole TYPE /AWS1/IMGROLENAMEORARN /AWS1/IMGROLENAMEORARN

The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to perform workflow actions.

RETURNING

oo_output TYPE REF TO /aws1/cl_imgcreateimagersp /AWS1/CL_IMGCREATEIMAGERSP

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_img~createimage(
  io_imagescanningconf = new /aws1/cl_imgimagescanningconf(
    io_ecrconfiguration = new /aws1/cl_imgecrconfiguration(
      it_containertags = VALUE /aws1/cl_imgstringlist_w=>tt_stringlist(
        ( new /aws1/cl_imgstringlist_w( |string| ) )
      )
      iv_repositoryname = |string|
    )
    iv_imagescanningenabled = ABAP_TRUE
  )
  io_imagetestsconfiguration = new /aws1/cl_imgimagetestsconf(
    iv_imagetestsenabled = ABAP_TRUE
    iv_timeoutminutes = 123
  )
  it_tags = VALUE /aws1/cl_imgtagmap_w=>tt_tagmap(
    (
      VALUE /aws1/cl_imgtagmap_w=>ts_tagmap_maprow(
        key = |string|
        value = new /aws1/cl_imgtagmap_w( |string| )
      )
    )
  )
  it_workflows = VALUE /aws1/cl_imgworkflowconf=>tt_workflowconfigurationlist(
    (
      new /aws1/cl_imgworkflowconf(
        it_parameters = VALUE /aws1/cl_imgworkflowparameter=>tt_workflowparameterlist(
          (
            new /aws1/cl_imgworkflowparameter(
              it_value = VALUE /aws1/cl_imgworkflowprmvalls00=>tt_workflowparametervaluelist(
                ( new /aws1/cl_imgworkflowprmvalls00( |string| ) )
              )
              iv_name = |string|
            )
          )
        )
        iv_onfailure = |string|
        iv_parallelgroup = |string|
        iv_workflowarn = |string|
      )
    )
  )
  iv_clienttoken = |string|
  iv_containerrecipearn = |string|
  iv_distributionconfarn = |string|
  iv_enhancedimagemetenabled = ABAP_TRUE
  iv_executionrole = |string|
  iv_imagerecipearn = |string|
  iv_infrastructureconfarn = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_nonemptystring = lo_result->get_requestid( ).
  lv_clienttoken = lo_result->get_clienttoken( ).
  lv_imagebuildversionarn = lo_result->get_imagebuildversionarn( ).
ENDIF.