Documentation ¶
Overview ¶
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning.
nolint: lll, goconst
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning.
nolint: lll, goconst
nolint: goconst
Index ¶
- Variables
- func EnsureKeywordSafe(name string) string
- func GeneratePackage(tool string, pkg *schema.Package, extraFiles map[string][]byte) (map[string][]byte, error)
- func GenerateProgram(program *hcl2.Program) (map[string][]byte, hcl.Diagnostics, error)
- func InitParamName(name string) string
- func LanguageResources(tool string, pkg *schema.Package) (map[string]LanguageResource, error)
- func PyName(name string) string
- func PyNameLegacy(name string) stringdeprecated
- type DocLanguageHelper
- func (d DocLanguageHelper) GenPropertyCaseMap(pkg *schema.Package, modName, tool string, prop *schema.Property, ...)
- 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, optional bool) 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 PackageInfo
- type PropertyInfo
Constants ¶
This section is empty.
Variables ¶
var Importer schema.Language = importer(0)
Importer implements schema.Language for Python.
var Keywords = codegen.NewStringSet(
"False",
"None",
"True",
"and",
"as",
"assert",
"async",
"await",
"break",
"class",
"continue",
"def",
"del",
"elif",
"else",
"except",
"exec",
"finally",
"for",
"from",
"global",
"if",
"import",
"in",
"is",
"lambda",
"nonlocal",
"not",
"or",
"pass",
"print",
"raise",
"return",
"try",
"while",
"with",
"yield")
Keywords is a map of reserved keywords used by Python 2 and 3. We use this to avoid generating unspeakable names in the resulting code. This map was sourced by merging the following reference material:
Functions ¶
func EnsureKeywordSafe ¶
EnsureKeywordSafe adds a trailing underscore if the generated name clashes with a Python 2 or 3 keyword, per PEP 8: https://www.python.org/dev/peps/pep-0008/?#function-and-method-arguments
func GeneratePackage ¶
func GenerateProgram ¶
func InitParamName ¶ added in v2.9.0
InitParamName returns a PyName-encoded name but also deduplicates the name against built-in parameters of resource __init__.
func LanguageResources ¶ added in v2.5.0
LanguageResources returns a map of resources that can be used by downstream codegen. The map key is the resource schema token.
func PyName ¶
PyName turns a variable or function name, normally using camelCase, to an underscore_case name.
func PyNameLegacy
deprecated
added in
v2.8.1
PyNameLegacy is an uncorrected and deprecated version of the PyName algorithm to maintain compatibility and avoid a breaking change. See the linked issue for more context: https://github.com/pulumi/pulumi-kubernetes/issues/1179
Deprecated: Use PyName instead.
Types ¶
type DocLanguageHelper ¶
type DocLanguageHelper struct{}
DocLanguageHelper is the Python-specific implementation of the DocLanguageHelper.
func (DocLanguageHelper) GenPropertyCaseMap ¶
func (d DocLanguageHelper) GenPropertyCaseMap(pkg *schema.Package, modName, tool string, prop *schema.Property, snakeCaseToCamelCase, camelCaseToSnakeCase map[string]string, seenTypes codegen.Set)
GenPropertyCaseMap generates the case maps for a property.
func (DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType ¶
func (d DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType(pkg *schema.Package, modName, typeName string, input bool) string
GetDocLinkForFunctionInputOrOutputType is not implemented at this time for Python.
func (DocLanguageHelper) GetDocLinkForPulumiType ¶
func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string
GetDocLinkForPulumiType is not implemented at this time for Python.
func (DocLanguageHelper) GetDocLinkForResourceInputOrOutputType ¶
func (d DocLanguageHelper) GetDocLinkForResourceInputOrOutputType(pkg *schema.Package, modName, typeName string, input bool) string
GetDocLinkForResourceInputOrOutputType is not implemented at this time for Python.
func (DocLanguageHelper) GetDocLinkForResourceType ¶
func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, modName, typeName string) string
GetDocLinkForResourceType returns the Python API doc for a type belonging to a resource provider.
func (DocLanguageHelper) GetEnumName ¶ added in v2.16.0
GetEnumName returns the enum name specific to Python.
func (DocLanguageHelper) GetFunctionName ¶ added in v2.1.0
func (d DocLanguageHelper) GetFunctionName(modName string, f *schema.Function) string
func (DocLanguageHelper) GetLanguageTypeString ¶
func (d DocLanguageHelper) GetLanguageTypeString(pkg *schema.Package, moduleName string, t schema.Type, input, optional bool) string
GetLanguageTypeString returns the Python-specific type given a Pulumi schema type.
func (DocLanguageHelper) GetModuleDocLink ¶ added in v2.2.0
GetModuleDocLink returns the display name and the link for a module.
func (DocLanguageHelper) GetPropertyName ¶
func (d DocLanguageHelper) GetPropertyName(p *schema.Property) (string, error)
GetPropertyName returns the property name specific to Python.
func (DocLanguageHelper) GetResourceFunctionResultName ¶
func (d DocLanguageHelper) GetResourceFunctionResultName(modName string, f *schema.Function) string
GetResourceFunctionResultName returns the name of the result type when a function is used to lookup an existing resource.
type LanguageResource ¶ added in v2.5.0
type LanguageResource struct { *schema.Resource Name string // The resource name (e.g. Deployment) Package string // The package name (e.g. pulumi_kubernetes.apps.v1) }
LanguageResource is derived from the schema and can be used by downstream codegen.
type PackageInfo ¶ added in v2.1.0
type PackageInfo struct { Requires map[string]string `json:"requires,omitempty"` // Readme contains the text for the package's README.md files. Readme string `json:"readme,omitempty"` // Optional overrides for Pulumi module names // // { "flowcontrol.apiserver.k8s.io/v1alpha1": "flowcontrol/v1alpha1" } // ModuleNameOverrides map[string]string `json:"moduleNameOverrides,omitempty"` // Toggle compatibility mode for a specified target. Compatibility string `json:"compatibility,omitempty"` // Deprecated: This bool is no longer needed since all providers now use input/output classes. UsesIOClasses bool `json:"usesIOClasses,omitempty"` // Indicates whether the pulumiplugin.json file should be generated. EmitPulumiPluginFile bool `json:"emitPulumiPluginFile,omitempty"` }
PackageInfo tracks Python-specific information associated with a package.
type PropertyInfo ¶ added in v2.1.0
type PropertyInfo struct {
MapCase bool `json:"mapCase,omitempty"`
}
PropertyInfo tracks Python-specific information associated with properties in a package.