handle method

Future<(bool, String)> handle(
  1. NodeControl request
)

Handles a node-control request.

Implementation

Future<(bool, String)> handle(NodeControl request) async {
  switch (request.action) {
    case 'restart':
      return _stopAgent(onRestartAgent, 'restart', 'the agent is restarting');
    case 'shutdown':
      return _stopAgent(onStopAgent, 'shutdown', 'the agent is stopping');
    case 'update':
      return _update(request);
    default:
      return (false, 'unknown node control action "${request.action}"');
  }
}