func (stage PipelineStage) UsedFor(targets ...PipelineTarget) PipelineStage {
	stage.targets = targets
	return stage
}
UsedFor specifies that this stage should be used for only the specified targets
package codegen
import (
	"context"
	"fmt"
	"strings"
	"github.com/Azure/k8s-infra/hack/generator/pkg/astmodel"
)
type PipelineStage struct {
	id string
	description string
	action func(context.Context, astmodel.Types) (astmodel.Types, error)
	targets []PipelineTarget
	prerequisites []string
}
func MakePipelineStage(
	id string,
	description string,
	action func(context.Context, astmodel.Types) (astmodel.Types, error)) PipelineStage {
	return PipelineStage{
		id:          id,
		description: description,
		action:      action,
	}
}
func (stage *PipelineStage) HasId(id string) bool {
	return stage.id == id
}
func (stage PipelineStage) RequiresPrerequisiteStages(prerequisites ...string) PipelineStage {
	if len(stage.prerequisites) > 0 {
		panic(fmt.Sprintf(
			"Prerequisites of stage '%s' already set to '%s'; cannot modify to '%s'.",
			stage.id,
			strings.Join(stage.prerequisites, "; "),
			strings.Join(prerequisites, "; ")))
	}
	stage.prerequisites = prerequisites
	return stage
}