helpers

package
v0.0.0-...-8e3368f Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MAX_RETRY = 10
)

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 AwsCredentialsLoad

func AwsCredentialsLoad() error

func AwsErrorCode

func AwsErrorCode(err error) string

func CertificateCA

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

func CertificateSelfSigned

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

func CloudWatchLogsStream

func CloudWatchLogsStream(ctx context.Context, cw cloudwatchlogsiface.CloudWatchLogsAPI, w io.WriteCloser, group, stream string, opts structs.LogsOptions) error

func CloudWatchLogsSubscribe

func CloudWatchLogsSubscribe(ctx context.Context, cw cloudwatchlogsiface.CloudWatchLogsAPI, group, stream string, opts structs.LogsOptions) (io.ReadCloser, error)

func CloudformationInstall

func CloudformationInstall(cf cloudformationiface.CloudFormationAPI, name, template string, params, tags map[string]string, cb func(int, int)) error

func CloudformationParameters

func CloudformationParameters(template []byte) (map[string]bool, error)

func CloudformationUninstall

func CloudformationUninstall(cf cloudformationiface.CloudFormationAPI, stack string) error

func CloudformationUpdate

func CloudformationUpdate(cf cloudformationiface.CloudFormationAPI, stack string, template string, changes map[string]string, tags map[string]string, topic string) 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 EndpointCheck

func EndpointCheck(url string) error

func EndpointWait

func EndpointWait(url string) error

func EnvDiff

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

func Error

func Error(log *logger.Logger, err 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 Id

func Id(prefix string, length int) string

func LinuxRelease

func LinuxRelease() (string, error)

func NewDefaultTransport

func NewDefaultTransport() *http.Transport

func NewSession

func NewSession() (*session.Session, error)

func Percent

func Percent(num float64) string

func Pipe

func Pipe(a, b io.ReadWriter) error

func RackId

func RackId() string

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 func())

func TrackError

func TrackError(event string, err error, params map[string]interface{})

func TrackEvent

func TrackEvent(event string, params map[string]interface{})

func TrackSuccess

func TrackSuccess(event string, params map[string]interface{})

Convenience function to track success in a controller handler See also httperr.TrackErrorf and httperr.TrackServer

func Unarchive

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

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 WaitForAppRollbackWithLogsContext

func WaitForAppRollbackWithLogsContext(ctx context.Context, 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, errorOnRollback bool) 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
}

Jump to

Keyboard shortcuts

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