package openapi
import "k8s.io/kubectl/pkg/util/openapi"
Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions. The openapi spec contains the object model definitions and extensions metadata such as the patchStrategy and patchMergeKey for creating patches.
Index ¶
- type CachedOpenAPIGetter
- func NewOpenAPIGetter(openAPIClient discovery.OpenAPISchemaInterface) *CachedOpenAPIGetter
- func (g *CachedOpenAPIGetter) OpenAPISchema() (*openapi_v2.Document, error)
- type CachedOpenAPIParser
- func NewOpenAPIParser(openAPIClient discovery.OpenAPISchemaInterface) *CachedOpenAPIParser
- func (p *CachedOpenAPIParser) Parse() (Resources, error)
- type OpenAPIResourcesGetter
- type Resources
Types ¶
type CachedOpenAPIGetter ¶
type CachedOpenAPIGetter struct { // Cached results sync.Once // contains filtered or unexported fields }
CachedOpenAPIGetter fetches the openapi schema once and then caches it in memory
func NewOpenAPIGetter ¶
func NewOpenAPIGetter(openAPIClient discovery.OpenAPISchemaInterface) *CachedOpenAPIGetter
NewOpenAPIGetter returns an object to return OpenAPIDatas which reads from a server, and then stores in memory for subsequent invocations
func (*CachedOpenAPIGetter) OpenAPISchema ¶
func (g *CachedOpenAPIGetter) OpenAPISchema() (*openapi_v2.Document, error)
OpenAPISchema implements OpenAPISchemaInterface.
type CachedOpenAPIParser ¶
type CachedOpenAPIParser struct { // Cached results sync.Once // contains filtered or unexported fields }
func NewOpenAPIParser ¶
func NewOpenAPIParser(openAPIClient discovery.OpenAPISchemaInterface) *CachedOpenAPIParser
func (*CachedOpenAPIParser) Parse ¶
func (p *CachedOpenAPIParser) Parse() (Resources, error)
type OpenAPIResourcesGetter ¶
OpenAPIResourcesGetter represents a function to return OpenAPI V2 resource specifications. Used for lazy-loading these resource specifications.
type Resources ¶
type Resources interface { LookupResource(gvk schema.GroupVersionKind) proto.Schema GetConsumes(gvk schema.GroupVersionKind, operation string) []string }
Resources interface describe a resources provider, that can give you resource based on group-version-kind.
func NewOpenAPIData ¶
func NewOpenAPIData(doc *openapi_v2.Document) (Resources, error)
NewOpenAPIData creates a new `Resources` out of the openapi document
Source Files ¶
doc.go openapi.go openapi_getter.go
Directories ¶
Path | Synopsis |
---|---|
pkg/util/openapi/testing |
- Version
- v0.32.3 (latest)
- Published
- Mar 12, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 5 days ago –
Tools for package owners.