http_funcs

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const UploadFormField = "uploadfile"

UploadFormField is the name of the field/multi-part section which contains the file bytes.

Variables

View Source
var (
	ErrGenericMimeDetected = errors.New("the generic '" + mimeGeneric + "' MIME type was detected which is unsupported")
	ErrUploadNotZip        = errors.New("uploaded file was not of '" + mimeZIP + "' MIME type")
)

Functions

func GetRouter

func GetRouter() *mux.Router

func InitAPI

func InitAPI(r *mux.Router, serv *HttpServ)

func InitEndpoints

func InitEndpoints(r *mux.Router, serv *HttpServ)

func InitHttpInvocationServer

func InitHttpInvocationServer(r *mux.Router, serv *HttpServ)

Types

type HttpServ

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

func NewServer

func NewServer(listenOn string, store storage.MservStore) *HttpServ

func (*HttpServ) AddMW

func (h *HttpServ) AddMW(w http.ResponseWriter, r *http.Request)

swagger:route POST /api/mw mw mwAdd Adds a new middleware. If `store_only` field is 'true' then it will only be available for download. Expects a zipped file bundle in the `uploadfile` form field.

Security:

api_key:

Responses:

200: mwIDResponse
500: genericErrorResponse

func (*HttpServ) DeleteMW

func (h *HttpServ) DeleteMW(w http.ResponseWriter, r *http.Request)

swagger:route DELETE /api/mw/{id} mw mwDelete Deletes a middleware specified by {id}.

Security:

api_key:

Responses:

200: mwIDResponse
500: genericErrorResponse

func (*HttpServ) Execute

func (h *HttpServ) Execute(w http.ResponseWriter, r *http.Request)

swagger:route POST /execute/{name} invocation invoke Invokes a middleware by {name}. Expects a coprocess.Object encoded as JSON in the request body and returns the result in the same way.

Security:

api_key:

Responses:

200: invocationResponse
500: genericErrorResponse

func (*HttpServ) ExtractBundleFromPost

func (h *HttpServ) ExtractBundleFromPost(r *http.Request) (string, error)

func (*HttpServ) FetchAllActiveMW

func (h *HttpServ) FetchAllActiveMW(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/mw/master/all mw mwListAll Lists all middleware.

Security:

api_key:

Responses:

200: mwListResponse
500: genericErrorResponse

func (*HttpServ) FetchBundleFile

func (h *HttpServ) FetchBundleFile(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/mw/bundle/{id} mw mwFetchBundle Fetches a middleware bundle file specified by {id}.

Produces: - application/octet-stream

Security:

api_key:

Responses:

200: mwBundleResponse
500: genericErrorResponse

func (*HttpServ) FetchMW

func (h *HttpServ) FetchMW(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/mw/{id} mw mwFetch Fetches a middleware specified by {id}.

Security:

api_key:

Responses:

200: mwResponse
500: genericErrorResponse

func (*HttpServ) HandleError

func (h *HttpServ) HandleError(err error, w http.ResponseWriter, r *http.Request)

func (*HttpServ) HandleOK

func (h *HttpServ) HandleOK(payload interface{}, w http.ResponseWriter, r *http.Request)

func (*HttpServ) HealthHandler

func (h *HttpServ) HealthHandler(w http.ResponseWriter, r *http.Request)

swagger:route GET /health system health Query health status of Mserv service.

Responses:

200: healthResponse
500: healthResponse

func (*HttpServ) Listen

func (h *HttpServ) Listen(m *mux.Router, l net.Listener) error

func (*HttpServ) UpdateMW

func (h *HttpServ) UpdateMW(w http.ResponseWriter, r *http.Request)

swagger:route PUT /api/mw/{id} mw mwUpdate Updates a middleware specified by {id}. Expects a file bundle in `uploadfile` form field.

Security:

api_key:

Responses:

200: mwIDResponse
500: genericErrorResponse

Jump to

Keyboard shortcuts

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