handlers

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 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 ...interface{})

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 interface{})

PanicHandler handles panics.

Types

type Handlers

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

Handlers a set of handlers.

func New

func New(store PluginStorer, goProxy *goproxy.Client, gh *github.Client) Handlers

New creates all HTTP handlers.

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) 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) 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)
	GetHashByName(ctx context.Context, module, version string) (db.PluginHash, error)
}

PluginStorer is capable of storing plugins.

Jump to

Keyboard shortcuts

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