helper

package
v1.6.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ResponseHeader = "X-Operation-ID"
)

******************************************************************************** Helper functions that were copied from uhc-clusters-service gitlab repository

Variables

This section is empty.

Functions

func CheckEmpty

func CheckEmpty(value string, name string)

func CheckError

func CheckError(err error)

func CheckResponse

func CheckResponse(response Response, err error, expectedStatus int)

func CreateConnectionWithToken

func CreateConnectionWithToken(token string,
	tokenURL string,
	gatewayURL string,
	clientID string,
	clientSecret string) *client.Connection

func GetLogger

func GetLogger() logging.Logger

func RunAttempt

func RunAttempt(attempt func() (interface{}, bool), maxAttempts int, delay time.Duration) (interface{}, error)

RunAttempt will run a function (attempt), until the function returns false - meaning no further attempts should follow, or until the number of attempts reached maxAttempts. Between each 2 attempts, it will wait for a given delay time. In case maxAttempts have been reached, an error will be returned, with the latest attempt result. The attempt function should return true as long as another attempt should be made, false when no further attempts are required - i.e. the attempt succeeded, and the result is available as returned value.

func WaitForBackendToBeReady

func WaitForBackendToBeReady(ctx context.Context, connection *client.Connection)

Types

type Response

type Response interface {
	Status() int
	Header() http.Header
}

Jump to

Keyboard shortcuts

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