collection

package
v0.0.0-...-6be268e Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	VariableName string
	Resource     resource.Schema
}

Builder is config for the creation of a Schema

func (Builder) Build

func (b Builder) Build() (Schema, error)

Build a Schema instance.

func (Builder) MustBuild

func (b Builder) MustBuild() Schema

MustBuild calls Build and panics if it fails.

type Schema

type Schema interface {
	fmt.Stringer

	// VariableName is a utility method used to help with codegen. It provides the name of a Schema instance variable.
	VariableName() string

	// Resource is the schema for resources contained in this collection.
	Resource() resource.Schema

	// Equal is a helper function for testing equality between Schema instances. This supports comparison
	// with the cmp library.
	Equal(other Schema) bool
}

Schema for a collection.

type Schemas

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

Schemas contains metadata about configuration resources.

func SchemasFor

func SchemasFor(schemas ...resource.Schema) Schemas

SchemasFor is a shortcut for creating Schemas. It uses MustAdd for each element.

func (Schemas) Add

func (s Schemas) Add(toAdd ...resource.Schema) Schemas

Add creates a copy of this Schemas with the given schemas added.

func (Schemas) All

func (s Schemas) All() []resource.Schema

All returns all known Schemas

func (Schemas) Equal

func (s Schemas) Equal(o Schemas) bool

func (Schemas) FindByGroupKind

func (s Schemas) FindByGroupKind(gvk config.GroupVersionKind) (resource.Schema, bool)

FindByGroupKind searches and returns the first schema with the given GVK, ignoring versions. Generally it's a good idea to use FindByGroupVersionAliasesKind, which validates the version as well. FindByGroupKind provides future proofing against versions we don't yet know about; given we don't know them, its risky.

func (Schemas) FindByGroupVersionAliasesKind

func (s Schemas) FindByGroupVersionAliasesKind(gvk config.GroupVersionKind) (resource.Schema, bool)

FindByGroupVersionAliasesKind searches and returns the first schema with the given GVK, if not found, it will search for version aliases for the schema to see if there is a match.

func (Schemas) FindByGroupVersionKind

func (s Schemas) FindByGroupVersionKind(gvk config.GroupVersionKind) (resource.Schema, bool)

FindByGroupVersionKind searches and returns the first schema with the given GVK

func (Schemas) FindByGroupVersionResource

func (s Schemas) FindByGroupVersionResource(gvr schema.GroupVersionResource) (resource.Schema, bool)

FindByGroupVersionResource searches and returns the first schema with the given GVR

func (Schemas) ForEach

func (s Schemas) ForEach(handleSchema func(resource.Schema) (done bool))

ForEach executes the given function on each contained schema, until the function returns true.

func (Schemas) GroupVersionKinds

func (s Schemas) GroupVersionKinds() []config.GroupVersionKind

GroupVersionKinds returns all known GroupVersionKinds

func (Schemas) Intersect

func (s Schemas) Intersect(otherSchemas Schemas) Schemas

func (Schemas) Kinds

func (s Schemas) Kinds() []string

Kinds returns all known resource kinds.

func (Schemas) Remove

func (s Schemas) Remove(toRemove ...resource.Schema) Schemas

Remove creates a copy of this Schemas with the given schemas removed.

func (Schemas) Union

func (s Schemas) Union(otherSchemas Schemas) Schemas

func (Schemas) Validate

func (s Schemas) Validate() (err error)

Validate the schemas. Returns error if there is a problem.

type SchemasBuilder

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

SchemasBuilder is a builder for the schemas type.

func NewSchemasBuilder

func NewSchemasBuilder() *SchemasBuilder

NewSchemasBuilder returns a new instance of SchemasBuilder.

func (*SchemasBuilder) Add

func (b *SchemasBuilder) Add(s resource.Schema) error

Add a new collection to the schemas.

func (*SchemasBuilder) Build

func (b *SchemasBuilder) Build() Schemas

Build a new schemas from this SchemasBuilder.

func (*SchemasBuilder) MustAdd

MustAdd calls Add and panics if it fails.

Jump to

Keyboard shortcuts

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