api

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2018 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRequestSuccessed       = errors.New("request successed.")
	ErrRequestAccepted        = errors.New("request accepted.")
	ErrRequestResolveInvaild  = errors.New("request resolve invaild.")
	ErrRequestNotFound        = errors.New("request resource not found.")
	ErrRequestServerException = errors.New("request server exception.")
	ErrRequestAllocNotFound   = errors.New("request resource not found in cache alloc.")
)

Functions

func NewRouter

func NewRouter(enableCors bool, store Store) *mux.Router

func RegisterStore

func RegisterStore(name string, value interface{})

func ResolveJobBaseRequest

func ResolveJobBaseRequest(c *Context) string

ResolveJobBaseRequest is exported

Types

type Context

type Context struct {
	context.Context
	ID string
	// contains filtered or unexported fields
}

func NewContext

func NewContext(w http.ResponseWriter, r *http.Request, store Store) *Context

func (*Context) Form

func (c *Context) Form(name string) string

func (*Context) Get

func (c *Context) Get(key string) interface{}

func (*Context) JSON

func (c *Context) JSON(code int, v interface{}) error

func (*Context) JSONP

func (c *Context) JSONP(code int, callback string, v interface{}) error

func (*Context) Query

func (c *Context) Query(name string) string

func (*Context) Request

func (c *Context) Request() *http.Request

func (*Context) Response

func (c *Context) Response() *Response

func (*Context) Set

func (c *Context) Set(key string, v interface{})

func (*Context) WriteHeader

func (c *Context) WriteHeader(code int)

type Dispatcher

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

func (*Dispatcher) ServeHTTP

func (dispatcher *Dispatcher) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Dispatcher) SetHandler

func (dispatcher *Dispatcher) SetHandler(handler http.Handler)

type GetJobBaseResponse

type GetJobBaseResponse struct {
	JobBase *models.JobBase `json:"jobbase"`
}

GetJobBaseResponse is exported

type GetJobsBaseResponse

type GetJobsBaseResponse struct {
	JobBase []*models.JobBase `json:"jobbase"`
}

GetJobsBaseResponse is exported

type HandleResponse

type HandleResponse interface {
	SetContent(content string)
	SetData(data interface{})
}

HandleResponse is exportyed

type JobActionRequest

type JobActionRequest struct {
	Runtime string `json:"runtime"`
	JobId   string `json:"jobid"`
	Action  string `json:"action"`
}

JobActionRequest is exported

func ResolveJobActionRequest

func ResolveJobActionRequest(c *Context) *JobActionRequest

ResolveJobActionRequest is exported

type Response

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

func NewResponse

func NewResponse(w http.ResponseWriter) *Response

func (*Response) Flush

func (r *Response) Flush()

func (*Response) Header

func (r *Response) Header() http.Header

func (*Response) SetWriter

func (r *Response) SetWriter(w http.ResponseWriter)

func (*Response) Size

func (r *Response) Size() int64

func (*Response) Status

func (r *Response) Status() int

func (*Response) Write

func (r *Response) Write(b []byte) (int, error)

func (*Response) WriteHeader

func (r *Response) WriteHeader(code int)

func (*Response) Writer

func (r *Response) Writer() http.ResponseWriter

type ResponseImpl

type ResponseImpl struct {
	HandleResponse `json:"-,omitempty"`
	Content        string      `json:"content"`
	Data           interface{} `json:"data,omitempty"`
}

ResponseImpl is exported

func (*ResponseImpl) SetContent

func (response *ResponseImpl) SetContent(content string)

SetContent is exported

func (*ResponseImpl) SetData

func (response *ResponseImpl) SetData(data interface{})

SetData is exported

type Server

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

func NewServer

func NewServer(hosts []string, enableCors bool, tlsConfig *tls.Config) *Server

func (*Server) ListenHosts

func (server *Server) ListenHosts() []string

func (*Server) SetHandler

func (server *Server) SetHandler(handler http.Handler)

func (*Server) Startup

func (server *Server) Startup() error

type Store

type Store map[string]interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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