istio: Index | Files

package resource

import ""

Package resource contains core abstract types for representing configuration resources.


Package Files

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

func MustSerialize Uses

func MustSerialize(r *Instance) *mcp.Resource

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

func Serialize Uses

func Serialize(r *Instance) (*mcp.Resource, error)

Serialize converts a resource entry into its enveloped form.

func SerializeAll Uses

func SerializeAll(resources []*Instance) ([]*mcp.Resource, error)

SerializeAll envelopes and returns all the entries.

func SerializeMetadata Uses

func SerializeMetadata(m Metadata) (*mcp.Metadata, error)

SerializeMetadata converts the given metadata to its enveloped form.

type FullName Uses

type FullName struct {
    Namespace Namespace
    Name      LocalName

FullName is a name that uniquely identifies a resource within the mesh.

func NewFullName Uses

func NewFullName(ns Namespace, n LocalName) FullName

NewFullName creates a new FullName from the given Namespace and Name.

func NewShortOrFullName Uses

func NewShortOrFullName(defaultNamespace Namespace, name string) FullName

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

func ParseFullName Uses

func ParseFullName(name string) (FullName, error)

ParseFullName parses the given name string that was serialized via FullName.String()

func ParseFullNameWithDefaultNamespace Uses

func ParseFullNameWithDefaultNamespace(defaultNamespace Namespace, name string) (FullName, error)

ParseFullName parses the given name string using defaultNamespace if no namespace is found.

func (FullName) String Uses

func (n FullName) String() string

String interface implementation.

func (FullName) Validate Uses

func (n FullName) Validate() error

Validate that the Name and Namespace are set.

type Instance Uses

type Instance struct {
    Metadata Metadata
    Message  proto.Message
    Origin   Origin

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

func Deserialize Uses

func Deserialize(e *mcp.Resource, s resource.Schema) (*Instance, error)

Deserialize an entry from an envelope.

func DeserializeAll Uses

func DeserializeAll(es []*mcp.Resource, s resource.Schema) ([]*Instance, error)

DeserializeAll extracts all entries from the given envelopes and returns.

func MustDeserialize Uses

func MustDeserialize(e *mcp.Resource, s resource.Schema) *Instance

MustDeserialize deserializes an entry from an envelope or panics.

func (*Instance) Clone Uses

func (r *Instance) Clone() *Instance

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

func (*Instance) IsEmpty Uses

func (r *Instance) IsEmpty() bool

IsEmpty returns true if the resource Instance.Message is nil.

type LocalName Uses

type LocalName string

LocalName that uniquely identifies the resource within the Namespace.

func (LocalName) String Uses

func (n LocalName) String() string

type Metadata Uses

type Metadata struct {
    Schema      resource.Schema
    FullName    FullName
    CreateTime  time.Time
    Version     Version
    Labels      StringMap
    Annotations StringMap

Metadata about a resource.

func DeserializeMetadata Uses

func DeserializeMetadata(m *mcp.Metadata, s resource.Schema) (Metadata, error)

DeserializeMetadata extracts metadata portion of the envelope

func (*Metadata) Clone Uses

func (m *Metadata) Clone() Metadata

Clone Metadata. Warning, this is expensive!

type Namespace Uses

type Namespace string

Namespace containing the resource.

func (Namespace) String Uses

func (n Namespace) String() string

type Origin Uses

type Origin interface {
    FriendlyName() string

    Namespace() Namespace

    Reference() Reference

    // FieldMap returns the flat map containing paths of the fields in the resource as keys,
    // and their corresponding line numbers as values
    FieldMap() map[string]int

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

type Reference Uses

type Reference interface {
    String() string

Reference provides more information about an Origin. This is also source-implementation dependant.

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 9 packages (graph) and is imported by 35 packages. Updated 2020-09-24. Refresh now. Tools for package owners.