This commit is contained in:
George Shaw 2017-11-13 16:10:02 -06:00
parent 9c186df91b
commit 3da84454ee
6 changed files with 26 additions and 10 deletions

View file

@ -6,8 +6,11 @@ Relative API Path:
api/server/status
Request:
N/A
Response():
N/A
Response(200, 405):
"0" - OFF,
"1" - ON,
"2" - "MAINTENANCE",
"3" - "RESTARTING"
*/
func Status(res http.ResponseWriter, req *http.Request) bool {}
@ -16,27 +19,31 @@ Relative API Path:
api/server/start
Request:
N/A
Response():
Response(204, 405, 409):
N/A
*/
func Start(res http.ResponseWriter, req *http.Request) bool {}
/*
Relative API Path:
api/server/Shutdown
api/server/shutdown
Request:
N/A
Response():
{
"graceful": boolean
}
Response(204, 404, 405):
N/A
*/
func Shutdown(res http.ResponseWriter, req *http.Request) bool {}
/*
Relative API Path:
api/server/Restart
api/server/restart
Request:
N/A
Response():
{
"graceful": boolean
}
Response(204, 404, 405):
N/A
*/
func Restart(res http.ResponseWriter, req *http.Request) bool {}
@ -46,7 +53,7 @@ Relative API Path:
api/server/maintenance
Request:
N/A
Response():
Response(204, 405):
N/A
*/
func Maintenance(res http.ResponseWriter, req *http.Request) bool {}

View file

@ -7,6 +7,8 @@ import (
"github.com/Ennovar/gPanel/pkg/public"
)
// Maintenance function is called from /api/server/maintenance and will place the public server into
// maintenance mode.
func Maintenance(res http.ResponseWriter, req *http.Request, publicServer *public.Controller) bool {
if req.Method != "UPDATE" {
http.Error(res, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)

View file

@ -8,6 +8,8 @@ import (
"github.com/Ennovar/gPanel/pkg/public"
)
// Restart function is called from /api/server/restart and will attempt to shutdown, either gracefully
// or not gracefully (contingent on request data), and then turn back on the public server.
func Restart(res http.ResponseWriter, req *http.Request, publicServer *public.Controller) bool {
if req.Method != "UPDATE" {
http.Error(res, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)

View file

@ -8,6 +8,8 @@ import (
"github.com/Ennovar/gPanel/pkg/public"
)
// Shutdown function is called from /api/server/shutdown and will attempt to shutdown, either gracefully
// or not gracefully (contingent on request data).
func Shutdown(res http.ResponseWriter, req *http.Request, publicServer *public.Controller) bool {
if req.Method != "UPDATE" {
http.Error(res, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)

View file

@ -7,6 +7,7 @@ import (
"github.com/Ennovar/gPanel/pkg/public"
)
// Start function is called from /api/server/start and turn the public server on.
func Start(res http.ResponseWriter, req *http.Request, publicServer *public.Controller) bool {
if req.Method != "UPDATE" {
http.Error(res, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)

View file

@ -8,6 +8,8 @@ import (
"github.com/Ennovar/gPanel/pkg/public"
)
// Status function is called from api/server/status and will return the current status of
// the public server.
func Status(res http.ResponseWriter, req *http.Request, publicServer *public.Controller) bool {
if req.Method != "GET" {
http.Error(res, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)