createWorkspaceImage method

Future<CreateWorkspaceImageResult> createWorkspaceImage({
  1. required String description,
  2. required String name,
  3. required String workspaceId,
  4. List<Tag>? tags,
})

Creates a new WorkSpace image from an existing WorkSpace.

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

Parameter description : The description of the new WorkSpace image.

Parameter name : The name of the new WorkSpace image.

Parameter workspaceId : The identifier of the source WorkSpace

Parameter tags : The tags that you want to add to the new WorkSpace image. To add tags when you're creating the image, you must create an IAM policy that grants your IAM user permission to use workspaces:CreateTags.

Implementation

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

  return CreateWorkspaceImageResult.fromJson(jsonResponse.body);
}