util

package
v0.1.63 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckExistingContext added in v0.0.290

func CheckExistingContext(contextName, kubeconfig string) bool

func CheckNetworkErr added in v0.1.26

func CheckNetworkErr(err error)

CheckNetworkErr if the provided error is a network error, it will print a warning message to the user to let him know he may has some network issues on the machine running this binary

func ContextWithCancelOnSignals

func ContextWithCancelOnSignals(ctx context.Context, sigs ...os.Signal) context.Context

ContextWithCancelOnSignals returns a context that is canceled when one of the specified signals are received

func CurrentAccount added in v0.0.293

func CurrentAccount(user *v1.User) (string, error)
func DecorateErrorWithDocsLink(err error, link ...string) error

func Die

func Die(err error, cause ...string)

Die panics it the error is not nil. If a cause string is provided it will be displayed in the error message.

func Doc

func Doc(doc string) string

Doc returns a string where all the '<BIN>' are replaced with the binary name and all the '\t' are replaced with a uniformed indentation using space.

func EscapeAppsetFieldName

func EscapeAppsetFieldName(field string) string

func GenerateIngressPathForDemoGitEventSource added in v0.0.463

func GenerateIngressPathForDemoGitEventSource(runtimeName string) string

func IsIP added in v0.0.239

func IsIP(s string) bool

func KubeContextNameByServer added in v0.0.283

func KubeContextNameByServer(server, kubeconfig string) (string, error)

func KubeContexts added in v0.0.290

func KubeContexts(kubeconfig string) []kubeContext

func KubeCurrentContextName added in v0.0.404

func KubeCurrentContextName(kubeconfig string) string

func KubeCurrentServer added in v0.0.290

func KubeCurrentServer(kubeconfig string) (string, error)

func KubeServerByContextName added in v0.0.283

func KubeServerByContextName(contextName, kubeconfig string) (string, error)

func OpenBrowserForGitLogin added in v0.0.293

func OpenBrowserForGitLogin(ingressHost string, user string, account string) error

func Retry added in v0.0.493

func Retry(ctx context.Context, opts *RetryOptions) error

func ReverseMap added in v0.0.503

func ReverseMap[K, V comparable](gitProviders map[K]V) map[V]K

func StringIndexOf added in v0.0.259

func StringIndexOf(slice []string, val string) int

func StructToMap added in v0.0.463

func StructToMap(obj interface{}) (map[string]interface{}, error)

func WithSpinner

func WithSpinner(ctx context.Context, msg ...string) func()

WithSpinner create a spinner that prints a message and canceled if the given context is canceled or the returned stop function is called.

Types

type AsyncRunner

type AsyncRunner struct {
	// contains filtered or unexported fields
}

func NewAsyncRunner

func NewAsyncRunner(n int) *AsyncRunner

NewAsyncRunner initializes a new AsyncRunner that can run up to n async operations.

func (*AsyncRunner) Run

func (ar *AsyncRunner) Run(f func() error)

Run runs another async operation

func (*AsyncRunner) Wait

func (ar *AsyncRunner) Wait() error

Wait waits for all async operations to finish and returns an error if one of the async operations returned an error, otherwise, returns nil.

type RetryOptions added in v0.0.493

type RetryOptions struct {
	Func    func() error
	Retries int
	Sleep   time.Duration
}

Directories

Path Synopsis
mocks
Package helm is a generated GoMock package.
Package helm is a generated GoMock package.

Jump to

Keyboard shortcuts

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