metadata

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ObjectTypeLookup = map[ObjectType]string{
	Image:  "image",
	Kernel: "kernel",
	VM:     "VM",
}

Functions

This section is empty.

Types

type AnyMetadata

type AnyMetadata interface {
	GetMD() *Metadata
}

This interface enables taking in any struct which embeds Metadata

func LoadAllMetadata

func LoadAllMetadata(path string, loadFunc func(string) (AnyMetadata, error)) ([]AnyMetadata, error)

type Filter

type Filter interface {
	Filter(AnyMetadata) []string
	ErrNonexistent() error
	ErrAmbiguous([]*Match) error
}

type IDNameFilter

type IDNameFilter struct {
	// contains filtered or unexported fields
}

func NewIDNameFilter

func NewIDNameFilter(p string, t ObjectType) *IDNameFilter

func (*IDNameFilter) ErrAmbiguous

func (f *IDNameFilter) ErrAmbiguous(matches []*Match) error

func (*IDNameFilter) ErrNonexistent

func (f *IDNameFilter) ErrNonexistent() error

func (*IDNameFilter) Filter

func (f *IDNameFilter) Filter(any AnyMetadata) []string

type Match

type Match struct {
	Object  AnyMetadata
	Strings []string
}

func (*Match) String

func (m *Match) String() string

type Metadata

type Metadata struct {
	ID         string      `json:"ID"`
	Name       Name        `json:"Name"`
	Type       ObjectType  `json:"Type"`
	Created    metav1.Time `json:"Created"`
	ObjectData `json:"ObjectData"`
}

func NewMetadata

func NewMetadata(id string, name *Name, t ObjectType, data ObjectData) *Metadata

func (*Metadata) GetMD

func (md *Metadata) GetMD() *Metadata

func (*Metadata) Load

func (md *Metadata) Load() error

func (*Metadata) ObjectPath

func (md *Metadata) ObjectPath() string

func (*Metadata) Save

func (md *Metadata) Save() error

type Name

type Name struct {
	// contains filtered or unexported fields
}

func NewName

func NewName(input string, matches *[]*Name) (*Name, error)

func (Name) MarshalJSON

func (n Name) MarshalJSON() ([]byte, error)

func (*Name) String

func (n *Name) String() string

func (*Name) UnmarshalJSON

func (n *Name) UnmarshalJSON(b []byte) error

type ObjectData

type ObjectData interface{}

type ObjectType

type ObjectType int
const (
	Image ObjectType = iota + 1 // Reserve 0 for unset
	Kernel
	VM
)

func (ObjectType) MarshalJSON

func (x ObjectType) MarshalJSON() ([]byte, error)

func (ObjectType) Path

func (x ObjectType) Path() string

func (ObjectType) String

func (x ObjectType) String() string

func (*ObjectType) UnmarshalJSON

func (x *ObjectType) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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