schema

package
v0.0.0-...-fe632b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder is a builder for schema.

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns a new instance of a Builder.

func (*Builder) Add

func (b *Builder) Add(spec ...ResourceSpec) *Builder

Add a new ResourceSpec to the schema.

func (*Builder) Build

func (b *Builder) Build() *Instance

Build a new instance of schema. The specs will be sorted by resource name.

type Instance

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

Instance represents a schema for a set of known Kubernetes resource types.

func New

func New(spec ...ResourceSpec) *Instance

New is a simplified Instance factory method when all specs can be provided as arguments.

func (*Instance) All

func (s *Instance) All() []ResourceSpec

All returns information about all known types.

func (*Instance) Get

func (s *Instance) Get(kind string) *ResourceSpec

Get returns the schema for the given kind, or nil if not found.

type ResourceSpec

type ResourceSpec struct {

	// Singular name of the K8s resource
	Singular string

	// Plural name of the K8s resource
	Plural string

	// Group name of the K8s resource
	Group string

	// Version of the K8s resource
	Version string

	// Kind of the K8s resource
	Kind string

	// ListKind of the K8s resource
	ListKind string

	// Target resource type of the resource
	Target resource.Info

	// The converter to use
	Converter converter.Fn
}

ResourceSpec represents a known crd. It is used to drive the K8s-related machinery, and to map to the proto format.

func (*ResourceSpec) APIResource

func (i *ResourceSpec) APIResource() *metaV1.APIResource

APIResource generated from this type.

func (*ResourceSpec) CanonicalResourceName

func (i *ResourceSpec) CanonicalResourceName() string

CanonicalResourceName of the resource.

func (*ResourceSpec) GroupVersion

func (i *ResourceSpec) GroupVersion() sc.GroupVersion

GroupVersion returns the GroupVersion of this type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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