Documentation ¶
Index ¶
- func MapPathOperations(p *openapi3.PathItem) map[string]*openapi3.Operation
- func NewMap(generatorsConf config.Generators, options ...Option) (map[string]*Generator, error)
- type Generator
- type OperationMap
- type OperationVersion
- type Option
- type ResourceKey
- type ResourceMap
- type ResourceScope
- type VersionScope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapPathOperations ¶
MapPathOperations returns a mapping from HTTP method to *openapi3.Operation for a given *openapi3.PathItem.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator generates files for new resources from data models and templates.
func (*Generator) Execute ¶
func (g *Generator) Execute(resources ResourceMap) ([]string, error)
Execute runs the generator on the given resources.
func (*Generator) Scope ¶
func (g *Generator) Scope() config.GeneratorScope
Scope returns the configured scope type of the generator.
type OperationMap ¶
type OperationMap map[string][]OperationVersion
OperationMap defines a mapping from operation name to all versions of that operation within a resource.
func MapResourceOperations ¶
func MapResourceOperations(resourceVersions *vervet.ResourceVersions) (OperationMap, error)
MapResourceOperations returns a mapping from operation ID to all versions of that operation.
type OperationVersion ¶
type OperationVersion struct { *vervet.ResourceVersion Path string Method string Operation *openapi3.Operation }
OperationVersion represents a version of an operation within a collection of resource versions.
type Option ¶
type Option func(g *Generator)
Option configures a Generator.
func DryRun ¶
DryRun executes templates and lists the files that would be generated without actually generating them.
func Filesystem ¶
Filesystem sets the filesytem that the generator checks for templates.
type ResourceKey ¶
ResourceKey uniquely identifies an API resource.
type ResourceMap ¶
type ResourceMap map[ResourceKey]*vervet.ResourceVersions
ResourceMap defines a mapping from API resource identity to its versions.
func MapResources ¶
func MapResources(proj *config.Project) (ResourceMap, error)
MapResources returns a mapping of all resources managed within a Vervet project.
type ResourceScope ¶
type ResourceScope struct { // ResourceVersions contains all the versions of this resource. *vervet.ResourceVersions // API is name of the API containing this resource. API string // Path is the path to the resource directory. Path string // Here is the directory containing the executing template. Here string // Env is a map of template values read from the os environment. Env map[string]string }
ResourceScope identifies a resource that the generator is building for.
func (*ResourceScope) Resource ¶
func (s *ResourceScope) Resource() string
Resource returns the name of the resource in scope.
type VersionScope ¶
type VersionScope struct { *vervet.ResourceVersion // API is name of the API containing this resource. API string // Path is the path to the resource directory. Path string // Here is the directory containing the generator template. Here string // Env is a map of template values read from the os environment. Env map[string]string }
VersionScope identifies a distinct version of a resource that the generator is building for.
func (*VersionScope) Resource ¶
func (s *VersionScope) Resource() string
Resource returns the name of the resource in scope.
func (*VersionScope) Version ¶
func (s *VersionScope) Version() *vervet.Version
Version returns the version of the resource in scope.