diff --git a/cmd/api/swagger.go b/cmd/api/swagger.go index 0dbdeb2..b2a2cb5 100644 --- a/cmd/api/swagger.go +++ b/cmd/api/swagger.go @@ -5,12 +5,12 @@ // @description API for managing Assetto Corsa Competizione dedicated servers // // @contact.name ACC Server Manager Support -// @contact.url https://github.com/yourusername/acc-server-manager +// @contact.url https://github.com/FJurmanovic/acc-server-manager // // @license.name MIT // @license.url https://opensource.org/licenses/MIT // -// @host localhost:3000 +// @host https://acc.jurmanovic.com // @BasePath /api/v1 // @schemes http https // diff --git a/local/controller/membership.go b/local/controller/membership.go index 7794c57..831a44e 100644 --- a/local/controller/membership.go +++ b/local/controller/membership.go @@ -61,7 +61,7 @@ func NewMembershipController(service *service.MembershipService, auth *middlewar // @Failure 400 {object} error_handler.ErrorResponse "Invalid request body" // @Failure 401 {object} error_handler.ErrorResponse "Invalid credentials" // @Failure 500 {object} error_handler.ErrorResponse "Internal server error" -// @Router /auth/login [post] +// @Router /v1/auth/login [post] func (c *MembershipController) Login(ctx *fiber.Ctx) error { type request struct { Username string `json:"username"` @@ -96,7 +96,7 @@ func (c *MembershipController) Login(ctx *fiber.Ctx) error { // @Failure 409 {object} error_handler.ErrorResponse "User already exists" // @Failure 500 {object} error_handler.ErrorResponse "Internal server error" // @Security BearerAuth -// @Router /membership [post] +// @Router /v1/membership [post] func (mc *MembershipController) CreateUser(c *fiber.Ctx) error { type request struct { Username string `json:"username"` @@ -128,7 +128,7 @@ func (mc *MembershipController) CreateUser(c *fiber.Ctx) error { // @Failure 403 {object} error_handler.ErrorResponse "Insufficient permissions" // @Failure 500 {object} error_handler.ErrorResponse "Internal server error" // @Security BearerAuth -// @Router /membership [get] +// @Router /v1/membership [get] func (mc *MembershipController) ListUsers(c *fiber.Ctx) error { users, err := mc.service.ListUsers(c.UserContext()) if err != nil { @@ -139,6 +139,18 @@ func (mc *MembershipController) ListUsers(c *fiber.Ctx) error { } // GetUser gets a single user by ID. +// @Summary Get user by ID +// @Description Get detailed information about a specific user +// @Tags User Management +// @Accept json +// @Produce json +// @Param id path string true "User ID (UUID format)" +// @Success 200 {object} model.User "User details" +// @Failure 400 {object} error_handler.ErrorResponse "Invalid user ID format" +// @Failure 401 {object} error_handler.ErrorResponse "Unauthorized" +// @Failure 404 {object} error_handler.ErrorResponse "User not found" +// @Security BearerAuth +// @Router /v1/membership/{id} [get] func (mc *MembershipController) GetUser(c *fiber.Ctx) error { id, err := uuid.Parse(c.Params("id")) if err != nil { @@ -154,6 +166,16 @@ func (mc *MembershipController) GetUser(c *fiber.Ctx) error { } // GetMe returns the currently authenticated user's details. +// @Summary Get current user details +// @Description Get details of the currently authenticated user +// @Tags Authentication +// @Accept json +// @Produce json +// @Success 200 {object} model.User "Current user details" +// @Failure 401 {object} error_handler.ErrorResponse "Unauthorized" +// @Failure 404 {object} error_handler.ErrorResponse "User not found" +// @Security BearerAuth +// @Router /v1/auth/me [get] func (mc *MembershipController) GetMe(c *fiber.Ctx) error { userID, ok := c.Locals("userID").(string) if !ok || userID == "" { @@ -172,6 +194,19 @@ func (mc *MembershipController) GetMe(c *fiber.Ctx) error { } // DeleteUser deletes a user. +// @Summary Delete user +// @Description Delete a specific user by ID +// @Tags User Management +// @Accept json +// @Produce json +// @Param id path string true "User ID (UUID format)" +// @Success 204 "User successfully deleted" +// @Failure 400 {object} error_handler.ErrorResponse "Invalid user ID format" +// @Failure 401 {object} error_handler.ErrorResponse "Unauthorized" +// @Failure 403 {object} error_handler.ErrorResponse "Insufficient permissions" +// @Failure 404 {object} error_handler.ErrorResponse "User not found" +// @Security BearerAuth +// @Router /v1/membership/{id} [delete] func (mc *MembershipController) DeleteUser(c *fiber.Ctx) error { id, err := uuid.Parse(c.Params("id")) if err != nil { @@ -187,6 +222,20 @@ func (mc *MembershipController) DeleteUser(c *fiber.Ctx) error { } // UpdateUser updates a user. +// @Summary Update user +// @Description Update user details by ID +// @Tags User Management +// @Accept json +// @Produce json +// @Param id path string true "User ID (UUID format)" +// @Param user body service.UpdateUserRequest true "Updated user details" +// @Success 200 {object} model.User "Updated user details" +// @Failure 400 {object} error_handler.ErrorResponse "Invalid request body or ID format" +// @Failure 401 {object} error_handler.ErrorResponse "Unauthorized" +// @Failure 403 {object} error_handler.ErrorResponse "Insufficient permissions" +// @Failure 404 {object} error_handler.ErrorResponse "User not found" +// @Security BearerAuth +// @Router /v1/membership/{id} [put] func (mc *MembershipController) UpdateUser(c *fiber.Ctx) error { id, err := uuid.Parse(c.Params("id")) if err != nil { @@ -207,6 +256,17 @@ func (mc *MembershipController) UpdateUser(c *fiber.Ctx) error { } // GetRoles returns all available roles. +// @Summary Get all roles +// @Description Get a list of all available user roles +// @Tags User Management +// @Accept json +// @Produce json +// @Success 200 {array} model.Role "List of roles" +// @Failure 401 {object} error_handler.ErrorResponse "Unauthorized" +// @Failure 403 {object} error_handler.ErrorResponse "Insufficient permissions" +// @Failure 500 {object} error_handler.ErrorResponse "Internal server error" +// @Security BearerAuth +// @Router /v1/membership/roles [get] func (mc *MembershipController) GetRoles(c *fiber.Ctx) error { roles, err := mc.service.GetAllRoles(c.UserContext()) if err != nil { diff --git a/local/controller/server.go b/local/controller/server.go index 4ec187b..aa1031b 100644 --- a/local/controller/server.go +++ b/local/controller/server.go @@ -50,7 +50,7 @@ func NewServerController(ss *service.ServerService, routeGroups *common.RouteGro // @Failure 401 {object} error_handler.ErrorResponse "Unauthorized" // @Failure 500 {object} error_handler.ErrorResponse "Internal server error" // @Security BearerAuth -// @Router /server [get] +// @Router /v1/api/server [get] func (ac *ServerController) GetAllApi(c *fiber.Ctx) error { var filter model.ServerFilter if err := common.ParseQueryFilter(c, &filter); err != nil { @@ -181,7 +181,21 @@ func (ac *ServerController) UpdateServer(c *fiber.Ctx) error { return c.JSON(server) } -// DeleteServer deletes a server +// DeleteServer deletes an existing server +// @Summary Delete an ACC server +// @Description Delete an existing ACC server +// @Tags Server +// @Accept json +// @Produce json +// @Param id path string true "Server ID (UUID format)" +// @Success 200 {object} object "Deleted server details" +// @Failure 400 {object} error_handler.ErrorResponse "Invalid server data or ID" +// @Failure 401 {object} error_handler.ErrorResponse "Unauthorized" +// @Failure 403 {object} error_handler.ErrorResponse "Insufficient permissions" +// @Failure 404 {object} error_handler.ErrorResponse "Server not found" +// @Failure 500 {object} error_handler.ErrorResponse "Internal server error" +// @Security BearerAuth +// @Router /v1/server/{id} [delete] func (ac *ServerController) DeleteServer(c *fiber.Ctx) error { serverIDStr := c.Params("id") serverID, err := uuid.Parse(serverIDStr) diff --git a/local/controller/service_control.go b/local/controller/service_control.go index dd7c85a..e73c37d 100644 --- a/local/controller/service_control.go +++ b/local/controller/service_control.go @@ -51,7 +51,7 @@ func NewServiceControlController(as *service.ServiceControlService, routeGroups // @Failure 404 {object} error_handler.ErrorResponse "Service not found" // @Failure 500 {object} error_handler.ErrorResponse "Internal server error" // @Security BearerAuth -// @Router /v1/service-control/{service} [get] +// @Router /v1/server/{id}/service/{service} [get] func (ac *ServiceControlController) getStatus(c *fiber.Ctx) error { id := c.Params("id") c.Locals("serverId", id) @@ -78,7 +78,7 @@ func (ac *ServiceControlController) getStatus(c *fiber.Ctx) error { // @Failure 409 {object} error_handler.ErrorResponse "Service already running" // @Failure 500 {object} error_handler.ErrorResponse "Internal server error" // @Security BearerAuth -// @Router /v1/service-control/start [post] +// @Router /v1/server/{id}/service/start [post] func (ac *ServiceControlController) startServer(c *fiber.Ctx) error { id := c.Params("id") c.Locals("serverId", id) @@ -105,7 +105,7 @@ func (ac *ServiceControlController) startServer(c *fiber.Ctx) error { // @Failure 409 {object} error_handler.ErrorResponse "Service already stopped" // @Failure 500 {object} error_handler.ErrorResponse "Internal server error" // @Security BearerAuth -// @Router /v1/service-control/stop [post] +// @Router /v1/server/{id}/service/stop [post] func (ac *ServiceControlController) stopServer(c *fiber.Ctx) error { id := c.Params("id") c.Locals("serverId", id) @@ -131,7 +131,7 @@ func (ac *ServiceControlController) stopServer(c *fiber.Ctx) error { // @Failure 404 {object} error_handler.ErrorResponse "Service not found" // @Failure 500 {object} error_handler.ErrorResponse "Internal server error" // @Security BearerAuth -// @Router /v1/service-control/restart [post] +// @Router /v1/server/{id}/service/restart [post] func (ac *ServiceControlController) restartServer(c *fiber.Ctx) error { id := c.Params("id") c.Locals("serverId", id) diff --git a/local/controller/system.go b/local/controller/system.go index d68149e..8c8130c 100644 --- a/local/controller/system.go +++ b/local/controller/system.go @@ -31,9 +31,9 @@ func NewSystemController(routeGroups *common.RouteGroups) *SystemController { // // @Summary Return service control status // @Description Return service control status -// @Tags service-control +// @Tags system // @Success 200 {array} string -// @Router /v1/service-control [get] +// @Router /v1/system/health [get] func (ac *SystemController) getFirst(c *fiber.Ctx) error { return c.SendString(configs.Version) } diff --git a/swagger/docs.go b/swagger/docs.go index e8d9dd0..f54e021 100644 --- a/swagger/docs.go +++ b/swagger/docs.go @@ -11,7 +11,7 @@ const docTemplate = `{ "title": "{{.Title}}", "contact": { "name": "ACC Server Manager Support", - "url": "https://github.com/yourusername/acc-server-manager" + "url": "https://github.com/FJurmanovic/acc-server-manager" }, "license": { "name": "MIT", @@ -22,199 +22,7 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { - "/auth/login": { - "post": { - "description": "Authenticate a user and receive a JWT token", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Authentication" - ], - "summary": "User login", - "parameters": [ - { - "description": "Login credentials", - "name": "credentials", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - } - } - } - ], - "responses": { - "200": { - "description": "JWT token", - "schema": { - "type": "object", - "properties": { - "token": { - "type": "string" - } - } - } - }, - "400": { - "description": "Invalid request body", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "401": { - "description": "Invalid credentials", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "500": { - "description": "Internal server error", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - } - } - } - }, - "/membership": { - "get": { - "security": [ - { - "BearerAuth": [] - } - ], - "description": "Get a list of all registered users", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "User Management" - ], - "summary": "List all users", - "responses": { - "200": { - "description": "List of users", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/model.User" - } - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "403": { - "description": "Insufficient permissions", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "500": { - "description": "Internal server error", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - } - } - }, - "post": { - "security": [ - { - "BearerAuth": [] - } - ], - "description": "Create a new user account with specified role", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "User Management" - ], - "summary": "Create a new user", - "parameters": [ - { - "description": "User details", - "name": "user", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "role": { - "type": "string" - }, - "username": { - "type": "string" - } - } - } - } - ], - "responses": { - "200": { - "description": "Created user details", - "schema": { - "$ref": "#/definitions/model.User" - } - }, - "400": { - "description": "Invalid request body", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "403": { - "description": "Insufficient permissions", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "409": { - "description": "User already exists", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "500": { - "description": "Internal server error", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - } - } - } - }, - "/server": { + "/v1/api/server": { "get": { "security": [ { @@ -305,6 +113,111 @@ const docTemplate = `{ } } }, + "/v1/auth/login": { + "post": { + "description": "Authenticate a user and receive a JWT token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Authentication" + ], + "summary": "User login", + "parameters": [ + { + "description": "Login credentials", + "name": "credentials", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "JWT token", + "schema": { + "type": "object", + "properties": { + "token": { + "type": "string" + } + } + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Invalid credentials", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, + "/v1/auth/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get details of the currently authenticated user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Authentication" + ], + "summary": "Get current user details", + "responses": { + "200": { + "description": "Current user details", + "schema": { + "$ref": "#/definitions/model.User" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "User not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, "/v1/lookup/car-models": { "get": { "security": [ @@ -569,6 +482,361 @@ const docTemplate = `{ } } }, + "/v1/membership": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all registered users", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "List all users", + "responses": { + "200": { + "description": "List of users", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.User" + } + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new user account with specified role", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Create a new user", + "parameters": [ + { + "description": "User details", + "name": "user", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "role": { + "type": "string" + }, + "username": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "Created user details", + "schema": { + "$ref": "#/definitions/model.User" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "409": { + "description": "User already exists", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, + "/v1/membership/roles": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all available user roles", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Get all roles", + "responses": { + "200": { + "description": "List of roles", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Role" + } + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, + "/v1/membership/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get detailed information about a specific user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Get user by ID", + "parameters": [ + { + "type": "string", + "description": "User ID (UUID format)", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "User details", + "schema": { + "$ref": "#/definitions/model.User" + } + }, + "400": { + "description": "Invalid user ID format", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "User not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update user details by ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Update user", + "parameters": [ + { + "type": "string", + "description": "User ID (UUID format)", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Updated user details", + "name": "user", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/service.UpdateUserRequest" + } + } + ], + "responses": { + "200": { + "description": "Updated user details", + "schema": { + "$ref": "#/definitions/model.User" + } + }, + "400": { + "description": "Invalid request body or ID format", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "User not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a specific user by ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Delete user", + "parameters": [ + { + "type": "string", + "description": "User ID (UUID format)", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "User successfully deleted" + }, + "400": { + "description": "Invalid user ID format", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "User not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, "/v1/server": { "get": { "security": [ @@ -854,6 +1122,71 @@ const docTemplate = `{ } } } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete an existing ACC server", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Server" + ], + "summary": "Delete an ACC server", + "parameters": [ + { + "type": "string", + "description": "Server ID (UUID format)", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Deleted server details", + "schema": { + "type": "object" + } + }, + "400": { + "description": "Invalid server data or ID", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "Server not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } } }, "/v1/server/{id}/config": { @@ -1086,27 +1419,7 @@ const docTemplate = `{ } } }, - "/v1/service-control": { - "get": { - "description": "Return service control status", - "tags": [ - "service-control" - ], - "summary": "Return service control status", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - "/v1/service-control/restart": { + "/v1/server/{id}/service/restart": { "post": { "security": [ { @@ -1185,7 +1498,7 @@ const docTemplate = `{ } } }, - "/v1/service-control/start": { + "/v1/server/{id}/service/start": { "post": { "security": [ { @@ -1270,7 +1583,7 @@ const docTemplate = `{ } } }, - "/v1/service-control/stop": { + "/v1/server/{id}/service/stop": { "post": { "security": [ { @@ -1355,7 +1668,7 @@ const docTemplate = `{ } } }, - "/v1/service-control/{service}": { + "/v1/server/{id}/service/{service}": { "get": { "security": [ { @@ -1463,6 +1776,26 @@ const docTemplate = `{ } } } + }, + "/v1/system/health": { + "get": { + "description": "Return service control status", + "tags": [ + "system" + ], + "summary": "Return service control status", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } } }, "definitions": { @@ -1617,6 +1950,20 @@ const docTemplate = `{ "type": "string" } } + }, + "service.UpdateUserRequest": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "roleId": { + "type": "string" + }, + "username": { + "type": "string" + } + } } }, "securityDefinitions": { @@ -1632,7 +1979,7 @@ const docTemplate = `{ // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "1.0", - Host: "localhost:3000", + Host: "https://acc.jurmanovic.com", BasePath: "/api/v1", Schemes: []string{"http", "https"}, Title: "ACC Server Manager API", diff --git a/swagger/swagger.json b/swagger/swagger.json index e141483..364d743 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -9,7 +9,7 @@ "title": "ACC Server Manager API", "contact": { "name": "ACC Server Manager Support", - "url": "https://github.com/yourusername/acc-server-manager" + "url": "https://github.com/FJurmanovic/acc-server-manager" }, "license": { "name": "MIT", @@ -17,202 +17,10 @@ }, "version": "1.0" }, - "host": "localhost:3000", + "host": "https://acc.jurmanovic.com", "basePath": "/api/v1", "paths": { - "/auth/login": { - "post": { - "description": "Authenticate a user and receive a JWT token", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Authentication" - ], - "summary": "User login", - "parameters": [ - { - "description": "Login credentials", - "name": "credentials", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - } - } - } - ], - "responses": { - "200": { - "description": "JWT token", - "schema": { - "type": "object", - "properties": { - "token": { - "type": "string" - } - } - } - }, - "400": { - "description": "Invalid request body", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "401": { - "description": "Invalid credentials", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "500": { - "description": "Internal server error", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - } - } - } - }, - "/membership": { - "get": { - "security": [ - { - "BearerAuth": [] - } - ], - "description": "Get a list of all registered users", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "User Management" - ], - "summary": "List all users", - "responses": { - "200": { - "description": "List of users", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/model.User" - } - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "403": { - "description": "Insufficient permissions", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "500": { - "description": "Internal server error", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - } - } - }, - "post": { - "security": [ - { - "BearerAuth": [] - } - ], - "description": "Create a new user account with specified role", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "User Management" - ], - "summary": "Create a new user", - "parameters": [ - { - "description": "User details", - "name": "user", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "role": { - "type": "string" - }, - "username": { - "type": "string" - } - } - } - } - ], - "responses": { - "200": { - "description": "Created user details", - "schema": { - "$ref": "#/definitions/model.User" - } - }, - "400": { - "description": "Invalid request body", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "403": { - "description": "Insufficient permissions", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "409": { - "description": "User already exists", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - }, - "500": { - "description": "Internal server error", - "schema": { - "$ref": "#/definitions/error_handler.ErrorResponse" - } - } - } - } - }, - "/server": { + "/v1/api/server": { "get": { "security": [ { @@ -303,6 +111,111 @@ } } }, + "/v1/auth/login": { + "post": { + "description": "Authenticate a user and receive a JWT token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Authentication" + ], + "summary": "User login", + "parameters": [ + { + "description": "Login credentials", + "name": "credentials", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "JWT token", + "schema": { + "type": "object", + "properties": { + "token": { + "type": "string" + } + } + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Invalid credentials", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, + "/v1/auth/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get details of the currently authenticated user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Authentication" + ], + "summary": "Get current user details", + "responses": { + "200": { + "description": "Current user details", + "schema": { + "$ref": "#/definitions/model.User" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "User not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, "/v1/lookup/car-models": { "get": { "security": [ @@ -567,6 +480,361 @@ } } }, + "/v1/membership": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all registered users", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "List all users", + "responses": { + "200": { + "description": "List of users", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.User" + } + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new user account with specified role", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Create a new user", + "parameters": [ + { + "description": "User details", + "name": "user", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "role": { + "type": "string" + }, + "username": { + "type": "string" + } + } + } + } + ], + "responses": { + "200": { + "description": "Created user details", + "schema": { + "$ref": "#/definitions/model.User" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "409": { + "description": "User already exists", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, + "/v1/membership/roles": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all available user roles", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Get all roles", + "responses": { + "200": { + "description": "List of roles", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Role" + } + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, + "/v1/membership/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get detailed information about a specific user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Get user by ID", + "parameters": [ + { + "type": "string", + "description": "User ID (UUID format)", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "User details", + "schema": { + "$ref": "#/definitions/model.User" + } + }, + "400": { + "description": "Invalid user ID format", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "User not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update user details by ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Update user", + "parameters": [ + { + "type": "string", + "description": "User ID (UUID format)", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Updated user details", + "name": "user", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/service.UpdateUserRequest" + } + } + ], + "responses": { + "200": { + "description": "Updated user details", + "schema": { + "$ref": "#/definitions/model.User" + } + }, + "400": { + "description": "Invalid request body or ID format", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "User not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a specific user by ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "User Management" + ], + "summary": "Delete user", + "parameters": [ + { + "type": "string", + "description": "User ID (UUID format)", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "User successfully deleted" + }, + "400": { + "description": "Invalid user ID format", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "User not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } + } + }, "/v1/server": { "get": { "security": [ @@ -852,6 +1120,71 @@ } } } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete an existing ACC server", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Server" + ], + "summary": "Delete an ACC server", + "parameters": [ + { + "type": "string", + "description": "Server ID (UUID format)", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Deleted server details", + "schema": { + "type": "object" + } + }, + "400": { + "description": "Invalid server data or ID", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "403": { + "description": "Insufficient permissions", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "404": { + "description": "Server not found", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/error_handler.ErrorResponse" + } + } + } } }, "/v1/server/{id}/config": { @@ -1084,27 +1417,7 @@ } } }, - "/v1/service-control": { - "get": { - "description": "Return service control status", - "tags": [ - "service-control" - ], - "summary": "Return service control status", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - "/v1/service-control/restart": { + "/v1/server/{id}/service/restart": { "post": { "security": [ { @@ -1183,7 +1496,7 @@ } } }, - "/v1/service-control/start": { + "/v1/server/{id}/service/start": { "post": { "security": [ { @@ -1268,7 +1581,7 @@ } } }, - "/v1/service-control/stop": { + "/v1/server/{id}/service/stop": { "post": { "security": [ { @@ -1353,7 +1666,7 @@ } } }, - "/v1/service-control/{service}": { + "/v1/server/{id}/service/{service}": { "get": { "security": [ { @@ -1461,6 +1774,26 @@ } } } + }, + "/v1/system/health": { + "get": { + "description": "Return service control status", + "tags": [ + "system" + ], + "summary": "Return service control status", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } } }, "definitions": { @@ -1615,6 +1948,20 @@ "type": "string" } } + }, + "service.UpdateUserRequest": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "roleId": { + "type": "string" + }, + "username": { + "type": "string" + } + } } }, "securityDefinitions": { diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index c9a0b87..d457a63 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -103,11 +103,20 @@ definitions: username: type: string type: object -host: localhost:3000 + service.UpdateUserRequest: + properties: + password: + type: string + roleId: + type: string + username: + type: string + type: object +host: https://acc.jurmanovic.com info: contact: name: ACC Server Manager Support - url: https://github.com/yourusername/acc-server-manager + url: https://github.com/FJurmanovic/acc-server-manager description: API for managing Assetto Corsa Competizione dedicated servers license: name: MIT @@ -115,130 +124,7 @@ info: title: ACC Server Manager API version: "1.0" paths: - /auth/login: - post: - consumes: - - application/json - description: Authenticate a user and receive a JWT token - parameters: - - description: Login credentials - in: body - name: credentials - required: true - schema: - properties: - password: - type: string - username: - type: string - type: object - produces: - - application/json - responses: - "200": - description: JWT token - schema: - properties: - token: - type: string - type: object - "400": - description: Invalid request body - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - "401": - description: Invalid credentials - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - "500": - description: Internal server error - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - summary: User login - tags: - - Authentication - /membership: - get: - consumes: - - application/json - description: Get a list of all registered users - produces: - - application/json - responses: - "200": - description: List of users - schema: - items: - $ref: '#/definitions/model.User' - type: array - "401": - description: Unauthorized - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - "403": - description: Insufficient permissions - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - "500": - description: Internal server error - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - security: - - BearerAuth: [] - summary: List all users - tags: - - User Management - post: - consumes: - - application/json - description: Create a new user account with specified role - parameters: - - description: User details - in: body - name: user - required: true - schema: - properties: - password: - type: string - role: - type: string - username: - type: string - type: object - produces: - - application/json - responses: - "200": - description: Created user details - schema: - $ref: '#/definitions/model.User' - "400": - description: Invalid request body - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - "403": - description: Insufficient permissions - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - "409": - description: User already exists - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - "500": - description: Internal server error - schema: - $ref: '#/definitions/error_handler.ErrorResponse' - security: - - BearerAuth: [] - summary: Create a new user - tags: - - User Management - /server: + /v1/api/server: get: consumes: - application/json @@ -294,6 +180,73 @@ paths: summary: List all servers (API format) tags: - Server + /v1/auth/login: + post: + consumes: + - application/json + description: Authenticate a user and receive a JWT token + parameters: + - description: Login credentials + in: body + name: credentials + required: true + schema: + properties: + password: + type: string + username: + type: string + type: object + produces: + - application/json + responses: + "200": + description: JWT token + schema: + properties: + token: + type: string + type: object + "400": + description: Invalid request body + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "401": + description: Invalid credentials + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "500": + description: Internal server error + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + summary: User login + tags: + - Authentication + /v1/auth/me: + get: + consumes: + - application/json + description: Get details of the currently authenticated user + produces: + - application/json + responses: + "200": + description: Current user details + schema: + $ref: '#/definitions/model.User' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "404": + description: User not found + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + security: + - BearerAuth: [] + summary: Get current user details + tags: + - Authentication /v1/lookup/car-models: get: consumes: @@ -461,6 +414,233 @@ paths: summary: Get available tracks tags: - Lookups + /v1/membership: + get: + consumes: + - application/json + description: Get a list of all registered users + produces: + - application/json + responses: + "200": + description: List of users + schema: + items: + $ref: '#/definitions/model.User' + type: array + "401": + description: Unauthorized + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "403": + description: Insufficient permissions + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "500": + description: Internal server error + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + security: + - BearerAuth: [] + summary: List all users + tags: + - User Management + post: + consumes: + - application/json + description: Create a new user account with specified role + parameters: + - description: User details + in: body + name: user + required: true + schema: + properties: + password: + type: string + role: + type: string + username: + type: string + type: object + produces: + - application/json + responses: + "200": + description: Created user details + schema: + $ref: '#/definitions/model.User' + "400": + description: Invalid request body + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "403": + description: Insufficient permissions + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "409": + description: User already exists + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "500": + description: Internal server error + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + security: + - BearerAuth: [] + summary: Create a new user + tags: + - User Management + /v1/membership/{id}: + delete: + consumes: + - application/json + description: Delete a specific user by ID + parameters: + - description: User ID (UUID format) + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "204": + description: User successfully deleted + "400": + description: Invalid user ID format + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "403": + description: Insufficient permissions + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "404": + description: User not found + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + security: + - BearerAuth: [] + summary: Delete user + tags: + - User Management + get: + consumes: + - application/json + description: Get detailed information about a specific user + parameters: + - description: User ID (UUID format) + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: User details + schema: + $ref: '#/definitions/model.User' + "400": + description: Invalid user ID format + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "404": + description: User not found + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + security: + - BearerAuth: [] + summary: Get user by ID + tags: + - User Management + put: + consumes: + - application/json + description: Update user details by ID + parameters: + - description: User ID (UUID format) + in: path + name: id + required: true + type: string + - description: Updated user details + in: body + name: user + required: true + schema: + $ref: '#/definitions/service.UpdateUserRequest' + produces: + - application/json + responses: + "200": + description: Updated user details + schema: + $ref: '#/definitions/model.User' + "400": + description: Invalid request body or ID format + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "403": + description: Insufficient permissions + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "404": + description: User not found + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + security: + - BearerAuth: [] + summary: Update user + tags: + - User Management + /v1/membership/roles: + get: + consumes: + - application/json + description: Get a list of all available user roles + produces: + - application/json + responses: + "200": + description: List of roles + schema: + items: + $ref: '#/definitions/model.Role' + type: array + "401": + description: Unauthorized + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "403": + description: Insufficient permissions + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "500": + description: Internal server error + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + security: + - BearerAuth: [] + summary: Get all roles + tags: + - User Management /v1/server: get: consumes: @@ -557,6 +737,48 @@ paths: tags: - Server /v1/server/{id}: + delete: + consumes: + - application/json + description: Delete an existing ACC server + parameters: + - description: Server ID (UUID format) + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: Deleted server details + schema: + type: object + "400": + description: Invalid server data or ID + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "403": + description: Insufficient permissions + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "404": + description: Server not found + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + "500": + description: Internal server error + schema: + $ref: '#/definitions/error_handler.ErrorResponse' + security: + - BearerAuth: [] + summary: Delete an ACC server + tags: + - Server get: consumes: - application/json @@ -792,20 +1014,7 @@ paths: summary: Update server configuration file tags: - Server Configuration - /v1/service-control: - get: - description: Return service control status - responses: - "200": - description: OK - schema: - items: - type: string - type: array - summary: Return service control status - tags: - - service-control - /v1/service-control/{service}: + /v1/server/{id}/service/{service}: get: consumes: - application/json @@ -849,7 +1058,7 @@ paths: summary: Get service status tags: - Service Control - /v1/service-control/restart: + /v1/server/{id}/service/restart: post: consumes: - application/json @@ -899,7 +1108,7 @@ paths: summary: Restart a Windows service tags: - Service Control - /v1/service-control/start: + /v1/server/{id}/service/start: post: consumes: - application/json @@ -953,7 +1162,7 @@ paths: summary: Start a Windows service tags: - Service Control - /v1/service-control/stop: + /v1/server/{id}/service/stop: post: consumes: - application/json @@ -1033,6 +1242,19 @@ paths: summary: Return StateHistorys tags: - StateHistory + /v1/system/health: + get: + description: Return service control status + responses: + "200": + description: OK + schema: + items: + type: string + type: array + summary: Return service control status + tags: + - system schemes: - http - https