http

package
v0.0.0-...-aa49ab7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 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 default geard jobs.

Index

Constants

This section is empty.

Variables

View Source
var ErrHandledResponse = errors.New("Request handled")

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.JobResponse

Types

type DefaultRequest

type DefaultRequest struct{}

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) UnmarshalHttpResponse

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

type HeaderSerialization

type HeaderSerialization interface {
	ToHeader() string
}

type HttpBuildImageRequest

type HttpBuildImageRequest jobs.BuildImageRequest

func (*HttpBuildImageRequest) Handler

func (*HttpBuildImageRequest) HttpMethod

func (h *HttpBuildImageRequest) HttpMethod() string

func (*HttpBuildImageRequest) HttpPath

func (h *HttpBuildImageRequest) HttpPath() string

type HttpConfiguration

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

func (*HttpConfiguration) Handler

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

type HttpContainerLogRequest

type HttpContainerLogRequest jobs.ContainerLogRequest

func (*HttpContainerLogRequest) Handler

func (*HttpContainerLogRequest) HttpMethod

func (h *HttpContainerLogRequest) HttpMethod() string

func (*HttpContainerLogRequest) HttpPath

func (h *HttpContainerLogRequest) HttpPath() string

type HttpContainerStatusRequest

type HttpContainerStatusRequest struct {
	jobs.ContainerStatusRequest
	DefaultRequest
}

func (*HttpContainerStatusRequest) Handler

func (*HttpContainerStatusRequest) HttpMethod

func (h *HttpContainerStatusRequest) HttpMethod() string

func (*HttpContainerStatusRequest) HttpPath

func (h *HttpContainerStatusRequest) HttpPath() string

type HttpContentRequest

type HttpContentRequest struct {
	jobs.ContentRequest
	DefaultRequest
}

func (*HttpContentRequest) Handler

func (*HttpContentRequest) HttpMethod

func (h *HttpContentRequest) HttpMethod() string

func (*HttpContentRequest) HttpPath

func (h *HttpContentRequest) HttpPath() string

type HttpDeleteContainerRequest

type HttpDeleteContainerRequest struct {
	jobs.DeleteContainerRequest
	DefaultRequest
	Label string
}

func (*HttpDeleteContainerRequest) Handler

func (*HttpDeleteContainerRequest) HttpMethod

func (h *HttpDeleteContainerRequest) HttpMethod() string

func (*HttpDeleteContainerRequest) HttpPath

func (h *HttpDeleteContainerRequest) HttpPath() string

func (*HttpDeleteContainerRequest) JobLabel

func (h *HttpDeleteContainerRequest) JobLabel() string

type HttpDispatcher

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

func NewHttpDispatcher

func NewHttpDispatcher(l RemoteLocator, logger *log.Logger) *HttpDispatcher

func (*HttpDispatcher) Dispatch

func (h *HttpDispatcher) Dispatch(job RemoteExecutable, res jobs.JobResponse) error

type HttpExtension

type HttpExtension func() []HttpJobHandler

type HttpInstallContainerRequest

type HttpInstallContainerRequest struct {
	jobs.InstallContainerRequest
	DefaultRequest
}

func (*HttpInstallContainerRequest) Handler

func (*HttpInstallContainerRequest) HttpMethod

func (h *HttpInstallContainerRequest) HttpMethod() string

func (*HttpInstallContainerRequest) HttpPath

func (h *HttpInstallContainerRequest) HttpPath() string

func (*HttpInstallContainerRequest) MarshalHttpRequestBody

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

func (*HttpInstallContainerRequest) UnmarshalHttpResponse

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

type HttpJobHandler

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

type HttpLinkContainersRequest

type HttpLinkContainersRequest struct {
	Label string
	jobs.LinkContainersRequest
	DefaultRequest
}

func (*HttpLinkContainersRequest) Handler

func (*HttpLinkContainersRequest) HttpMethod

func (h *HttpLinkContainersRequest) HttpMethod() string

func (*HttpLinkContainersRequest) HttpPath

func (h *HttpLinkContainersRequest) HttpPath() string

func (*HttpLinkContainersRequest) JobLabel

func (h *HttpLinkContainersRequest) JobLabel() string

func (*HttpLinkContainersRequest) MarshalHttpRequestBody

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

type HttpListBuildsRequest

type HttpListBuildsRequest jobs.ListBuildsRequest

func (*HttpListBuildsRequest) Handler

func (*HttpListBuildsRequest) HttpMethod

func (h *HttpListBuildsRequest) HttpMethod() string

func (*HttpListBuildsRequest) HttpPath

func (h *HttpListBuildsRequest) HttpPath() string

type HttpListContainerPortsRequest

type HttpListContainerPortsRequest jobs.ContainerPortsRequest

func (*HttpListContainerPortsRequest) Handler

func (*HttpListContainerPortsRequest) HttpMethod

func (h *HttpListContainerPortsRequest) HttpMethod() string

func (*HttpListContainerPortsRequest) HttpPath

func (h *HttpListContainerPortsRequest) HttpPath() string

type HttpListContainersRequest

type HttpListContainersRequest struct {
	jobs.ListContainersRequest
	DefaultRequest
	Label string
}

func (*HttpListContainersRequest) Handler

func (*HttpListContainersRequest) HttpMethod

func (h *HttpListContainersRequest) HttpMethod() string

func (*HttpListContainersRequest) HttpPath

func (h *HttpListContainersRequest) HttpPath() string

func (*HttpListContainersRequest) JobLabel

func (h *HttpListContainersRequest) JobLabel() string

func (*HttpListContainersRequest) UnmarshalHttpResponse

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

type HttpListImagesRequest

type HttpListImagesRequest jobs.ListImagesRequest

func (*HttpListImagesRequest) Handler

func (*HttpListImagesRequest) HttpMethod

func (h *HttpListImagesRequest) HttpMethod() string

func (*HttpListImagesRequest) HttpPath

func (h *HttpListImagesRequest) HttpPath() string

type HttpPatchEnvironmentRequest

type HttpPatchEnvironmentRequest struct {
	jobs.PatchEnvironmentRequest
	DefaultRequest
}

func (*HttpPatchEnvironmentRequest) Handler

func (*HttpPatchEnvironmentRequest) HttpMethod

func (h *HttpPatchEnvironmentRequest) HttpMethod() string

func (*HttpPatchEnvironmentRequest) HttpPath

func (h *HttpPatchEnvironmentRequest) HttpPath() string

func (*HttpPatchEnvironmentRequest) MarshalHttpRequestBody

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

type HttpPutEnvironmentRequest

type HttpPutEnvironmentRequest struct {
	jobs.PutEnvironmentRequest
	DefaultRequest
}

func (*HttpPutEnvironmentRequest) Handler

func (*HttpPutEnvironmentRequest) HttpMethod

func (h *HttpPutEnvironmentRequest) HttpMethod() string

func (*HttpPutEnvironmentRequest) HttpPath

func (h *HttpPutEnvironmentRequest) HttpPath() string

func (*HttpPutEnvironmentRequest) MarshalHttpRequestBody

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

type HttpRestartContainerRequest

type HttpRestartContainerRequest struct {
	jobs.RestartContainerRequest
	DefaultRequest
}

func (*HttpRestartContainerRequest) Handler

func (*HttpRestartContainerRequest) HttpMethod

func (h *HttpRestartContainerRequest) HttpMethod() string

func (*HttpRestartContainerRequest) HttpPath

func (h *HttpRestartContainerRequest) HttpPath() string

type HttpRunContainerRequest

type HttpRunContainerRequest struct {
	jobs.RunContainerRequest
	DefaultRequest
}

func (*HttpRunContainerRequest) Handler

func (*HttpRunContainerRequest) HttpMethod

func (h *HttpRunContainerRequest) HttpMethod() string

func (*HttpRunContainerRequest) HttpPath

func (h *HttpRunContainerRequest) HttpPath() string

func (*HttpRunContainerRequest) MarshalHttpRequestBody

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

type HttpStartContainerRequest

type HttpStartContainerRequest struct {
	jobs.StartedContainerStateRequest
	DefaultRequest
}

func (*HttpStartContainerRequest) Handler

func (*HttpStartContainerRequest) HttpMethod

func (h *HttpStartContainerRequest) HttpMethod() string

func (*HttpStartContainerRequest) HttpPath

func (h *HttpStartContainerRequest) HttpPath() string

type HttpStopContainerRequest

type HttpStopContainerRequest struct {
	jobs.StoppedContainerStateRequest
	DefaultRequest
}

func (*HttpStopContainerRequest) Handler

func (*HttpStopContainerRequest) HttpMethod

func (h *HttpStopContainerRequest) HttpMethod() string

func (*HttpStopContainerRequest) HttpPath

func (h *HttpStopContainerRequest) HttpPath() string

type HttpStreamable

type HttpStreamable interface {
	Streamable() bool
}

type JobHandler

type JobHandler func(*jobs.JobContext, *rest.Request) (jobs.Job, error)

type ListContainersResponse

type ListContainersResponse struct {
	jobs.ListContainersResponse
}

Apply the "label" from the job to the response

func (*ListContainersResponse) WriteTableTo

func (l *ListContainersResponse) WriteTableTo(w io.Writer) error

type Locator

type Locator interface {
	IsRemote() bool
	Identity() string
}

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)
}

type RemoteJob

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

type RemoteLocator

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

type ResponseContentMode

type ResponseContentMode int
const (
	ResponseJson ResponseContentMode = iota
	ResponseTable
)

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