request

package
v0.0.0-...-fc1dba9 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NamespaceNone = ""
	NamespaceRoot = "root"
)
View Source
const (
	GetOperation    = "get"
	ListOperation   = "list"
	CreateOperation = "create"
	UpdateOperation = "update"
	PatchOperation  = "patch"
	DeleteOperation = "delete"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestInfo

type RequestInfo struct {
	IsResourceRequest bool
	Path              string
	Verb              string

	APIPrefix  string
	APIGroup   string
	APIVersion string
	Namespace  string
	// Resource is the name of the resource being requested.  This is not the kind.  For example: pods
	Resource    string
	Subresource string
	// Name is empty for some verbs, but if the request directly indicates a name (not in body content) then this field is filled in.
	Name string
	// Parts are the path parts for the request, always starting with /{resource}/{name}
	Parts []string
}

RequestInfo holds information parsed from the http.Request

type RequestInfoFactory

type RequestInfoFactory struct {
	APIPrefixes set.String
}

func (*RequestInfoFactory) NewRequestInfo

func (r *RequestInfoFactory) NewRequestInfo(req *http.Request) (*RequestInfo, error)

TODO write an integration test against the swagger doc to test the RequestInfo and match up behavior to responses NewRequestInfo returns the information from the http request. If error is not nil, RequestInfo holds the information as best it is known before the failure It handles both resource and non-resource requests and fills in all the pertinent information for each. Valid Inputs: Resource paths /apis/{api-group}/{version}/namespaces /api/{version}/namespaces /api/{version}/namespaces/{namespace} /api/{version}/namespaces/{namespace}/{resource} /api/{version}/namespaces/{namespace}/{resource}/{resourceName} /api/{version}/{resource} /api/{version}/{resource}/{resourceName}

Special verbs with subresources: /api/{version}/watch/{resource} /api/{version}/watch/namespaces/{namespace}/{resource}

NonResource paths /apis/{api-group}/{version} /apis/{api-group} /apis /api/{version} /api /healthz /

type RequestInfoResolver

type RequestInfoResolver interface {
	NewRequestInfo(req *http.Request) (*RequestInfo, error)
}

Jump to

Keyboard shortcuts

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