Documentation

Overview

    Package handlers contains HTTP handlers to implement the apiserver APIs.

    Index

    Constants

    View Source
    const MaxRetryWhenPatchConflicts = 5

      MaxRetryWhenPatchConflicts is the maximum number of conflicts retry during a patch operation before returning failure

      Variables

      This section is empty.

      Functions

      func ConnectResource

      func ConnectResource(connecter rest.Connecter, scope RequestScope, admit admission.Interface, restPath string) restful.RouteFunction

        ConnectResource returns a function that handles a connect request on a rest.Storage object.

        func CreateNamedResource

        func CreateNamedResource(r rest.NamedCreater, scope RequestScope, typer runtime.ObjectTyper, admit admission.Interface) restful.RouteFunction

          CreateNamedResource returns a function that will handle a resource creation with name.

          func CreateResource

          func CreateResource(r rest.Creater, scope RequestScope, typer runtime.ObjectTyper, admit admission.Interface) restful.RouteFunction

            CreateResource returns a function that will handle a resource creation.

            func DeleteCollection

            func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope RequestScope, admit admission.Interface) restful.RouteFunction

              DeleteCollection returns a function that will handle a collection deletion

              func DeleteResource

              func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope RequestScope, admit admission.Interface) restful.RouteFunction

                DeleteResource returns a function that will handle a resource deletion

                func GetResource

                func GetResource(r rest.Getter, e rest.Exporter, scope RequestScope) restful.RouteFunction

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

                  func GetResourceWithOptions

                  func GetResourceWithOptions(r rest.GetterWithOptions, scope RequestScope) restful.RouteFunction

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

                    func GroupHandler

                    func GroupHandler(s runtime.NegotiatedSerializer, group metav1.APIGroup) restful.RouteFunction

                      GroupHandler returns a handler which will return the api.GroupAndVersion of the group.

                      func ListResource

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

                        ListResource returns a function that handles retrieving a list of resources from a rest.Storage object.

                        func PatchResource

                        func PatchResource(r rest.Patcher, scope RequestScope, admit admission.Interface, converter runtime.ObjectConvertor) restful.RouteFunction

                          PatchResource returns a function that will handle a resource patch TODO: Eventually PatchResource should just use GuaranteedUpdate and this routine should be a bit cleaner

                          func RootAPIHandler

                          func RootAPIHandler(s runtime.NegotiatedSerializer, f func(req *restful.Request) []metav1.APIGroup) restful.RouteFunction

                            RootAPIHandler returns a handler which will list the provided groups and versions as available.

                            func SupportedResourcesHandler

                            func SupportedResourcesHandler(s runtime.NegotiatedSerializer, groupVersion schema.GroupVersion, lister APIResourceLister) restful.RouteFunction

                              SupportedResourcesHandler returns a handler which will list the provided resources as available.

                              func UpdateResource

                              func UpdateResource(r rest.Updater, scope RequestScope, typer runtime.ObjectTyper, admit admission.Interface) restful.RouteFunction

                                UpdateResource returns a function that will handle a resource update

                                Types

                                type APIResourceLister

                                type APIResourceLister interface {
                                	ListAPIResources() []metav1.APIResource
                                }

                                type ContextFunc

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

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

                                  type ProxyHandler

                                  type ProxyHandler struct {
                                  	Prefix     string
                                  	Storage    map[string]rest.Storage
                                  	Serializer runtime.NegotiatedSerializer
                                  	Mapper     request.RequestContextMapper
                                  }

                                    ProxyHandler provides a http.Handler which will proxy traffic to locations specified by items implementing Redirector.

                                    func (*ProxyHandler) ServeHTTP

                                    func (r *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

                                    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 *restful.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 *restful.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(req *restful.Request, obj runtime.Object) (uri string, err error)
                                      	// GenerateLink creates an encoded URI for a list that represents the canonical path and query.
                                      	GenerateListLink(req *restful.Request) (uri string, err error)
                                      }

                                        ScopeNamer handles accessing names from requests and objects

                                        type TimeoutFactory

                                        type TimeoutFactory interface {
                                        	TimeoutCh() (<-chan time.Time, func() bool)
                                        }

                                          timeoutFactory abstracts watch timeout logic for testing

                                          type WatchServer

                                          type WatchServer struct {
                                          	Watching watch.Interface
                                          	Scope    RequestScope
                                          
                                          	// true if websocket messages should use text framing (as opposed to binary framing)
                                          	UseTextFraming bool
                                          	// the media type this watch is being served with
                                          	MediaType string
                                          	// used to frame the watch stream
                                          	Framer runtime.Framer
                                          	// used to encode the watch stream event itself
                                          	Encoder runtime.Encoder
                                          	// used to encode the nested object in the watch stream
                                          	EmbeddedEncoder runtime.Encoder
                                          	Fixup           func(runtime.Object)
                                          
                                          	TimeoutFactory TimeoutFactory
                                          }

                                            WatchServer serves a watch.Interface over a websocket or vanilla HTTP.

                                            func (*WatchServer) HandleWS

                                            func (s *WatchServer) HandleWS(ws *websocket.Conn)

                                              HandleWS implements a websocket handler.

                                              func (*WatchServer) ServeHTTP

                                              func (s *WatchServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

                                                ServeHTTP serves a series of encoded events via HTTP with Transfer-Encoding: chunked or over a websocket connection.

                                                Directories

                                                Path Synopsis
                                                Package negotation contains media type negotiation logic.
                                                Package negotation contains media type negotiation logic.
                                                Package responsewriters containers helpers to write responses in HTTP handlers.
                                                Package responsewriters containers helpers to write responses in HTTP handlers.