rest

package
v0.0.0-...-cd0f3b4 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2016 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package rest implements the REST server for GlusterD

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendHTTPError

func SendHTTPError(rw http.ResponseWriter, statusCode int, errMsg string)

SendHTTPError is to report error back to the client

func SendHTTPResponse

func SendHTTPResponse(w http.ResponseWriter, statusCode int, rsp interface{})

SendHTTPResponse to send response back to the client

Types

type APIError

type APIError struct {
	Error string
}

APIError is the placeholder for error string to report back to the client

type GDRest

type GDRest struct {
	Routes *mux.Router
	// contains filtered or unexported fields
}

GDRest is the GlusterD Rest server

func New

func New() *GDRest

New returns a GDRest object which can listen on the configured address

func (*GDRest) Listen

func (r *GDRest) Listen() error

Listen begins the GlusterD Rest server

func (*GDRest) SetRoutes

func (r *GDRest) SetRoutes(routes Routes)

SetRoutes adds the given routes to the GlusterD Rest server

func (*GDRest) Stop

func (r *GDRest) Stop()

Stop stops the GlusterD Rest server

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	Version     int
	HandlerFunc http.HandlerFunc
}

Route models a route to be set on the GlusterD Rest server This route style comes from the tutorial on http://thenewstack.io/make-a-restful-json-api-go/

type Routes

type Routes []Route

Routes is a table of many Route's

Jump to

Keyboard shortcuts

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