Future _startWorkstationHandler()

in server/lib/controllers/WorkstationsController.dart [123:148]


  Future<Response> _startWorkstationHandler(Request request) async {
    try {
      String clusterName = request.params['clusterName']!;
      String configName = request.params['configName']!;
      String workstationName = request.params['workstationName']!;
      String projectId = request.url.queryParameters['projectId']!;
      String region = request.url.queryParameters['region']!;

      var response = await _workstationsService.startWorkstation(projectId, clusterName, configName, workstationName, region);

      if (response != null) {
        return Response.ok(
          jsonResponseEncode({"msg": "Workstation started"}),
        );
      } else {
        return Response.internalServerError(
          body: jsonResponseEncode({"msg": "Failed to start workstation"}),
        );
      }
    } on Exception catch (e, stacktrace) {
      print("Exception occurred: $e stackTrace: $stacktrace");
      return Response.internalServerError(
        body: jsonResponseEncode({"msg": "Internal Server Error"}),
      );
    }
  }