Documentation ¶
Overview ¶
Package route handles incoming REST requests to the server.
Index ¶
- Constants
- func AddCORSHeaders(allowedOrigins []string, next http.HandlerFunc) http.HandlerFunc
- func AttachHandler(app *gimlet.APIApp, opts HandlerOpts)
- func CheckUnexpirableHostLimitExceeded(ctx context.Context, userId string, maxHosts int) error
- func GetProjectContext(ctx context.Context) *model.Context
- func MustHaveProjectContext(ctx context.Context) *model.Context
- func MustHaveUser(ctx context.Context) *user.DBUser
- func NewCanCreateMiddleware() gimlet.Middleware
- func NewCommitQueueItemOwnerMiddleware() gimlet.Middleware
- func NewGithubAuthMiddleware() gimlet.Middleware
- func NewHostAuthMiddleware() gimlet.Middleware
- func NewMockCommitQueueItemOwnerMiddleware() gimlet.Middleware
- func NewPodAuthMiddleware() gimlet.Middleware
- func NewPodOrHostAuthMiddleWare() gimlet.Middleware
- func NewProjectAdminMiddleware() gimlet.Middleware
- func NewProjectContextMiddleware() gimlet.Middleware
- func NewRepoAdminMiddleware() gimlet.Middleware
- func NewSNSAuthMiddleware() gimlet.Middleware
- func NewTaskAuthMiddleware() gimlet.Middleware
- func NewTaskHostAuthMiddleware() gimlet.Middleware
- func RequiresDistroPermission(permission string, level evergreen.PermissionLevel) gimlet.Middleware
- func RequiresProjectPermission(permission string, level evergreen.PermissionLevel) gimlet.Middleware
- func RequiresSuperUserPermission(permission string, level evergreen.PermissionLevel) gimlet.Middleware
- type CommitQueueItemOwnerMiddleware
- type EventLogPermissionsMiddleware
- type GetPatchTriggerAliasHandler
- type GetProjectAliasResultsHandler
- type HandlerOpts
- type RequestedPermissions
- type StatsHandler
- type TaskAuthMiddleware
- type TaskHostAuthMiddleware
- type UsersPermissionsInput
- type UsersPermissionsResult
- type UsersWithRoleResponse
Constants ¶
const ( // GroupBy API values for tasks StatsAPITaskGroupByDistro = "task_variant_distro" StatsAPITaskGroupByVariant = "task_variant" StatsAPITaskGroupByTask = "task" )
const (
// These are private custom types to avoid key collisions.
RequestContext requestContextKey = 0
)
Variables ¶
This section is empty.
Functions ¶
func AddCORSHeaders ¶
func AddCORSHeaders(allowedOrigins []string, next http.HandlerFunc) http.HandlerFunc
func AttachHandler ¶
func AttachHandler(app *gimlet.APIApp, opts HandlerOpts)
AttachHandler attaches the api's request handlers to the given mux router. It builds a Connector then attaches each of the main functions for the api to the router.
func GetProjectContext ¶
GetProjectContext returns the project context associated with a given request.
func MustHaveProjectContext ¶
MustHaveProjectContext returns the project context set on the http request context. It panics if none is set.
func MustHaveUser ¶
MustHaveUser returns the user associated with a given request or panics if none is present.
func NewCanCreateMiddleware ¶
func NewCanCreateMiddleware() gimlet.Middleware
func NewCommitQueueItemOwnerMiddleware ¶
func NewCommitQueueItemOwnerMiddleware() gimlet.Middleware
func NewGithubAuthMiddleware ¶
func NewGithubAuthMiddleware() gimlet.Middleware
NewGithubAuthMiddleware returns a middleware that verifies the payload.
func NewHostAuthMiddleware ¶
func NewHostAuthMiddleware() gimlet.Middleware
NewHostAuthMiddleware returns a route middleware that verifies the request's host ID and secret.
func NewMockCommitQueueItemOwnerMiddleware ¶
func NewMockCommitQueueItemOwnerMiddleware() gimlet.Middleware
func NewPodAuthMiddleware ¶
func NewPodAuthMiddleware() gimlet.Middleware
NewPodAuthMiddleware returns a middleware that verifies the request's pod ID and secret.
func NewPodOrHostAuthMiddleWare ¶
func NewPodOrHostAuthMiddleWare() gimlet.Middleware
NewPodOrHostAuthMiddleWare returns a middleware that verifies that the request comes from a valid pod or host based on its ID and shared secret.
func NewProjectAdminMiddleware ¶
func NewProjectAdminMiddleware() gimlet.Middleware
func NewProjectContextMiddleware ¶
func NewProjectContextMiddleware() gimlet.Middleware
func NewRepoAdminMiddleware ¶
func NewRepoAdminMiddleware() gimlet.Middleware
This middleware is more restrictive than checkProjectAdmin, as branch admins do not have access
func NewSNSAuthMiddleware ¶
func NewSNSAuthMiddleware() gimlet.Middleware
NewSNSAuthMiddleware returns a middleware that verifies the payload
func NewTaskAuthMiddleware ¶
func NewTaskAuthMiddleware() gimlet.Middleware
func NewTaskHostAuthMiddleware ¶
func NewTaskHostAuthMiddleware() gimlet.Middleware
NewTaskHostAuthMiddleware returns route middleware that authenticates a host created by a task and verifies the secret of the host that created this host.
func RequiresDistroPermission ¶
func RequiresDistroPermission(permission string, level evergreen.PermissionLevel) gimlet.Middleware
func RequiresProjectPermission ¶
func RequiresProjectPermission(permission string, level evergreen.PermissionLevel) gimlet.Middleware
func RequiresSuperUserPermission ¶
func RequiresSuperUserPermission(permission string, level evergreen.PermissionLevel) gimlet.Middleware
Types ¶
type CommitQueueItemOwnerMiddleware ¶
type CommitQueueItemOwnerMiddleware struct {
// contains filtered or unexported fields
}
func (*CommitQueueItemOwnerMiddleware) ServeHTTP ¶
func (m *CommitQueueItemOwnerMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type EventLogPermissionsMiddleware ¶
type EventLogPermissionsMiddleware struct{}
func (*EventLogPermissionsMiddleware) ServeHTTP ¶
func (m *EventLogPermissionsMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type GetPatchTriggerAliasHandler ¶
type GetPatchTriggerAliasHandler struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////
Handler for the patch trigger aliases defined for project
/projects/{project_id}/patch_trigger_aliases
func (*GetPatchTriggerAliasHandler) Factory ¶
func (p *GetPatchTriggerAliasHandler) Factory() gimlet.RouteHandler
type GetProjectAliasResultsHandler ¶
type GetProjectAliasResultsHandler struct {
// contains filtered or unexported fields
}
func (*GetProjectAliasResultsHandler) Factory ¶
func (p *GetProjectAliasResultsHandler) Factory() gimlet.RouteHandler
Factory creates an instance of the handler.
@Summary Check project alias results @Description Checks a specified project alias in a specified project against an Evergreen configuration, returning the tasks and variants that alias would select. Currently only supports passing in the configuration via an already-created version. @Tags projects @Router /projects/test_alias [get] @Security Api-User || Api-Key @Param version query string true "version" @Param alias query string true "alias" @Param include_deps query bool false "include dependencies" @Success 200 {object} model.APIVariantTasks
type HandlerOpts ¶
type HandlerOpts struct { APIQueue amboy.Queue TaskDispatcher model.TaskQueueItemDispatcher TaskAliasDispatcher model.TaskQueueItemDispatcher URL string GithubSecret []byte }
type RequestedPermissions ¶
type RequestedPermissions struct { // resource_type - the type of resources for which permission is granted. Must be one of "project", "distro", or "superuser" ResourceType string `json:"resource_type"` // resources - an array of strings representing what resources the access is for. For a resource_type of project, this will be a list of projects. For a resource_type of distro, this will be a list of distros. Resources []string `json:"resources"` // permissions - an object whose keys are the permission keys returned by the /permissions endpoint above, and whose values are the levels of access to grant for that permission (also returned by the /permissions endpoint) Permissions gimlet.Permissions `json:"permissions"` }
type StatsHandler ¶
type StatsHandler struct {
// contains filtered or unexported fields
}
func (*StatsHandler) ParseCommonFilter ¶
func (sh *StatsHandler) ParseCommonFilter(vals url.Values) error
ParseCommonFilter parses the query parameter values and fills the struct filter field.
type TaskAuthMiddleware ¶
type TaskAuthMiddleware struct{}
func (*TaskAuthMiddleware) ServeHTTP ¶
func (m *TaskAuthMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type TaskHostAuthMiddleware ¶
type TaskHostAuthMiddleware struct { }
func (*TaskHostAuthMiddleware) ServeHTTP ¶
func (m *TaskHostAuthMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type UsersPermissionsInput ¶
type UsersPermissionsResult ¶
type UsersPermissionsResult map[string]gimlet.Permissions
UserPermissionsResult is a map from userId to their highest permission for the resource
type UsersWithRoleResponse ¶
type UsersWithRoleResponse struct {
Users []*string `json:"users"`
}
Source Files ¶
- admin_banner.go
- admin_clear.go
- admin_events.go
- admin_flags.go
- admin_restart.go
- admin_settings.go
- admin_spawn_hosts.go
- agent.go
- alias.go
- annotations.go
- auth.go
- build.go
- build_task.go
- cli_version.go
- commit_queue.go
- distro.go
- doc.go
- github.go
- github_comments.go
- host.go
- host_agent.go
- host_create.go
- host_spawn.go
- keys.go
- middleware.go
- notification.go
- notifications_route.go
- options.go
- otel.go
- patch.go
- permissions.go
- placeholder.go
- pod.go
- pod_agent.go
- project.go
- project_copy.go
- project_events.go
- reliability.go
- repo.go
- scheduler.go
- service.go
- sns.go
- status.go
- subscription.go
- task.go
- task_abort.go
- task_generate.go
- task_manifest.go
- task_output.go
- task_project.go
- task_restart.go
- task_stats.go
- test.go
- user.go
- version.go
- version_create.go