handlers

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONError

func JSONError(rw http.ResponseWriter, code int, errMsg string)

JSONError handles an JSON error.

func JSONErrorf

func JSONErrorf(rw http.ResponseWriter, code int, errMsg string, args ...any)

JSONErrorf handles an JSON error.

func JSONInternalServerError

func JSONInternalServerError(rw http.ResponseWriter)

JSONInternalServerError handles an JSON InternalServerError.

func NotFound

func NotFound(rw http.ResponseWriter, _ *http.Request)

NotFound a not found handler.

func PanicHandler

func PanicHandler(rw http.ResponseWriter, req *http.Request, err any)

PanicHandler handles panics.

Types

type BlacklistStorer added in v1.14.0

type BlacklistStorer interface {
	ListBlacklist(ctx context.Context) ([]db.BlacklistEntry, error)
	UpsertBlacklist(ctx context.Context, entry db.BlacklistEntry) (db.BlacklistEntry, error)
	DeleteBlacklist(ctx context.Context, repository string) error
}

BlacklistStorer is capable of storing the plugin blacklist.

type Handlers

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

Handlers a set of handlers.

func New

func New(store Storer, goProxy *goproxy.Client, gh *github.Client, pinProxyURL string) Handlers

New creates all HTTP handlers. pinProxyURL is the Go module proxy whose version info pins the commit each version was published from.

func (Handlers) AddToBlacklist added in v1.14.0

func (h Handlers) AddToBlacklist(rw http.ResponseWriter, req *http.Request)

AddToBlacklist adds (or updates) a repository in the blacklist.

func (Handlers) Create

func (h Handlers) Create(rw http.ResponseWriter, req *http.Request)

Create creates a plugin.

func (Handlers) Delete

func (h Handlers) Delete(rw http.ResponseWriter, req *http.Request)

Delete deletes an instance info.

func (Handlers) DeleteFromBlacklist added in v1.14.0

func (h Handlers) DeleteFromBlacklist(rw http.ResponseWriter, req *http.Request)

DeleteFromBlacklist removes a repository from the blacklist. The repository is passed in the path: DELETE /internal/blacklist/{owner}/{repo}.

func (Handlers) Download

func (h Handlers) Download(rw http.ResponseWriter, req *http.Request)

Download a plugin archive.

func (Handlers) Get

func (h Handlers) Get(rw http.ResponseWriter, req *http.Request)

Get gets a plugin.

func (Handlers) List

func (h Handlers) List(rw http.ResponseWriter, req *http.Request)

List gets a list of plugins.

func (Handlers) ListBlacklist added in v1.14.0

func (h Handlers) ListBlacklist(rw http.ResponseWriter, req *http.Request)

ListBlacklist lists the blacklisted repositories.

func (Handlers) Update

func (h Handlers) Update(rw http.ResponseWriter, req *http.Request)

Update updates a plugin.

func (Handlers) Validate

func (h Handlers) Validate(rw http.ResponseWriter, req *http.Request)

Validate validates a plugin archive.

type PluginStorer

type PluginStorer interface {
	Get(ctx context.Context, id string) (db.Plugin, error)
	Delete(ctx context.Context, id string) error
	Create(context.Context, db.Plugin) (db.Plugin, error)
	List(context.Context, db.Pagination) ([]db.Plugin, string, error)
	GetByName(context.Context, string, bool, bool) (db.Plugin, error)
	SearchByName(context.Context, string, db.Pagination) ([]db.Plugin, string, error)
	Update(context.Context, string, db.Plugin) (db.Plugin, error)

	CreateHash(ctx context.Context, module, version, hash string) (db.PluginHash, error)
	UpdateHashVerified(ctx context.Context, module, version, hash string, verified bool) (db.PluginHash, error)
	GetHashByName(ctx context.Context, module, version string) (db.PluginHash, error)
}

PluginStorer is capable of storing plugins.

type Storer added in v1.14.0

type Storer interface {
	PluginStorer
	BlacklistStorer
}

Storer is capable of storing plugins and the plugin blacklist.

Jump to

Keyboard shortcuts

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