model

package
v0.0.0-...-4760111 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMesh = "default"
)

Variables

View Source
var (
	// ResourceNameExtensionsUnsupported is a convenience constant
	// that is meant to make source code more readable.
	ResourceNameExtensionsUnsupported = ResourceNameExtensions(nil)
)

Functions

func ErrorInvalidItemType

func ErrorInvalidItemType(expected, actual interface{}) error

Types

type Pagination

type Pagination struct {
	Total      uint32
	NextOffset string
}

func (*Pagination) GetNextOffset

func (p *Pagination) GetNextOffset() string

func (*Pagination) GetTotal

func (p *Pagination) GetTotal() uint32

func (*Pagination) SetNextOffset

func (p *Pagination) SetNextOffset(nextOffset string)

func (*Pagination) SetTotal

func (p *Pagination) SetTotal(total uint32)

type Resource

type Resource interface {
	GetType() ResourceType
	GetMeta() ResourceMeta
	SetMeta(ResourceMeta)
	GetSpec() ResourceSpec
	SetSpec(ResourceSpec) error
	Validate() error
}

type ResourceKey

type ResourceKey struct {
	Mesh string
	Name string
}

func MetaToResourceKey

func MetaToResourceKey(meta ResourceMeta) ResourceKey

type ResourceList

type ResourceList interface {
	GetItemType() ResourceType
	GetItems() []Resource
	NewItem() Resource
	AddItem(Resource) error
	GetPagination() *Pagination
}

type ResourceMeta

type ResourceMeta interface {
	GetName() string
	GetNameExtensions() ResourceNameExtensions
	GetVersion() string
	GetMesh() string
	GetCreationTime() time.Time
	GetModificationTime() time.Time
}

type ResourceNameExtensions

type ResourceNameExtensions map[string]string

ResourceNameExtensions represents an composite resource name in environments other than Universal.

E.g., name of a Kubernetes resource consists of a namespace component and a name component that is local to that namespace.

Technically, ResourceNameExtensions is a mapping between a component identifier and a component value, e.g.

"k8s.kuma.io/namespace" => "my-namespace"
"k8s.kuma.io/name"      => "my-policy"

Component identifier must be considered a part of user-facing Kuma API. In other words, it is supposed to be visible to users and should not be changed lightly.

Component identifier might have any value, however, it's preferable to choose one that is intuitive to users of that particular environment. E.g., on Kubernetes component identifiers should use a label name format, like in "k8s.kuma.io/namespace" and "k8s.kuma.io/name".

type ResourceSpec

type ResourceSpec interface {
	// all resources must be defined via Protobuf
	proto.Message
}

type ResourceType

type ResourceType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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