util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GiB = 1024 * 1024 * 1024
)

Variables

This section is empty.

Functions

func BytesToGiB

func BytesToGiB(volumeSizeBytes int64) (int32, error)

func Contains

func Contains(slice []string, element string) bool

func ConvertJsonStringToObject

func ConvertJsonStringToObject(input string, object any) error

ConvertJsonStringToObject converts a given input into an object. The input should be a formatted JSON string. The object must be passed in by reference

func ConvertObjectToJsonString

func ConvertObjectToJsonString(input any) (string, error)

ConvertObjectToJsonString converts a given object to a json string.

func ConvertObjectType

func ConvertObjectType(from any, to any) error

ConvertObjectType converts a given object into another object type. This is done by converting the object into a JSON string, then using the JSON string to populate the parameters of a new object. The "to" object must be passed in by reference

func ConvertStringMapToAny

func ConvertStringMapToAny(input map[string]string) map[string]any

ConvertStringMapToAny converts a given map to map containing any values which are parsable by json. Strings should already be formatted as jsons, therefore the raw value is taken ints and bools are converted to their respective types for proper json parsing

func DecodeDeletionTag

func DecodeDeletionTag(input string) string

func EncodeDeletionTag

func EncodeDeletionTag(input string) string

func GiBToBytes

func GiBToBytes(volumeSizeGiB int32) int64

func MapCopy

func MapCopy(oldMap map[string]string) map[string]string

MapCopy copies map onto new map to allow for element manipulation Used for testing

func ParseEndpoint

func ParseEndpoint(endpoint string) (string, string, error)

func RemoveParametersAndPopulateObject

func RemoveParametersAndPopulateObject(parameters map[string]string, config any) error

RemoveParametersAndPopulateObject uses a given map[string]string to populate a given pointer to a struct. Values used in the map are removed once used.

func ReplaceParametersAndPopulateObject

func ReplaceParametersAndPopulateObject(newKey string, parameters map[string]string, config any) error

ReplaceParametersAndPopulateObject removes config variables from parameters, and replaces them with one combined json string.

func StrictRemoveParametersAndPopulateObject

func StrictRemoveParametersAndPopulateObject(parameters map[string]string, config any) error

StrictRemoveParametersAndPopulateObject removes config variables from parameters, and replaces them with one combined json string. Also ensures that all parameters has been used

Types

This section is empty.

Jump to

Keyboard shortcuts

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