Documentation ¶
Overview ¶
Package util contains common definition and utils used across liqoctl
Index ¶
- func ExtractValueFromArgumentList(key string, argumentList []string) (string, error)
- func ExtractValuesFromArgumentListOrDefault(key string, argumentList []string, defaultValue string) string
- func ExtractValuesFromNestedMaps(m map[string]interface{}, keys ...string) (val interface{}, err error)
- func ParseArgsMultipleValues(values, separator string) (map[string]string, error)
- func RetrieveLiqoAuthDeploymentArgs(ctx context.Context, cl client.Client, namespace string) ([]string, error)
- func RetrieveLiqoControllerManagerDeploymentArgs(ctx context.Context, cl client.Client, namespace string) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractValueFromArgumentList ¶
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 ParseArgsMultipleValues ¶ added in v0.7.0
ParseArgsMultipleValues parse a string containing multiple key/value couples separated by ',' (eg. key1=value1,key2=value2).
func RetrieveLiqoAuthDeploymentArgs ¶ added in v0.7.0
func RetrieveLiqoAuthDeploymentArgs(ctx context.Context, cl client.Client, namespace string) ([]string, error)
RetrieveLiqoAuthDeploymentArgs retrieves the list of arguments associated with the liqo auth deployment.
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.