const ( // SchemaExtension is the file extension this package requires schema files to have SchemaExtension = ".json" )
const ( // TemplateExtension is the file extension this package requires template files to have TemplateExtension = ".template.yaml" )
func SchemaStrings(data ...string) framework.SchemaParser
SchemaStrings returns a SchemaParser that will parse the schemas in the given strings.
This is a helper for use with framework.TemplateProcessor#AdditionalSchemas. Example:
processor := framework.TemplateProcessor{ //... AdditionalSchemas: parser.SchemaStrings(` { "definitions": { "com.example.v1.Foo": { ... } } } `),
func TemplateStrings(data ...string) framework.TemplateParser
TemplateStrings returns a TemplateParser that will parse the templates from the given strings.
This is a helper for use with framework.TemplateProcessor's template subfields. Example:
processor := framework.TemplateProcessor{ ResourceTemplates: []framework.ResourceTemplate{{ Templates: parser.TemplateStrings(` apiVersion: apps/v1 kind: Deployment metadata: name: foo namespace: default annotations: {{ .Key }}: {{ .Value }} `) }}, }
SchemaParser is a framework.SchemaParser that can parse files or directories containing openapi schemas.
type SchemaParser struct {
// contains filtered or unexported fields
}
func SchemaFiles(paths ...string) SchemaParser
SchemaFiles returns a SchemaParser that will parse the schemas in the given files. This is a helper for use with framework.TemplateProcessor#AdditionalSchemas.
processor := framework.TemplateProcessor{ //... AdditionalSchemas: parser.SchemaFiles("path/to/crd-schemas", "path/to/special-schema.json), }
func (l SchemaParser) FromFS(fs iofs.FS) SchemaParser
FromFS allows you to replace the filesystem in which the parser will look up the given paths. For example, you can use an embed.FS.
func (l SchemaParser) Parse() ([]*spec.Definitions, error)
Parse implements framework.SchemaParser
TemplateParser is a framework.TemplateParser that can parse files or directories containing Go templated YAML.
type TemplateParser struct {
// contains filtered or unexported fields
}
func TemplateFiles(paths ...string) TemplateParser
TemplateFiles returns a TemplateParser that will parse the templates from the given files or directories. Only immediate children of any given directories will be parsed. All files must end in .template.yaml.
This is a helper for use with framework.TemplateProcessor's template subfields. Example:
processor := framework.TemplateProcessor{ ResourceTemplates: []framework.ResourceTemplate{{ Templates: parser.TemplateFiles("path/to/templates", "path/to/special.template.yaml") }}, }
func (l TemplateParser) FromFS(fs iofs.FS) TemplateParser
FromFS allows you to replace the filesystem in which the parser will look up the given paths. For example, you can use an embed.FS.
func (l TemplateParser) Parse() ([]*template.Template, error)
Parse implements framework.TemplateParser
func (l TemplateParser) WithExtensions(ext ...string) TemplateParser
WithExtensions allows you to replace the extension the parser accept on the input files.