router

package
v0.0.0-...-4c964c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 104 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArtifactMount          = "/_artifacts"
	ArtifactContainerMount = "/v2"
)
View Source
const APIMount = "/api"
View Source
const GitMount = "/git"

Variables

View Source
var WireSet = wire.NewSet(
	ProvideRouter,
)

WireSet provides a wire set for this package.

Functions

func GetGitRoutingHost

func GetGitRoutingHost(ctx context.Context, urlProvider url.Provider) string

func NewAPIHandler

func NewAPIHandler(
	appCtx context.Context,
	config *types.Config,
	principalStore store.PrincipalStore,
	authenticator authn.Authenticator,
	repoCtrl *repo.Controller,
	repoSettingsCtrl *reposettings.Controller,
	executionCtrl *execution.Controller,
	logCtrl *logs.Controller,
	spaceCtrl *space.Controller,
	pipelineCtrl *pipeline.Controller,
	secretCtrl *secret.Controller,
	triggerCtrl *trigger.Controller,
	connectorCtrl *connector.Controller,
	templateCtrl *template.Controller,
	pluginCtrl *plugin.Controller,
	pullreqCtrl *pullreq.Controller,
	webhookCtrl *webhook.Controller,
	githookCtrl *controllergithook.Controller,
	git git.Interface,
	saCtrl *serviceaccount.Controller,
	userCtrl *user.Controller,
	principalCtrl principal.Controller,
	userGroupCtrl *usergroup.Controller,
	checkCtrl *check.Controller,
	sysCtrl *system.Controller,
	uploadCtrl *upload.Controller,
	searchCtrl *keywordsearch.Controller,
	artifactCtrl *artctl.Controller,
	runnerCtrl *runner.Controller,
	infraProviderCtrl *infraprovider.Controller,
	migrateCtrl *migrate.Controller,
	gitspaceCtrl *gitspace.Controller,
	aiagentCtrl *aiagent.Controller,
	capabilitiesCtrl *capabilities.Controller,
) http.Handler

NewAPIHandler returns a new APIHandler.

func NewGitHandler

func NewGitHandler(
	config *types.Config,
	urlProvider url.Provider,
	authenticator authn.Authenticator,
	repoCtrl *repo.Controller,
) http.Handler

NewGitHandler returns a new GitHandler.

func NewWebHandler

func NewWebHandler(
	config *types.Config,
	authenticator authn.Authenticator,
	openapi openapi.Service,
) http.Handler

NewWebHandler returns a new WebHandler.

func SetupChecks

func SetupChecks(r chi.Router, checkCtrl *check.Controller)

func SetupGitHooks

func SetupGitHooks(r chi.Router, githookCtrl *controllergithook.Controller, git git.Interface)

func SetupPullReq

func SetupPullReq(r chi.Router, pullreqCtrl *pullreq.Controller)

func SetupRepoLabels

func SetupRepoLabels(r chi.Router, repoCtrl *repo.Controller)

func SetupRules

func SetupRules(r chi.Router, repoCtrl *repo.Controller)

func SetupSpaceAI

func SetupSpaceAI(r chi.Router, spaceCtrl *space.Controller)

func SetupSpaceLabels

func SetupSpaceLabels(r chi.Router, spaceCtrl *space.Controller)

func SetupUploads

func SetupUploads(r chi.Router, uploadCtrl *upload.Controller)

func SetupWebhookRepo

func SetupWebhookRepo(r chi.Router, webhookCtrl *webhook.Controller)

func SetupWebhookSpace

func SetupWebhookSpace(r chi.Router, webhookCtrl *webhook.Controller)

func StripPrefix

func StripPrefix(prefix string, req *http.Request) error

StripPrefix removes the prefix from the request path (or noop if it's not there).

func WithLoggingRouter

func WithLoggingRouter(handler string) logging.Option

WithLoggingRouter can be used to annotate logs with the handler info.

Types

type APIRouter

type APIRouter struct {
	// contains filtered or unexported fields
}

func NewAPIRouter

func NewAPIRouter(handler http.Handler) *APIRouter

func (*APIRouter) Handle

func (r *APIRouter) Handle(w http.ResponseWriter, req *http.Request)

func (*APIRouter) IsEligibleTraffic

func (r *APIRouter) IsEligibleTraffic(req *http.Request) bool

func (*APIRouter) Name

func (r *APIRouter) Name() string

type ArtifactHandler

type ArtifactHandler interface {
	http.Handler
}

ArtifactHandler is an abstraction of a http handler that handles Artifact calls.

func NewArtifactHandler

func NewArtifactHandler(
	appCtx context.Context,
	urlProvider url.Provider,
	config *types.Config,
	authenticator authn.Authenticator,
	artCtrl *artctl.Controller,
	artStore store.ArtifactStore,
	repoStore store.RepoStore,
	fileStore storage.ContentStorage,
) ArtifactHandler

type ArtifactRouter

type ArtifactRouter struct {
	// contains filtered or unexported fields
}

func NewArtifactRouter

func NewArtifactRouter(handler http.Handler) *ArtifactRouter

func (*ArtifactRouter) Handle

func (r *ArtifactRouter) Handle(w http.ResponseWriter, req *http.Request)

func (*ArtifactRouter) IsEligibleTraffic

func (r *ArtifactRouter) IsEligibleTraffic(req *http.Request) bool

func (*ArtifactRouter) Name

func (r *ArtifactRouter) Name() string

type GitRouter

type GitRouter struct {
	// contains filtered or unexported fields
}

func NewGitRouter

func NewGitRouter(handler http.Handler, gitHost string) *GitRouter

func (*GitRouter) Handle

func (r *GitRouter) Handle(w http.ResponseWriter, req *http.Request)

func (*GitRouter) IsEligibleTraffic

func (r *GitRouter) IsEligibleTraffic(req *http.Request) bool

func (*GitRouter) Name

func (r *GitRouter) Name() string

type Interface

type Interface interface {
	Handle(w http.ResponseWriter, req *http.Request)
	IsEligibleTraffic(req *http.Request) bool
	Name() string
}

type Router

type Router struct {
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(
	routers []Interface,
) *Router

NewRouter returns a new http.Handler that routes traffic to the appropriate handlers.

func ProvideRouter

func ProvideRouter(
	appCtx context.Context,
	config *types.Config,
	principalStore store.PrincipalStore,
	authenticator authn.Authenticator,
	repoCtrl *repo.Controller,
	repoSettingsCtrl *reposettings.Controller,
	executionCtrl *execution.Controller,
	logCtrl *logs.Controller,
	spaceCtrl *space.Controller,
	pipelineCtrl *pipeline.Controller,
	secretCtrl *secret.Controller,
	triggerCtrl *trigger.Controller,
	connectorCtrl *connector.Controller,
	templateCtrl *template.Controller,
	pluginCtrl *plugin.Controller,
	pullreqCtrl *pullreq.Controller,
	webhookCtrl *webhook.Controller,
	githookCtrl *githook.Controller,
	git git.Interface,
	saCtrl *serviceaccount.Controller,
	userCtrl *user.Controller,
	principalCtrl principal.Controller,
	userGroupCtrl *usergroup.Controller,
	checkCtrl *check.Controller,
	sysCtrl *system.Controller,
	blobCtrl *upload.Controller,
	searchCtrl *keywordsearch.Controller,
	artifactCtrl *artctl.Controller,
	runnerCtrl *runner.Controller,
	infraProviderCtrl *infraprovider.Controller,
	gitspaceCtrl *gitspace.Controller,
	migrateCtrl *migrate.Controller,
	aiagentCtrl *aiagent.Controller,
	capabilitiesCtrl *capabilities.Controller,
	urlProvider url.Provider,
	openapi openapi.Service,
	artStore store.ArtifactStore,
	repoStore store.RepoStore,
	fileStore storage.ContentStorage,
) *Router

ProvideRouter provides ordered list of routers.

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

type WebRouter

type WebRouter struct {
	// contains filtered or unexported fields
}

func NewWebRouter

func NewWebRouter(handler http.Handler) *WebRouter

func (*WebRouter) Handle

func (r *WebRouter) Handle(w http.ResponseWriter, req *http.Request)

func (*WebRouter) IsEligibleTraffic

func (r *WebRouter) IsEligibleTraffic(*http.Request) bool

func (*WebRouter) Name

func (r *WebRouter) Name() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL