createContainerRecipe method

Future<CreateContainerRecipeResponse> createContainerRecipe({
  1. required List<ComponentConfiguration> components,
  2. required ContainerType containerType,
  3. required String dockerfileTemplateData,
  4. required String name,
  5. required String parentImage,
  6. required String semanticVersion,
  7. required TargetContainerRepository targetRepository,
  8. String? clientToken,
  9. String? description,
  10. String? dockerfileTemplateUri,
  11. String? imageOsVersionOverride,
  12. String? kmsKeyId,
  13. Platform? platformOverride,
  14. Map<String, String>? tags,
  15. String? workingDirectory,
})

Creates a new container recipe. Container 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 : Components for build and test that are included in the container recipe.

Parameter containerType : The type of container to create.

Parameter dockerfileTemplateData : The Dockerfile template used to build your image as an inline data blob.

Parameter name : The name of the container recipe.

Parameter parentImage : The source image for the container recipe.

Parameter semanticVersion : The semantic version of the container recipe (<major>.<minor>.<patch>).

Parameter targetRepository : The destination repository for the container image.

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

Parameter description : The description of the container recipe.

Parameter dockerfileTemplateUri : The S3 URI for the Dockerfile that will be used to build your container image.

Parameter imageOsVersionOverride : Specifies the operating system version for the source image.

Parameter kmsKeyId : Identifies which KMS key is used to encrypt the container image.

Parameter platformOverride : Specifies the operating system platform when you use a custom source image.

Parameter tags : Tags that are attached to the container recipe.

Parameter workingDirectory : The working directory for use during build and test workflows.

Implementation

Future<CreateContainerRecipeResponse> createContainerRecipe({
  required List<ComponentConfiguration> components,
  required ContainerType containerType,
  required String dockerfileTemplateData,
  required String name,
  required String parentImage,
  required String semanticVersion,
  required TargetContainerRepository targetRepository,
  String? clientToken,
  String? description,
  String? dockerfileTemplateUri,
  String? imageOsVersionOverride,
  String? kmsKeyId,
  Platform? platformOverride,
  Map<String, String>? tags,
  String? workingDirectory,
}) async {
  ArgumentError.checkNotNull(components, 'components');
  ArgumentError.checkNotNull(containerType, 'containerType');
  ArgumentError.checkNotNull(
      dockerfileTemplateData, 'dockerfileTemplateData');
  _s.validateStringLength(
    'dockerfileTemplateData',
    dockerfileTemplateData,
    1,
    16000,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  ArgumentError.checkNotNull(parentImage, 'parentImage');
  _s.validateStringLength(
    'parentImage',
    parentImage,
    1,
    1024,
    isRequired: true,
  );
  ArgumentError.checkNotNull(semanticVersion, 'semanticVersion');
  ArgumentError.checkNotNull(targetRepository, 'targetRepository');
  _s.validateStringLength(
    'clientToken',
    clientToken,
    1,
    36,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    1024,
  );
  _s.validateStringLength(
    'imageOsVersionOverride',
    imageOsVersionOverride,
    1,
    1024,
  );
  _s.validateStringLength(
    'kmsKeyId',
    kmsKeyId,
    1,
    1024,
  );
  _s.validateStringLength(
    'workingDirectory',
    workingDirectory,
    1,
    1024,
  );
  final $payload = <String, dynamic>{
    'components': components,
    'containerType': containerType.toValue(),
    'dockerfileTemplateData': dockerfileTemplateData,
    'name': name,
    'parentImage': parentImage,
    'semanticVersion': semanticVersion,
    'targetRepository': targetRepository,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (dockerfileTemplateUri != null)
      'dockerfileTemplateUri': dockerfileTemplateUri,
    if (imageOsVersionOverride != null)
      'imageOsVersionOverride': imageOsVersionOverride,
    if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
    if (platformOverride != null)
      'platformOverride': platformOverride.toValue(),
    if (tags != null) 'tags': tags,
    if (workingDirectory != null) 'workingDirectory': workingDirectory,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/CreateContainerRecipe',
    exceptionFnMap: _exceptionFns,
  );
  return CreateContainerRecipeResponse.fromJson(response);
}