utils

package
v0.6.113 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertMapInterfaceMapString

func ConvertMapInterfaceMapString(v interface{}) interface{}

ConvertMapInterfaceMapString converts map[interface{}]interface{} => map[string]interface{}

It will also convert []interface{} => []string

func CreateK8sResource

func CreateK8sResource(
	client dynamic.Interface,
	group,
	version,
	resource string,
	object interface{},
	force bool,
) error

CreateK8sResource takes a dynamic client and resource info and tries to create that resource.

If a resource already exists and has the label controller set to "meshery" then it will try to update the resource.

If a resource exists but does not have the label then the function will return an error however if force parameter is set to true then it will replace that resource with a new resource with the appropriate labels

It will add labels to the resources:

"controller": "meshery"
"source" : "pattern"

func CreateNamespace

func CreateNamespace(client dynamic.Interface, namespace string) error

func DeleteK8sResource

func DeleteK8sResource(
	client dynamic.Interface,
	group,
	version,
	resource,
	namespace,
	name string,
) error

DeleteK8sResouce deletes the given kubernetes resource

func FlattenMap

func FlattenMap(prefix string, src map[string]interface{}, dest map[string]interface{})

FlattenMap flattens the given map and writes the flattened map in the dest

func GetRandomAlphabetsOfDigit added in v0.6.105

func GetRandomAlphabetsOfDigit(length int) (s string)

func MergeMaps added in v0.6.80

func MergeMaps(mergeInto, toMerge map[string]interface{})

func RecursiveCastMapStringInterfaceToMapStringInterface

func RecursiveCastMapStringInterfaceToMapStringInterface(in map[string]interface{}) map[string]interface{}

RecursiveCastMapStringInterfaceToMapStringInterface will convert a map[string]interface{} recursively => map[string]interface{}

func ToMapStringInterface

func ToMapStringInterface(mp interface{}) map[string]interface{}

ToMapStringInterface takes in data of type interface and returns a map[string]interface{} from that data

If the conversion fails then returns an empty map

Types

This section is empty.

Jump to

Keyboard shortcuts

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