Documentation
¶
Index ¶
- type Generator
- type GeneratorHook
- type GeneratorOptions
- func WithNoApi() GeneratorOptions
- func WithNoInit() GeneratorOptions
- func WithNoWebhook() GeneratorOptions
- func WithPostApiHook(hook GeneratorHook) GeneratorOptions
- func WithPostInitHook(hook GeneratorHook) GeneratorOptions
- func WithPostWebhookHook(hook GeneratorHook) GeneratorOptions
- func WithPreApiHook(hook GeneratorHook) GeneratorOptions
- func WithPreInitHook(hook GeneratorHook) GeneratorOptions
- func WithPreWebhookHook(hook GeneratorHook) GeneratorOptions
- type Sample
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is a utility that can be used to generate multiple samples at a time. A Generator can be configured to run only specific subcommands for the samples via GeneratorOptions functions
func NewGenerator ¶
func NewGenerator(opts ...GeneratorOptions) *Generator
NewGenerator creates a new Generator. The returned Generator can be configured with GeneratorOptions functions. By default the Generator that is returned will be set to run all Generate functions of a Sample (GenerateInit, GenerateApi, GenerateWebhook)
func (*Generator) GenerateSamples ¶
GenerateSamples will perform the generation logic for a list of Samples based on the Generator configuration
type GeneratorHook ¶
type GeneratorHook func(Sample)
GeneratorHook is a function that takes in a sample and represents a function that gets called in a Pre/Post hook for different stages of sample generation
type GeneratorOptions ¶
type GeneratorOptions func(g *Generator)
GeneratorOptions is a type of function that is used to configure a Generator
func WithNoApi ¶
func WithNoApi() GeneratorOptions
WithNoApi will configure a Generator to not run the GenerateApi function of a Sample
func WithNoInit ¶
func WithNoInit() GeneratorOptions
WithNoInit will configure a Generator to not run the GenerateInit function of a Sample
func WithNoWebhook ¶
func WithNoWebhook() GeneratorOptions
WithNoWebhook will configure a Generator to not run the GenerateWebhook function of a Sample
func WithPostApiHook ¶
func WithPostApiHook(hook GeneratorHook) GeneratorOptions
WithPostApiHook will configure a Generator to run the given GeneratorHook after executing the GenerateApi function of a Sample
func WithPostInitHook ¶
func WithPostInitHook(hook GeneratorHook) GeneratorOptions
WithPostInitHook will configure a Generator to run the given GeneratorHook after executing the GenerateInit function of a Sample
func WithPostWebhookHook ¶
func WithPostWebhookHook(hook GeneratorHook) GeneratorOptions
WithPostWebhookHook will configure a Generator to run the given GeneratorHook after executing the GenerateWebhook function of a Sample
func WithPreApiHook ¶
func WithPreApiHook(hook GeneratorHook) GeneratorOptions
WithPreApiHook will configure a Generator to run the given GeneratorHook before executing the GenerateApi function of a Sample
func WithPreInitHook ¶
func WithPreInitHook(hook GeneratorHook) GeneratorOptions
WithPreInitHook will configure a Generator to run the given GeneratorHook before executing the GenerateInit function of a Sample
func WithPreWebhookHook ¶
func WithPreWebhookHook(hook GeneratorHook) GeneratorOptions
WithPreWebhookHook will configure a Generator to run the given GeneratorHook before executing the GenerateWebhook function of a Sample
type Sample ¶
type Sample interface { // CommandContext returns the CommandContext that the Sample is using CommandContext() command.CommandContext // Name returns the name of the Sample Name() string // GVKs return an array of GVKs that are used when generating the apis and webhooks for the Sample GVKs() []schema.GroupVersionKind // Domain returs the domain of the sample Domain() string // Dir returns the directory the sample is created in Dir() string // Binary returns the binary that is used when creating a sample Binary() string // GenerateInit scaffolds using the `init` subcommand GenerateInit() error // GenerateApi scaffolds using the `create api` subcommand GenerateApi() error // GenerateWebhook scaffolds using the `create webhook` subcommand GenerateWebhook() error }
Sample represents a sample project that can be created and used for testing