Documentation ¶
Overview ¶
Package rest_handlers provides rest handlers
Index ¶
- Variables
- func FileHandler(mongodbOperator mongodb.MongoOperator, kubeClients *k8s.KubeClients) gin.HandlerFunc
- func LoggingMiddleware() gin.HandlerFunc
- func PlaygroundHandler() gin.HandlerFunc
- func ReadinessHandler(mongoClient *mongo.Client, mongodbOperator mongodb.MongoOperator) gin.HandlerFunc
- func StatusHandler(c *gin.Context)
- func WorkflowHelperImageVersionHandler(c *gin.Context)
- type APIStatus
- type ReadinessAPIStatus
- type WorkflowHelperImageVersion
Constants ¶
This section is empty.
Variables ¶
View Source
var GetIconHandler = gin.HandlerFunc(func(c *gin.Context) { replacer := strings.NewReplacer("..", "", "../", "", "/", "", "\\", "") var ( projectID = replacer.Replace(c.Param("ProjectID")) hubName = replacer.Replace(c.Param("HubName")) chartName = replacer.Replace(c.Param("ChartName")) iconName = replacer.Replace(c.Param("IconName")) img *os.File err error responseStatusCode = http.StatusOK ) if strings.ToLower(chartName) == "predefined" { img, err = os.Open("/tmp/version/" + projectID + "/" + hubName + "/workflows/icons/" + iconName) } else { img, err = os.Open("/tmp/version/" + projectID + "/" + hubName + "/charts/" + chartName + "/icons/" + iconName) } if err != nil { responseStatusCode = http.StatusInternalServerError fmt.Fprint(c.Writer, "icon cannot be fetched, err : "+err.Error()) } defer img.Close() c.Writer.Header().Set("Access-Control-Allow-Origin", "*") c.Writer.WriteHeader(responseStatusCode) c.Writer.Header().Set("Content-Type", "image/png") io.Copy(c.Writer, img) })
GetIconHandler ...
Functions ¶
func FileHandler ¶
func FileHandler(mongodbOperator mongodb.MongoOperator, kubeClients *k8s.KubeClients) gin.HandlerFunc
FileHandler dynamically generates the manifest file and sends it as a response
func LoggingMiddleware ¶
func LoggingMiddleware() gin.HandlerFunc
LoggingMiddleware is a middleware that logs the request as it goes in and the response as it goes out.
func PlaygroundHandler ¶
func PlaygroundHandler() gin.HandlerFunc
PlaygroundHandler returns GraphQL playground ui
func ReadinessHandler ¶
func ReadinessHandler(mongoClient *mongo.Client, mongodbOperator mongodb.MongoOperator) gin.HandlerFunc
ReadinessHandler returns current status of this application
func StatusHandler ¶
StatusHandler returns current status of this application
func WorkflowHelperImageVersionHandler ¶
WorkflowHelperImageVersionHandler is used to provide workflow helper's image version
Types ¶
type ReadinessAPIStatus ¶
type WorkflowHelperImageVersion ¶
type WorkflowHelperImageVersion struct {
Version string `json:"version"`
}
Click to show internal directories.
Click to hide internal directories.