common

package
v0.0.0-...-173f4c4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CompactSortableTime = "20060102150405000000000"
	PrintableTime       = "2006-01-02 15:04:05"
	SortableTime        = "20060102.150405.000000000"
)
View Source
var (
	ProviderWaitDuration = 5 * time.Second
)

Functions

func Ago

func Ago(t time.Time) string

func AppEnvironment

func AppEnvironment(p structs.Provider, app string) (structs.Environment, error)

func AppManifest

func AppManifest(p structs.Provider, app string) (*manifest.Manifest, *structs.Release, error)

func Archive

func Archive(file string) (io.Reader, error)

func AtomStatus

func AtomStatus(status string) string

func CertificateCA

func CertificateCA(host string, ca *tls.Certificate) (*tls.Certificate, error)

func CertificateParts

func CertificateParts(c *tls.Certificate) ([]byte, []byte, error)

func CertificateSelfSigned

func CertificateSelfSigned(host string) (*tls.Certificate, error)

func CoalesceInt

func CoalesceInt(ii ...int) int

func CoalesceString

func CoalesceString(ss ...string) string

func DefaultBool

func DefaultBool(v *bool, def bool) bool

func DefaultDuration

func DefaultDuration(v *time.Duration, def time.Duration) time.Duration

func DefaultInt

func DefaultInt(v *int, def int) int

func DefaultInt32

func DefaultInt32(v *int32, def int32) int32

func DefaultString

func DefaultString(v *string, def string) string

func Duration

func Duration(start, end time.Time) string

func EnvDiff

func EnvDiff(a, b string) (string, error)

func FileExists

func FileExists(filename string) bool

func FormatYAML

func FormatYAML(data []byte) ([]byte, error)

func Get

func Get(url string) ([]byte, error)

func InitializeKlog

func InitializeKlog()

func InsecureHTTPClient

func InsecureHTTPClient() *http.Client

func LinuxRelease

func LinuxRelease() (string, error)

func NewDefaultTransport

func NewDefaultTransport() *http.Transport

func Percent

func Percent(num float64) string

func Pipe

func Pipe(a, b io.ReadWriter) error

func RandomString

func RandomString(length int) (string, error)

func RebaseArchive

func RebaseArchive(r io.Reader, src, dst string) (io.Reader, error)

func ReleaseLatest

func ReleaseLatest(p structs.Provider, app string) (*structs.Release, error)

func ReleaseManifest

func ReleaseManifest(p structs.Provider, app, release string) (*manifest.Manifest, *structs.Release, error)

func Retry

func Retry(times int, interval time.Duration, fn func() error) error

func Stream

func Stream(w io.Writer, r io.Reader) error

func StreamAppLogs

func StreamAppLogs(ctx context.Context, p structs.Provider, w io.Writer, app string)

func StreamSystemLogs

func StreamSystemLogs(ctx context.Context, p structs.Provider, w io.Writer)

func Tarball

func Tarball(dir string) ([]byte, error)

func Testdata

func Testdata(name string) ([]byte, error)

func Tick

func Tick(d time.Duration, fn Ticker)

func Unarchive

func Unarchive(r io.Reader, target string) error

func UpperName

func UpperName(name string) string

func Wait

func Wait(interval time.Duration, timeout time.Duration, times int, fn func() (bool, error)) error

func WaitContext

func WaitContext(ctx context.Context, interval time.Duration, timeout time.Duration, times int, fn func() (bool, error)) error

func WaitForAppDeleted

func WaitForAppDeleted(p structs.Provider, w io.Writer, app string) error

func WaitForAppRunning

func WaitForAppRunning(p structs.Provider, app string) error

func WaitForAppRunningContext

func WaitForAppRunningContext(ctx context.Context, p structs.Provider, app string) error

func WaitForAppWithLogs

func WaitForAppWithLogs(p structs.Provider, w io.Writer, app string) error

func WaitForAppWithLogsContext

func WaitForAppWithLogsContext(ctx context.Context, p structs.Provider, w io.Writer, app string) error

func WaitForProcessRunning

func WaitForProcessRunning(p structs.Provider, w io.Writer, app, pid string) error

func WaitForRackRunning

func WaitForRackRunning(p structs.Provider, w io.Writer) error

func WaitForRackWithLogs

func WaitForRackWithLogs(p structs.Provider, w io.Writer) error

func WriteFile

func WriteFile(filename string, data []byte, mode os.FileMode) error

Types

type ReadWriter

type ReadWriter struct {
	io.Reader
	io.Writer
}

type Ticker

type Ticker func() error

Jump to

Keyboard shortcuts

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