Documentation ¶
Overview ¶
The codegen package provides utilities for converting Pulumi YAML templates to other forms (e.g. programs in higher-level languages supported by Pulumi).
Index ¶
- Variables
- func ConvertTemplate(template *ast.TemplateDecl, generate GenerateFunc, ...) (map[string][]byte, hcl.Diagnostics, error)
- func ConvertTemplateIL(template *ast.TemplateDecl, loader schema.ReferenceLoader) (string, hcl.Diagnostics, error)
- func Eject(dir string, loader schema.ReferenceLoader) (*workspace.Project, *pcl.Program, error)
- func EjectProgram(template *ast.TemplateDecl, loader schema.ReferenceLoader) (*pcl.Program, hcl.Diagnostics, error)
- func GenerateProgram(program *pcl.Program) (map[string][]byte, hcl.Diagnostics, error)
- func GenerateProject(directory string, project workspace.Project, program *pcl.Program) error
- func ImportTemplate(file *ast.TemplateDecl, loader pulumiyaml.PackageLoader) (*model.Body, syntax.Diagnostics)
- func LoadTemplate(dir string) (*workspace.Project, *ast.TemplateDecl, hcl.Diagnostics, error)
- type BlockSyntax
- type DocLanguageHelper
- func (d DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType(pkg *schema.Package, moduleName, typeName string, input bool) string
- func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string
- func (d DocLanguageHelper) GetDocLinkForResourceInputOrOutputType(pkg *schema.Package, moduleName, typeName string, input bool) string
- func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, moduleName, typeName string) string
- func (d DocLanguageHelper) GetEnumName(e *schema.Enum, typeName string) (string, error)
- func (d DocLanguageHelper) GetFunctionName(modName string, f *schema.Function) string
- func (d DocLanguageHelper) GetLanguageTypeString(pkg *schema.Package, moduleName string, t schema.Type, input bool) string
- func (d DocLanguageHelper) GetMethodName(m *schema.Method) string
- func (d DocLanguageHelper) GetMethodResultName(pkg *schema.Package, modName string, r *schema.Resource, m *schema.Method) string
- func (d DocLanguageHelper) GetModuleDocLink(pkg *schema.Package, modName string) (string, string)
- func (d DocLanguageHelper) GetPropertyName(p *schema.Property) (string, error)
- func (d DocLanguageHelper) GetResourceFunctionResultName(modName string, f *schema.Function) string
- type GenerateFunc
- type HasTrivia
- type Invoke
- type Traversal
- type TraversalList
- type TraversalSegment
- type YAMLError
Constants ¶
This section is empty.
Variables ¶
var ProjectKeysToOmit = []string{"configuration", "resources", "outputs", "variables"}
Functions ¶
func ConvertTemplate ¶
func ConvertTemplate(template *ast.TemplateDecl, generate GenerateFunc, loader schema.ReferenceLoader) (map[string][]byte, hcl.Diagnostics, error)
ConvertTemplate converts a Pulumi YAML template to a target language using PCL as an intermediate representation.
loader is the schema.Loader used when binding the the PCL program. If `nil`, a `schema.Loader` will be created from `newPluginHost()`.
func ConvertTemplateIL ¶
func ConvertTemplateIL(template *ast.TemplateDecl, loader schema.ReferenceLoader) (string, hcl.Diagnostics, error)
func Eject ¶
Eject on a YAML program directory returns a Pulumi Project and a YAML program which has been parsed and converted to the intermediate PCL language
func EjectProgram ¶
func EjectProgram(template *ast.TemplateDecl, loader schema.ReferenceLoader) (*pcl.Program, hcl.Diagnostics, error)
func GenerateProgram ¶
Generate a serializable YAML template.
func GenerateProject ¶
func ImportTemplate ¶
func ImportTemplate(file *ast.TemplateDecl, loader pulumiyaml.PackageLoader) (*model.Body, syntax.Diagnostics)
ImportTemplate converts a YAML template to a PCL definition.
func LoadTemplate ¶
Types ¶
type BlockSyntax ¶ added in v0.5.3
type BlockSyntax struct { Leading syntax.TriviaList Trailing syntax.TriviaList }
func (BlockSyntax) FootComment ¶ added in v0.5.3
func (b BlockSyntax) FootComment() string
func (BlockSyntax) HeadComment ¶ added in v0.5.3
func (b BlockSyntax) HeadComment() string
func (BlockSyntax) LineComment ¶ added in v0.5.3
func (b BlockSyntax) LineComment() string
func (BlockSyntax) Range ¶ added in v0.5.3
func (b BlockSyntax) Range() *hcl.Range
type DocLanguageHelper ¶
type DocLanguageHelper struct{}
DocLanguageHelper is the YAML-specific implementation of the DocLanguageHelper.
func (DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType ¶
func (DocLanguageHelper) GetDocLinkForPulumiType ¶
func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string
func (DocLanguageHelper) GetDocLinkForResourceInputOrOutputType ¶
func (DocLanguageHelper) GetDocLinkForResourceType ¶
func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, moduleName, typeName string) string
func (DocLanguageHelper) GetEnumName ¶
Pulumi YAML doesn't have enums, so you should just use the value itself.
func (DocLanguageHelper) GetFunctionName ¶
func (d DocLanguageHelper) GetFunctionName(modName string, f *schema.Function) string
func (DocLanguageHelper) GetLanguageTypeString ¶
func (DocLanguageHelper) GetMethodName ¶
func (d DocLanguageHelper) GetMethodName(m *schema.Method) string
func (DocLanguageHelper) GetMethodResultName ¶
func (d DocLanguageHelper) GetMethodResultName(pkg *schema.Package, modName string, r *schema.Resource, m *schema.Method) string
There is no way to name types besides resources and invokes in Pulumi YAML.
func (DocLanguageHelper) GetModuleDocLink ¶
func (DocLanguageHelper) GetPropertyName ¶
func (d DocLanguageHelper) GetPropertyName(p *schema.Property) (string, error)
func (DocLanguageHelper) GetResourceFunctionResultName ¶
func (d DocLanguageHelper) GetResourceFunctionResultName(modName string, f *schema.Function) string
type GenerateFunc ¶
A GenerateFunc generates a set of output files from a PCL program. This is used to convert YAML templates to higher-level languages using PCL as an intermediate representation.
type HasTrivia ¶ added in v0.5.3
type HasTrivia interface { GetLeadingTrivia() syntax.TriviaList GetTrailingTrivia() syntax.TriviaList }
type Traversal ¶
type Traversal struct {
// contains filtered or unexported fields
}
A `ScopedTraversalExpression` ready to display.
type TraversalList ¶
type TraversalList = []Traversal
func AppendTraversal ¶
func AppendTraversal(tl TraversalList, t Traversal) TraversalList
func NewTraversalList ¶
func NewTraversalList() TraversalList
type TraversalSegment ¶
type TraversalSegment struct {
// contains filtered or unexported fields
}
A segment of `Traversal`