migrateWorkspace method

Future<MigrateWorkspaceResult> migrateWorkspace({
  1. required String bundleId,
  2. required String sourceWorkspaceId,
})

Migrates a WorkSpace from one operating system or bundle type to another, while retaining the data on the user volume.

The migration process recreates the WorkSpace by using a new root volume from the target bundle image and the user volume from the last available snapshot of the original WorkSpace. During migration, the original D:\Users%USERNAME% user profile folder is renamed to D:\Users%USERNAME%MMddyyTHHmmss%.NotMigrated. A new D:\Users%USERNAME%</code> folder is generated by the new OS. Certain files in the old user profile are moved to the new user profile.

For available migration scenarios, details about what happens during migration, and best practices, see Migrate a WorkSpace.

May throw InvalidParameterValuesException. May throw ResourceNotFoundException. May throw AccessDeniedException. May throw OperationNotSupportedException. May throw OperationInProgressException. May throw ResourceUnavailableException.

Parameter bundleId : The identifier of the target bundle type to migrate the WorkSpace to.

Parameter sourceWorkspaceId : The identifier of the WorkSpace to migrate from.

Implementation

Future<MigrateWorkspaceResult> migrateWorkspace({
  required String bundleId,
  required String sourceWorkspaceId,
}) async {
  ArgumentError.checkNotNull(bundleId, 'bundleId');
  ArgumentError.checkNotNull(sourceWorkspaceId, 'sourceWorkspaceId');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkspacesService.MigrateWorkspace'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'BundleId': bundleId,
      'SourceWorkspaceId': sourceWorkspaceId,
    },
  );

  return MigrateWorkspaceResult.fromJson(jsonResponse.body);
}