package rest

import "k8s.io/apiserver/pkg/registry/generic/rest"

Package rest has generic implementations of resources used for REST responses

Index

Functions

func PreventRedirects

func PreventRedirects(_ *http.Request, _ []*http.Request) error

PreventRedirects is a redirect checker that prevents the client from following a redirect.

Types

type CounterMetric

type CounterMetric interface {
	Inc()
}

type GenericHttpResponseChecker

type GenericHttpResponseChecker struct {
	QualifiedResource schema.GroupResource
	Name              string
}

A generic http response checker to transform the error.

func NewGenericHttpResponseChecker

func NewGenericHttpResponseChecker(qualifiedResource schema.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
	RedirectChecker func(req *http.Request, via []*http.Request) error
	// TLSVerificationErrorCounter is an optional value that will Inc every time a TLS error is encountered.  This can
	// be wired a single prometheus counter instance to get counts overall.
	TLSVerificationErrorCounter CounterMetric
	// DeprecatedTLSVerificationErrorCounter is a temporary field used to rename
	// the kube_apiserver_pod_logs_pods_logs_backend_tls_failure_total metric
	// with a one release deprecation period in 1.27.0.
	DeprecatedTLSVerificationErrorCounter CounterMetric
}

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

func (*LocationStreamer) DeepCopyObject

func (obj *LocationStreamer) DeepCopyObject() runtime.Object

func (*LocationStreamer) GetObjectKind

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

func (*LocationStreamer) InputStream

func (s *LocationStreamer) InputStream(ctx context.Context, 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.

Source Files

doc.go response_checker.go streamer.go

Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
12 packages
Last checked
1 hour ago

Tools for package owners.