metadata

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 14 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 AmbiguousError added in v0.3.0

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

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(*ID) (AnyMetadata, error)) ([]AnyMetadata, error)

type Filter

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

type ID added in v0.3.0

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

func (*ID) Equal added in v0.3.0

func (id *ID) Equal(other *ID) bool

func (*ID) MarshalJSON added in v0.3.0

func (id *ID) MarshalJSON() ([]byte, error)

func (*ID) String added in v0.3.0

func (id *ID) String() string

func (*ID) UnmarshalJSON added in v0.3.0

func (id *ID) UnmarshalJSON(b []byte) 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         *ID         `json:"ID"`
	Name       Name        `json:"Name"`
	Type       ObjectType  `json:"Type"`
	Created    metav1.Time `json:"Created"`
	ObjectData `json:"ObjectData"`
}

func NewMetadata

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

func (*Metadata) Cleanup added in v0.3.0

func (md *Metadata) Cleanup(silent bool) error

silent specifies if the ID should be printed, when chaining commands silence all but the last command to print the ID only once

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) Remove added in v0.3.0

func (md *Metadata) Remove(quiet bool) error

func (*Metadata) Save

func (md *Metadata) Save() error

func (*Metadata) Success added in v0.3.0

func (md *Metadata) Success() error

Should be returned as the last command when creating objects

type Name

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

func NewName

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

func NewNameWithLatest added in v0.3.0

func NewNameWithLatest(input string, matches *[]AnyMetadata) (*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 NonexistentError added in v0.3.0

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

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