createImageVersion method

Future<CreateImageVersionResponse> createImageVersion({
  1. required String baseImage,
  2. required String imageName,
  3. List<String>? aliases,
  4. String? clientToken,
  5. bool? horovod,
  6. JobType? jobType,
  7. String? mLFramework,
  8. Processor? processor,
  9. String? programmingLang,
  10. String? releaseNotes,
  11. VendorGuidance? vendorGuidance,
})

Creates a version of the SageMaker AI image specified by ImageName. The version represents the Amazon ECR container image specified by BaseImage.

May throw ResourceInUse. May throw ResourceLimitExceeded. May throw ResourceNotFound.

Parameter baseImage : The registry path of the container image to use as the starting point for this version. The path is an Amazon ECR URI in the following format:

<acct-id>.dkr.ecr.<region>.amazonaws.com/<repo-name[:tag] or [@digest]>

Parameter imageName : The ImageName of the Image to create a version of.

Parameter aliases : A list of aliases created with the image version.

Parameter clientToken : A unique ID. If not specified, the Amazon Web Services CLI and Amazon Web Services SDKs, such as the SDK for Python (Boto3), add a unique value to the call.

Parameter horovod : Indicates Horovod compatibility.

Parameter jobType : Indicates SageMaker AI job type compatibility.

  • TRAINING: The image version is compatible with SageMaker AI training jobs.
  • INFERENCE: The image version is compatible with SageMaker AI inference jobs.
  • NOTEBOOK_KERNEL: The image version is compatible with SageMaker AI notebook kernels.

Parameter mLFramework : The machine learning framework vended in the image version.

Parameter processor : Indicates CPU or GPU compatibility.

  • CPU: The image version is compatible with CPU.
  • GPU: The image version is compatible with GPU.

Parameter programmingLang : The supported programming language and its version.

Parameter releaseNotes : The maintainer description of the image version.

Parameter vendorGuidance : The stability of the image version, specified by the maintainer.

  • NOT_PROVIDED: The maintainers did not provide a status for image version stability.
  • STABLE: The image version is stable.
  • TO_BE_ARCHIVED: The image version is set to be archived. Custom image versions that are set to be archived are automatically archived after three months.
  • ARCHIVED: The image version is archived. Archived image versions are not searchable and are no longer actively supported.

Implementation

Future<CreateImageVersionResponse> createImageVersion({
  required String baseImage,
  required String imageName,
  List<String>? aliases,
  String? clientToken,
  bool? horovod,
  JobType? jobType,
  String? mLFramework,
  Processor? processor,
  String? programmingLang,
  String? releaseNotes,
  VendorGuidance? vendorGuidance,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateImageVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'BaseImage': baseImage,
      'ImageName': imageName,
      if (aliases != null) 'Aliases': aliases,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (horovod != null) 'Horovod': horovod,
      if (jobType != null) 'JobType': jobType.value,
      if (mLFramework != null) 'MLFramework': mLFramework,
      if (processor != null) 'Processor': processor.value,
      if (programmingLang != null) 'ProgrammingLang': programmingLang,
      if (releaseNotes != null) 'ReleaseNotes': releaseNotes,
      if (vendorGuidance != null) 'VendorGuidance': vendorGuidance.value,
    },
  );

  return CreateImageVersionResponse.fromJson(jsonResponse.body);
}