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 AWS GovCloud (US-West) Region, to copy images to and from other AWS Regions, contact AWS Support.

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

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 {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(sourceImageId, 'sourceImageId');
  ArgumentError.checkNotNull(sourceRegion, 'sourceRegion');
  _s.validateStringLength(
    'sourceRegion',
    sourceRegion,
    1,
    31,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    256,
  );
  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);
}