Documentation ¶
Index ¶
- Variables
- func GetTX(c echo.Context) newrelic.Transaction
- func WithSegment(name string, c echo.Context, f func() error) error
- type AppAuthMiddleware
- type Application
- func (a *Application) CreateUserHandler(c echo.Context) error
- func (a *Application) DeleteAppHandler(c echo.Context) error
- func (a *Application) DeleteTemplateHandler(c echo.Context) error
- func (a *Application) DeleteUserHandler(c echo.Context) error
- func (a *Application) GetAppHandler(c echo.Context) error
- func (a *Application) GetJobHandler(c echo.Context) error
- func (a *Application) GetTemplateHandler(c echo.Context) error
- func (a *Application) GetUploadURL(c echo.Context) error
- func (a *Application) GetUserHandler(c echo.Context) error
- func (a *Application) HealthcheckHandler(c echo.Context) error
- func (a *Application) ListAppsHandler(c echo.Context) error
- func (a *Application) ListJobsHandler(c echo.Context) error
- func (a *Application) ListTemplatesHandler(c echo.Context) error
- func (a *Application) ListUsersHandler(c echo.Context) error
- func (a *Application) OnErrorHandler(err error, stack []byte)
- func (a *Application) PauseJobHandler(c echo.Context) error
- func (a *Application) PostAppHandler(c echo.Context) error
- func (a *Application) PostJobHandler(c echo.Context) error
- func (a *Application) PostTemplateHandler(c echo.Context) error
- func (a *Application) PutAppHandler(c echo.Context) error
- func (a *Application) PutTemplateHandler(c echo.Context) error
- func (a *Application) ResumeJobHandler(c echo.Context) error
- func (a *Application) Start()
- func (a *Application) StopJobHandler(c echo.Context) error
- func (a *Application) UpdateUserHandler(c echo.Context) error
- type Error
- type Health
- type InputValidation
- type LoggerMiddleware
- type NewRelicMiddleware
- type RecoveryMiddleware
- type SentryMiddleware
- type UploadAuthMiddleware
- type UserAuthMiddleware
- type VersionMiddleware
Constants ¶
This section is empty.
Variables ¶
var RecordNotFoundString = "pg: no rows in result set"
RecordNotFoundString is the string returned when a record is not found
var VERSION = "3.1.11"
VERSION identifies marathon's current version
Functions ¶
Types ¶
type AppAuthMiddleware ¶
type AppAuthMiddleware struct {
App *Application
}
AppAuthMiddleware automatically adds a version header to response
func NewAppAuthMiddleware ¶
func NewAppAuthMiddleware(app *Application) *AppAuthMiddleware
NewAppAuthMiddleware returns a configured auth middleware
func (AppAuthMiddleware) Serve ¶
func (a AppAuthMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve Validate that a user exists
type Application ¶
type Application struct { Debug bool API *echo.Echo Logger zap.Logger Port int Host string DB interfaces.DB PushDB interfaces.DB ConfigPath string Config *viper.Viper NewRelic newrelic.Application Worker *worker.Worker S3Client interfaces.S3 SendgridClient *extensions.SendgridClient }
Application is the api main struct
func GetApplication ¶
func GetApplication(host string, port int, debug bool, l zap.Logger, configPath string) *Application
GetApplication returns a configured api
func (*Application) CreateUserHandler ¶
func (a *Application) CreateUserHandler(c echo.Context) error
CreateUserHandler is the method called when a post to /users is called
func (*Application) DeleteAppHandler ¶
func (a *Application) DeleteAppHandler(c echo.Context) error
DeleteAppHandler is the method called when a delete to /apps/:aid is called
func (*Application) DeleteTemplateHandler ¶ added in v0.5.0
func (a *Application) DeleteTemplateHandler(c echo.Context) error
DeleteTemplateHandler is the method called when a delete to /apps/:aid/templates/:tid is called
func (*Application) DeleteUserHandler ¶
func (a *Application) DeleteUserHandler(c echo.Context) error
DeleteUserHandler is the method called when a delete to /users/:id is called
func (*Application) GetAppHandler ¶
func (a *Application) GetAppHandler(c echo.Context) error
GetAppHandler is the method called when a get to /apps/:aid is called
func (*Application) GetJobHandler ¶ added in v0.5.0
func (a *Application) GetJobHandler(c echo.Context) error
GetJobHandler is the method called when a get to /apps/:aid/templates/:templateName/jobs/:jid is called
func (*Application) GetTemplateHandler ¶ added in v0.5.0
func (a *Application) GetTemplateHandler(c echo.Context) error
GetTemplateHandler is the method called when a get to /apps/:aid/templates/:tid is called
func (*Application) GetUploadURL ¶ added in v0.5.0
func (a *Application) GetUploadURL(c echo.Context) error
GetUploadURL handles a file upload
func (*Application) GetUserHandler ¶
func (a *Application) GetUserHandler(c echo.Context) error
GetUserHandler is the method called when a get to /users/:id is called
func (*Application) HealthcheckHandler ¶
func (a *Application) HealthcheckHandler(c echo.Context) error
HealthcheckHandler is the method called when a get to /healthcheck is called
func (*Application) ListAppsHandler ¶ added in v0.5.0
func (a *Application) ListAppsHandler(c echo.Context) error
ListAppsHandler is the method called when a get to /apps is called
func (*Application) ListJobsHandler ¶ added in v0.5.0
func (a *Application) ListJobsHandler(c echo.Context) error
ListJobsHandler is the method called when a get to /apps/:aid/templates/:templateName/jobs is called
func (*Application) ListTemplatesHandler ¶ added in v0.5.0
func (a *Application) ListTemplatesHandler(c echo.Context) error
ListTemplatesHandler is the method called when a get to /apps/:aid/templates is called
func (*Application) ListUsersHandler ¶
func (a *Application) ListUsersHandler(c echo.Context) error
ListUsersHandler is the method called when a get to /users is called
func (*Application) OnErrorHandler ¶
func (a *Application) OnErrorHandler(err error, stack []byte)
OnErrorHandler handles panics
func (*Application) PauseJobHandler ¶ added in v0.5.0
func (a *Application) PauseJobHandler(c echo.Context) error
PauseJobHandler is the method called when a put to apps/:id/jobs/:jid/pause is called
func (*Application) PostAppHandler ¶
func (a *Application) PostAppHandler(c echo.Context) error
PostAppHandler is the method called when a post to /apps is called
func (*Application) PostJobHandler ¶ added in v0.5.0
func (a *Application) PostJobHandler(c echo.Context) error
PostJobHandler is the method called when a post to /apps/:aid/templates/:templateName/jobs is called
func (*Application) PostTemplateHandler ¶ added in v0.5.0
func (a *Application) PostTemplateHandler(c echo.Context) error
PostTemplateHandler is the method called when a post to /apps/:aid/templates is called
func (*Application) PutAppHandler ¶
func (a *Application) PutAppHandler(c echo.Context) error
PutAppHandler is the method called when a put to /apps/:aid is called
func (*Application) PutTemplateHandler ¶ added in v0.5.0
func (a *Application) PutTemplateHandler(c echo.Context) error
PutTemplateHandler is the method called when a put to /apps/:aid/templates/:tid is called
func (*Application) ResumeJobHandler ¶ added in v0.5.0
func (a *Application) ResumeJobHandler(c echo.Context) error
ResumeJobHandler is the method called when a put to apps/:id/jobs/:jid/resume is called
func (*Application) StopJobHandler ¶ added in v0.5.0
func (a *Application) StopJobHandler(c echo.Context) error
StopJobHandler is the method called when a put to apps/:id/jobs/:jid/stop is called
func (*Application) UpdateUserHandler ¶
func (a *Application) UpdateUserHandler(c echo.Context) error
UpdateUserHandler is the method called when a put to /users/:id is called
type Error ¶
type Error struct { Reason string `json:"reason"` Value InputValidation `json:"value"` }
Error is a struct to help return errors
type Health ¶
type Health struct {
Healthy bool `json:"healthy"`
}
Health is a struct to help healthcheck handler
type InputValidation ¶
InputValidation is an interface for all "input submission" structs used for deserialization
type LoggerMiddleware ¶
LoggerMiddleware is responsible for logging to Zap all requests
func NewLoggerMiddleware ¶
func NewLoggerMiddleware(theLogger zap.Logger) *LoggerMiddleware
NewLoggerMiddleware returns the logger middleware
func (*LoggerMiddleware) Serve ¶
func (l *LoggerMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware
type NewRelicMiddleware ¶
type NewRelicMiddleware struct { App *Application Logger zap.Logger }
NewRelicMiddleware is responsible for logging to Zap all requests
func NewNewRelicMiddleware ¶
func NewNewRelicMiddleware(app *Application, theLogger zap.Logger) *NewRelicMiddleware
NewNewRelicMiddleware returns the logger middleware
func (*NewRelicMiddleware) Serve ¶
func (nr *NewRelicMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware
type RecoveryMiddleware ¶
RecoveryMiddleware recovers from errors
func NewRecoveryMiddleware ¶
func NewRecoveryMiddleware(onError func(error, []byte)) *RecoveryMiddleware
NewRecoveryMiddleware returns a configured middleware
func (*RecoveryMiddleware) Serve ¶
func (r *RecoveryMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve executes on error handler when errors happen
type SentryMiddleware ¶
type SentryMiddleware struct {
Application *Application
}
SentryMiddleware is responsible for sending all exceptions to sentry
func NewSentryMiddleware ¶
func NewSentryMiddleware(app *Application) *SentryMiddleware
NewSentryMiddleware returns a new sentry middleware
func (*SentryMiddleware) Serve ¶
func (s *SentryMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware
type UploadAuthMiddleware ¶
type UploadAuthMiddleware struct {
App *Application
}
UploadAuthMiddleware automatically adds a version header to response
func NewUploadAuthMiddleware ¶
func NewUploadAuthMiddleware(app *Application) *UploadAuthMiddleware
NewUploadAuthMiddleware returns a configured auth middleware
func (UploadAuthMiddleware) Serve ¶
func (a UploadAuthMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve Validate that a user exists
type UserAuthMiddleware ¶
type UserAuthMiddleware struct {
App *Application
}
UserAuthMiddleware automatically adds a version header to response
func NewUserAuthMiddleware ¶
func NewUserAuthMiddleware(app *Application) *UserAuthMiddleware
NewUserAuthMiddleware returns a configured auth middleware
func (UserAuthMiddleware) Serve ¶
func (a UserAuthMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve Validate that a user exists
type VersionMiddleware ¶
type VersionMiddleware struct {
Version string
}
VersionMiddleware inserts the current version in all requests
func NewVersionMiddleware ¶
func NewVersionMiddleware() *VersionMiddleware
NewVersionMiddleware with API version
func (*VersionMiddleware) Serve ¶
func (v *VersionMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware