Documentation
¶
Index ¶
- type APIGroupContext
- type APIVersionContext
- type CompatibilityConfig
- type Config
- type Context
- type CrdifyConfig
- type DeepcopyConfig
- type EmptyPartialSchema
- type Generator
- type ManifestMerge
- type MultiGroupGenerator
- type OpenAPIConfig
- type Options
- type Result
- type SchemaCheckConfig
- type SchemaPatchConfig
- type SwaggerDocsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIGroupContext ¶
type APIGroupContext struct {
// Name is the group name.
Name string
// Versions is a list of API versions found within the group.
Versions []APIVersionContext
// Config is the group's generation configuration.
// This is populated from the `.codegen.yaml` configuration for the API group.
Config *Config
}
APIGroupContext is the context gathered for a particular API group.
type APIVersionContext ¶
type APIVersionContext struct {
// Name is the version name.
Name string
// Path is the path to the folder containing the API version.
Path string
// PackagePath is the path to the package containing the API version.
// This is the import path for the package.
PackagePath string
// PackageName is the golang packagh name for the API version.
PackageName string
}
APIVersionContext is the context gathered for a particular API version.
type CompatibilityConfig ¶
type CompatibilityConfig struct {
// Disabled determines whether the compatibility generator should be run or not.
// This generator is enabled by default so this field defaults to false.
Disabled bool `json:"disabled,omitempty"`
}
CompatibilityConfig is the configuration for the compatibility generator.
type Config ¶
type Config struct {
// Compatibility represents the configuration of the compatiblity generator.
// When omitted, the default configuration will be used.
Compatibility *CompatibilityConfig `json:"compatibility,omitempty"`
// Crdify represents the configuration of the crdify generator.
// When omitted, the default configuration will be used.
Crdify *CrdifyConfig `json:"crdify,omitempty"`
// Deepcopy represents the configuration of the deepcopy generator.
// When omitted, the default configuration will be used.
Deepcopy *DeepcopyConfig `json:"deepcopy,omitempty"`
// OpenAPI represents the configuration of the openapi generator.
// When omitted, the default configuration will be used.
OpenAPI *OpenAPIConfig `json:"openapi,omitempty"`
// SchemaCheck represents the configuration for the schemacheck generator.
// When omitted, the default configuration will be used.
// When provided, any equivalent flag provided values are ignored.
SchemaCheck *SchemaCheckConfig `json:"schemacheck,omitempty"`
// SchemaPatch represents the configuration for the schemapatch generator.
// When omitted, the default configuration will be used.
// When provided, any equivalent flag provided values are ignored.
SchemaPatch *SchemaPatchConfig `json:"schemapatch,omitempty"`
// ManifestMerge represents the configuration for the manifest merge generator.
// When omitted, the default configuration will be used.
// When provided, any equivalent flag provided values are ignored.
ManifestMerge *ManifestMerge `json:"manifestMerge,omitempty"`
// EmptyPartialSchema represents the configuration for the manifest merge generator.
// When omitted, the default configuration will be used.
// When provided, any equivalent flag provided values are ignored.
EmptyPartialSchema *EmptyPartialSchema `json:"emptyPartialSchema,omitempty"`
// SwaggerDocs represents the configuration for the swaggerdocs generator.
// When omitted, the default configuration will be used.
// When provided, any equivalent flag provided values are ignored.
SwaggerDocs *SwaggerDocsConfig `json:"swaggerdocs,omitempty"`
}
Config represents the configuration of a API group version and the configuration for each generator within it.
type Context ¶
type Context struct {
// BaseDir is the top level directory in which to search for API packages
// and in which to run the generators.
BaseDir string
// APIGroups contains a list of API Groups and information regarding
// their generation.
APIGroups []APIGroupContext
}
Context is the top level generation context passed into each generator.
func NewContext ¶
NewContext creates a generation context from the provided options.
type CrdifyConfig ¶
type CrdifyConfig struct {
// Disabled determines whether the crdify generator should be run or not.
// This generator is enabled by default so this field defaults to false.
Disabled bool `json:"disabled,omitempty"`
// Config configures the validations that crdify performs and how they should be run.
// When omitted, a default configuration is used.
Config *crdifycfg.Config `json:"config,omitempty"`
}
type DeepcopyConfig ¶
type DeepcopyConfig struct {
// Disabled determines whether the deepcopy generator should be run or not.
// This generator is enabled by default so this field defaults to false.
Disabled bool `json:"disabled,omitempty"`
// HeaderFilePath is the path to the file containing the boilerplate header text.
// When omitted, no header is added to the generated files.
HeaderFilePath string `json:"headerFilePath,omitempty"`
// OutputFileBaseName is the base name of the output file.
// When omitted, DefaultOutputFileBaseName is used.
// The current value of DefaultOutputFileBaseName is "zz_generated.deepcopy".
OutputFileBaseName string `json:"outputFileBaseName,omitempty"`
}
DeepcopyConfig is the configuration for the deepcopy generator.
type EmptyPartialSchema ¶
type EmptyPartialSchema struct {
// Disabled determines whether the schemapatch generator should be run or not.
// This generator is enabled by default so this field defaults to false.
Disabled bool `json:"disabled,omitempty"`
}
ManifestMerge is the configuration for the manifest merge generator.
type Generator ¶
type Generator interface {
// Name returns a name identifier for the generator.
Name() string
// GenGroup runs the generator against the given APIGroupContext.
GenGroup(APIGroupContext) ([]Result, error)
// ApplyConfig creates a new generator instance with the given configuration.
ApplyConfig(*Config) Generator
}
Generator is an interface for running a generator against a particular API group.
type ManifestMerge ¶
type ManifestMerge struct {
// Disabled determines whether the schemapatch generator should be run or not.
// This generator is enabled by default so this field defaults to false.
Disabled bool `json:"disabled,omitempty"`
}
ManifestMerge is the configuration for the manifest merge generator.
type MultiGroupGenerator ¶
type MultiGroupGenerator interface {
// Name returns a name identifier for the generator.
Name() string
// GenGroups runs the generator against the given APIGroupContexts.
GenGroups([]APIGroupContext) error
}
MultiGroupGenerator is an interface for running a generator against multiple API groups. This is used for generators that the the context of multiple groups simultaneously.
type OpenAPIConfig ¶
type OpenAPIConfig struct {
// Disabled determines whether the openapi generator should include this
// group or not.
// This generator is enabled by default so this field defaults to false.
Disabled bool `json:"disabled,omitempty"`
}
OpenAPIConfig is the configuration for the openapi generator.
type Options ¶
type Options struct {
// BaseDir is the base directory in which to run the generators.
BaseDir string
// APIGroupVersions is a list of API group versions to generate.
// When omitted, all discovered API group versions are generated.
APIGroupVersions []string
}
Options represents the base configuration used to generate a context.
type Result ¶
type Result struct {
// Generator is the name of the generator that produced this result.
Generator string
// Group is the name of the API group that was processed.
Group string
// Version is the version of the API group that was processed.
Version string
// Manifest is the path to the file the was processed.
Manifest string
// Info contains informational messages from the generator.
Info []string
// Warnings contains warning messages from the generator.
Warnings []string
// Errors contains error messages from the generator.
Errors []error
}
type SchemaCheckConfig ¶
type SchemaCheckConfig struct {
// Disabled determines whether the schemacheck generator should be run or not.
// This generator is enabled by default so this field defaults to false.
Disabled bool `json:"disabled,omitempty"`
// EnabledValidators is a list of the validators that should be enabled.
// If this is empty, the default validators are enabled.
EnabledValidators []string `json:"enabledValidators,omitempty"`
// DisabledValidators is a list of the validators that should be disabled.
// If this is empty, no default validators are disabled.
DisabledValidators []string `json:"disabledValidators,omitempty"`
}
SchemaCheckConfig is the configuration for the schemacheck generator.
type SchemaPatchConfig ¶
type SchemaPatchConfig struct {
// Disabled determines whether the schemapatch generator should be run or not.
// This generator is enabled by default so this field defaults to false.
Disabled bool `json:"disabled,omitempty"`
// RequiredFeatureSets is a list of feature sets combinations that should be
// generated for this API group.
// Each entry in this list is a comma separated list of feature set names
// which will be matched with the `release.openshift.io/feature-set` annotation
// on the CRD definition.
// When omitted, any manifest with a feature set annotation will be ignored.
// Example entries are `""` (empty string), `"TechPreviewNoUpgrade"` or `"TechPreviewNoUpgrade,CustomNoUpgrade"`.
RequiredFeatureSets []string `json:"requiredFeatureSets,omitempty"`
}
SchemaPatchConfig is the configuration for the schemapatch generator.
type SwaggerDocsConfig ¶
type SwaggerDocsConfig struct {
// Disabled determines whether the swaggerdocs generator should be run or not.
// This generator is enabled by default so this field defaults to false.
Disabled bool `json:"disabled,omitempty"`
// CommentPolicy determines how, when verifying swaggerdocs, the generator
// should handle missing comments.
// Valid values are `Ignore`, `Warn` and `Enforce`.
// This defaults to `Warn`.
// When set to `Ignore`, the generator will ignore any missing comments.
// When set to `Warn`, the generator will emit a warning for any missing comments.
// When set to `Enforce`, the generator will return an error for any missing comments.
CommentPolicy string `json:"commentPolicy,omitempty"`
// OutputFileName is the file name to use for writing the generated swagger
// docs to. This file will be created for each group version.
// Whem omitted, this will default to `zz_generated.swagger_doc_generated.go`.
OutputFileName string `json:"outputFileName,omitempty"`
}
SwaggerDocsConfig is the configuration for the swaggerdocs generator.