Beispiel #1
0
 /**
  * Suspend Server
  *
  * @Post("/servers/{id}/suspend")
  * @Versions({"v1"})
  * @Parameters({
  *      @Parameter("id", type="integer", required=true, description="The ID of the server."),
  * })
  * @Response(204)
  */
 public function suspend(Request $request, $id)
 {
     try {
         $server = new ServerRepository();
         $server->suspend($id);
         return $this->response->noContent();
     } catch (DisplayException $ex) {
         throw new ResourceException($ex->getMessage());
     } catch (\Exception $ex) {
         throw new ServiceUnavailableHttpException('An error occured while attempting to suspend this server instance.');
     }
 }
 public function postSuspendServer(Request $request, $id)
 {
     try {
         $repo = new ServerRepository();
         $repo->suspend($id);
         Alert::success('Server has been suspended on the system. All running processes have been stopped and will not be startable until it is un-suspended.');
     } catch (DisplayException $e) {
         Alert::danger($e->getMessage())->flash();
     } catch (\Exception $e) {
         Log::error($e);
         Alert::danger('An unhandled exception occured while attemping to suspend this server. Please try again.')->flash();
     } finally {
         return redirect()->route('admin.servers.view', ['id' => $id, 'tab' => 'tab_manage']);
     }
 }