Documentation ¶
Overview ¶
Package handlers contains HTTP handlers to implement the apiserver APIs.
Index ¶
- Constants
- func ConnectResource(connecter rest.Connecter, scope *RequestScope, admit admission.Interface, ...) http.HandlerFunc
- func CreateNamedResource(r rest.NamedCreater, scope *RequestScope, admission admission.Interface) http.HandlerFunc
- func CreateResource(r rest.Creater, scope *RequestScope, admission admission.Interface) http.HandlerFunc
- func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope *RequestScope, ...) http.HandlerFunc
- func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope *RequestScope, ...) http.HandlerFunc
- func GetResource(r rest.Getter, e rest.Exporter, scope *RequestScope) http.HandlerFunc
- func GetResourceWithOptions(r rest.GetterWithOptions, scope *RequestScope, isSubresource bool) http.HandlerFunc
- func ListResource(r rest.Lister, rw rest.Watcher, scope *RequestScope, forceWatch bool, ...) http.HandlerFunc
- func PatchResource(r rest.Patcher, scope *RequestScope, admit admission.Interface, ...) http.HandlerFunc
- func UpdateResource(r rest.Updater, scope *RequestScope, admit admission.Interface) http.HandlerFunc
- type ContextBasedNaming
- 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 (n ContextBasedNaming) Name(req *http.Request) (namespace, name string, err error)
- func (n ContextBasedNaming) Namespace(req *http.Request) (namespace string, err error)
- func (n ContextBasedNaming) ObjectName(obj runtime.Object) (namespace, name string, err error)
- func (n ContextBasedNaming) SetSelfLink(obj runtime.Object, url string) error
- type RequestScope
- func (scope *RequestScope) AllowsMediaTypeTransform(mimeType, mimeSubType string, gvk *schema.GroupVersionKind) bool
- func (scope *RequestScope) AllowsServerVersion(version string) bool
- func (scope *RequestScope) AllowsStreamSchema(s string) bool
- func (r *RequestScope) GetEquivalentResourceMapper() runtime.EquivalentResourceMapper
- func (r *RequestScope) GetObjectConvertor() runtime.ObjectConvertor
- func (r *RequestScope) GetObjectCreater() runtime.ObjectCreater
- func (r *RequestScope) GetObjectDefaulter() runtime.ObjectDefaulter
- func (r *RequestScope) GetObjectTyper() runtime.ObjectTyper
- type ScopeNamer
- type TimeoutFactory
- type WatchServer
Constants ¶
const ( // DuplicateOwnerReferencesWarningFormat is the warning that a client receives when a create/update request contains // duplicate owner reference entries. DuplicateOwnerReferencesWarningFormat = "" /* 201-byte string literal not displayed */ // DuplicateOwnerReferencesAfterMutatingAdmissionWarningFormat indicates the duplication was observed // after mutating admission. // NOTE: For CREATE and UPDATE requests the API server dedups both before and after mutating admission. // For PATCH request the API server only dedups after mutating admission. DuplicateOwnerReferencesAfterMutatingAdmissionWarningFormat = "" /* 234-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func ConnectResource ¶
func ConnectResource(connecter rest.Connecter, scope *RequestScope, admit admission.Interface, restPath string, isSubresource bool) http.HandlerFunc
ConnectResource returns a function that handles a connect request on a rest.Storage object.
func CreateNamedResource ¶
func CreateNamedResource(r rest.NamedCreater, scope *RequestScope, admission admission.Interface) http.HandlerFunc
CreateNamedResource returns a function that will handle a resource creation with name.
func CreateResource ¶
func CreateResource(r rest.Creater, scope *RequestScope, admission admission.Interface) http.HandlerFunc
CreateResource returns a function that will handle a resource creation.
func DeleteCollection ¶
func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope *RequestScope, admit admission.Interface) http.HandlerFunc
DeleteCollection returns a function that will handle a collection deletion
func DeleteResource ¶
func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope *RequestScope, admit admission.Interface) http.HandlerFunc
DeleteResource returns a function that will handle a resource deletion TODO admission here becomes solely validating admission
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 GetResourceWithOptions ¶
func GetResourceWithOptions(r rest.GetterWithOptions, scope *RequestScope, isSubresource bool) http.HandlerFunc
GetResourceWithOptions 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
func PatchResource ¶
func PatchResource(r rest.Patcher, scope *RequestScope, admit admission.Interface, patchTypes []string) http.HandlerFunc
PatchResource returns a function that will handle a resource patch.
func UpdateResource ¶
func UpdateResource(r rest.Updater, scope *RequestScope, admit admission.Interface) http.HandlerFunc
UpdateResource returns a function that will handle a resource update
Types ¶
type ContextBasedNaming ¶
type ContextBasedNaming struct { SelfLinker runtime.SelfLinker ClusterScoped bool SelfLinkPathPrefix string SelfLinkPathSuffix string }
func (ContextBasedNaming) GenerateLink ¶
func (n ContextBasedNaming) GenerateLink(requestInfo *request.RequestInfo, obj runtime.Object) (uri string, err error)
func (ContextBasedNaming) GenerateListLink ¶
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 (ContextBasedNaming) SetSelfLink ¶
func (n ContextBasedNaming) SetSelfLink(obj runtime.Object, url string) error
type RequestScope ¶
type RequestScope struct { Namer ScopeNamer Serializer runtime.NegotiatedSerializer runtime.ParameterCodec // StandardSerializers, if set, restricts which serializers can be used when // we aren't transforming the output (into Table or PartialObjectMetadata). // Used only by CRDs which do not yet support Protobuf. StandardSerializers []runtime.SerializerInfo Creater runtime.ObjectCreater Convertor runtime.ObjectConvertor Defaulter runtime.ObjectDefaulter Typer runtime.ObjectTyper UnsafeConvertor runtime.ObjectConvertor Authorizer authorizer.Authorizer EquivalentResourceMapper runtime.EquivalentResourceMapper TableConvertor rest.TableConvertor FieldManager *fieldmanager.FieldManager Resource schema.GroupVersionResource Kind schema.GroupVersionKind Subresource string MetaGroupVersion schema.GroupVersion // HubGroupVersion indicates what version objects read from etcd or incoming requests should be converted to for in-memory handling. HubGroupVersion schema.GroupVersion MaxRequestBodyBytes int64 }
RequestScope encapsulates common fields across all RESTful handler methods.
func (*RequestScope) AllowsMediaTypeTransform ¶
func (scope *RequestScope) AllowsMediaTypeTransform(mimeType, mimeSubType string, gvk *schema.GroupVersionKind) bool
func (*RequestScope) AllowsServerVersion ¶
func (scope *RequestScope) AllowsServerVersion(version string) bool
func (*RequestScope) AllowsStreamSchema ¶
func (scope *RequestScope) AllowsStreamSchema(s string) bool
func (*RequestScope) GetEquivalentResourceMapper ¶
func (r *RequestScope) GetEquivalentResourceMapper() runtime.EquivalentResourceMapper
func (*RequestScope) GetObjectConvertor ¶
func (r *RequestScope) GetObjectConvertor() runtime.ObjectConvertor
func (*RequestScope) GetObjectCreater ¶
func (r *RequestScope) GetObjectCreater() runtime.ObjectCreater
func (*RequestScope) GetObjectDefaulter ¶
func (r *RequestScope) GetObjectDefaulter() runtime.ObjectDefaulter
func (*RequestScope) GetObjectTyper ¶
func (r *RequestScope) GetObjectTyper() runtime.ObjectTyper
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
type TimeoutFactory ¶
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 // used to correct the object before we send it to the serializer Fixup func(runtime.Object) 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.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package negotiation contains media type negotiation logic.
|
Package negotiation 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. |