latest

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package latest defines the default output serializations that code should use and imports the required schemas. It also ensures all previously known and supported API versions are available for conversion. Consumers may import this package in lieu of importing individual versions.

Index

Constants

This section is empty.

Variables

View Source
var (

	// Group is a shortcut to allGroups.Group.
	Group = allGroups.Group
	// RegisterGroup is a shortcut to allGroups.RegisterGroup.
	RegisterGroup = allGroups.RegisterGroup
	// GroupOrDie is a shortcut to allGroups.GroupOrDie.
	GroupOrDie = allGroups.GroupOrDie
	// AllPreferredGroupVersions returns the preferred versions of all
	// registered groups in the form of "group1/version1,group2/version2,..."
	AllPreferredGroupVersions = allGroups.AllPreferredGroupVersions
	// IsRegistered is a shortcut to allGroups.IsRegistered.
	IsRegistered = allGroups.IsRegistered
)

Functions

func CodecFor added in v1.0.7

func CodecFor(group string) (runtime.Codec, error)

func CodecForLegacyGroup added in v1.0.7

func CodecForLegacyGroup() runtime.Codec

func DefaultVersionFor added in v1.0.7

func DefaultVersionFor(group string) (string, error)

func DefaultVersionForLegacyGroup added in v1.0.7

func DefaultVersionForLegacyGroup() string

func InterfacesFor

func InterfacesFor(groupVersion GroupVersion) (*meta.VersionInterfaces, error)

func InterfacesForLegacyGroup added in v1.0.7

func InterfacesForLegacyGroup(version string) (*meta.VersionInterfaces, error)

func RESTMapperFor added in v1.0.7

func RESTMapperFor(group string) (meta.RESTMapper, error)

func RESTMapperForLegacyGroup added in v1.0.7

func RESTMapperForLegacyGroup() meta.RESTMapper

func VersionsForLegacyGroup added in v1.0.7

func VersionsForLegacyGroup() []string

Types

type GroupMeta added in v1.0.7

type GroupMeta struct {
	// GroupVersion represents the current external default version of the group. It
	// is in the form of "group/version".
	GroupVersion string

	// Version represents the current external default version of the group.
	// It equals to the "version" part of GroupVersion.
	Version string

	// Group represents the name of the group
	Group string

	// Versions is the list of versions that are recognized in code. The order
	// provided is assumed to be from the oldest to the newest, e.g.,
	// Versions[0] == oldest and Versions[N-1] == newest.
	// Clients may choose to prefer the latter items in the list over the former
	// items when presented with a set of versions to choose.
	Versions []string

	// GroupVersions is Group + Versions. This is to avoid string concatenation
	// in many places.
	GroupVersions []string

	// Codec is the default codec for serializing output that should use
	// the latest supported version.  Use this Codec when writing to
	// disk, a data store that is not dynamically versioned, or in tests.
	// This codec can decode any object that Kubernetes is aware of.
	Codec runtime.Codec

	// SelfLinker can set or get the SelfLink field of all API types.
	// TODO: when versioning changes, make this part of each API definition.
	// TODO(lavalamp): Combine SelfLinker & ResourceVersioner interfaces, force all uses
	// to go through the InterfacesFor method below.
	SelfLinker runtime.SelfLinker

	// RESTMapper provides the default mapping between REST paths and the objects declared in api.Scheme and all known
	// Kubernetes versions.
	RESTMapper meta.RESTMapper

	// InterfacesFor returns the default Codec and ResourceVersioner for a given version
	// string, or an error if the version is not known.
	InterfacesFor func(version string) (*meta.VersionInterfaces, error)
}

GroupMeta stores the metadata of a group, such as the latest supported version.

type GroupMetaMap added in v1.0.7

type GroupMetaMap map[string]*GroupMeta

GroupMetaMap is a map between group names and their metadata.

func (GroupMetaMap) AllPreferredGroupVersions added in v1.0.7

func (g GroupMetaMap) AllPreferredGroupVersions() string

AllPreferredGroupVersions returns the preferred versions of all registered groups in the form of "group1/version1,group2/version2,..."

func (GroupMetaMap) Group added in v1.0.7

func (g GroupMetaMap) Group(group string) (*GroupMeta, error)

Group returns the metadata of a group if the gruop is registered, otherwise an erorr is returned.

func (GroupMetaMap) GroupOrDie added in v1.0.7

func (g GroupMetaMap) GroupOrDie(group string) *GroupMeta

TODO: This is an expedient function, because we don't check if a Group is supported throughout the code base. We will abandon this function and checking the error returned by the Group() function.

func (GroupMetaMap) IsRegistered added in v1.0.7

func (g GroupMetaMap) IsRegistered(group string) bool

IsRegistered takes a string and determines if it's one of the registered groups

func (GroupMetaMap) RegisterGroup added in v1.0.7

func (g GroupMetaMap) RegisterGroup(group string) (*GroupMeta, error)

RegisterGroup registers a group to GroupMetaMap.

type GroupVersion added in v1.0.7

type GroupVersion struct {
	Group   string
	Version string
}

Jump to

Keyboard shortcuts

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