Documentation ¶
Index ¶
- Constants
- func AskForConfirmation(message string) bool
- func CommandExecutesSuccessfully(cmd string, args ...string) bool
- func DecryptText(cryptoText string) (string, error)
- func EncryptText(text string) (string, error)
- func FriendlyDuration(d time.Duration) time.Duration
- func GenerateSelfSignedCert(certPath, keyPath string, ips []net.IP, alternateDNS []string) error
- func HomeDir() string
- func IsTtySupported() bool
- func Pad(str string) string
- func ReadInputFromStdin(fieldlabel string) string
- func ReadPasswordFromStdin(fieldlabel string) string
- func Retry(attempts int, callback func() error) (err error)
- func RetryAfter(attempts int, callback func() error, d time.Duration) (err error)
- func TimeElapsed(start time.Time, friendly bool) string
- func TimeTrack(start time.Time, w io.Writer, friendly bool)
- func Until(fn func() error, w io.Writer, name string, sleep time.Duration, ...)
- func ValidateProxyURL(proxyUrl string) error
- func VersionOrdinal(version string) string
- type MultiError
- type ProxyConfig
- type RealRunner
- type RetriableError
- type Runner
Constants ¶
const OpenShiftRegistryIp = "172.30.1.1"
Variables ¶
This section is empty.
Functions ¶
func AskForConfirmation ¶ added in v1.4.0
func CommandExecutesSuccessfully ¶ added in v1.11.0
CommandExecutesSuccessfully returns true if the command executed based on the exit code
func DecryptText ¶ added in v1.0.0
Decrypt from base64 to decrypted string
func EncryptText ¶ added in v1.0.0
Encrypt string to base64 crypto using AES
func GenerateSelfSignedCert ¶
You may also specify additional subject alt names (either ip or dns names) for the certificate The certificate will be created with file mode 0644. The key will be created with file mode 0600. If the certificate or key files already exist, they will be overwritten. Any parent directories of the certPath or keyPath will be created as needed with file mode 0755.
func HomeDir ¶ added in v1.0.0
func HomeDir() string
HomeDir returns the home directory for the current user
func IsTtySupported ¶ added in v1.11.0
func IsTtySupported() bool
func ReadInputFromStdin ¶ added in v1.0.0
func ReadPasswordFromStdin ¶ added in v1.0.0
func TimeElapsed ¶ added in v1.4.0
TimeElapsed is used to time the execution of a method.
func TimeTrack ¶ added in v1.2.0
TimeTrack is used to time the execution of a method. It is passed the start time as well as a output writer for the timing. The usage of TimeTrack is in combination with defer like so:
defer TimeTrack(time.Now(), os.Stdout)
func Until ¶
Until endlessly loops the provided function until a message is received on the done channel. The function will wait the duration provided in sleep between function calls. Errors will be sent on provider Writer.
func ValidateProxyURL ¶ added in v1.1.0
validateProxyURL validates that the specified proxyURL is valid
func VersionOrdinal ¶ added in v1.0.0
Types ¶
type MultiError ¶ added in v0.3.5
type MultiError struct {
Errors []error
}
func (*MultiError) Collect ¶ added in v0.3.5
func (m *MultiError) Collect(err error)
func (MultiError) ToError ¶ added in v0.3.5
func (m MultiError) ToError() error
type ProxyConfig ¶ added in v1.1.0
type ProxyConfig struct {
// contains filtered or unexported fields
}
ProxyConfig keeps the proxy configuration for the current environment
func NewProxyConfig ¶ added in v1.1.0
func NewProxyConfig(httpProxy string, httpsProxy string, noProxy string) (*ProxyConfig, error)
NewProxyConfig creates a proxy configuration with the specified parameters. If a empty string is passed the corresponding environment variable is checked.
func (*ProxyConfig) AddNoProxy ¶ added in v1.1.0
func (p *ProxyConfig) AddNoProxy(host string)
AddNoProxy appends the specified host to the list of no proxied hosts.
func (*ProxyConfig) ApplyToEnvironment ¶ added in v1.1.0
func (p *ProxyConfig) ApplyToEnvironment()
Sets the current config as environment variables in the current process.
func (*ProxyConfig) HttpProxy ¶ added in v1.1.0
func (p *ProxyConfig) HttpProxy() string
HttpProxy returns the configured value for the HTTP proxy. The empty string is returned in case HTTP proxy is not set.
func (*ProxyConfig) HttpsProxy ¶ added in v1.1.0
func (p *ProxyConfig) HttpsProxy() string
HttpsProxy returns the configured value for the HTTPS proxy. The empty string is returned in case HTTPS proxy is not set.
func (*ProxyConfig) IsEnabled ¶ added in v1.1.0
func (p *ProxyConfig) IsEnabled() bool
Enabled returns true if at least one proxy (HTTP or HTTPS) is configured. Returns false otherwise.
func (*ProxyConfig) NoProxy ¶ added in v1.1.0
func (p *ProxyConfig) NoProxy() string
NoProxy returns a comma separated list of hosts for which proxies should not be applied.
func (*ProxyConfig) ProxyConfig ¶ added in v1.1.0
func (p *ProxyConfig) ProxyConfig() []string
ProxyConfig returns a the proxy configuration as a slice, one element for each of the potential settings HTTP_PROXY, HTTPS_PROXY and NO_PROXY. If proxies are not enabled an empty slice is returned.
type RealRunner ¶ added in v1.0.0
type RealRunner struct {
Env []string
}
type RetriableError ¶ added in v1.7.0
type RetriableError struct {
Err error
}
func (RetriableError) Error ¶ added in v1.7.0
func (r RetriableError) Error() string