Documentation
¶
Index ¶
- func CutString255(original string) string
- func PatchService(ctx context.Context, client clientset.Interface, cur, mod *v1.Service) error
- func RoundUpSize(volumeSizeBytes int64, allocationUnitBytes int64) int64
- func SanitizeLabel(input string) string
- func SetMapIfNotEmpty[K comparable, V comparable](m map[K]V, key K, value V) map[K]V
- func SplitTrim(s string, sep rune) []string
- func Sprintf255(format string, args ...interface{}) string
- func StringListEqual(list1, list2 []string) bool
- func StringToMap(str string) map[string]string
- func UUID(s string) (string, error)
- type MyDuration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CutString255 ¶ added in v1.26.4
CutString255 makes sure the string length doesn't exceed 255, which is usually the maximum string length in OpenStack.
func PatchService ¶ added in v1.23.0
PatchService makes patch request to the Service object.
func RoundUpSize ¶ added in v1.19.0
RoundUpSize calculates how many allocation units are needed to accommodate a volume of given size. E.g. when user wants 1500MiB volume, while AWS EBS allocates volumes in gibibyte-sized chunks, RoundUpSize(1500 * 1024*1024, 1024*1024*1024) returns '2' (2 GiB is the smallest allocatable volume that can hold 1500MiB)
func SanitizeLabel ¶ added in v1.31.0
func SetMapIfNotEmpty ¶ added in v1.32.0
func SetMapIfNotEmpty[K comparable, V comparable](m map[K]V, key K, value V) map[K]V
SetMapIfNotEmpty sets the value of the key in the provided map if the value is not empty (i.e., it is not the zero value for that type) and returns a pointer to the new map. If the map is nil, it will be initialized with a new map.
func SplitTrim ¶ added in v1.32.0
SplitTrim splits a string of values separated by sep rune into a slice of strings with trimmed spaces.
func Sprintf255 ¶ added in v1.26.4
Sprintf255 formats according to a format specifier and returns the resulting string with a maximum length of 255 characters.
func StringListEqual ¶
StringListEqual compares two string list, returns true if they have the same items, order doesn't matter
func StringToMap ¶ added in v1.28.3
StringToMap converts a string of comma-separated key-values into a map
Types ¶
type MyDuration ¶ added in v1.21.0
MyDuration is the encoding.TextUnmarshaler interface for time.Duration
func (*MyDuration) UnmarshalText ¶ added in v1.21.0
func (d *MyDuration) UnmarshalText(text []byte) error
UnmarshalText is used to convert from text to Duration