Documentation
¶
Index ¶
- func All() map[string]Action
- func ByPackage(packageName string) map[string]Action
- func ByRegexp(r *regexp.Regexp) map[string]Action
- func Disabled(name string) bool
- func MatchRule(name string, rule string) bool
- func Register(f Action, opts ...Option) map[string]Action
- func RegisterWithName(f Action, name string, opts ...Option) map[string]Action
- type Action
- type ErrSkipped
- type Helper
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchRule ¶ added in v0.4.0
MatchRule returns true if the name of an action matches a given rule.
Types ¶
type ErrSkipped ¶ added in v0.4.0
type ErrSkipped struct {
Reason string
}
ErrSkipped must be returned by an action when skipped for any reason.
func (*ErrSkipped) Error ¶ added in v0.4.0
func (e *ErrSkipped) Error() string
type Helper ¶
type Helper interface {
// Log returns an intermediate logger.Entry
// that already contains default fields for the current action.
Log() *logger.Entry
// Sleep pauses the current goroutine for at least the given duration and logs that.
Sleep(time.Duration)
// Cleanup registers a function to be called when the action complete or later.
// Cleanup functions registered from within the same action will be called in last added,
// first called order.
Cleanup(f func(), args ...interface{})
// SpawnAs starts a child process and waits for it to complete.
// The child runs the given action as a different program name.
// The current event-generator binary is copied with a differen name
// prior to be run.
SpawnAs(name string, action string, args ...string) error
// SpawnAsWithSymlink works like SpawnAs, except that it does not make a
// copy of the the current event-generator binary, but creates a symlink instead.
SpawnAsWithSymlink(name string, action string, args ...string) error
// Spawned returns true if the action is running in a child process.
Spawned() bool
// ResourceBuilder returns a k8s' resource.Builder.
ResourceBuilder() *resource.Builder
// InContainer returns true if the application is running in a container.
// Useful to skip actions which won't work within a container.
InContainer() bool
// ExePath returns the path of the event-generator executable
ExePath() string
}
A Helper is passed to an Action as argument.
type Option ¶ added in v0.4.0
type Option func(*actionOpts)
Option is a functional option
func WithDisabled ¶ added in v0.4.0
func WithDisabled() Option
Click to show internal directories.
Click to hide internal directories.