Skip to content

/AWS1/IF_EBN=>CREATEAPPLICATIONVERSION()

About CreateApplicationVersion

Creates an application version for the specified application. You can create an application version from a source bundle in Amazon S3, a commit in CodeCommit, or the output of an CodeBuild build as follows:

Specify a commit in an CodeCommit repository with SourceBuildInformation.

Specify a build in an CodeBuild with SourceBuildInformation and BuildConfiguration.

Specify a source bundle in Amazon S3 with SourceBundle

Omit both SourceBuildInformation and SourceBundle to use the default sample application.

After you create an application version with a specified Amazon S3 bucket and key location, you can't change that Amazon S3 location. If you change the Amazon S3 location, you receive an exception when you attempt to launch an environment from the application version.

Method Signature

METHODS /AWS1/IF_EBN~CREATEAPPLICATIONVERSION
  IMPORTING
    !IV_APPLICATIONNAME TYPE /AWS1/EBNAPPLICATIONNAME OPTIONAL
    !IV_VERSIONLABEL TYPE /AWS1/EBNVERSIONLABEL OPTIONAL
    !IV_DESCRIPTION TYPE /AWS1/EBNDESCRIPTION OPTIONAL
    !IO_SOURCEBUILDINFORMATION TYPE REF TO /AWS1/CL_EBNSRCBUILDINFMTION OPTIONAL
    !IO_SOURCEBUNDLE TYPE REF TO /AWS1/CL_EBNS3LOCATION OPTIONAL
    !IO_BUILDCONFIGURATION TYPE REF TO /AWS1/CL_EBNBUILDCONFIGURATION OPTIONAL
    !IV_AUTOCREATEAPPLICATION TYPE /AWS1/EBNAUTOCREATEAPPLICATION OPTIONAL
    !IV_PROCESS TYPE /AWS1/EBNAPPLICATIONVRSPROCC00 OPTIONAL
    !IT_TAGS TYPE /AWS1/CL_EBNTAG=>TT_TAGS OPTIONAL
    !IO_IMAGECONFIGURATION TYPE REF TO /AWS1/CL_EBNIMAGECONFIGURATION OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ebnapplicationvrsds00
  RAISING
    /AWS1/CX_EBNCODEBUILDNOTINSV00
    /AWS1/CX_EBNINSUFFICIENTPRIV00
    /AWS1/CX_EBNS3LOCNOTINSVCREG00
    /AWS1/CX_EBNTOOMANYAPPLICATI00
    /AWS1/CX_EBNTOOMANYAPPLICATI01
    /AWS1/CX_EBNCLIENTEXC
    /AWS1/CX_EBNSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_applicationname TYPE /AWS1/EBNAPPLICATIONNAME /AWS1/EBNAPPLICATIONNAME

The name of the application. If no application is found with this name, and AutoCreateApplication is false, returns an InvalidParameterValue error.

iv_versionlabel TYPE /AWS1/EBNVERSIONLABEL /AWS1/EBNVERSIONLABEL

A label identifying this version.

Constraint: Must be unique per application. If an application version already exists with this label for the specified application, Elastic Beanstalk returns an InvalidParameterValue error.

Optional arguments:

iv_description TYPE /AWS1/EBNDESCRIPTION /AWS1/EBNDESCRIPTION

A description of this application version.

io_sourcebuildinformation TYPE REF TO /AWS1/CL_EBNSRCBUILDINFMTION /AWS1/CL_EBNSRCBUILDINFMTION

Specify a commit in an CodeCommit Git repository to use as the source code for the application version.

io_sourcebundle TYPE REF TO /AWS1/CL_EBNS3LOCATION /AWS1/CL_EBNS3LOCATION

The Amazon S3 bucket and key that identify the location of the source bundle for this version.

The Amazon S3 bucket must be in the same region as the environment.

Unless you're specifying a source bundle in the bucket that Elastic Beanstalk manages in your account, you must assign a custom policy to your user, and grant Allow permission to the s3:Get* actions on your S3 object resource, for example, arn:aws:s3:::your-bucket/your-source-bundle-object.

Specify a source bundle in Amazon S3 or a commit in an CodeCommit repository (with SourceBuildInformation), but not both. If neither SourceBundle nor SourceBuildInformation are provided, Elastic Beanstalk uses a sample application.

io_buildconfiguration TYPE REF TO /AWS1/CL_EBNBUILDCONFIGURATION /AWS1/CL_EBNBUILDCONFIGURATION

Settings for an CodeBuild build.

Don't specify BuildConfiguration together with ImageConfiguration, which configures a container image build instead.

iv_autocreateapplication TYPE /AWS1/EBNAUTOCREATEAPPLICATION /AWS1/EBNAUTOCREATEAPPLICATION

Set to true to create an application with the specified name if it doesn't already exist.

iv_process TYPE /AWS1/EBNAPPLICATIONVRSPROCC00 /AWS1/EBNAPPLICATIONVRSPROCC00

Pre-processes and validates the environment manifest (env.yaml) and configuration files (*.config files in the .ebextensions folder) in the source bundle. Validating configuration files can identify issues prior to deploying the application version to an environment.

You must turn processing on for application versions that you create using CodeBuild or CodeCommit. For application versions built from a source bundle in Amazon S3, processing is optional.

The Process option validates Elastic Beanstalk configuration files. It doesn't validate your application's configuration files, like proxy server or Docker configuration.

it_tags TYPE /AWS1/CL_EBNTAG=>TT_TAGS TT_TAGS

Specifies the tags applied to the application version.

Elastic Beanstalk applies these tags only to the application version. Environments that use the application version don't inherit the tags.

io_imageconfiguration TYPE REF TO /AWS1/CL_EBNIMAGECONFIGURATION /AWS1/CL_EBNIMAGECONFIGURATION

The source of the container image for this application version. You can specify an image that you built and pushed to a container registry yourself, or settings for Elastic Beanstalk to build one from your source bundle. Specify exactly one of the Source and Build members.

Don't specify ImageConfiguration together with BuildConfiguration, which configures an CodeBuild build instead.

RETURNING

oo_output TYPE REF TO /aws1/cl_ebnapplicationvrsds00 /AWS1/CL_EBNAPPLICATIONVRSDS00

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->createapplicationversion(
  io_buildconfiguration = new /aws1/cl_ebnbuildconfiguration(
    iv_artifactname = |string|
    iv_codebuildservicerole = |string|
    iv_computetype = |string|
    iv_image = |string|
    iv_timeoutinminutes = 123
  )
  io_imageconfiguration = new /aws1/cl_ebnimageconfiguration(
    io_build = new /aws1/cl_ebnimagebuildconf(
      iv_architecture = |string|
      iv_buildpack = |string|
      iv_codebuildservicerole = |string|
      iv_computetype = |string|
      iv_dockerfilelocation = |string|
      iv_timeoutinminutes = 123
      iv_type = |string|
    )
    io_source = new /aws1/cl_ebnimagesource( |string| )
  )
  io_sourcebuildinformation = new /aws1/cl_ebnsrcbuildinfmtion(
    iv_sourcelocation = |string|
    iv_sourcerepository = |string|
    iv_sourcetype = |string|
  )
  io_sourcebundle = new /aws1/cl_ebns3location(
    iv_s3bucket = |string|
    iv_s3key = |string|
  )
  it_tags = VALUE /aws1/cl_ebntag=>tt_tags(
    (
      new /aws1/cl_ebntag(
        iv_key = |string|
        iv_value = |string|
      )
    )
  )
  iv_applicationname = |string|
  iv_autocreateapplication = ABAP_TRUE
  iv_description = |string|
  iv_process = ABAP_TRUE
  iv_versionlabel = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_applicationversiondescr = lo_result->get_applicationversion( ).
  IF lo_applicationversiondescr IS NOT INITIAL.
    lv_applicationversionarn = lo_applicationversiondescr->get_applicationversionarn( ).
    lv_applicationname = lo_applicationversiondescr->get_applicationname( ).
    lv_description = lo_applicationversiondescr->get_description( ).
    lv_versionlabel = lo_applicationversiondescr->get_versionlabel( ).
    lo_sourcebuildinformation = lo_applicationversiondescr->get_sourcebuildinformation( ).
    IF lo_sourcebuildinformation IS NOT INITIAL.
      lv_sourcetype = lo_sourcebuildinformation->get_sourcetype( ).
      lv_sourcerepository = lo_sourcebuildinformation->get_sourcerepository( ).
      lv_sourcelocation = lo_sourcebuildinformation->get_sourcelocation( ).
    ENDIF.
    lv_string = lo_applicationversiondescr->get_buildarn( ).
    lo_s3location = lo_applicationversiondescr->get_sourcebundle( ).
    IF lo_s3location IS NOT INITIAL.
      lv_s3bucket = lo_s3location->get_s3bucket( ).
      lv_s3key = lo_s3location->get_s3key( ).
    ENDIF.
    lo_imagesource = lo_applicationversiondescr->get_imagesource( ).
    IF lo_imagesource IS NOT INITIAL.
      lv_string = lo_imagesource->get_uri( ).
    ENDIF.
    lo_imagebuildconfiguration = lo_applicationversiondescr->get_imagebuildconfiguration( ).
    IF lo_imagebuildconfiguration IS NOT INITIAL.
      lv_imagebuildtype = lo_imagebuildconfiguration->get_type( ).
      lv_string = lo_imagebuildconfiguration->get_dockerfilelocation( ).
      lv_string = lo_imagebuildconfiguration->get_buildpack( ).
      lv_architecturetype = lo_imagebuildconfiguration->get_architecture( ).
      lv_nonemptystring = lo_imagebuildconfiguration->get_codebuildservicerole( ).
      lv_computetype = lo_imagebuildconfiguration->get_computetype( ).
      lv_boxedint = lo_imagebuildconfiguration->get_timeoutinminutes( ).
    ENDIF.
    lv_applicationversionprocc = lo_applicationversiondescr->get_process( ).
    lv_creationdate = lo_applicationversiondescr->get_datecreated( ).
    lv_updatedate = lo_applicationversiondescr->get_dateupdated( ).
    lv_applicationversionstatu = lo_applicationversiondescr->get_status( ).
  ENDIF.
ENDIF.

To create a new application

The following operation creates a new version (v1) of an application named my-app:

DATA(lo_result) = lo_client->createapplicationversion(
  io_sourcebundle = new /aws1/cl_ebns3location(
    iv_s3bucket = |my-bucket|
    iv_s3key = |sample.war|
  )
  iv_applicationname = |my-app|
  iv_autocreateapplication = ABAP_TRUE
  iv_description = |my-app-v1|
  iv_process = ABAP_TRUE
  iv_versionlabel = |v1|
).