restapi

package
v0.0.0-...-e72b3e1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PUT    = "PUT"
	GET    = "GET"
	POST   = "POST"
	DELETE = "DELETE"
)

Variables

This section is empty.

Functions

func GetChannelsHandler

func GetChannelsHandler(ctx *AppContext, w http.ResponseWriter, r *http.Request)

func LogReq

func LogReq(r *http.Request) *log.Entry

func StartRestAPI

func StartRestAPI(gctsdbServer *gctsdb.GCTSDBServer)

Types

type AppContext

type AppContext struct {
	GCTSDBServer *gctsdb.GCTSDBServer
}

type AppHandler

type AppHandler struct {
	Context *AppContext
	// contains filtered or unexported fields
}

func NewAppHandler

func NewAppHandler(appContext *AppContext, r *mux.Router) AppHandler

func (*AppHandler) Handle

func (h *AppHandler) Handle(method string, uri string, handler func(*AppContext, http.ResponseWriter, *http.Request), scopes ...string)

type Authentication

type Authentication struct {
	Scopes []string
	Token  string
	UserId string
}

func GetAuthentication

func GetAuthentication(ctx *AppContext, r *http.Request) *Authentication

func (*Authentication) HasScope

func (y *Authentication) HasScope(scope string) bool

type CORS

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

func NewCORS

func NewCORS() *CORS

func (*CORS) ServeHTTP

func (cors *CORS) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type Channel

type Channel struct {
	Name       string `json:"name"`
	DataType   string `json:"datatype"`
	BucketSize int64  `json:"bucketSize"`
}

func NewRestChannel

func NewRestChannel(ch *gctsdb.Channel) (*Channel, error)

type Created

type Created struct {
	Id   string `json:"id"`
	Link string `json:"link"`
}

type HttpError

type HttpError struct {
	HTTPCode  int    `json:"-"`
	ErrorCode string `json:"errorCode"`
	Message   string `json:"errorMessage"`
}

func NewHttpError

func NewHttpError(httpCode int, errorCode string, errorMessage string, a ...interface{}) *HttpError

func (*HttpError) WriteResponse

func (e *HttpError) WriteResponse(w http.ResponseWriter)

type Logger

type Logger struct {
}

func NewLogger

func NewLogger() *Logger

func (*Logger) ServeHTTP

func (lg *Logger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type UberAuthorizator

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

func (*UberAuthorizator) Handler

func (ua *UberAuthorizator) Handler(rw http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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