client

package
v0.0.0-...-5f4265e Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2015 License: Apache-2.0 Imports: 14 Imported by: 86

Documentation

Overview

Provides remote execution of jobs via the http transport.

Index

Constants

View Source
const DefaultHttpPort = "43273"

Variables

This section is empty.

Functions

func AddHttpExtension

func AddHttpExtension(extension HttpExtension)

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

func Inline

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

Types

type DefaultRequest

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

func (*DefaultRequest) HttpApiVersion

func (h *DefaultRequest) HttpApiVersion() string

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

func (h *DefaultRequest) Streamable() bool

func (*DefaultRequest) UnmarshalHttpResponse

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

type HttpClient

type HttpClient struct {
	Client http.Client
}

func (*HttpClient) ExecuteRemote

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

type HttpExtension

type HttpExtension interface {
	HttpJobFor(request interface{}) (RemoteExecutable, error)
}

type HttpFailureResponse

type HttpFailureResponse struct {
	Message string
	Data    interface{} `json:"Data,omitempty"`
	// FIXME: default error reporter can include this
	Error string `json:"Error,omitempty"`
}

type HttpStreamable

type HttpStreamable interface {
	Streamable() bool
}

type HttpTransport

type HttpTransport struct {
	HttpClient
}

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

Jump to

Keyboard shortcuts

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