Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MaxAsyncActionTimeout = 30 * time.Minute
MaxAsyncActionTimeout is the maximum amount of time an asynchronous action can take before it's forcibly cancelled
Functions ¶
This section is empty.
Types ¶
type Dependencies ¶
type Dependencies struct { DataLayer persistence.DataLayer GitHubEventWebhook *ghevent.GitHubEventWebhook EnvironmentSpawner spawner.EnvironmentSpawner ServerConfig config.ServerConfig NRApplication newrelic.Application Logger *log.Logger }
Dependencies are the dependencies required for the API
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher is the concrete implementation of Manager
func NewDispatcher ¶
func NewDispatcher(s *http.Server) *Dispatcher
NewDispatcher returns an initialized Dispatcher. s should be preconfigured to be able to run ListenAndServeTLS()
func (*Dispatcher) RegisterVersions ¶
func (d *Dispatcher) RegisterVersions(deps *Dependencies, ro ...RegisterOption) error
RegisterVersions registers all API versions with the supplied http.Server
func (*Dispatcher) WaitForAsync ¶
func (d *Dispatcher) WaitForAsync()
WaitAsync waits for any async goroutines to finish
func (*Dispatcher) WaitForHandlers ¶
func (d *Dispatcher) WaitForHandlers()
WaitHandlers waits for any handlers that have used waitMiddleware to finish
type Manager ¶
type Manager interface { RegisterVersions(deps *Dependencies) Wait() }
Manager describes an object capable of registering API versions and waiting on requests
type RegisterOption ¶
type RegisterOption func(*registerOptions)
RegisterOption is an option for RegisterVersions()
func WithAPIKeys ¶
func WithAPIKeys(keys []string) RegisterOption
WithAPIKeys supplies API keys for protected endpoints
func WithDebugEndpoints ¶
func WithDebugEndpoints() RegisterOption
WithDebugEndpoints causes RegisterVersions to register debug pprof endpoints
func WithIPWhitelist ¶
func WithIPWhitelist(ips []string) RegisterOption
WithIPWhitelist supplies IP CIDRs for whitelisted endpoints. Invalid CIDRs are ignored.