createImage method

Future<CreateImageResponse> createImage({
  1. required String infrastructureConfigurationArn,
  2. String? clientToken,
  3. String? containerRecipeArn,
  4. String? distributionConfigurationArn,
  5. bool? enhancedImageMetadataEnabled,
  6. String? imageRecipeArn,
  7. ImageTestsConfiguration? imageTestsConfiguration,
  8. Map<String, String>? tags,
})

Creates a new image. This request will create a new image along with all of the configured output resources defined in the distribution configuration.

May throw ServiceException. May throw ClientException. May throw ServiceUnavailableException. May throw InvalidRequestException. May throw IdempotentParameterMismatchException. May throw ForbiddenException. May throw CallRateLimitExceededException. May throw ResourceInUseException. May throw ServiceQuotaExceededException.

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

Parameter clientToken : The idempotency token used to make this request idempotent.

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

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

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

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

Parameter imageTestsConfiguration : The image tests configuration of the image.

Parameter tags : The tags of the image.

Implementation

Future<CreateImageResponse> createImage({
  required String infrastructureConfigurationArn,
  String? clientToken,
  String? containerRecipeArn,
  String? distributionConfigurationArn,
  bool? enhancedImageMetadataEnabled,
  String? imageRecipeArn,
  ImageTestsConfiguration? imageTestsConfiguration,
  Map<String, String>? tags,
}) async {
  ArgumentError.checkNotNull(
      infrastructureConfigurationArn, 'infrastructureConfigurationArn');
  _s.validateStringLength(
    'clientToken',
    clientToken,
    1,
    36,
  );
  final $payload = <String, dynamic>{
    'infrastructureConfigurationArn': infrastructureConfigurationArn,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (containerRecipeArn != null) 'containerRecipeArn': containerRecipeArn,
    if (distributionConfigurationArn != null)
      'distributionConfigurationArn': distributionConfigurationArn,
    if (enhancedImageMetadataEnabled != null)
      'enhancedImageMetadataEnabled': enhancedImageMetadataEnabled,
    if (imageRecipeArn != null) 'imageRecipeArn': imageRecipeArn,
    if (imageTestsConfiguration != null)
      'imageTestsConfiguration': imageTestsConfiguration,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/CreateImage',
    exceptionFnMap: _exceptionFns,
  );
  return CreateImageResponse.fromJson(response);
}