http

package
v0.0.0-...-47d37a2 Latest Latest
Warning

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

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

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."}
)
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.Response

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 cjobs.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 cjobs.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 {
	cjobs.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 {
	cjobs.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 {
	cjobs.DeleteContainerRequest
	DefaultRequest
}

func (*HttpDeleteContainerRequest) Handler

func (*HttpDeleteContainerRequest) HttpMethod

func (h *HttpDeleteContainerRequest) HttpMethod() string

func (*HttpDeleteContainerRequest) HttpPath

func (h *HttpDeleteContainerRequest) HttpPath() string

type HttpExtension

type HttpExtension interface {
	Routes() []HttpJobHandler
	HttpJobFor(job jobs.Job) (RemoteExecutable, error)
}

type HttpInstallContainerRequest

type HttpInstallContainerRequest struct {
	cjobs.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 {
	cjobs.LinkContainersRequest
	DefaultRequest
}

func (*HttpLinkContainersRequest) Handler

func (*HttpLinkContainersRequest) HttpMethod

func (h *HttpLinkContainersRequest) HttpMethod() string

func (*HttpLinkContainersRequest) HttpPath

func (h *HttpLinkContainersRequest) HttpPath() string

func (*HttpLinkContainersRequest) MarshalHttpRequestBody

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

type HttpListBuildsRequest

type HttpListBuildsRequest cjobs.ListBuildsRequest

func (*HttpListBuildsRequest) Handler

func (*HttpListBuildsRequest) HttpMethod

func (h *HttpListBuildsRequest) HttpMethod() string

func (*HttpListBuildsRequest) HttpPath

func (h *HttpListBuildsRequest) HttpPath() string

type HttpListContainerPortsRequest

type HttpListContainerPortsRequest cjobs.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 {
	cjobs.ListContainersRequest
	DefaultRequest
}

func (*HttpListContainersRequest) Handler

func (*HttpListContainersRequest) HttpMethod

func (h *HttpListContainersRequest) HttpMethod() string

func (*HttpListContainersRequest) HttpPath

func (h *HttpListContainersRequest) HttpPath() string

func (*HttpListContainersRequest) UnmarshalHttpResponse

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

type HttpListImagesRequest

type HttpListImagesRequest cjobs.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 {
	cjobs.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 {
	cjobs.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 {
	cjobs.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 {
	cjobs.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 {
	cjobs.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 {
	cjobs.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 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 jobs.Job) (job jobs.Job, err error)

type JobHandler

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

type ListContainersResponse

type ListContainersResponse struct {
	cjobs.ListContainersResponse
}

Apply the "label" from the job to the response

func (*ListContainersResponse) WriteTableTo

func (l *ListContainersResponse) WriteTableTo(w io.Writer) 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 jobs.Job) (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 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