utils

package
v0.5.45 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: Apache-2.0 Imports: 14 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 added in v0.5.46

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 RecursiveCastMapStringInterfaceToMapStringInterface

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

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

func ToMapStringInterface added in v0.5.46

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