resource

package
v0.0.0-...-e7c9706 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromKubernetesGVK

func FromKubernetesGVK(in *schema.GroupVersionKind) config.GroupVersionKind

FromKubernetesGVK converts a Kubernetes GVK to an Istio GVK

Types

type Builder

type Builder struct {
	// ClusterScoped is true for resource in cluster-level.
	ClusterScoped bool

	// Synthetic is true for resource that do not actually exist in a cluster
	Synthetic bool

	// Builtin is true for resources that are builtin (not CRD)
	Builtin bool

	// Identifier is the unique identifier for the resource
	Identifier string

	// Kind is the config proto type.
	Kind string

	// Plural is the type in plural.
	Plural string

	// Group is the config proto group.
	Group string

	// Version is the config proto version.
	Version string

	// VersionAliases is the config proto version aliases.
	VersionAliases []string

	// Proto refers to the protobuf message type name corresponding to the type
	Proto string

	StatusProto string

	// ReflectType is the type of the go struct
	ReflectType reflect.Type

	// StatusType is the type of the associated status.
	StatusType reflect.Type

	// ProtoPackage refers to the name of golang package for the protobuf message.
	ProtoPackage string

	// StatusPackage refers to the name of the golang status package.
	StatusPackage string

	// ValidateProto performs validation on protobuf messages based on this schema.
	ValidateProto validation.ValidateFunc
}

Builder for a Schema.

func (Builder) Build

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

Build a Schema instance.

func (Builder) BuildNoValidate

func (b Builder) BuildNoValidate() Schema

BuildNoValidate builds the Schema without checking the fields.

func (Builder) MustBuild

func (b Builder) MustBuild() Schema

MustBuild calls Build and panics if it fails.

type Schema

type Schema interface {
	fmt.Stringer

	// GroupVersionKind of the resource. This is the only way to uniquely identify a resource.
	GroupVersionKind() config.GroupVersionKind

	// GroupVersionResource of the resource.
	GroupVersionResource() schema.GroupVersionResource

	// IsClusterScoped indicates that this resource is scoped to a particular namespace within a cluster.
	IsClusterScoped() bool

	// IsBuiltin indicates that this resource is builtin (not a CRD)
	IsBuiltin() bool

	// Identifier returns a unique identifier for the resource
	Identifier() string

	// Kind for this resource.
	Kind() string

	// Plural returns the plural form of the Kind.
	Plural() string

	// Group for this resource.
	Group() string

	// Version of this resource.
	Version() string

	// GroupVersionAliasKinds is the GVK of this resource,
	// but the version is from its version aliases to perform version conversion.
	GroupVersionAliasKinds() []config.GroupVersionKind

	// APIVersion is a utility that returns a k8s API version string of the form "Group/Version".
	APIVersion() string

	// Proto returns the protocol buffer type name for this resource.
	Proto() string

	// ProtoPackage returns the golang package for the protobuf resource.
	ProtoPackage() string

	// NewInstance returns a new instance of the protocol buffer message for this resource.
	NewInstance() (config.Spec, error)

	// Status returns the associated status of the schema
	Status() (config.Status, error)

	// StatusKind returns the Kind of the status field. If unset, the field does not support status.
	StatusKind() string
	StatusPackage() string

	// MustNewInstance calls NewInstance and panics if an error occurs.
	MustNewInstance() config.Spec

	// Validate this schema.
	Validate() error

	// ValidateConfig validates that the given config message is of the correct type for this schema
	// and that the contents are valid.
	ValidateConfig(cfg config.Config) (validation.Warning, error)

	// 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 resource.

Jump to

Keyboard shortcuts

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