tags

package
v1.223.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tags provides shared tag/label matching primitives used across Atmos subsystems (auth identities/providers, components, bulk component selection) so every consumer applies the same any/all-match semantics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectAvailableTags

func CollectAvailableTags[T any](items map[string]T, getTags func(T) []string) []string

CollectAvailableTags returns the sorted, deduplicated set of tags across all items, using getTags to extract each item's tags. Used to build "available tags" hints for no-match errors (e.g. auth identities/providers).

func MatchesLabels

func MatchesLabels(labels map[string]string, filterLabels map[string]string) bool

MatchesLabels reports whether labels contains every key=value pair in filterLabels (AND). An empty filterLabels always matches (no filter applied).

func MatchesTags

func MatchesTags(tags []string, filterTags []string, mode TagMode) bool

MatchesTags reports whether tags satisfies filterTags under mode. An empty filterTags always matches (no filter applied).

func ParseLabelsFlag

func ParseLabelsFlag(input string) (map[string]string, error)

ParseLabelsFlag parses a comma-separated key=value list into a map[string]string.

func ParseTagsFlag

func ParseTagsFlag(input string) []string

ParseTagsFlag parses a comma-separated tags string into a trimmed, non-empty slice.

func SortedKeys

func SortedKeys(m map[string]string) []string

SortedKeys returns the sorted keys of a map[string]string.

func SortedValues

func SortedValues(m map[string]string) []string

SortedValues returns the values of a map[string]string, ordered by key for deterministic output (map iteration order is randomized in Go).

func ToStringMap

func ToStringMap(v any) map[string]string

ToStringMap coerces a YAML-decoded value (typically map[string]any) into a map[string]string, skipping any non-string values. Returns an empty (non-nil) map for nil/invalid input so callers always get a rangeable value.

func ToStringSlice

func ToStringSlice(v any) []string

ToStringSlice coerces a YAML-decoded value (typically []any) into a []string, skipping any non-string elements. Returns an empty (non-nil) slice for nil/invalid input so callers always get a rangeable value.

Types

type TagMode

type TagMode string

TagMode defines how multiple filter tags combine when matching against an entity's tags.

const (
	// TagModeAny matches if the entity has at least one of the filter tags (OR).
	TagModeAny TagMode = "any"
	// TagModeAll matches only if the entity has every filter tag (AND).
	TagModeAll TagMode = "all"
)

Jump to

Keyboard shortcuts

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