Documentation
¶
Index ¶
- func JSONError(rw http.ResponseWriter, code int, errMsg string)
- func JSONErrorf(rw http.ResponseWriter, code int, errMsg string, args ...any)
- func JSONInternalServerError(rw http.ResponseWriter)
- func NotFound(rw http.ResponseWriter, _ *http.Request)
- func PanicHandler(rw http.ResponseWriter, req *http.Request, err any)
- type BlacklistStorer
- type Handlers
- func (h Handlers) AddToBlacklist(rw http.ResponseWriter, req *http.Request)
- func (h Handlers) Create(rw http.ResponseWriter, req *http.Request)
- func (h Handlers) Delete(rw http.ResponseWriter, req *http.Request)
- func (h Handlers) DeleteFromBlacklist(rw http.ResponseWriter, req *http.Request)
- func (h Handlers) Download(rw http.ResponseWriter, req *http.Request)
- func (h Handlers) Get(rw http.ResponseWriter, req *http.Request)
- func (h Handlers) List(rw http.ResponseWriter, req *http.Request)
- func (h Handlers) ListBlacklist(rw http.ResponseWriter, req *http.Request)
- func (h Handlers) Update(rw http.ResponseWriter, req *http.Request)
- func (h Handlers) Validate(rw http.ResponseWriter, req *http.Request)
- type PluginStorer
- type Storer
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 (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.
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.