workflow

package
v0.0.0-...-0ed2cf1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package workflow defines the contract between the cleanup-sweeper command and its cleanup workflows. Workflow-specific settings are declared by each workflow itself and supplied as --options=<workflow>.<key>=<value>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Common

type Common struct {
	// DryRun previews what would be deleted without changing anything.
	DryRun bool
	// Parallelism bounds concurrent deletions per step.
	Parallelism int
	// Timeout bounds the whole run; zero means the workflow's own default, if any.
	Timeout time.Duration
	// PolicyFile is the policy document for the selected workflow, for the
	// workflows that take one.
	PolicyFile string
}

Common holds the options that apply to every workflow.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds the available workflows and the options each declares.

func NewRegistry

func NewRegistry(workflows ...Workflow) (*Registry, error)

NewRegistry registers workflows in the supplied order, rejecting nil workflows and empty, whitespace-padded or duplicate names, and lets each workflow declare its options.

func (*Registry) ApplyOptions

func (r *Registry) ApplyOptions(selected string, entries []string) error

ApplyOptions sets the selected workflow's options from entries of the form "<workflow>.<key>=<value>". Keys are the names the workflow declared, and later entries override earlier ones (list-valued options accumulate). An unknown workflow, an option meant for a different workflow than the selected one, an unknown key, or a value the option rejects is an error.

func (*Registry) Get

func (r *Registry) Get(name string) (Workflow, error)

Get returns the named workflow.

func (*Registry) Names

func (r *Registry) Names() []string

Names lists the registered workflow names in registration order.

func (*Registry) OptionsUsage

func (r *Registry) OptionsUsage() string

OptionsUsage describes every option declared by the registered workflows, grouped by workflow, for command help.

type Workflow

type Workflow interface {
	// Name is the value of --workflow selecting this workflow and the <workflow>
	// prefix of its options.
	Name() string
	// AttachOptions declares the options this workflow accepts through
	// --options=<name>.<key>=<value>. The workflow owns each option's key,
	// default and help; workflows without options declare nothing.
	AttachOptions(flags *pflag.FlagSet)
	// Validate checks the applied options and the common options, including
	// loading the policy file, before any credential is created.
	Validate(common Common) error
	// LogValues returns key/value pairs, such as the target subscription, that
	// identify what the workflow acts on. The command adds them to every log entry.
	LogValues() []any
	// Run executes the workflow.
	Run(ctx context.Context, common Common, credential azcore.TokenCredential) error
}

Workflow is one cleanup workflow. A Workflow value holds the state its own options are bound to, so every command invocation needs its own instances.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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