util

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEndpoint

func ParseEndpoint(displayName string, endpoint string) (net.IP, error)

ParseEndpoint is a helper function that reads an endpoint and returns the looked-up IP address

func RandomString

func RandomString(n int) string

RandomString generates a random string of n characters using basic characters

func SplitTagsByNamespace

func SplitTagsByNamespace(tags []map[string]string, searchNamespace string) (map[string]string, map[string]string, error)

SplitTagsByNamespace searches through a list of tags and separates them by namespace. Specifically, it returns one map of all tags (key->value) that matched the given namespace, and another map of all tags (key->value) that didn't. Note that this *is* a lossy operation, since all tags that don't match the namespace won't have the namespace stored, it's just dropped.

func TagsListSetDefaultNamespace

func TagsListSetDefaultNamespace(tags []map[string]string, namespace string)

TagsListSetDefaultNamespace iterates through every tag in a list of tags, and if it doesn't have a namespace set it will set it to the provided default namespacece

func TagsListToMap

func TagsListToMap(tagsMap map[string]string, tagsList *[]map[string]string, defaultNamespace string) map[string]string

TagsListToMap takes in a list of tags ({ key, namespace, value }) and converts it into a flat map of the format "key,namespace" (a single string) => value

func TagsMapToList

func TagsMapToList(tagsMap map[string]string) ([]map[string]string, error)

TagsMapToList converts a flat map (usually produced by TagsListToMap) with the format "key,namespace" => value into a list of tags ({ key, namespace, value })

func TagsMapToListNoNamespace

func TagsMapToListNoNamespace(tagsMap map[string]string, setNamespace string) []map[string]string

TagsMapToListNoNamespace converts a flat map in the format "key->value" into a list of tags ({ key, namespace, value}), setting the namespace to the provided parameter

Types

This section is empty.

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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