Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultInterval is the default amount of time to wait in between checks DefaultInterval = 5 * time.Second // DefaultGracePeriod is the amount of time to wait before running the first // check and after a successful check DefaultGracePeriod = time.Duration(0) // DefaultRetries is the default number of times to retry before failing DefaultRetries = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Preparer ¶
type Preparer struct { // the shell interpreter that will be used for your scripts. `/bin/sh` is // used by default. Interpreter string `hcl:"interpreter"` // the script to run to check if a resource is ready. exit with exit code 0 if // the resource is healthy, and 1 (or above) otherwise. Check string `hcl:"check" required:"true"` // flags to pass to the `interpreter` binary to check validity. For // `/bin/sh` this is `-n`. CheckFlags []string `hcl:"check_flags"` // flags to pass to the interpreter at execution time. ExecFlags []string `hcl:"exec_flags"` // the amount of time the command will wait before halting forcefully. The // format is Go's duration string. A duration string is a possibly signed // sequence of decimal numbers, each with optional fraction and a unit // suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", // "us" (or "µs"), "ms", "s", "m", "h". Timeout string `hcl:"timeout" doc_type:"duration string"` // the working directory this command should be run in. Dir string `hcl:"dir"` // any environment variables that should be passed to the command. Env map[string]string `hcl:"env"` // the amount of time to wait in between checks. The format is Go's duration // string. A duration string is a possibly signed sequence of decimal numbers, // each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or // "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". If // the interval is not specified, it will default to 5 seconds. Interval string `hcl:"interval" doc_type:"duration string"` // the amount of time to wait before running the first check and after a // successful check. The format is Go's duration string. A duration string is // a possibly signed sequence of decimal numbers, each with optional fraction // and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units // are "ns", "us" (or "µs"), "ms", "s", "m", "h". If no grace period is // specified, no grace period will be taken into account. GracePeriod string `hcl:"grace_period" doc_type:"duration string"` // the maximum number of attempts before the wait fails. If the maximum number // of retries is not set, it will default to 5. MaxRetry int `hcl:"max_retry"` }
Preparer handles wait.query tasks
type Retrier ¶
type Retrier struct { GracePeriod time.Duration Interval time.Duration MaxRetry int RetryCount int Duration time.Duration }
Retrier can be included in resources to provide retry capabilities
func PrepareRetrier ¶
PrepareRetrier generates a Retrier from preparer input
Click to show internal directories.
Click to hide internal directories.