util

package
v0.5.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package util contains common definition and utils used across liqoctl

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractValueFromArgumentList

func ExtractValueFromArgumentList(key string, argumentList []string) (string, error)

ExtractValueFromArgumentList extracts the argument value from an argument list.

func ExtractValuesFromArgumentListOrDefault

func ExtractValuesFromArgumentListOrDefault(key string, argumentList []string, defaultValue string) string

ExtractValuesFromArgumentListOrDefault extracts the argument value from an argument list or returns a default value.

func ExtractValuesFromNestedMaps

func ExtractValuesFromNestedMaps(m map[string]interface{}, keys ...string) (val interface{}, err error)

ExtractValuesFromNestedMaps takes a map and a list of keys and visits a tree of nested maps using the keys in the order provided. At each iteration, if the number of non-visited keys is 1, the function returns the value associated to the last key, else if it is greater than 1, the function expects the value to be a map and a new recursive iteration happens. In case the key is not found, an empty string is returned. In case no keys are provided, an error is returned. Example:

m := map[string]interface{}{
	"first": map[string]interface{}{
		"second": map[string]interface{}{
			"third": "value",
		},
	},
}
ValueFor(m, "first", "second", "third") // returns "value", nil
ValueFor(m, "first", "second") // returns map[string]interface{}{ "third": "value" }, nil
ValueFor(m, "first", "third") // returns "", nil
ValueFor(m) // returns nil, "At least one key is required"

func RetrieveLiqoControllerManagerDeploymentArgs

func RetrieveLiqoControllerManagerDeploymentArgs(ctx context.Context, cl client.Client, namespace string) ([]string, error)

RetrieveLiqoControllerManagerDeploymentArgs retrieves the list of arguments associated with the liqo controller manager deployment.

Types

This section is empty.

Jump to

Keyboard shortcuts

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