createApplicationVersion method

Future<ApplicationVersionDescriptionMessage> createApplicationVersion({
  1. required String applicationName,
  2. required String versionLabel,
  3. bool? autoCreateApplication,
  4. BuildConfiguration? buildConfiguration,
  5. String? description,
  6. bool? process,
  7. SourceBuildInformation? sourceBuildInformation,
  8. S3Location? sourceBundle,
  9. List<Tag>? tags,
})

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

Specify a commit in an AWS CodeCommit repository with SourceBuildInformation.

Specify a build in an AWS CodeBuild with SourceBuildInformation and BuildConfiguration.

Specify a source bundle in S3 with SourceBundle

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

May throw TooManyApplicationsException. May throw TooManyApplicationVersionsException. May throw InsufficientPrivilegesException. May throw S3LocationNotInServiceRegionException. May throw CodeBuildNotInServiceRegionException.

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

Parameter versionLabel : A label identifying this version.

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

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

Parameter buildConfiguration : Settings for an AWS CodeBuild build.

Parameter description : A description of this application version.

Parameter process : 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 AWS CodeBuild or AWS CodeCommit. For application versions built from a source bundle in Amazon S3, processing is optional.

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

Parameter sourceBundle : The Amazon S3 bucket and key that identify the location of the source bundle for this version. Specify a source bundle in S3 or a commit in an AWS CodeCommit repository (with SourceBuildInformation), but not both. If neither SourceBundle nor SourceBuildInformation are provided, Elastic Beanstalk uses a sample application.

Parameter 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.

Implementation

Future<ApplicationVersionDescriptionMessage> createApplicationVersion({
  required String applicationName,
  required String versionLabel,
  bool? autoCreateApplication,
  BuildConfiguration? buildConfiguration,
  String? description,
  bool? process,
  SourceBuildInformation? sourceBuildInformation,
  S3Location? sourceBundle,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(applicationName, 'applicationName');
  _s.validateStringLength(
    'applicationName',
    applicationName,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(versionLabel, 'versionLabel');
  _s.validateStringLength(
    'versionLabel',
    versionLabel,
    1,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    200,
  );
  final $request = <String, dynamic>{};
  $request['ApplicationName'] = applicationName;
  $request['VersionLabel'] = versionLabel;
  autoCreateApplication
      ?.also((arg) => $request['AutoCreateApplication'] = arg);
  buildConfiguration?.also((arg) => $request['BuildConfiguration'] = arg);
  description?.also((arg) => $request['Description'] = arg);
  process?.also((arg) => $request['Process'] = arg);
  sourceBuildInformation
      ?.also((arg) => $request['SourceBuildInformation'] = arg);
  sourceBundle?.also((arg) => $request['SourceBundle'] = arg);
  tags?.also((arg) => $request['Tags'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'CreateApplicationVersion',
    version: '2010-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CreateApplicationVersionMessage'],
    shapes: shapes,
    resultWrapper: 'CreateApplicationVersionResult',
  );
  return ApplicationVersionDescriptionMessage.fromXml($result);
}