service

package
v0.0.0-...-2dc2d1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2025 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceHandler

type ServiceHandler struct {
	DB             *pgxpool.Pool
	ConnectionPool *connection.ConnectionPool
	DockerPool     *connection.ConnectionPool
}

func (*ServiceHandler) CreateServiceCompose

func (h *ServiceHandler) CreateServiceCompose(w http.ResponseWriter, r *http.Request)

CreateServiceCompose godoc @Summary Create a new service @Description Creates a new service with Docker compose configuration within a team and project @Tags service @Accept json @Produce json @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param request body createServiceRequest true "Service creation request" @Success 201 {object} response.SuccessResponse{data=models.Service} "Service created successfully" @Failure 400 {object} response.ErrorResponse "Invalid request body, team access denied, or project not found" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/compose [post] @Security BearerAuth

func (*ServiceHandler) DeleteService

func (h *ServiceHandler) DeleteService(w http.ResponseWriter, r *http.Request)

DeleteService godoc @Summary Delete service with complete cleanup @Description Deletes a service including stopping Docker containers, removing networks/volumes, and cleaning up all related database records @Tags service @Produce json @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Success 200 {object} response.SuccessResponse "Service deleted successfully" @Failure 400 {object} response.ErrorResponse "Invalid request or team access denied" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 404 {object} response.ErrorResponse "Service not found" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID} [delete] @Security BearerAuth

func (*ServiceHandler) GetContainerLogs

func (h *ServiceHandler) GetContainerLogs(w http.ResponseWriter, r *http.Request)

GetContainerLogs godoc @Summary Get container logs with SSE streaming @Description Retrieves Docker container logs for a specific service container with real-time streaming via Server-Sent Events @Tags service @Accept json @Produce text/event-stream @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Param containerID path string true "Container ID (from service_containers table)" @Param follow query bool false "Follow log output (stream continuously)" default(false) @Param tail query string false "Number of lines to show from end of logs" default("100") @Param timestamps query bool false "Include timestamps in log output" default(false) @Param since query string false "Show logs since timestamp (RFC3339 format)" example("2023-01-01T00:00:00Z") @Success 200 {string} string "SSE stream of container logs" @Failure 400 {object} response.ErrorResponse "Team access denied, service/container not found, or invalid parameters" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID}/containers/{contUNAUTHORIZEDainerID}/logs [get] @Security BearerAuth

func (*ServiceHandler) GetContainers

func (h *ServiceHandler) GetContainers(w http.ResponseWriter, r *http.Request)

GetContainers godoc @Summary Get all containers for a service @Description Retrieves all containers associated with a specific service within a project and team @Tags service @Accept json @Produce json @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Success 200 {object} response.SuccessResponse{data=[]models.ServiceContainer} "List of service containers" @Failure 400 {object} response.ErrorResponse "Team access denied or service not found" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID}/containers [get] @Security BearerAuth

func (*ServiceHandler) GetService

func (h *ServiceHandler) GetService(w http.ResponseWriter, r *http.Request)

GetService godoc @Summary Get a single service by ID @Description Retrieves a specific service by its ID within a project and team @Tags service @Accept json @Produce json @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Success 200 {object} response.SuccessResponse{data=models.Service} "Service details" @Failure 400 {object} response.ErrorResponse "Team access denied or service not found" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID} [get] @Security BearerAuth

func (*ServiceHandler) GetServiceCompose

func (h *ServiceHandler) GetServiceCompose(w http.ResponseWriter, r *http.Request)

GetServiceCompose godoc @Summary Get service Docker Compose configuration @Description Retrieves the Docker Compose configuration for a specific service @Tags service @Accept json @Produce json @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Success 200 {object} response.SuccessResponse{data=models.ServiceComposeConfig} "Service compose configuration" @Failure 400 {object} response.ErrorResponse "Team access denied or compose config not found" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID}/compose [get] @Security BearerAuth

func (*ServiceHandler) GetServiceEnvironments

func (h *ServiceHandler) GetServiceEnvironments(w http.ResponseWriter, r *http.Request)

GetServiceEnvironments godoc @Summary Get all environment variables for a service @Description Retrieves all environment variables for a specific service within a team and project @Tags service @Accept json @Produce json @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Success 200 {object} response.SuccessResponse{data=[]models.ServiceEnvironment} "Environment variables retrieved successfully" @Failure 400 {object} response.ErrorResponse "Invalid request or team access denied" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 404 {object} response.ErrorResponse "Service not found" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID}/env [get] @Security BearerAuth

func (*ServiceHandler) GetServices

func (h *ServiceHandler) GetServices(w http.ResponseWriter, r *http.Request)

GetServices godoc @Summary Get all services for a project @Description Retrieves all services belonging to a specific project within a team @Tags service @Accept json @Produce json @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Success 200 {object} response.SuccessResponse{data=[]models.Service} "List of services" @Failure 400 {object} response.ErrorResponse "Team access denied" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services [get] @Security BearerAuth

func (*ServiceHandler) UpdateService

func (h *ServiceHandler) UpdateService(w http.ResponseWriter, r *http.Request)

UpdateService godoc @Summary Update service metadata @Description Updates service metadata (name, description, type) within a team and project @Tags service @Accept json @Produce json @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Param request body updateServiceRequest true "Service update request" @Success 200 {object} response.SuccessResponse{data=models.Service} "Service updated successfully" @Failure 400 {object} response.ErrorResponse "Invalid request body or team access denied" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 404 {object} response.ErrorResponse "Service not found" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID} [patch] @Security BearerAuth

func (*ServiceHandler) UpdateServiceCompose

func (h *ServiceHandler) UpdateServiceCompose(w http.ResponseWriter, r *http.Request)

UpdateServiceCompose godoc @Summary Update service Docker Compose configuration @Description Updates the Docker Compose configuration for a specific service @Tags service @Accept json @Produce text/event-stream @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Param request body updateServiceComposeRequest true "Service compose update request" @Success 200 {string} string "SSE stream of compose update and rebuild progress" @Failure 400 {object} response.ErrorResponse "Invalid request body, team access denied, or service not found" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID}/compose [patch] @Security BearerAuth

func (*ServiceHandler) UpdateServiceEnvironments

func (h *ServiceHandler) UpdateServiceEnvironments(w http.ResponseWriter, r *http.Request)

UpdateServiceEnvironments godoc @Summary Update multiple environment variables for a service @Description Updates multiple existing environment variables for a specific service within a team and project @Tags service @Accept json @Produce json @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Param request body updateServiceEnvironmentsRequest true "Batch environment variables update request" @Success 200 {object} response.SuccessResponse{data=[]models.ServiceEnvironment} "Environment variables updated successfully" @Failure 400 {object} response.ErrorResponse "Invalid request body or team access denied" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 404 {object} response.ErrorResponse "Service or environment variable not found" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID}/env [patch] @Security BearerAuth

func (*ServiceHandler) UpdateServiceState

func (h *ServiceHandler) UpdateServiceState(w http.ResponseWriter, r *http.Request)

UpdateServiceState godoc @Summary Update service state with SSE streaming @Description Updates service state (start/stop/restart/rebuild) with real-time progress streaming via Server-Sent Events @Tags service @Accept json @Produce text/event-stream @Param teamID path string true "Team ID" @Param projectID path string true "Project ID" @Param serviceID path string true "Service ID" @Param request body updateServiceStateRequest true "Service state update request" @Success 200 {string} string "SSE stream of service state updates" @Failure 400 {object} response.ErrorResponse "Invalid request body or team access denied" @Failure 401 {object} response.ErrorResponse "User not authenticated" @Failure 404 {object} response.ErrorResponse "Service not found" @Failure 500 {object} response.ErrorResponse "Internal server error" @Router /teams/{teamID}/projects/{projectID}/services/{serviceID}/state [patch] @Security BearerAuth

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址