importVmImage method

Future<ImportVmImageResponse> importVmImage({
  1. required String name,
  2. required Platform platform,
  3. required String semanticVersion,
  4. required String vmImportTaskId,
  5. String? clientToken,
  6. String? description,
  7. ImageLoggingConfiguration? loggingConfiguration,
  8. String? osVersion,
  9. Map<String, String>? tags,
})

When you export your virtual machine (VM) from its virtualization environment, that process creates a set of one or more disk container files that act as snapshots of your VM’s environment, settings, and data. The Amazon EC2 API ImportImage action uses those files to import your VM and create an AMI. To import using the CLI command, see import-image

You can reference the task ID from the VM import to pull in the AMI that the import created as the base image for your Image Builder recipe.

May throw ClientException. May throw ServiceException. May throw ServiceUnavailableException.

Parameter name : The name of the base image that is created by the import process.

Parameter platform : The operating system platform for the imported VM.

Parameter semanticVersion : The semantic version to attach to the base image that was created during the import process. This version follows the semantic version syntax.

Assignment: For the first three nodes you can assign any positive integer value, including zero, with an upper limit of 2^30-1, or 1073741823 for each node. Image Builder automatically assigns the build number to the fourth node.

Patterns: You can use any numeric pattern that adheres to the assignment requirements for the nodes that you can assign. For example, you might choose a software version pattern, such as 1.0.0, or a date, such as 2021.01.01.

Parameter vmImportTaskId : The importTaskId (API) or ImportTaskId (CLI) from the Amazon EC2 VM import process. Image Builder retrieves information from the import process to pull in the AMI that is created from the VM source as the base image for your recipe.

Parameter clientToken : Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.

Parameter description : The description for the base image that is created by the import process.

Parameter loggingConfiguration : Define logging configuration for the image build process.

Parameter osVersion : The operating system version for the imported VM.

Parameter tags : Tags that are attached to the import resources.

Implementation

Future<ImportVmImageResponse> importVmImage({
  required String name,
  required Platform platform,
  required String semanticVersion,
  required String vmImportTaskId,
  String? clientToken,
  String? description,
  ImageLoggingConfiguration? loggingConfiguration,
  String? osVersion,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    'platform': platform.value,
    'semanticVersion': semanticVersion,
    'vmImportTaskId': vmImportTaskId,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (loggingConfiguration != null)
      'loggingConfiguration': loggingConfiguration,
    if (osVersion != null) 'osVersion': osVersion,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/ImportVmImage',
    exceptionFnMap: _exceptionFns,
  );
  return ImportVmImageResponse.fromJson(response);
}