utils

package
v0.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// MaxLabelValueLength specifies max length of k8s label value
	MaxLabelValueLength = 63
)

Variables

This section is empty.

Functions

func AppendMap added in v0.0.2

func AppendMap(origin map[string]string, newMap map[string]string)

AppendMap adds a map

func CountImportedDataVolumes

func CountImportedDataVolumes(dvsDone map[string]bool) int

CountImportedDataVolumes return number of true values in map of booleans

func FormatBytes

func FormatBytes(bytes int64) (string, error)

FormatBytes convert bytes to highest suffix

func GetMapKeys

func GetMapKeys(theMap map[string]string) []string

GetMapKeys gets all keys from a map as a slice

func IndexByIDAndName

func IndexByIDAndName(mapping *[]v2vv1alpha1.ResourceMappingItem) (mapByID map[string]v2vv1alpha1.ResourceMappingItem, mapByName map[string]v2vv1alpha1.ResourceMappingItem)

IndexByIDAndName indexes mapping array by ID and by Name

func IsUtcCompatible

func IsUtcCompatible(timezone string) bool

IsUtcCompatible checks whether given timezone behaves like UTC - has the same offset of 0 and does not observer daylight saving time

func MakeLabelFrom

func MakeLabelFrom(name string) string

MakeLabelFrom creates label value from given CR name

func NormalizeName

func NormalizeName(name string) (string, error)

NormalizeName returns a normalized name based on the given name that complies to DNS 1123 format

func ParseUtcOffsetToSeconds

func ParseUtcOffsetToSeconds(offset string) (int, error)

ParseUtcOffsetToSeconds parses UTC offset string ([+|-]HH:MM) into representation in seconds. Only syntactical validation is performed on input string.

func ToLoggableID

func ToLoggableID(id *string, name *string) string

ToLoggableID creates loggable identifier that may be comprised of an id and/or a name

func ToLoggableResourceName

func ToLoggableResourceName(name string, namespace *string) string

ToLoggableResourceName creates loggable representation of maybe namespaced resource name

func WithLabels added in v0.0.3

func WithLabels(labels map[string]string, existing map[string]string) map[string]string

WithLabels aggregates existing lables

func WithMessage

func WithMessage(message string, newMessage string) string

WithMessage joins message and newMessage with a ", " string and returns the resulting string or returns newMessage if message is empty

Types

This section is empty.

Jump to

Keyboard shortcuts

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