Documentation ¶
Index ¶
- func DurationFromEnvOrDefault(envVarName string, defaultValue string, getEnv GetEnvFunc) (time.Duration, error)
- func IntFromEnvOrDefault(envVarName string, defaultValue string, getEnv GetEnvFunc) (int, error)
- func NewLimitedBackOff(interval time.Duration, retryLimit int) *limitedBackOff
- func NewResponseError(resp *http.Response) error
- func ReadResponseBody(resp *http.Response) ([]byte, error)
- func ValidateResponse(resp *http.Response) error
- func VerifyFileExists(path string) error
- func WaitForFile(path string, retryCountLimit int) error
- type Error
- type ErrorDetails
- type GetEnvFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DurationFromEnvOrDefault ¶
func DurationFromEnvOrDefault( envVarName string, defaultValue string, getEnv GetEnvFunc, ) (time.Duration, error)
DurationFromEnvOrDefault extracts the value of the given environment variable, or the default value if the environment variable is not defined, and returns it as a time.Duration object
func IntFromEnvOrDefault ¶
func IntFromEnvOrDefault( envVarName string, defaultValue string, getEnv GetEnvFunc, ) (int, error)
IntFromEnvOrDefault extracts the value of the given environment variable, or the default value if the environment variable is not defined, and returns it as an int object
func NewLimitedBackOff ¶
func NewResponseError ¶ added in v0.19.1
NewResponseError creates a new instance of Error
func ReadResponseBody ¶ added in v0.19.1
ReadResponseBody returns the response body
func ValidateResponse ¶ added in v0.19.1
validateResponse checks the HTTP status of the response. If it's less than 300, it returns the response body as a byte array. Otherwise it returns a NewResponseError.
func VerifyFileExists ¶ added in v0.19.0
VerifyFileExists verifies that a file exists at a given path and is a regular file.
func WaitForFile ¶
WaitForFile waits for retryCountLimit seconds to see if the file exists in the given path. If it's not there by the end of the retry count limit, it returns an error.
Types ¶
type Error ¶ added in v0.19.1
type Error struct { Code int Message string Details *ErrorDetails `json:"error"` }
Error includes the error info for response errors
type ErrorDetails ¶ added in v0.19.1
ErrorDetails includes JSON data on Errors
type GetEnvFunc ¶
GetEnvFunc is a function that returns a value for an environment variable