var ( ErrNS = errorx.NewNamespace("error.api") ErrUnknown = ErrNS.NewType("unknown") // 500 ErrBadRequest = ErrNS.NewType("bad_request") // 400 ErrNotFound = ErrNS.NewType("resource_not_found") // 404 ErrInternalServer = ErrNS.NewType("internal_server_error") // 500 // Custom ErrNoClusterPrivilege = ErrNS.NewType("no_cluster_privilege") // 401 ErrNoNamespacePrivilege = ErrNS.NewType("no_namespace_privilege") // 401 )
var ( ResponseSuccess = Response{Status: "success"} )
func AuthMiddleware(c *gin.Context, config *config.ChaosDashboardConfig)
func SetAPIError(c *gin.Context, err *errorx.Error)
func SetAPImachineryError(c *gin.Context, err error)
func ShouldBindBodyWithJSON(c *gin.Context, obj interface{}) (err error)
type APIError struct { Code int `json:"code"` Type string `json:"type"` Message string `json:"message"` FullText string `json:"full_text"` }
MapSliceResponse is an alias of map[string][]string.
type MapStringSliceResponse map[string][]string
Response defines a common status struct.
type Response struct { Status string `json:"status"` }