resolver

package
v0.27.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 9 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSchemaNotFound = fmt.Errorf("schema not found")

ErrSchemaNotFound is wrapped and returned if the schema cannot be located by the resolver.

Functions

This section is empty.

Types

type ClientDiscoveryResolver

type ClientDiscoveryResolver struct {
	Discovery discovery.DiscoveryInterface
}

ClientDiscoveryResolver uses client-go discovery to resolve schemas at run time.

func (*ClientDiscoveryResolver) ResolveSchema

func (r *ClientDiscoveryResolver) ResolveSchema(gvk schema.GroupVersionKind) (*spec.Schema, error)

type DefinitionsSchemaResolver

type DefinitionsSchemaResolver struct {
	// contains filtered or unexported fields
}

DefinitionsSchemaResolver resolves the schema of a built-in type by looking up the OpenAPI definitions.

func NewDefinitionsSchemaResolver

func NewDefinitionsSchemaResolver(scheme *runtime.Scheme, getDefinitions common.GetOpenAPIDefinitions) *DefinitionsSchemaResolver

NewDefinitionsSchemaResolver creates a new DefinitionsSchemaResolver. An example working setup: scheme = "k8s.io/client-go/kubernetes/scheme".Scheme getDefinitions = "k8s.io/kubernetes/pkg/generated/openapi".GetOpenAPIDefinitions

func (*DefinitionsSchemaResolver) ResolveSchema

type SchemaResolver

type SchemaResolver interface {
	// ResolveSchema takes a GroupVersionKind (GVK) and returns the OpenAPI schema
	// identified by the GVK.
	// The function returns a non-nil error if the schema cannot be found or fail
	// to resolve. The returned error wraps ErrSchemaNotFound if the resolution is
	// attempted but the corresponding schema cannot be found.
	ResolveSchema(gvk schema.GroupVersionKind) (*spec.Schema, error)
}

SchemaResolver finds the OpenAPI schema for the given GroupVersionKind. This interface uses the type defined by k8s.io/kube-openapi

Jump to

Keyboard shortcuts

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