importWorkspaceImage method

Future<ImportWorkspaceImageResult> importWorkspaceImage({
  1. required String ec2ImageId,
  2. required String imageDescription,
  3. required String imageName,
  4. required WorkspaceImageIngestionProcess ingestionProcess,
  5. List<Application>? applications,
  6. List<Tag>? tags,
})

Imports the specified Windows 10 Bring Your Own License (BYOL) image into Amazon WorkSpaces. The image must be an already licensed Amazon EC2 image that is in your AWS account, and you must own the image. For more information about creating BYOL images, see Bring Your Own Windows Desktop Licenses.

May throw ResourceLimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceNotFoundException. May throw OperationNotSupportedException. May throw AccessDeniedException. May throw InvalidParameterValuesException.

Parameter ec2ImageId : The identifier of the EC2 image.

Parameter imageDescription : The description of the WorkSpace image.

Parameter imageName : The name of the WorkSpace image.

Parameter ingestionProcess : The ingestion process to be used when importing the image, depending on which protocol you want to use for your BYOL Workspace image, either PCoIP or WorkSpaces Streaming Protocol (WSP). To use WSP, specify a value that ends in _WSP. To use PCoIP, specify a value that does not end in _WSP.

For non-GPU-enabled bundles (bundles other than Graphics or GraphicsPro), specify BYOL_REGULAR or BYOL_REGULAR_WSP, depending on the protocol.

Parameter applications : If specified, the version of Microsoft Office to subscribe to. Valid only for Windows 10 BYOL images. For more information about subscribing to Office for BYOL images, see Bring Your Own Windows Desktop Licenses.

Parameter tags : The tags. Each WorkSpaces resource can have a maximum of 50 tags.

Implementation

Future<ImportWorkspaceImageResult> importWorkspaceImage({
  required String ec2ImageId,
  required String imageDescription,
  required String imageName,
  required WorkspaceImageIngestionProcess ingestionProcess,
  List<Application>? applications,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(ec2ImageId, 'ec2ImageId');
  ArgumentError.checkNotNull(imageDescription, 'imageDescription');
  _s.validateStringLength(
    'imageDescription',
    imageDescription,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(imageName, 'imageName');
  _s.validateStringLength(
    'imageName',
    imageName,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(ingestionProcess, 'ingestionProcess');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkspacesService.ImportWorkspaceImage'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Ec2ImageId': ec2ImageId,
      'ImageDescription': imageDescription,
      'ImageName': imageName,
      'IngestionProcess': ingestionProcess.toValue(),
      if (applications != null)
        'Applications': applications.map((e) => e.toValue()).toList(),
      if (tags != null) 'Tags': tags,
    },
  );

  return ImportWorkspaceImageResult.fromJson(jsonResponse.body);
}