label

package
v0.0.0-...-1fccfa7 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Changed

func Changed(old, new map[string]string) bool

Changed checks if label maps are same or different

func Create

func Create(ctx context.Context, s store.Labels, r LabeledResource) error

Update updates/creates all labels on labeled resource and removes that are explicitly passed

func Load

func Load(ctx context.Context, s store.Labels, rr ...LabeledResource) error

Load searches labels for all labeled resources

func ParseStrings

func ParseStrings(ss []string) (m map[string]string, err error)

ParseStrings converts slice of strings with "key=val" format into

func Search(ctx context.Context, s store.Labels, kind string, f map[string]string, base ...uint64) ([]uint64, error)

Search queries all matching (by kind and key-value filter) labels

In case when list of (base) resources is given, labels are also filtered by resource IDs to ensure only matching subset is returned

3 scenarios: - empty filter - filter set - filter & base set

func Update

func Update(ctx context.Context, s store.Labels, r LabeledResource) error

Update updates or creates all labels on labeled resource and removes all non explicitly defined

Types

type LabeledResource

type LabeledResource interface {
	GetLabels() map[string]string
	SetLabel(key string, value string)
	LabelResourceKind() string
	LabelResourceID() uint64
}

type Labels

type Labels map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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