terminateWorkspaces method

Future<TerminateWorkspacesResult> terminateWorkspaces({
  1. required List<TerminateRequest> terminateWorkspaceRequests,
})

Terminates the specified WorkSpaces. You can terminate a WorkSpace that is in any state except SUSPENDED.

This operation is asynchronous and returns before the WorkSpaces have been completely terminated. After a WorkSpace is terminated, the TERMINATED state is returned only briefly before the WorkSpace directory metadata is cleaned up, so this state is rarely returned. To confirm that a WorkSpace is terminated, check for the WorkSpace ID by using DescribeWorkSpaces. If the WorkSpace ID isn't returned, then the WorkSpace has been successfully terminated.

To delete empty directories, see Delete the Directory for Your WorkSpaces. If you delete your Simple AD or AD Connector directory, you can always create a new one when you want to start using WorkSpaces again.

Parameter terminateWorkspaceRequests : The WorkSpaces to terminate. You can specify up to 25 WorkSpaces.

Implementation

Future<TerminateWorkspacesResult> terminateWorkspaces({
  required List<TerminateRequest> terminateWorkspaceRequests,
}) async {
  ArgumentError.checkNotNull(
      terminateWorkspaceRequests, 'terminateWorkspaceRequests');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkspacesService.TerminateWorkspaces'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TerminateWorkspaceRequests': terminateWorkspaceRequests,
    },
  );

  return TerminateWorkspacesResult.fromJson(jsonResponse.body);
}