Documentation
¶
Index ¶
- Constants
- func CreateTempDirOrDie(dir, pattern string) string
- func DynamicBackgroundPollUntilContextCancel(ctx context.Context, getInterval func() time.Duration, syncFirstRun bool, ...) (err error)
- func DynamicPollUntilContextCancel(ctx context.Context, intervalFunc func() time.Duration, ...) error
- func EnsureDirOrDie(dir string)
- func EnsureFileOrDie(file string, content *string) string
- func Exists(file string) bool
- func GVRFromGVK(gvk schema.GroupVersionKind) schema.GroupVersionResource
- func GetEnv(key, fallback string) string
- func GetPluralEnv(key, fallback string) string
- func GetPluralEnvBool(key string, fallback bool) bool
- func GetPluralEnvDuration(key string, fallback time.Duration) time.Duration
- func GetPluralEnvSlice(key string, fallback []string) []string
- func NewAuthorizationBearerTransport(token string) http.RoundTripper
- func NewAuthorizationTokenTransport(token string) http.RoundTripper
- func ParseIntOrDie(value string) int
- type AuthorizationBearerTransport
- type AuthorizationTokenTransport
- type Buffer
- type FetchClient
- type FetchOption
- type FileClient
Constants ¶
const (
EnvPrefix = "PLRL"
)
Variables ¶
This section is empty.
Functions ¶
func CreateTempDirOrDie ¶
CreateTempDirOrDie - creates a temporary directory in the specified dir with the given pattern. If dir is an empty string, the default temporary directory for the OS will be used. Panics if the directory cannot be created.
func DynamicBackgroundPollUntilContextCancel ¶
func DynamicBackgroundPollUntilContextCancel(ctx context.Context, getInterval func() time.Duration, syncFirstRun bool, callback wait.ConditionWithContextFunc) (err error)
DynamicBackgroundPollUntilContextCancel spawns a new goroutine that runs the condition function on interval. If syncFirstRun is set to true, it will execute the condition function synchronously first and then start polling. Since error is returned synchronously, the only way to check for it is to use syncFirstRun. Background poller does not sync errors. It can be stopped externally by cancelling the provided context.
func EnsureDirOrDie ¶
func EnsureDirOrDie(dir string)
EnsureDirOrDie - ensures that the specified directory exists. If the directory does not exist, it will be created with the specified permissions. Panics if the directory cannot be created.
func EnsureFileOrDie ¶
func GVRFromGVK ¶
func GVRFromGVK(gvk schema.GroupVersionKind) schema.GroupVersionResource
func GetEnv ¶
GetEnv - Lookup the environment variable provided and set to default value if variable isn't found
func GetPluralEnv ¶
GetPluralEnv - Lookup the plural environment variable. It has to be prefixed with EnvPrefix. If variable with the provided key is not found, fallback will be used.
func GetPluralEnvBool ¶
GetPluralEnvBool - Lookup the plural environment variable. It has to be prefixed with EnvPrefix. If variable with the provided key is not found, fallback will be used.
func GetPluralEnvDuration ¶
GetPluralEnvDuration retrieves a duration from an environment variable prefixed with EnvPrefix. Returns the parsed duration or a fallback if parsing fails or the environment variable is not set.
func GetPluralEnvSlice ¶
GetPluralEnvSlice - Lookup the plural environment variable. It has to be prefixed with EnvPrefix. If variable with the provided key is not found, fallback will be used.
func NewAuthorizationBearerTransport ¶
func NewAuthorizationBearerTransport(token string) http.RoundTripper
func NewAuthorizationTokenTransport ¶
func NewAuthorizationTokenTransport(token string) http.RoundTripper
func ParseIntOrDie ¶
Types ¶
type AuthorizationBearerTransport ¶
type AuthorizationBearerTransport struct {
// contains filtered or unexported fields
}
type AuthorizationTokenTransport ¶
type AuthorizationTokenTransport struct {
// contains filtered or unexported fields
}
type Buffer ¶
Buffer is an internal buffer wrapper to ensure that Write/Read operations are thread-safe and cannot be run at the same time. It also starts a small goroutine that notifies about buffer size changes through channel. See Updated method for more information.
func (*Buffer) ReadBytes ¶
ReadBytes overrides bytes.Buffer method. It ensures thread-safe execution.
type FetchClient ¶
func Fetch ¶
func Fetch(options ...FetchOption) FetchClient
type FetchOption ¶
type FetchOption func(*fetchClient)
func FetchToDir ¶
func FetchToDir(destination string) FetchOption
func FetchWithBearer ¶
func FetchWithBearer(token string) FetchOption
func FetchWithTimeout ¶
func FetchWithTimeout(timeout time.Duration) FetchOption
func FetchWithToken ¶
func FetchWithToken(token string) FetchOption
type FileClient ¶
func File ¶
func File() FileClient