Back to godoc.org

Package routes

v0.0.0-...-afdeb59
Latest Go to latest

The latest major version is .

Published: Jul 3, 2020 | License: Apache-2.0 | Module: github.com/odahu/odahu-flow/packages/operator

Index

Constants

const (
	WritingDataErrorMessage              = "Writing swagger data is failed"
	ReadingFromVFSErrorMessage           = "Error while reading swagger files from virtual file system"
	ReadingSwaggerDefinitionErrorMessage = "Reading of a swagger definition is failed"
)

Error messages

const (
	MaxSize                 = 500
	FirstPage               = 0
	SizeURLParamName        = "size"
	PageURLParamName        = "page"
	DisabledAPIErrorMessage = "This API is disabled"
)
const (
	ContentTypeHeaderKey = "Content-Type"
)
const (
	HealthCheckURL = "/health"
)

func CalculateHTTPStatusCode

func CalculateHTTPStatusCode(err error) int

We should develop a custom exception on the repository layer. But we rely on kubernetes exceptions for now. TODO: implement Odahuflow exceptions

func DisableAPIMiddleware

func DisableAPIMiddleware(enabledAPI bool) gin.HandlerFunc

func GetTimeNowTruncatedToSeconds

func GetTimeNowTruncatedToSeconds() metav1.Time

Because k8s has only "seconds" precision therefore we should operate the same precision in tests to compare timings in appropriate way

func SetUpHealthCheck

func SetUpHealthCheck(server *gin.Engine)

func SetUpPrometheus

func SetUpPrometheus(server *gin.Engine)

func SetUpSwagger

func SetUpSwagger(rg *gin.RouterGroup, apiStaticFS http.FileSystem)

func SwaggerHandler

func SwaggerHandler(apiStaticFS http.FileSystem, swaggerDefReader SwaggerDefinitionReader) gin.HandlerFunc

func URLParamsToFilter

func URLParamsToFilter(c *gin.Context, filter interface{}, fields map[string]int) (size int, page int, err error)

type HTTPResult

type HTTPResult struct {
	// Success of error message
	Message string `json:"message"`
}

type SwaggerDefinitionReader

type SwaggerDefinitionReader func() (string, error)

It returns a v2 or v3 swagger definition as a string. Example of the definition is https://petstore.swagger.io/v2/swagger.json

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier