Documentation ¶
Overview ¶
Copyright 2022, Pulumi Corporation. All rights reserved.
Default value and config value code-generation facilities for SDK generation are kept in this separate file as they are a bit intricate.
Index ¶
- Constants
- Variables
- func GeneratePackage(tool string, pkg *schema.Package, extraFiles map[string][]byte) (map[string][]byte, error)
- func GenerateProgram(program *pcl.Program) (map[string][]byte, hcl.Diagnostics, error)
- func GenerateProject(directory string, project workspace.Project, program *pcl.Program) error
- func LanguageResources(tool string, pkg *schema.Package) (map[string]LanguageResource, error)
- func Template(name string, text string) *tmplt.Template
- type DocLanguageHelper
- func (d DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType(pkg *schema.Package, modName, typeName string, input bool) string
- func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string
- func (d DocLanguageHelper) GetDocLinkForResourceInputOrOutputType(pkg *schema.Package, modName, typeName string, input bool) string
- func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, modName, 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 LanguageResource
- type MethodCall
- type PackageInfo
- type PropertyInfo
- type TypeShape
- func (ts TypeShape) Equal(other TypeShape) bool
- func (ts TypeShape) ListType(ctx *classFileContext) string
- func (ts TypeShape) Optional() TypeShape
- func (ts TypeShape) ParameterTypes(imports *names.Imports) []string
- func (ts TypeShape) ParameterTypesTransformed(f func(TypeShape) string) []string
- func (ts TypeShape) StringJavaTypeShape(imports *names.Imports) string
- func (ts TypeShape) ToCode(imports *names.Imports) string
- func (ts TypeShape) ToCodeClassLiteral(imports *names.Imports) string
- func (ts TypeShape) ToCodeCommentedAnnotations(imports *names.Imports) string
- func (ts TypeShape) ToCodeErased(imports *names.Imports) string
- func (ts TypeShape) ToCodeWithOptions(imports *names.Imports, opts TypeShapeStringOptions) string
- func (ts TypeShape) UnEither() (bool, TypeShape, TypeShape)
- func (ts TypeShape) UnList() (bool, TypeShape)
- func (ts TypeShape) UnNullable() (bool, TypeShape)
- func (ts TypeShape) UnOptional() (bool, TypeShape)
- func (ts TypeShape) UnOutput() (bool, TypeShape)
- func (ts TypeShape) WithoutAnnotations() TypeShape
- type TypeShapeStringOptions
Constants ¶
const (
// MissingKeyErrorOption is the renderer option to stop execution immediately with an error on missing key
MissingKeyErrorOption = "missingkey=error"
)
Variables ¶
var Importer schema.Language = importer(0)
Importer implements schema.Language for Java
Functions ¶
func GeneratePackage ¶
func GenerateProgram ¶
func GenerateProject ¶
func LanguageResources ¶
LanguageResources returns a map of resources that can be used by downstream codegen. The map key is the resource schema token.
Types ¶
type DocLanguageHelper ¶
type DocLanguageHelper struct{}
DocLanguageHelper is the Java-specific implementation of the similarly named codegen interface.
func (DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType ¶
func (DocLanguageHelper) GetDocLinkForPulumiType ¶
func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string
TODO revisit once javadocs are published.
Not every language currently supports this. For Python docsgen the implementation returns "" also.
For an example of a language that supports this, check out Go.
When visiting https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucket/ see:
func NewBucket(ctx *Context, name string, args *BucketArgs, opts ...ResourceOption)
Context, BucketARgs and ResourceOption get linked to Go API docs.
For Java we could link to JavaDoc when appropriate.
func (DocLanguageHelper) GetDocLinkForResourceInputOrOutputType ¶
func (DocLanguageHelper) GetDocLinkForResourceType ¶
func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, modName, typeName string) string
func (DocLanguageHelper) GetEnumName ¶
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 (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 LanguageResource ¶
type LanguageResource struct { *schema.Resource Name string // The resource name (e.g. Deployment) Package string // The package name (e.g. apps.v1) }
LanguageResource is derived from the schema and can be used by downstream codegen.
type MethodCall ¶
func (MethodCall) String ¶
func (m MethodCall) String() string
type PackageInfo ¶
type PackageInfo struct { Packages map[string]string `json:"packages,omitempty"` BasePackage string `json:"basePackage"` // If set to "gradle" generates a basic set of Gradle build files. BuildFiles string `json:"buildFiles"` }
PackageInfo represents a Java language-specific info for a package.
func (PackageInfo) BasePackageOrDefault ¶
func (i PackageInfo) BasePackageOrDefault() string
func (PackageInfo) With ¶ added in v0.2.1
func (i PackageInfo) With(overrides PackageInfo) PackageInfo
type PropertyInfo ¶
type PropertyInfo struct {
Name string `json:"name,omitempty"`
}
PropertyInfo represents a Java language-specific info for a property.
type TypeShape ¶
func (TypeShape) ParameterTypes ¶
func (TypeShape) ParameterTypesTransformed ¶
func (TypeShape) StringJavaTypeShape ¶
StringJavaTypeShape returns a Java code representation if this TypeShape
Basically rewrites itself to Java.
func (TypeShape) ToCodeClassLiteral ¶
ToCodeClassLiteral converts to Java class literal, may add imports to use short names.
func (TypeShape) ToCodeCommentedAnnotations ¶
func (TypeShape) ToCodeErased ¶
ToCodeErased converts to Java code with erased generics, may add imports to use short names.
func (TypeShape) ToCodeWithOptions ¶
func (ts TypeShape) ToCodeWithOptions(imports *names.Imports, opts TypeShapeStringOptions) string
func (TypeShape) UnNullable ¶
func (TypeShape) UnOptional ¶
func (TypeShape) WithoutAnnotations ¶
type TypeShapeStringOptions ¶
type TypeShapeStringOptions struct { // useful for type parameters because (most) annotations are not allowed on a generic parameter type CommentOutAnnotations bool // useful for annotation parameters and other contexts where comments or annotations are not allowed SkipAnnotations bool // useful for .class or [].class to skip the generic part of the type GenericErasure bool // useful to append .class AppendClassLiteral bool // useful to append [].class AppendClassArrayLiteral bool }