istio: Index | Files

package resource

import ""

Package resource contains core abstract types for representing configuration resources.


Package Files

entry.go metadata.go name.go origin.go serialization.go stringmap.go version.go

func MustSerialize Uses

func MustSerialize(e *Entry) *mcp.Resource

MustSerialize converts a resource entry into its enveloped form or panics if it cannot.

func Serialize Uses

func Serialize(e *Entry) (*mcp.Resource, error)

Serialize converts a resource entry into its enveloped form.

func SerializeAll Uses

func SerializeAll(entries []*Entry) ([]*mcp.Resource, error)

SerializeAll envelopes and returns all the entries.

type Entry Uses

type Entry struct {
    Metadata Metadata
    Item     proto.Message
    Origin   Origin

Entry is the abstract representation of a versioned config resource in Istio.

func Deserialize Uses

func Deserialize(e *mcp.Resource) (*Entry, error)

Deserialize an entry from an envelope.

func DeserializeAll Uses

func DeserializeAll(es []*mcp.Resource) ([]*Entry, error)

DeserializeAll extracts all entries from the given envelopes and returns.

func MustDeserialize Uses

func MustDeserialize(e *mcp.Resource) *Entry

MustDeserialize deserializes an entry from an envelope or panics.

func (*Entry) Clone Uses

func (r *Entry) Clone() *Entry

Clone returns a deep-copy of this entry. Warning, this is expensive!

func (*Entry) IsEmpty Uses

func (r *Entry) IsEmpty() bool

IsEmpty returns true if the resource Entry.Item is nil.

type Metadata Uses

type Metadata struct {
    Name        Name
    CreateTime  time.Time
    Version     Version
    Labels      StringMap
    Annotations StringMap

Metadata about a resource.

func (*Metadata) Clone Uses

func (m *Metadata) Clone() Metadata

Clone Metadata. Warning, this is expensive!

type Name Uses

type Name struct {
    // contains filtered or unexported fields

Name of the resource. It is unique within a given set of resource of the same collection.

func NewFullName Uses

func NewFullName(name string) (Name, error)

NewFullName returns a given name as a resource Name, validating it for correctness

func NewName Uses

func NewName(namespace, local string) Name

NewName returns a Name from namespace and name.

func NewShortOrFullName Uses

func NewShortOrFullName(defaultNamespace, name string) Name

NewShortOrFullName tries to parse the given name to resource.Name. If the name does not include namespace information, the defaultNamespace is used.

func (Name) InterpretAsNamespaceAndName Uses

func (n Name) InterpretAsNamespaceAndName() (string, string)

InterpretAsNamespaceAndName tries to split the name as namespace and name

func (Name) String Uses

func (n Name) String() string

String interface implementation.

type Origin Uses

type Origin interface {
    FriendlyName() string

    Namespace() string

Origin of a resource. This is source-implementation dependent.

type StringMap Uses

type StringMap map[string]string

StringMap is used to store labels and annotations.

func (*StringMap) Clone Uses

func (s *StringMap) Clone() StringMap

Clone the StringMap

func (*StringMap) CloneOrCreate Uses

func (s *StringMap) CloneOrCreate() StringMap

CloneOrCreate clones a StringMap. It creates the map if it doesn't exist.

func (*StringMap) Delete Uses

func (s *StringMap) Delete(name string)

Remove the given name from the string map

type Version Uses

type Version string

Version is the version identifier of a resource.

Package resource imports 8 packages (graph) and is imported by 26 packages. Updated 2019-11-04. Refresh now. Tools for package owners.