handler

package
v0.0.0-...-0dca507 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthzHandler

func HealthzHandler(c echo.Context) error

HealthzHandler shows server is up and running.

Types

type MockedManager

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

func (*MockedManager) New

func (m *MockedManager) New(_ context.Context, name string, _ []runner.Env) (runner.Runner, error)

func (*MockedManager) Pull

func (m *MockedManager) Pull(context.Context) ([2]string, error)

func (*MockedManager) Remove

func (m *MockedManager) Remove(_ context.Context, r runner.Runner) error

func (*MockedManager) Restart

type Projects

type Projects struct {
	Store   store.Project
	Manager runner.Manager

	Config config.Runner
}

Projects manages existing projects.

func (Projects) Create

func (v Projects) Create(c echo.Context) error

Create adds a project to the DB and creates its docker. This function is mapped to the path POST /projects nolint: funlen

func (Projects) Destroy

func (v Projects) Destroy(c echo.Context) error

Destroy deletes a project from the DB and its docker. This function is mapped to the path DELETE /projects/{project_id}.

func (Projects) List

func (v Projects) List(c echo.Context) error

List gets all projects. This function is mapped to the path GET /projects.

func (Projects) Logs

func (v Projects) Logs(c echo.Context) error

Logs returns project execution logs and errors. This function is mapped to the path GET /projects/{project_id}/logs.

func (Projects) Recreate

func (v Projects) Recreate(c echo.Context) error

Recreate creates project docker and stores their information. This function is mapped to the path GET /projects/{project_id}/recreate.

func (Projects) Register

func (v Projects) Register(g *echo.Group)

Register registers the routes of projects handler on given echo group.

func (Projects) Show

func (v Projects) Show(c echo.Context) error

Show gets the data for one project. This function is mapped to the path GET /projects/{project_id}.

func (Projects) Update

func (v Projects) Update(c echo.Context) error

Update updates the name of the project. The project owner is passed as an environment variable to project docker so it cannot be changed. This function is mapped to the path PUT /projects/{project_id}.

type Queries

type Queries struct {
	Store store.Data
}

Queries handles useful queries on database.

func (Queries) Fetch

func (q Queries) Fetch(c echo.Context) error

Fetch fetches given things data in given time range from database. please consider that this function returns data in ascending time order. This function is mapped to the path POST /queries/fetch.

func (Queries) FetchSingle

func (q Queries) FetchSingle(c echo.Context) error

FetchSingle fetches the given thing data in given time range from database. please consider that this function returns data in ascending time order. This function is mapped to the path GET /queries/things/thing_id/fetch.

func (Queries) List

func (q Queries) List(c echo.Context) error

List lists things and count of their data in database. This function is mapped to the path GET /projects/{project_id}/things/{thing_id}/queries/list.

func (Queries) Register

func (q Queries) Register(g *echo.Group)

Register registers the routes of queries handler on given echo group.

type Runner

type Runner struct {
	Store   store.Project
	Manager runner.Manager

	DockerHost string
}

func (Runner) PassThrough

func (r Runner) PassThrough(c echo.Context) error

PassThrough sends request to specific Runner.

func (Runner) Pull

func (r Runner) Pull(c echo.Context) error

Pull pulls the latest version of required images.

func (Runner) Register

func (r Runner) Register(g *echo.Group)

type Things

type Things struct {
	Store store.Thing
}

Things handles existing things.

func (Things) Activation

func (v Things) Activation(c echo.Context) error

Activation activates/deactivates thing. This function is mapped to the path GET /things/{thing_id}/{t:(?:activate|deactivate)}.

func (Things) Create

func (v Things) Create(c echo.Context) error

Create adds a thing to the DB and its project. This function is mapped to the path POST /projects/{project_id}/things.

func (Things) Destroy

func (v Things) Destroy(c echo.Context) error

Destroy deletes a thing from the DB and its project. This function is mapped to the path DELETE /things/{thing_id}.

func (Things) List

func (v Things) List(c echo.Context) error

List gets all things. This function is mapped to the path GET /projects/{project_id}/things.

func (Things) Register

func (v Things) Register(g *echo.Group)

Register registers the routes of things handler on given echo group.

func (Things) Show

func (v Things) Show(c echo.Context) error

Show gets the data for one thing. This function is mapped to the path GET /things/{thing_id}.

func (Things) Update

func (v Things) Update(c echo.Context) error

Update updates a thing information includes name, model and location. Please note that you must provide them all in update request even if you do not want to change it. This function is mapped to the path PUT /things/{thing_id}.

Jump to

Keyboard shortcuts

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