apiserver

package
v0.0.0-...-a541f19 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package apiserver is ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiServer

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

ApiServer is an HTTPHandler that delegates to RESTStorage objects. It handles URLs of the form: ${prefix}/${storage_key}[/${object_name}] Where 'prefix' is an arbitrary string, and 'storage_key' points to a RESTStorage object stored in storage.

TODO: consider migrating this to go-restful which is a more full-featured version of the same thing.

func New

func New(storage map[string]RESTStorage, prefix string) *ApiServer

New creates a new ApiServer object. 'storage' contains a map of handlers. 'prefix' is the hosting path prefix.

func (*ApiServer) ServeHTTP

func (server *ApiServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

HTTP Handler interface

type RESTStorage

type RESTStorage interface {
	List(*url.URL) (interface{}, error)
	Get(id string) (interface{}, error)
	Delete(id string) error
	Extract(body string) (interface{}, error)
	Create(interface{}) error
	Update(interface{}) error
}

RESTStorage is a generic interface for RESTful storage services

type Status

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

Status is a return value for calls that don't return other objects

Jump to

Keyboard shortcuts

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