resource

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package resource defines interfaces that may be implemented by types -- e.g. pkg/apis/GROUP/VERSION/types.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToScheme

func AddToScheme(objs ...Object) func(s *runtime.Scheme) error

AddToScheme returns a function to add the Objects to the scheme.

AddToScheme will register the objects returned by New and NewList under the GroupVersion for each object. AddToScheme will also register the objects under the "__internal" group version for each object that returns true for IsInternalVersion. AddToScheme will register the defaulting function if it implements the Defaulter inteface.

Types

type ArbitrarySubResource

type ArbitrarySubResource interface {
	Name() string
}

ArbitrarySubResource defines interface for registering arbitrary subresource to the parent resource.

type MultiVersionObject

type MultiVersionObject interface {
	// NewStorageVersionObject returns a new empty instance of storage version.
	NewStorageVersionObject() runtime.Object

	// ConvertToStorageVersion receives an new instance of storage version object as the conversion target
	// and overwrites it to the equal form of the current resource version.
	ConvertToStorageVersion(storageObj runtime.Object) error

	// ConvertFromStorageVersion receives an instance of storage version as the conversion source and
	// in-place mutates the current object to the equal form of the storage version object.
	ConvertFromStorageVersion(storageObj runtime.Object) error
}

MultiVersionObject should be implemented if the resource is not storage version and has multiple versions serving at the server.

type Object

type Object interface {
	// Object allows the apiserver libraries to operate on the Object
	runtime.Object

	// GetObjectMeta returns the object meta reference.
	GetObjectMeta() *metav1.ObjectMeta

	// Scoper is used to qualify the resource as either namespace scoped or non-namespace scoped.
	rest.Scoper

	// New returns a new instance of the resource -- e.g. &v1.Deployment{}
	New() runtime.Object

	// NewList return a new list instance of the resource -- e.g. &v1.DeploymentList{}
	NewList() runtime.Object

	// GetGroupVersionResource returns the GroupVersionResource for this resource.  The resource should
	// be the all lowercase and pluralized kind.s
	GetGroupVersionResource() schema.GroupVersionResource

	// IsStorageVersion returns true if the object is also the internal version -- i.e. is the type defined
	// for the API group an alias to this object.
	// If false, the resource is expected to implement MultiVersionObject interface.
	IsStorageVersion() bool
}

Object must be implemented by all resources served by the apiserver.

type ObjectList

type ObjectList interface {
	// Object allows the apiserver libraries to operate on the Object
	runtime.Object

	// GetListMeta returns the list meta reference.
	GetListMeta() *metav1.ListMeta
}

ObjectList must be implemented by all resources' list object.

type ObjectWithArbitrarySubResource

type ObjectWithArbitrarySubResource interface {
	Object
	ArbitrarySubResources() []ArbitrarySubResource
}

ObjectWithArbitrarySubResource adds arbitrary subresources to the resource.

type ObjectWithScaleSubResource

type ObjectWithScaleSubResource interface {
	Object
	SetScale(scaleSubResource *autoscalingv1.Scale)
	GetScale() (scaleSubResource *autoscalingv1.Scale)
}

ObjectWithScaleSubResource defines an interface for getting and setting the scale sub-resource for a resource.

type ObjectWithStatusSubResource

type ObjectWithStatusSubResource interface {
	Object
	GetStatus() (statusSubResource StatusSubResource)
}

ObjectWithStatusSubResource defines an interface for getting and setting the status sub-resource for a resource.

type StatusSubResource

type StatusSubResource interface {
	// CopyTo copies the content of the status subresource to a parent resource.
	CopyTo(parent ObjectWithStatusSubResource)
}

StatusSubResource defines interface for registering status subresource to a parent resource.

Directories

Path Synopsis
Package resourcerest defines interfaces for resource REST implementations.
Package resourcerest defines interfaces for resource REST implementations.
Package resourcestrategy defines interfaces for customizing how resources are converted and stored.
Package resourcestrategy defines interfaces for customizing how resources are converted and stored.
Package util contains a set of utility functions that help plumbing new kubernetes resources into an aggregated apiserver.
Package util contains a set of utility functions that help plumbing new kubernetes resources into an aggregated apiserver.

Jump to

Keyboard shortcuts

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