modifyWorkspaceState method

Future<void> modifyWorkspaceState({
  1. required String workspaceId,
  2. required TargetWorkspaceState workspaceState,
})

Sets the state of the specified WorkSpace.

To maintain a WorkSpace without being interrupted, set the WorkSpace state to ADMIN_MAINTENANCE. WorkSpaces in this state do not respond to requests to reboot, stop, start, rebuild, or restore. An AutoStop WorkSpace in this state is not stopped. Users cannot log into a WorkSpace in the ADMIN_MAINTENANCE state.

May throw InvalidParameterValuesException. May throw InvalidResourceStateException. May throw ResourceNotFoundException.

Parameter workspaceId : The identifier of the WorkSpace.

Parameter workspaceState : The WorkSpace state.

Implementation

Future<void> modifyWorkspaceState({
  required String workspaceId,
  required TargetWorkspaceState workspaceState,
}) async {
  ArgumentError.checkNotNull(workspaceId, 'workspaceId');
  ArgumentError.checkNotNull(workspaceState, 'workspaceState');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkspacesService.ModifyWorkspaceState'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'WorkspaceId': workspaceId,
      'WorkspaceState': workspaceState.toValue(),
    },
  );
}