handlers

package
v0.0.0-...-b479636 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResource

func CreateResource(r rest.Creater, scope RequestScope, typer runtime.ObjectTyper) http.HandlerFunc

CreateResource returns a function that will handle a resource creation. FIXME (rantuttl): 'Typer' already sent in scope object. Remove from this and associated method signatures

func DeleteResource

func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope RequestScope) http.HandlerFunc

DeleteResource returns a function that will handle a resource deletion

func GetResource

func GetResource(r rest.Getter, e rest.Exporter, scope RequestScope) http.HandlerFunc

GetResource returns a function that handles retrieving a single resource from a rest.Storage object.

func ListResource

func ListResource(r rest.Lister, rw rest.Watcher, scope RequestScope, forceWatch bool, minRequestTimeout time.Duration) http.HandlerFunc

Types

type ContextBasedNaming

type ContextBasedNaming struct {
	GetContext    ContextFunc
	SelfLinker    runtime.SelfLinker
	ClusterScoped bool

	SelfLinkPathPrefix string
	SelfLinkPathSuffix string
}
func (n ContextBasedNaming) GenerateLink(requestInfo *request.RequestInfo, obj runtime.Object) (uri string, err error)
func (n ContextBasedNaming) GenerateListLink(req *http.Request) (uri string, err error)

func (ContextBasedNaming) Name

func (n ContextBasedNaming) Name(req *http.Request) (namespace, name string, err error)

func (ContextBasedNaming) Namespace

func (n ContextBasedNaming) Namespace(req *http.Request) (namespace string, err error)

func (ContextBasedNaming) ObjectName

func (n ContextBasedNaming) ObjectName(obj runtime.Object) (namespace, name string, err error)
func (n ContextBasedNaming) SetSelfLink(obj runtime.Object, url string) error

type ContextFunc

type ContextFunc func(req *http.Request) request.Context

ContextFunc returns a Context given a request - a context must be returned

type RequestScope

RequestScope encapsulates common fields across all RESTful handler methods.

type ScopeNamer

type ScopeNamer interface {
	// Namespace returns the appropriate namespace value from the request (may be empty) or an
	// error.
	Namespace(req *http.Request) (namespace string, err error)
	// Name returns the name from the request, and an optional namespace value if this is a namespace
	// scoped call. An error is returned if the name is not available.
	Name(req *http.Request) (namespace, name string, err error)
	// ObjectName returns the namespace and name from an object if they exist, or an error if the object
	// does not support names.
	ObjectName(obj runtime.Object) (namespace, name string, err error)
	// SetSelfLink sets the provided URL onto the object. The method should return nil if the object
	// does not support selfLinks.
	SetSelfLink(obj runtime.Object, url string) error
	// GenerateLink creates an encoded URI for a given runtime object that represents the canonical path
	// and query.
	GenerateLink(requestInfo *request.RequestInfo, obj runtime.Object) (uri string, err error)
	// GenerateListLink creates an encoded URI for a list that represents the canonical path and query.
	GenerateListLink(req *http.Request) (uri string, err error)
}

ScopeNamer handles accessing names from requests and objects

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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