Version: v0.0.0-...-53c5426 Latest Latest

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

Go to latest
Published: Mar 23, 2016 License: Apache-2.0 Imports: 17 Imported by: 0



Package rest has generic implementations of resources used for REST responses



This section is empty.


This section is empty.


This section is empty.


type ErrorResponder

type ErrorResponder interface {
	Error(err error)

ErrorResponder abstracts error reporting to the proxy handler to remove the need to hardcode a particular error format.

type GenericHttpResponseChecker

type GenericHttpResponseChecker struct {
	QualifiedResource unversioned.GroupResource
	Name              string

A generic http response checker to transform the error.

func NewGenericHttpResponseChecker

func NewGenericHttpResponseChecker(qualifiedResource unversioned.GroupResource, name string) GenericHttpResponseChecker

func (GenericHttpResponseChecker) Check

func (checker GenericHttpResponseChecker) Check(resp *http.Response) error

type HttpResponseChecker

type HttpResponseChecker interface {
	Check(resp *http.Response) error

Check the http error status from a location URL. And convert an error into a structured API object. Finally ensure we close the body before returning the error

type LocationStreamer

type LocationStreamer struct {
	Location        *url.URL
	Transport       http.RoundTripper
	ContentType     string
	Flush           bool
	ResponseChecker HttpResponseChecker

LocationStreamer is a resource that streams the contents of a particular location URL

func (*LocationStreamer) GetObjectKind

func (obj *LocationStreamer) GetObjectKind() unversioned.ObjectKind

func (*LocationStreamer) InputStream

func (s *LocationStreamer) InputStream(apiVersion, acceptHeader string) (stream io.ReadCloser, flush bool, contentType string, err error)

InputStream returns a stream with the contents of the URL location. If no location is provided, a null stream is returned.

type UpgradeAwareProxyHandler

type UpgradeAwareProxyHandler struct {
	UpgradeRequired bool
	Location        *url.URL
	// Transport provides an optional round tripper to use to proxy. If nil, the default proxy transport is used
	Transport http.RoundTripper
	// WrapTransport indicates whether the provided Transport should be wrapped with default proxy transport behavior (URL rewriting, X-Forwarded-* header setting)
	WrapTransport  bool
	FlushInterval  time.Duration
	MaxBytesPerSec int64
	Responder      ErrorResponder

UpgradeAwareProxyHandler is a handler for proxy requests that may require an upgrade

func NewUpgradeAwareProxyHandler

func NewUpgradeAwareProxyHandler(location *url.URL, transport http.RoundTripper, wrapTransport, upgradeRequired bool, responder ErrorResponder) *UpgradeAwareProxyHandler

NewUpgradeAwareProxyHandler creates a new proxy handler with a default flush interval. Responder is required for returning errors to the caller.

func (*UpgradeAwareProxyHandler) ServeHTTP

ServeHTTP handles the proxy request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL