http

package
v0.0.0-...-88921fd Latest Latest
Warning

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

Go to latest
Published: May 22, 2014 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Serve jobs over the http protocol, and provide a marshalling interface for the core geard jobs.

Index

Constants

View Source
const DefaultHttpPort = "43273"

Variables

View Source
var (
	ErrContentTypeDoesNotMatch = jobs.SimpleError{jobs.ResponseNotAcceptable, "The content type you requested is not available for this action."}
)

Functions

func AddHttpExtension

func AddHttpExtension(extension HttpExtension)

Register an extension to this server during init() or startup

func ApiVersion

func ApiVersion() string

func Inline

func Inline(s string, with ...string) string

func NewHttpJobResponse

func NewHttpJobResponse(w http.ResponseWriter, skipStreaming bool, mode ResponseContentMode) jobs.Response

Types

type DefaultRequest

type DefaultRequest struct {
	Server string `json:"-"`
}

func (*DefaultRequest) MarshalHttpRequestBody

func (h *DefaultRequest) MarshalHttpRequestBody(w io.Writer) error

func (*DefaultRequest) MarshalRequestIdentifier

func (h *DefaultRequest) MarshalRequestIdentifier() jobs.RequestIdentifier

func (*DefaultRequest) MarshalUrlQuery

func (h *DefaultRequest) MarshalUrlQuery(query *url.Values)

func (*DefaultRequest) SetServer

func (h *DefaultRequest) SetServer(server string)

func (*DefaultRequest) UnmarshalHttpResponse

func (h *DefaultRequest) UnmarshalHttpResponse(headers http.Header, r io.Reader, mode ResponseContentMode) (interface{}, error)

type HeaderSerialization

type HeaderSerialization interface {
	ToHeader() string
}

type HttpConfiguration

type HttpConfiguration struct {
	Docker     config.DockerConfiguration
	Dispatcher *dispatcher.Dispatcher
}

func (*HttpConfiguration) Handler

func (conf *HttpConfiguration) Handler() (http.Handler, error)

type HttpExtension

type HttpExtension interface {
	Routes() []HttpJobHandler
	HttpJobFor(request interface{}) (RemoteExecutable, error)
}

type HttpJobHandler

type HttpJobHandler interface {
	RemoteJob
	Handler(conf *HttpConfiguration) JobHandler
}

type HttpStreamable

type HttpStreamable interface {
	Streamable() bool
}

type HttpTransport

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

func NewHttpTransport

func NewHttpTransport() *HttpTransport

func (*HttpTransport) ExecuteRemote

func (h *HttpTransport) ExecuteRemote(baseUrl *url.URL, job RemoteExecutable, res jobs.Response) error

func (*HttpTransport) LocatorFor

func (h *HttpTransport) LocatorFor(value string) (transport.Locator, error)

func (*HttpTransport) RemoteJobFor

func (h *HttpTransport) RemoteJobFor(locator transport.Locator, j interface{}) (job jobs.Job, err error)

type JobHandler

type JobHandler func(*jobs.JobContext, *rest.Request) (interface{}, error)

type RemoteExecutable

type RemoteExecutable interface {
	RemoteJob
	MarshalRequestIdentifier() jobs.RequestIdentifier
	MarshalUrlQuery(*url.Values)
	MarshalHttpRequestBody(io.Writer) error
	UnmarshalHttpResponse(headers http.Header, r io.Reader, mode ResponseContentMode) (interface{}, error)
}

func HttpJobFor

func HttpJobFor(job interface{}) (exc RemoteExecutable, err error)

type RemoteJob

type RemoteJob interface {
	HttpMethod() string
	HttpPath() string
}

type RemoteLocator

type RemoteLocator interface {
	ToURL() *url.URL
}

type ResponseContentMode

type ResponseContentMode int
const (
	ResponseJson ResponseContentMode = iota
	ResponseTable
)

type ServerAware

type ServerAware interface {
	SetServer(string)
}

type StringHeader

type StringHeader string

func (StringHeader) ToHeader

func (s StringHeader) ToHeader() string

type TabularOutput

type TabularOutput interface {
	WriteTableTo(io.Writer) error
}

Jump to

Keyboard shortcuts

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