copyWorkspaceImage method

Future<CopyWorkspaceImageResult> copyWorkspaceImage({
  1. required String name,
  2. required String sourceImageId,
  3. required String sourceRegion,
  4. String? description,
  5. List<Tag>? tags,
})

Copies the specified image from the specified Region to the current Region. For more information about copying images, see Copy a Custom WorkSpaces Image.

In the China (Ningxia) Region, you can copy images only within the same Region.

In Amazon Web Services GovCloud (US), to copy images to and from other Regions, contact Amazon Web Services Support.

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

Parameter name : The name of the image.

Parameter sourceImageId : The identifier of the source image.

Parameter sourceRegion : The identifier of the source Region.

Parameter description : A description of the image.

Parameter tags : The tags for the image.

Implementation

Future<CopyWorkspaceImageResult> copyWorkspaceImage({
  required String name,
  required String sourceImageId,
  required String sourceRegion,
  String? description,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkspacesService.CopyWorkspaceImage'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'SourceImageId': sourceImageId,
      'SourceRegion': sourceRegion,
      if (description != null) 'Description': description,
      if (tags != null) 'Tags': tags,
    },
  );

  return CopyWorkspaceImageResult.fromJson(jsonResponse.body);
}