Skip to content

/AWS1/IF_APS=>CREATEIMPORTEDIMAGE()

About CreateImportedImage

Creates a custom WorkSpaces Applications image by importing an EC2 AMI. This allows you to use your own customized AMI to create WorkSpaces Applications images that support additional instance types beyond the standard stream.* instances.

Method Signature

METHODS /AWS1/IF_APS~CREATEIMPORTEDIMAGE
  IMPORTING
    !IV_NAME TYPE /AWS1/APSNAME OPTIONAL
    !IV_SOURCEAMIID TYPE /AWS1/APSPHOTONAMIID OPTIONAL
    !IV_IAMROLEARN TYPE /AWS1/APSARN OPTIONAL
    !IV_DESCRIPTION TYPE /AWS1/APSIMAGEIMPORTDESC OPTIONAL
    !IV_DISPLAYNAME TYPE /AWS1/APSIMAGEIMPORTDSPNAME OPTIONAL
    !IT_TAGS TYPE /AWS1/CL_APSTAGS_W=>TT_TAGS OPTIONAL
    !IO_RUNTIMEVALIDATIONCONFIG TYPE REF TO /AWS1/CL_APSRTIMEVALIDATIONCFG OPTIONAL
    !IV_AGENTSOFTWAREVERSION TYPE /AWS1/APSAGENTSOFTWAREVERSION OPTIONAL
    !IT_APPCATALOGCONFIG TYPE /AWS1/CL_APSAPPLICATIONCONFIG=>TT_APPCATALOGCONFIG OPTIONAL
    !IV_DRYRUN TYPE /AWS1/APSBOOLEAN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_apscreimpedimagerslt
  RAISING
    /AWS1/CX_APSDRYRUNOPERATIONEX
    /AWS1/CX_APSINCOMPATIBLEIMAG00
    /AWS1/CX_APSINVACCTSTATUSEX
    /AWS1/CX_APSINVALIDROLEEX
    /AWS1/CX_APSLIMITEXCEEDEDEX
    /AWS1/CX_APSOPNOTPERMITTEDEX
    /AWS1/CX_APSRESRCALRDYEXISTSEX
    /AWS1/CX_APSRESOURCENOTFOUNDEX
    /AWS1/CX_APSCLIENTEXC
    /AWS1/CX_APSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_name TYPE /AWS1/APSNAME /AWS1/APSNAME

A unique name for the imported image. The name must be between 1 and 100 characters and can contain letters, numbers, underscores, periods, and hyphens.

iv_sourceamiid TYPE /AWS1/APSPHOTONAMIID /AWS1/APSPHOTONAMIID

The ID of the EC2 AMI to import. The AMI must meet specific requirements including Windows Server 2022 Full Base, UEFI boot mode, TPM 2.0 support, and proper drivers.

iv_iamrolearn TYPE /AWS1/APSARN /AWS1/APSARN

The ARN of the IAM role that allows WorkSpaces Applications to access your AMI. The role must have permissions to modify image attributes and describe images, with a trust relationship allowing appstream.amazonaws.com to assume the role.

Optional arguments:

iv_description TYPE /AWS1/APSIMAGEIMPORTDESC /AWS1/APSIMAGEIMPORTDESC

An optional description for the imported image. The description must match approved regex patterns and can be up to 256 characters.

iv_displayname TYPE /AWS1/APSIMAGEIMPORTDSPNAME /AWS1/APSIMAGEIMPORTDSPNAME

An optional display name for the imported image. The display name must match approved regex patterns and can be up to 100 characters.

it_tags TYPE /AWS1/CL_APSTAGS_W=>TT_TAGS TT_TAGS

The tags to apply to the imported image. Tags help you organize and manage your WorkSpaces Applications resources.

io_runtimevalidationconfig TYPE REF TO /AWS1/CL_APSRTIMEVALIDATIONCFG /AWS1/CL_APSRTIMEVALIDATIONCFG

Configuration for runtime validation of the imported image. When specified, WorkSpaces Applications provisions an instance to test streaming functionality, which helps ensure the image is suitable for use.

iv_agentsoftwareversion TYPE /AWS1/APSAGENTSOFTWAREVERSION /AWS1/APSAGENTSOFTWAREVERSION

The version of the WorkSpaces Applications agent to use for the imported image. Choose CURRENT_LATEST to use the agent version available at the time of import, or ALWAYS_LATEST to automatically update to the latest agent version when new versions are released.

it_appcatalogconfig TYPE /AWS1/CL_APSAPPLICATIONCONFIG=>TT_APPCATALOGCONFIG TT_APPCATALOGCONFIG

Configuration for the application catalog of the imported image. This allows you to specify applications available for streaming, including their paths, icons, and launch parameters. This field contains sensitive data.

iv_dryrun TYPE /AWS1/APSBOOLEAN /AWS1/APSBOOLEAN

When set to true, performs validation checks without actually creating the imported image. Use this to verify your configuration before executing the actual import operation.

RETURNING

oo_output TYPE REF TO /aws1/cl_apscreimpedimagerslt /AWS1/CL_APSCREIMPEDIMAGERSLT

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->createimportedimage(
  io_runtimevalidationconfig = new /aws1/cl_apsrtimevalidationcfg( |string| )
  it_appcatalogconfig = VALUE /aws1/cl_apsapplicationconfig=>tt_appcatalogconfig(
    (
      new /aws1/cl_apsapplicationconfig(
        iv_absoluteapppath = |string|
        iv_absoluteiconpath = |string|
        iv_absolutemanifestpath = |string|
        iv_displayname = |string|
        iv_launchparameters = |string|
        iv_name = |string|
        iv_workingdirectory = |string|
      )
    )
  )
  it_tags = VALUE /aws1/cl_apstags_w=>tt_tags(
    (
      VALUE /aws1/cl_apstags_w=>ts_tags_maprow(
        key = |string|
        value = new /aws1/cl_apstags_w( |string| )
      )
    )
  )
  iv_agentsoftwareversion = |string|
  iv_description = |string|
  iv_displayname = |string|
  iv_dryrun = ABAP_TRUE
  iv_iamrolearn = |string|
  iv_name = |string|
  iv_sourceamiid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_image = lo_result->get_image( ).
  IF lo_image IS NOT INITIAL.
    lv_string = lo_image->get_name( ).
    lv_arn = lo_image->get_arn( ).
    lv_arn = lo_image->get_baseimagearn( ).
    lv_string = lo_image->get_displayname( ).
    lv_imagestate = lo_image->get_state( ).
    lv_visibilitytype = lo_image->get_visibility( ).
    lv_boolean = lo_image->get_imagebuildersupported( ).
    lv_string = lo_image->get_imagebuildername( ).
    lv_platformtype = lo_image->get_platform( ).
    lv_string = lo_image->get_description( ).
    lo_imagestatechangereason = lo_image->get_statechangereason( ).
    IF lo_imagestatechangereason IS NOT INITIAL.
      lv_imagestatechangereasonc = lo_imagestatechangereason->get_code( ).
      lv_string = lo_imagestatechangereason->get_message( ).
    ENDIF.
    LOOP AT lo_image->get_applications( ) into lo_row.
      lo_row_1 = lo_row.
      IF lo_row_1 IS NOT INITIAL.
        lv_string = lo_row_1->get_name( ).
        lv_string = lo_row_1->get_displayname( ).
        lv_string = lo_row_1->get_iconurl( ).
        lv_string = lo_row_1->get_launchpath( ).
        lv_string = lo_row_1->get_launchparameters( ).
        lv_boolean = lo_row_1->get_enabled( ).
        LOOP AT lo_row_1->get_metadata( ) into ls_row_2.
          lv_key = ls_row_2-key.
          lo_value = ls_row_2-value.
          IF lo_value IS NOT INITIAL.
            lv_string = lo_value->get_value( ).
          ENDIF.
        ENDLOOP.
        lv_string = lo_row_1->get_workingdirectory( ).
        lv_string = lo_row_1->get_description( ).
        lv_arn = lo_row_1->get_arn( ).
        lv_arn = lo_row_1->get_appblockarn( ).
        lo_s3location = lo_row_1->get_icons3location( ).
        IF lo_s3location IS NOT INITIAL.
          lv_s3bucket = lo_s3location->get_s3bucket( ).
          lv_s3key = lo_s3location->get_s3key( ).
        ENDIF.
        LOOP AT lo_row_1->get_platforms( ) into lo_row_3.
          lo_row_4 = lo_row_3.
          IF lo_row_4 IS NOT INITIAL.
            lv_platformtype = lo_row_4->get_value( ).
          ENDIF.
        ENDLOOP.
        LOOP AT lo_row_1->get_instancefamilies( ) into lo_row_5.
          lo_row_6 = lo_row_5.
          IF lo_row_6 IS NOT INITIAL.
            lv_string = lo_row_6->get_value( ).
          ENDIF.
        ENDLOOP.
        lv_timestamp = lo_row_1->get_createdtime( ).
      ENDIF.
    ENDLOOP.
    lv_timestamp = lo_image->get_createdtime( ).
    lv_timestamp = lo_image->get_pubbaseimagereleaseddate( ).
    lv_appstreamagentversion = lo_image->get_appstreamagentversion( ).
    lo_imagepermissions = lo_image->get_imagepermissions( ).
    IF lo_imagepermissions IS NOT INITIAL.
      lv_booleanobject = lo_imagepermissions->get_allowfleet( ).
      lv_booleanobject = lo_imagepermissions->get_allowimagebuilder( ).
    ENDIF.
    LOOP AT lo_image->get_imageerrors( ) into lo_row_7.
      lo_row_8 = lo_row_7.
      IF lo_row_8 IS NOT INITIAL.
        lv_fleeterrorcode = lo_row_8->get_errorcode( ).
        lv_string = lo_row_8->get_errormessage( ).
        lv_timestamp = lo_row_8->get_errortimestamp( ).
      ENDIF.
    ENDLOOP.
    lv_latestappstreamagentver = lo_image->get_latestappstreamagentvrs( ).
    LOOP AT lo_image->get_supportedinstfamilies( ) into lo_row_5.
      lo_row_6 = lo_row_5.
      IF lo_row_6 IS NOT INITIAL.
        lv_string = lo_row_6->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_dynamicappprovidersenab = lo_image->get_dynamicapppvdrsenabled( ).
    lv_imagesharedwithothers = lo_image->get_imagesharedwithothers( ).
    lv_boolean = lo_image->get_managedsoftwareincluded( ).
    lv_imagetype = lo_image->get_imagetype( ).
  ENDIF.
ENDIF.