Documentation
¶
Overview ¶
Package schedexpr parses the schedule expressions the deployment's scheduler uses to trigger recommendation collection and works out when the next run fires (issue #756).
Three syntaxes are accepted, matching what the Terraform modules hand to their schedulers:
- EventBridge rate expressions, e.g. "rate(1 day)" (AWS Lambda/Fargate);
- EventBridge cron expressions with six fields, e.g. "cron(0 2 * * ? *)" (AWS Lambda/Fargate);
- standard five-field cron, e.g. "0 2 * * *" (GCP Cloud Scheduler, Kubernetes CronJobs, the Azure Logic App recurrence).
Every scheduler involved evaluates its schedule in UTC, so Next works in UTC. The parser is deliberately strict: anything it does not fully understand is an error, and callers report "unknown" instead of a wrong time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmpty = errors.New("empty schedule expression")
ErrEmpty is returned by Parse for an empty or blank expression, which the deployment uses to mean "scheduled collection is disabled".
Functions ¶
This section is empty.
Types ¶
type Schedule ¶
type Schedule interface {
// Next returns the first fire time strictly after t, in UTC. ok is
// false when the fire time cannot be known from the expression alone
// (rate expressions) or no fire time exists within the search horizon.
Next(t time.Time) (next time.Time, ok bool)
}
Schedule is a parsed schedule expression.