createImageRecipe method

Future<CreateImageRecipeResponse> createImageRecipe({
  1. required List<ComponentConfiguration> components,
  2. required String name,
  3. required String parentImage,
  4. required String semanticVersion,
  5. List<InstanceBlockDeviceMapping>? blockDeviceMappings,
  6. String? clientToken,
  7. String? description,
  8. Map<String, String>? tags,
  9. String? workingDirectory,
})

Creates a new image recipe. Image recipes define how images are configured, tested, and assessed.

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

Parameter components : The components of the image recipe.

Parameter name : The name of the image recipe.

Parameter parentImage : The parent image of the image recipe. The value of the string can be the ARN of the parent image or an AMI ID. The format for the ARN follows this example: arn:aws:imagebuilder:us-west-2:aws:image/windows-server-2016-english-full-base-x86/xxxx.x.x. You can provide the specific version that you want to use, or you can use a wildcard in all of the fields. If you enter an AMI ID for the string value, you must have access to the AMI, and the AMI must be in the same Region in which you are using Image Builder.

Parameter semanticVersion : The semantic version of the image recipe.

Parameter blockDeviceMappings : The block device mappings of the image recipe.

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

Parameter description : The description of the image recipe.

Parameter tags : The tags of the image recipe.

Parameter workingDirectory : The working directory to be used during build and test workflows.

Implementation

Future<CreateImageRecipeResponse> createImageRecipe({
  required List<ComponentConfiguration> components,
  required String name,
  required String parentImage,
  required String semanticVersion,
  List<InstanceBlockDeviceMapping>? blockDeviceMappings,
  String? clientToken,
  String? description,
  Map<String, String>? tags,
  String? workingDirectory,
}) async {
  ArgumentError.checkNotNull(components, 'components');
  ArgumentError.checkNotNull(name, 'name');
  ArgumentError.checkNotNull(parentImage, 'parentImage');
  _s.validateStringLength(
    'parentImage',
    parentImage,
    1,
    1024,
    isRequired: true,
  );
  ArgumentError.checkNotNull(semanticVersion, 'semanticVersion');
  _s.validateStringLength(
    'clientToken',
    clientToken,
    1,
    36,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    1024,
  );
  _s.validateStringLength(
    'workingDirectory',
    workingDirectory,
    1,
    1024,
  );
  final $payload = <String, dynamic>{
    'components': components,
    'name': name,
    'parentImage': parentImage,
    'semanticVersion': semanticVersion,
    if (blockDeviceMappings != null)
      'blockDeviceMappings': blockDeviceMappings,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (tags != null) 'tags': tags,
    if (workingDirectory != null) 'workingDirectory': workingDirectory,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/CreateImageRecipe',
    exceptionFnMap: _exceptionFns,
  );
  return CreateImageRecipeResponse.fromJson(response);
}