handlers

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

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) Handlers

New creates all HTTP handlers.

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