restartModule method

Future<void> restartModule({
  1. String? moduleId,
  2. String? moduleName,
})

RestartModule restarts a module on the machine. Identify the module by either moduleId (for registry modules) or moduleName (for local modules). Exactly one of the two must be provided.

await machine.restartModule(moduleName: 'my-local-module');

Implementation

Future<void> restartModule({String? moduleId, String? moduleName}) async {
  if ((moduleId == null) == (moduleName == null)) {
    throw Exception('Exactly one of moduleId or moduleName must be provided');
  }
  final request = rpb.RestartModuleRequest(moduleId: moduleId, moduleName: moduleName);
  await _client.restartModule(request);
}