Documentation
¶
Overview ¶
Copyright (c) 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
Copyright (c) 2024, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
Index ¶
- func BoolPtr(v bool) *bool
- func CreateUploadCertificateKey() (string, error)
- func ExponentialRetry(ftor retryFunc, arg interface{}) (interface{}, bool, error)
- func ExponentialRetryImpl(ftor retryFunc, arg interface{}, start time.Duration, max time.Duration, ...) (interface{}, bool, error)
- func ExponentialRetryTimeout(ftor retryFunc, arg interface{}, timeout time.Duration) (interface{}, bool, error)
- func FileIsTTY(f *os.File) (bool, error)
- func FilesFromPath(path string) ([]string, error)
- func InMemoryFile(name string) (string, error)
- func IncrementCount(in string, delim string) string
- func Int32Ptr(v int32) *int32
- func Int64Ptr(v int64) *int64
- func IntPtr(v int) *int
- func IsNil(v interface{}) bool
- func LinearRetry(ftor retryFunc, arg interface{}) (interface{}, bool, error)
- func LinearRetryImpl(ftor retryFunc, arg interface{}, wait time.Duration, timeout time.Duration) (interface{}, bool, error)
- func LinearRetryTimeout(ftor retryFunc, arg interface{}, timeout time.Duration) (interface{}, bool, error)
- func ResolveURIToIP(uri *url.URL) (string, bool, error)
- func StrPtr(v string) *string
- func TemplateToString(templateString string, contents interface{}) (string, error)
- func TemplateToStringWithFuncs(templateString string, contents interface{}, funcs map[string]any) (string, error)
- type JsonPatch
- type JsonPatches
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExponentialRetry ¶
ExponentialRetry executes a functor at some interval until is either succeeds, fails in a non-recoverable way, or a timeout is reached. The given functor is called with the given arguments each interval.
func ExponentialRetryImpl ¶
func ExponentialRetryImpl(ftor retryFunc, arg interface{}, start time.Duration, max time.Duration, factor time.Duration, timeout time.Duration) (interface{}, bool, error)
ExponentialRetryImpl executes a functor at some interval until is either succeeds, fails in a non-recoverable way, or a timeout is reached. The given functor is called with the given arguments each interval. 'start' is the first duration to wait. 'max' is the maximum duration. 'factor' is the amount to increase the wait each iteration. 'timeout' is the last time to start a request. Due to the fact that a functor call may be long, this function may take longer than the given timeout.
func ExponentialRetryTimeout ¶
func ExponentialRetryTimeout(ftor retryFunc, arg interface{}, timeout time.Duration) (interface{}, bool, error)
ExponentialRetryTimeout executes a functor at some interval until is either succeeds, fails in a non-recoverable way, or a timeout is reached. The given functor is called with the given arguments each interval.
func FileIsTTY ¶
FileIsTTY gives a best guess that a given file represents a TTY or PTY. The current best guess is that the file is a character device.
While it is possible for character devices not to be TTYs, it is unlikely to be true in the context of this code. A common counterexample is something like a disk. If someone is trying to do something like pipe a disk to stdin, then they are being silly and some odd behavior can be tolerated.
func FilesFromPath ¶
func InMemoryFile ¶
InMemoryFile returns the filename of a file that exists only in memory. It can be used with all typical file operations except for deletion.
func IncrementCount ¶
IncrementCount adds one to a string that has a number at the end or appends a 1 to a string that does not. Empty strings are returned unmodified.
func IsNil ¶
func IsNil(v interface{}) bool
IsNil is a mostly complete way of checking if a value is nil. It still misses some esoteric types of values.
func LinearRetry ¶
LinearRetry executes a functor every 'wait' until it either succeeds, fails in a way that should not be retries, or until the timeout of 10 seconds is reached. If the functor succeeds, the function returns false with no error. If the functor fails in a way that should not be retried, the function returns true with an error. If the function times out, it returns false as well as the last error from the functor.
func LinearRetryImpl ¶
func LinearRetryImpl(ftor retryFunc, arg interface{}, wait time.Duration, timeout time.Duration) (interface{}, bool, error)
LinearRetryImpl executes a functor every 'wait' until it either succeeds, fails in a way that should not be retries, or until the timeout is reached. If the functor succeeds, the function returns false with no error. If the functor fails in a way that should not be retried, the function returns true with an error. If the function times out, it returns false as well as the last error from the functor.
func LinearRetryTimeout ¶
func LinearRetryTimeout(ftor retryFunc, arg interface{}, timeout time.Duration) (interface{}, bool, error)
LinearRetryTimeout executes a functor every 'wait' until it either succeeds, fails in a way that should not be retries, or until the timeout is reached. If the functor succeeds, the function returns false with no error. If the functor fails in a way that should not be retried, the function returns true with an error. If the function times out, it returns false as well as the last error from the functor.
func ResolveURIToIP ¶
ResolveURIToIP extracts a reasonable candidate for an IP address from the given URI. If the URI can reasonably be said to point to the host, the second return value is "true", otherwise it is "false".
func TemplateToString ¶
Types ¶
type JsonPatches ¶
type JsonPatches struct {
Patches []*JsonPatch
}
func (*JsonPatches) AddPatch ¶
func (jp *JsonPatches) AddPatch(op string, path []string, value string) *JsonPatches
func (*JsonPatches) Replace ¶
func (jp *JsonPatches) Replace(path []string, value string) *JsonPatches
func (*JsonPatches) String ¶
func (jp *JsonPatches) String() string