endpoints

package
v0.4.91 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: MIT Imports: 22 Imported by: 8

README

API end-points of DataTug agent

When DataTug agent is started with a serve command it listens on HTTP port (by default 8989).

datatug serve -p=./example

Endpoints

Method Path Description
Executor
POST /exec/execute Executes a batch of commands
GET /exec/select Executes a single non mutating SELECT command
Entities
GET /entities/all_entities
GET /entities/entity
POST /entities/create_entity
PUT /entities/save_entity
DELETE /entities/delete_entity
Queries
GET /queries/all_queries
POST /queries/create_query
PUT /queries/save_query
DELETE /queries/delete_query
Recordsets
GET /data/recordsets
GET /data/recordset_definition
GET /data/recordset_data
POST /data/recordset_add_rows
PUT /data/recordset_update_rows
DELETE /data/recordset_delete_rows
Boards
GET /boards/board
POST /boards/create_board
PUT /boards/save_board
DELETE /boards/delete_board
Endpoint: POST /execute

Executes a batch of commands

Endpoint: GET /select

Executes a single non mutating SELECT command

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentInfo

func AgentInfo(w http.ResponseWriter, r *http.Request)

AgentInfo returns version of the agent

func IsSupportedOrigin

func IsSupportedOrigin(origin string) bool

IsSupportedOrigin check provided origin is allowed

func Ping

func Ping(w http.ResponseWriter, _ *http.Request)

Ping return "pong" - is a simplest

func RegisterDatatugHandlers

func RegisterDatatugHandlers(
	pathPrefix string,
	router *httprouter.Router,
	mode RegisterMode,
	wrap wrapper,
	contextProvider func(r *http.Request) (context.Context, error),
	handler Handler,
)

RegisterDatatugHandlers registers datatug HTTP handlers

Types

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse defines format of error response body

type Handler

type Handler = func(
	w http.ResponseWriter,
	r *http.Request,
	requestDTO apicore.RequestDTO,
	verifyOptions verify.RequestOptions,
	successStatusCode int,
	getContext apicore.ContextProvider,
	handler apicore.Worker,
)

Handler is responsible for creating context and call `handler()` func that should use provided context along with `requestDTO` that was populated from request body Its is exposed publicly so it can be replaced with custom implementation

type ProjectAgentEndpoints

type ProjectAgentEndpoints struct {
}

ProjectAgentEndpoints defines project endpoints

type ProjectEndpoints

type ProjectEndpoints interface {
	CreateProject(w http.ResponseWriter, r *http.Request)
	DeleteProject(w http.ResponseWriter, r *http.Request)
}

ProjectEndpoints defines project endpoints

type RegisterMode

type RegisterMode = int
const (
	RegisterWriteOnlyHandlers RegisterMode = iota
	RegisterAllHandlers
)

type VerifyRequest

type VerifyRequest struct {
	MinContentLength int64
	MaxContentLength int64
	AuthRequired     bool
}

VerifyRequest implements VerifyRequestOptions

func (VerifyRequest) AuthenticationRequired

func (v VerifyRequest) AuthenticationRequired() bool

AuthenticationRequired specifies if authentication is mandatory

func (VerifyRequest) MaximumContentLength

func (v VerifyRequest) MaximumContentLength() int64

MaximumContentLength defines max content length, if < 0 no limit

func (VerifyRequest) MinimumContentLength

func (v VerifyRequest) MinimumContentLength() int64

MinimumContentLength defines min content length

Jump to

Keyboard shortcuts

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