actions

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 8 Imported by: 3

README

simple-actions

This is based somewhat on https://github.com/kubernetes-sigs/kind/tree/93abedaa23f6d4639e0c1b83fc0eb7cacbf357e4/pkg/cluster/internal/create/actions though it is intended to be a little more flexible

  • Supports a Dry Run flag for all actions

Included actions

  • docker actions allow you to interact with docker in your actions without needing to call the docker cli directly
  • kubectl actions wrap kubectl call in an action interface

Documentation

Overview

Package actions contains the high level workflow actions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirExists

func DirExists(filename string) bool

DirExists returns true if the path exists and is a directory.

func FileExists

func FileExists(filename string) bool

FileExists returns true if the file exists and is not a directory.

func FormatDuration

func FormatDuration(duration time.Duration) string

FormatDuration format duration string.

Types

type Action

type Action interface {
	Execute(ctx ActionContext) error
}

Action documentation.

func NewCopyFileAction added in v1.2.0

func NewCopyFileAction(from, to string) Action

NewCopyFileAction documentation.

func NewCreateDirectoryAction

func NewCreateDirectoryAction(path string) Action

NewCreateDirectoryAction documentation.

func NewErrorAction

func NewErrorAction(err error, msg string) Action

NewErrorAction docs.

func NewPrintAction

func NewPrintAction(msg string) Action

NewPrintAction documentation.

func NewSleepAction

func NewSleepAction(duration, msg string) Action

NewSleepAction docs.

type ActionContext added in v1.0.1

type ActionContext interface {
	Logger() log.Logger
	Status() *term.Status
	IsDryRun() bool
	Data() interface{}
}

ActionContext docs.

func NewDefaultActionContext added in v1.0.1

func NewDefaultActionContext(logger log.Logger, dryRun bool) ActionContext

NewDefaultActionContext generate a default action context with a nil return for Data().

type Actions

type Actions []Action

Actions list of action items.

func (Actions) Execute

func (a Actions) Execute(ctx ActionContext) (err error)

Execute executes all action items in the Actions list.

Directories

Path Synopsis
Package log same as https://github.com/kubernetes-sigs/kind/tree/master/pkg/log
Package log same as https://github.com/kubernetes-sigs/kind/tree/master/pkg/log
Package term same as https://github.com/kubernetes-sigs/kind/tree/master/pkg/internal/env
Package term same as https://github.com/kubernetes-sigs/kind/tree/master/pkg/internal/env

Jump to

Keyboard shortcuts

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