Back to / pkg / config / schema / resource

Package resource

Latest Go to latest

The latest major version is .

Published: 1 hour ago | License: Apache-2.0 | Module:


func FromKubernetesGVK

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

FromKubernetesGVK converts a Kubernetes GVK to an Istio GVK

type Builder

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

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

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

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

	// ProtoPackage refers to the name of golang package for the protobuf message.
	ProtoPackage 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 {

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

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

	// 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)

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier