handlers

package
v1.112.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppSlugMiddleware

func AppSlugMiddleware(next http.Handler) http.Handler

func GetContextParams

func GetContextParams(r *http.Request) types.UpgradeServiceParams

func JSON

func JSON(w http.ResponseWriter, code int, payload interface{})

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

func NewLoggingResponseWriter

func NewLoggingResponseWriter(w http.ResponseWriter) *loggingResponseWriter

func ParamsMiddleware

func ParamsMiddleware(params types.UpgradeServiceParams) mux.MiddlewareFunc

func RegisterAPIRoutes

func RegisterAPIRoutes(r *mux.Router, handler UpgradeServiceHandler)

func SetContextParams

func SetContextParams(r *http.Request, params types.UpgradeServiceParams) *http.Request

Types

type CurrentConfigResponse

type CurrentConfigResponse struct {
	Success          bool                                     `json:"success"`
	Error            string                                   `json:"error,omitempty"`
	ConfigGroups     []kotsv1beta1.ConfigGroup                `json:"configGroups"`
	ValidationErrors []configtypes.ConfigGroupValidationError `json:"validationErrors,omitempty"`
}

type DeployRequest

type DeployRequest struct {
	IsSkipPreflights             bool `json:"isSkipPreflights"`
	ContinueWithFailedPreflights bool `json:"continueWithFailedPreflights"`
}

type DeployResponse

type DeployResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

type DownloadFileFromConfigResponse

type DownloadFileFromConfigResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

type GetPreflightResultResponse

type GetPreflightResultResponse struct {
	PreflightProgress string                         `json:"preflightProgress,omitempty"`
	PreflightResult   preflighttypes.PreflightResult `json:"preflightResult"`
}

type Handler

type Handler struct {
}

func (*Handler) CurrentConfig

func (h *Handler) CurrentConfig(w http.ResponseWriter, r *http.Request)

func (*Handler) Deploy

func (h *Handler) Deploy(w http.ResponseWriter, r *http.Request)

func (*Handler) DownloadFileFromConfig

func (h *Handler) DownloadFileFromConfig(w http.ResponseWriter, r *http.Request)

func (*Handler) GetPreflightResult

func (h *Handler) GetPreflightResult(w http.ResponseWriter, r *http.Request)

func (*Handler) Info

func (h *Handler) Info(w http.ResponseWriter, r *http.Request)

func (*Handler) LiveConfig

func (h *Handler) LiveConfig(w http.ResponseWriter, r *http.Request)

func (*Handler) Ping

func (h *Handler) Ping(w http.ResponseWriter, r *http.Request)

func (*Handler) SaveConfig

func (h *Handler) SaveConfig(w http.ResponseWriter, r *http.Request)

func (*Handler) StartPreflightChecks

func (h *Handler) StartPreflightChecks(w http.ResponseWriter, r *http.Request)

type InfoResponse

type InfoResponse struct {
	Success        bool   `json:"success"`
	Error          string `json:"error,omitempty"`
	HasPreflight   bool   `json:"hasPreflight"`
	IsConfigurable bool   `json:"isConfigurable"`
}

type LiveConfigRequest

type LiveConfigRequest struct {
	ConfigGroups []kotsv1beta1.ConfigGroup `json:"configGroups"`
}

type LiveConfigResponse

type LiveConfigResponse struct {
	Success          bool                                     `json:"success"`
	Error            string                                   `json:"error,omitempty"`
	ConfigGroups     []kotsv1beta1.ConfigGroup                `json:"configGroups"`
	ValidationErrors []configtypes.ConfigGroupValidationError `json:"validationErrors,omitempty"`
}

type PingResponse

type PingResponse struct {
	Ping string `json:"ping"`
}

type SPAHandler

type SPAHandler struct {
}

SPAHandler implements the http.Handler interface, so we can use it to respond to HTTP requests. The path to the static directory and path to the index file within that static directory are used to serve the SPA in the given static directory.

func (SPAHandler) ServeHTTP

func (h SPAHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP inspects the URL path to locate a file within the static dir on the SPA handler. If a file is found, it will be served. If not, the file located at the index path on the SPA handler will be served. This is suitable behavior for serving an SPA (single page application).

type SaveConfigRequest

type SaveConfigRequest struct {
	ConfigGroups []kotsv1beta1.ConfigGroup `json:"configGroups"`
}

type SaveConfigResponse

type SaveConfigResponse struct {
	Success          bool                                     `json:"success"`
	Error            string                                   `json:"error,omitempty"`
	RequiredItems    []string                                 `json:"requiredItems,omitempty"`
	ValidationErrors []configtypes.ConfigGroupValidationError `json:"validationErrors,omitempty"`
}

type StatusNotFoundHandler

type StatusNotFoundHandler struct {
}

func (StatusNotFoundHandler) ServeHTTP

type UpgradeServiceHandler

type UpgradeServiceHandler interface {
	Info(w http.ResponseWriter, r *http.Request)
	Ping(w http.ResponseWriter, r *http.Request)

	CurrentConfig(w http.ResponseWriter, r *http.Request)
	LiveConfig(w http.ResponseWriter, r *http.Request)
	SaveConfig(w http.ResponseWriter, r *http.Request)
	DownloadFileFromConfig(w http.ResponseWriter, r *http.Request)

	StartPreflightChecks(w http.ResponseWriter, r *http.Request)
	GetPreflightResult(w http.ResponseWriter, r *http.Request)

	Deploy(w http.ResponseWriter, r *http.Request)
}

Jump to

Keyboard shortcuts

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