Documentation ¶
Overview ¶
Most endpoints do not require authentication.
Those which do will be marked. Provide authentication as a bearer token in the `Authorization` header.
Endpoints which specify a response of `None` will return the JSON: `{"ok": true}`.
Index ¶
- func ComputeGHWebhookSignature(secret, body []byte) string
- type AppByIDHandler
- type AppCategoriesHandler
- type AppSearchHandler
- type AppTagsHandler
- type AppsDeployHandler
- type AppsDeployResourcesHandler
- type BaseHandler
- type CORSHandler
- type DeployInstructionsHandler
- type HealthHandler
- type MetricsHandler
- type NaturalSearchHandler
- type PanicHandler
- type PreFlightOptionsHandler
- type ReqLoggerHandler
- type WebhookHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeGHWebhookSignature ¶
ComputeGHWebhookSignature creates the expected X-Hub-Signature header value for a body. WARNING: Compare the resulting signature with crypto/hmax.Equal for security purposes.
Types ¶
type AppByIDHandler ¶
type AppByIDHandler struct {
BaseHandler
}
AppByIDHandler returns a single app by ID from the database
func (AppByIDHandler) ServeHTTP ¶
func (h AppByIDHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type AppCategoriesHandler ¶
type AppCategoriesHandler struct {
BaseHandler
}
AppCategoriesHandler is used to get all the categories stored in the database, can also be used to get categories of matched apps if query is provided
func (AppCategoriesHandler) ServeHTTP ¶
func (h AppCategoriesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type AppSearchHandler ¶
type AppSearchHandler struct {
BaseHandler
}
func (AppSearchHandler) ServeHTTP ¶
func (h AppSearchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type AppTagsHandler ¶
type AppTagsHandler struct {
BaseHandler
}
AppTagsHandler is used to get all the tags stored in the database, can also be used to get tags of matched apps if query is provided
func (AppTagsHandler) ServeHTTP ¶
func (h AppTagsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type AppsDeployHandler ¶
type AppsDeployHandler struct {
BaseHandler
}
AppsDeployHandler returns a custom Bash deployment script for the specified app
func (AppsDeployHandler) ServeHTTP ¶
func (h AppsDeployHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type AppsDeployResourcesHandler ¶
type AppsDeployResourcesHandler struct {
BaseHandler
}
AppsDeployResourcesHandler returns JSON formatted Kubernetes resource manifests for the specified app
func (AppsDeployResourcesHandler) ServeHTTP ¶
func (h AppsDeployResourcesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type BaseHandler ¶
type BaseHandler struct { // Ctx is the application context Ctx context.Context // Logger logs information Logger golog.Logger // Cfg is the application configuration Cfg *config.Config // Metrics holds Prometheus internal metrics recorders Metrics metrics.Metrics // MDb is a MongoDB database instance MDb *mongo.Database // MDbApps is the MongoDB apps collection instance MDbApps *mongo.Collection // Gh is the GitHub API client Gh *github.Client }
func (BaseHandler) GetChild ¶
func (h BaseHandler) GetChild(prefix string) BaseHandler
GetChild makes a child instance of the base handler with a prefix
func (BaseHandler) ParseJSON ¶
func (h BaseHandler) ParseJSON(r *http.Request, dest interface{})
ParseJSON parses a request body as JSON
func (BaseHandler) RespondJSON ¶
func (h BaseHandler) RespondJSON(w http.ResponseWriter, status int, resp interface{})
RespondJSON sends an object as a JSON encoded response
func (BaseHandler) RespondTEXT ¶
func (h BaseHandler) RespondTEXT(w http.ResponseWriter, status int, resp string)
RespondTEXT sends an object as a TEXT encoded response
type CORSHandler ¶
type CORSHandler struct { BaseHandler // Handler to enabled CORS for Handler http.Handler }
CORSHandler enables cross origin resource sharing (CORS)
func (CORSHandler) ServeHTTP ¶
func (h CORSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP runs CorsHandler.Handler with CORS enabled
type DeployInstructionsHandler ¶
type DeployInstructionsHandler struct {
BaseHandler
}
DeployInstructionsHandler provides user with deployment instructions
func (DeployInstructionsHandler) ServeHTTP ¶
func (h DeployInstructionsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.ServerHTTP
type HealthHandler ¶
type HealthHandler struct {
BaseHandler
}
HealthHandler is used to determine if the server is running
func (HealthHandler) ServeHTTP ¶
func (h HealthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type MetricsHandler ¶
type MetricsHandler struct { BaseHandler // Handler will actually handle requests Handler http.Handler }
MetricsHandler exports custom API metrics.
The PanicHandler is the only other middleware handler that exports metrics. This is neccessary due to the nature of the metrics it collects.
func (MetricsHandler) ServeHTTP ¶
func (h MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP will observe custom metrics and let the .Handler handle the request
type NaturalSearchHandler ¶
type NaturalSearchHandler struct {
BaseHandler
}
NaturalSearchHandler is used search apps and return result in case of an empty query, it returns all the apps in the database
func (NaturalSearchHandler) ServeHTTP ¶
func (h NaturalSearchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type PanicHandler ¶
type PanicHandler struct { BaseHandler // Handler to run Handler http.Handler }
func (PanicHandler) ServeHTTP ¶
func (h PanicHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type PreFlightOptionsHandler ¶
type PreFlightOptionsHandler struct {
BaseHandler
}
PreFlightOptionsHandler responds to OPTIONS requests with headers which set headers required to allow CORS
func (PreFlightOptionsHandler) ServeHTTP ¶
func (h PreFlightOptionsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type ReqLoggerHandler ¶
type ReqLoggerHandler struct { BaseHandler // Handler to actually handle requests Handler http.Handler }
ReqLoggerHandler logs every request
func (ReqLoggerHandler) ServeHTTP ¶
func (h ReqLoggerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type WebhookHandler ¶
type WebhookHandler struct { BaseHandler // JobRunner is used to run jobs JobRunner *jobs.JobRunner }
WebhookHandler handles GitHub App pull requests
func (WebhookHandler) ServeHTTP ¶
func (h WebhookHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements net.Handler