utils

package
v0.0.0-...-d827e98 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Expose string = "false" // Expose hidden commands
)

Functions

func AddListGlobalScope

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

Add global scope flags to a URL request

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 AddRequestGlobalScope

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

func Contains

func Contains(elems []string, v string) bool

func CreateFile

func CreateFile(srcfilename, buffer string) error

func CustomLabelPrinter

func CustomLabelPrinter(labels map[string]string) string

func DownloadFile

func DownloadFile(url string, filepath string) error

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 FilterRafayLabels

func FilterRafayLabels(l map[string]string) string

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 GetUpgradeStatusMap

func GetUpgradeStatusMap() map[string]string

func GetUserHome

func GetUserHome() string

func Hidden

func Hidden() bool

func IsJSON

func IsJSON(s string) bool

func JoinYAML

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

func KubeCtlCmd

func KubeCtlCmd(args []string) (bytes.Buffer, 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 SCPFileToRemote

func SCPFileToRemote(sshIpaddress, sshPort, sshPrivateKeyPath, sshUser, srcFilePath string) error

func ShowDeprecatedMessageOutput

func ShowDeprecatedMessageOutput(msg, output string)

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, map[string]string, 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

func ValidateLabel

func ValidateLabel(label string) (map[string]string, error)

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 LabelStruct

type LabelStruct struct {
	Items map[string]string `yaml:"LABELS"`
}

type RafayErrorMessage

type RafayErrorMessage 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