Future _stopWorkstationHandler()

in server/lib/controllers/WorkstationsController.dart [150:176]


  Future<Response> _stopWorkstationHandler(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.stopWorkstation(projectId, clusterName, configName, workstationName, region);

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