annotations

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, c client.Client, o client.Object, fns ...UpdateFn) error

Apply applies UpdateFns to a resource.

func Set

func Set(o client.Object, fns ...UpdateFn)

Set mutates the annotations on an object given UpdateFns.

Types

type Annotation added in v0.1.0

type Annotation string

Annotation is a string type that can be used as a convenience wrapper for the exported functions of this package.

func (Annotation) Add added in v0.1.0

func (a Annotation) Add(val string) UpdateFn

Add adds/sets a single value annotation.

func (Annotation) AddToList added in v0.1.0

func (a Annotation) AddToList(val string) UpdateFn

AddToList adds the value to the annotation list.

func (Annotation) ParseObjectName added in v0.1.0

func (a Annotation) ParseObjectName(o client.Object) (types.NamespacedName, bool)

ParseObjectName attempts to parse an object name from an annotation on the given object.

func (Annotation) Remove added in v0.1.0

func (a Annotation) Remove() UpdateFn

Remove removes the annotation.

func (Annotation) RemoveFromList added in v0.1.0

func (a Annotation) RemoveFromList(val string) UpdateFn

RemoveFromList removes the value from the list.

func (Annotation) String added in v0.1.0

func (a Annotation) String() string

String returns the annotation name.

type UpdateFn

type UpdateFn func(in map[string]string)

UpdateFn is any function that mutates a string map.

func Add

func Add(k, v string) UpdateFn

Add returns an UpdateFn which adds a k/v map.

func AddToList added in v0.0.2

func AddToList(k, v string) UpdateFn

AddToList returns an UpdateFn which adds v to a list stored in k.

If the list does not exist it will create it.

func Remove

func Remove(k string) UpdateFn

Remove returns an UpdateFn which removes a key.

func RemoveFromList added in v0.0.2

func RemoveFromList(k, v string) UpdateFn

RemoveFromList returns an UpdateFn which removes v from a list stored in k.

If the list does not exist, it does nothing. If the value remaning afterwards is empty, it will delete the key.

Jump to

Keyboard shortcuts

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