handlers

package
v0.0.0-...-b9c19b3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NEW_CLUSTER         = -1
	CLUSTER_DIDNT_EXIST = -2
)
View Source
const (
	JSONerrorIncorrect                     = 11
	JSONerrorIncorrectMessage              = "Incorrect JSON"
	JSONerrorIncorrectField                = 12
	JSONerrorIncorrectFieldMessage         = "Bad name. You should use only alpha-numeric characters and '-' symbols and only alphabetic characters for leading symbol."
	JSONerrorMissField                     = 13
	JSONerrorMissFieldMessage              = "Required field is empty"
	DBerror                                = 21
	DBerrorMessage                         = "DB error"
	LibErrorUUID                           = 31
	LibErrorUUIDMessage                    = "UUID generating error"
	LibErrorStructToJson                   = 32
	LibErrorStructToJsonMessage            = "Struct to JSON converting error"
	UserErrorProjectUnmodField             = 41
	UserErrorProjectUnmodFieldMessage      = "This fields of project or cluster can't be modified"
	UserErrorProjectWithClustersDel        = 42
	UserErrorProjectWithClustersDelMessage = "Project has already had clusters. Delete them first"
	UserErrorClusterExisted                = 43
	UserErrorClusterExistedMessage         = "Cluster with this name has already existed in this project"
	UserErrorClusterStatus                 = 44
	UserErrorClusterStatusMessage          = "Cluster status must be 'CREATED' or 'FAILED' for UPDATE or DELETE"
	UserErrorBadServiceVersion             = 45
	UserErrorBadServiceVersionMessage      = "Incompatible versions between services"
	ImageExisted                           = 50
	ImageExistedMessage                    = "Image with this name already exists"
	ImageUsed                              = 51
	ImageUsedMessage                       = "Image already in use. It can't be modified or deleted"
	ImageUnmodField                        = 52
	ImageUnmodFieldMessage                 = "Some fileds can't be modified"
	AuthorizationHeaderIncorrect           = 61
	AuthorizationHeaderIncorrectMessage    = "Authorization header is empty or doesn't contain access token"
	AuthorizationFailed                    = 62
	AuthorizationFailedMessage             = "Authentication failed"
)

Variables

This section is empty.

Functions

func IsValidType

func IsValidType(t string) bool

list of supported types

func ValidateCluster

func ValidateCluster(hS HttpServer, cluster *proto.Cluster) bool

func ValidateProject

func ValidateProject(project *proto.Project) bool

func ValidateService

func ValidateService(hS HttpServer, service *protobuf.Service) (bool, error)

Types

type ErrorHandler

type ErrorHandler interface {
	Handle(w http.ResponseWriter, code int, message string, err error) (string, error)
}

ErrorHandler handling interface

type ErrorStruct

type ErrorStruct struct {
	ErrorCode    string
	Desription   string
	ErrorMessage string
}

type GrpcClient

type GrpcClient interface {
	StartClusterCreation(c *proto.Cluster)
	StartClusterDestroying(c *proto.Cluster)
	StartClusterModification(c *proto.Cluster)
}

type HttpErrorHandler

type HttpErrorHandler struct{}

func (HttpErrorHandler) Handle

func (httpEH HttpErrorHandler) Handle(w http.ResponseWriter, code int, message string, err error) (string, error)

type HttpServer

type HttpServer struct {
	Gc         GrpcClient
	Logger     *log.Logger
	Db         database.Database
	ErrHandler ErrorHandler
	Auth       auth.Authenticate
	Config     utils.Config
}

func (HttpServer) AddDependencies

func (hS HttpServer) AddDependencies(c *proto.Cluster, curS *proto.Service) ([]*proto.Service, error)

func (HttpServer) ClusterCreate

func (hS HttpServer) ClusterCreate(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ClustersDelete

func (hS HttpServer) ClustersDelete(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ClustersGet

func (hS HttpServer) ClustersGet(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ClustersGetByName

func (hS HttpServer) ClustersGetByName(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ClustersStatusGetByName

func (hS HttpServer) ClustersStatusGetByName(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ClustersUpdate

func (hS HttpServer) ClustersUpdate(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ConfigsCreateConfigParam

func (hS HttpServer) ConfigsCreateConfigParam(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ConfigsCreateService

func (hS HttpServer) ConfigsCreateService(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (HttpServer) ConfigsCreateVersion

func (hS HttpServer) ConfigsCreateVersion(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ConfigsDeleteService

func (hS HttpServer) ConfigsDeleteService(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ConfigsDeleteVersion

func (hS HttpServer) ConfigsDeleteVersion(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ConfigsGetService

func (hS HttpServer) ConfigsGetService(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ConfigsGetServices

func (hS HttpServer) ConfigsGetServices(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (HttpServer) ConfigsGetVersion

func (hS HttpServer) ConfigsGetVersion(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ConfigsGetVersions

func (hS HttpServer) ConfigsGetVersions(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ConfigsUpdateService

func (hS HttpServer) ConfigsUpdateService(w http.ResponseWriter, r *http.Request, params httprouter.Params)

updates only information about service type versions and config params could be updated in ConfigsUpdateVersion

func (HttpServer) ConfigsUpdateVersion

func (hS HttpServer) ConfigsUpdateVersion(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ImageDelete

func (hs HttpServer) ImageDelete(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ImageGet

func (hs HttpServer) ImageGet(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ImagePut

func (hs HttpServer) ImagePut(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ImagesGetList

func (hs HttpServer) ImagesGetList(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (HttpServer) ImagesPost

func (hs HttpServer) ImagesPost(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (HttpServer) ProjectCreate

func (hS HttpServer) ProjectCreate(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (HttpServer) ProjectDelete

func (hS HttpServer) ProjectDelete(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ProjectGetByName

func (hS HttpServer) ProjectGetByName(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ProjectUpdate

func (hS HttpServer) ProjectUpdate(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ProjectsGetList

func (hS HttpServer) ProjectsGetList(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (HttpServer) ServeAnsibleOutput

func (hS HttpServer) ServeAnsibleOutput(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ServeAnsibleServiceLog

func (hS HttpServer) ServeAnsibleServiceLog(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ServeHttpServerLog

func (hS HttpServer) ServeHttpServerLog(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) ServeHttpServerLogstash

func (hS HttpServer) ServeHttpServerLogstash(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) TemplateCreate

func (hS HttpServer) TemplateCreate(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) TemplateDelete

func (hS HttpServer) TemplateDelete(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) TemplateGet

func (hS HttpServer) TemplateGet(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) TemplateUpdate

func (hS HttpServer) TemplateUpdate(w http.ResponseWriter, r *http.Request, params httprouter.Params)

func (HttpServer) TemplatesGetList

func (hS HttpServer) TemplatesGetList(w http.ResponseWriter, r *http.Request, params httprouter.Params)

Jump to

Keyboard shortcuts

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