utils

package
v0.1.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPagenationToRequest

func AddPagenationToRequest(url string, limit, offset int) (string, error)

Add pagination flags to a URL request

func AddPagenationToRequestWithCmd

func AddPagenationToRequestWithCmd(cmd *cobra.Command, url string) string

Add pagination flags to a URL request

func ExpandFile

func ExpandFile(path string) (string, error)

func FileExists

func FileExists(filename string) bool

fileExists checks if a file exists and is not a directory before we try using it to prevent further errors.

func FormatYamlMessage

func FormatYamlMessage(data interface{}) (string, error)

func FullPagenationToRequest

func FullPagenationToRequest(url string) string

Full

func FullPath

func FullPath(parentFile, path string) string

func FullPaths

func FullPaths(parentFile, path string) string

func GetAsMap

func GetAsMap(array []string) map[string]string

func GetAsString

func GetAsString(i interface{}) string

func GetUserHome

func GetUserHome() string

func IsJSON

func IsJSON(s string) bool

func JoinYAML

func JoinYAML(srcs [][]byte) ([]byte, error)

func ListAllInstances

func ListAllInstances(
	baseUri string,
	getObjects func(string) ([]interface{}, int, error)) ([]interface{}, int, error)

Get all data from paginated API

func PrettyPrint

func PrettyPrint(responseStr string)

func ProcessValueFiles

func ProcessValueFiles(valuesFilePath string) (string, error)

func ReadYAMLFileContents

func ReadYAMLFileContents(filePath string) ([]byte, error)

func SplitYAML

func SplitYAML(src []byte) ([][]byte, error)

splitYAML function splits an YAML into multiple YAMLs

func SplitYamlAndGetListByKind

func SplitYamlAndGetListByKind(src []byte) (map[string][][]byte, error)

SplitYaml splits multiple yaml contents by given delimiter and returns map of kind to list of yaml(string).

func StringInSlice

func StringInSlice(a string, list []string) bool

func StringInSliceCaseInsensitive

func StringInSliceCaseInsensitive(a string, list []string) bool

func StringOrNone

func StringOrNone(name string) string

func StringSliceContainsDuplicates

func StringSliceContainsDuplicates(strSlice []string) (string, bool)

StringSliceContainsDuplicates checks if the string slice contains duplicates, and returns the first duplicate, if there are multiple

func StringsAreEqualCaseInsensitive

func StringsAreEqualCaseInsensitive(a, b string) bool

Types

type ErrorDetails

type ErrorDetails struct {
	ErrorCode string `json:"error_code,omitempty" yaml:"error_code,omitempty"`
	Detail    string `json:"detail,omitempty" yaml:"detail,omitempty"`
	Info      string `json:"info,omitempty" yaml:"info,omitempty"`
}

type ParalusErrorMessage

type ParalusErrorMessage struct {
	StatusCode int            `json:"status_code,omitempty" yaml:"status_code,omitempty"`
	Details    []ErrorDetails `json:"details,omitempty" yaml:"details,omitempty"`
}

Jump to

Keyboard shortcuts

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