gen

package
v2.25.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2021 License: Apache-2.0 Imports: 26 Imported by: 6

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

Index

Constants

This section is empty.

Variables

View Source
var Importer schema.Language = importer(0)

Importer implements schema.Language for Go.

Functions

func CRDTypes added in v2.9.0

func CRDTypes(tool string, pkg *schema.Package) (map[string]*bytes.Buffer, error)

CRDTypes returns a map from each module name to a buffer containing the code for its generated types.

func GeneratePackage

func GeneratePackage(tool string, pkg *schema.Package) (map[string][]byte, error)

func GenerateProgram added in v2.3.0

func GenerateProgram(program *hcl2.Program) (map[string][]byte, hcl.Diagnostics, error)

func LanguageResources added in v2.2.0

func LanguageResources(tool string, pkg *schema.Package) (map[string]LanguageResource, error)

LanguageResources returns a map of resources that can be used by downstream codegen. The map key is the resource schema token.

func Title

func Title(s string) string

Title converts the input string to a title case where only the initial letter is upper-cased. It also removes $-prefix if any.

Types

type DocLanguageHelper

type DocLanguageHelper struct {
	// contains filtered or unexported fields
}

DocLanguageHelper is the Go-specific implementation of the DocLanguageHelper.

func (*DocLanguageHelper) GeneratePackagesMap

func (d *DocLanguageHelper) GeneratePackagesMap(pkg *schema.Package, tool string, goInfo GoPackageInfo)

GeneratePackagesMap generates a map of Go packages for resources, functions and types.

func (DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType

func (d DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType(pkg *schema.Package, moduleName, typeName string, input bool) string

GetDocLinkForFunctionInputOrOutputType returns the doc link for an input or output type of a Function.

func (DocLanguageHelper) GetDocLinkForPulumiType

func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string

GetDocLinkForPulumiType returns the doc link for a Pulumi type.

func (DocLanguageHelper) GetDocLinkForResourceInputOrOutputType

func (d DocLanguageHelper) GetDocLinkForResourceInputOrOutputType(pkg *schema.Package, moduleName, typeName string, input bool) string

GetDocLinkForResourceInputOrOutputType returns the godoc URL for an input or output type.

func (DocLanguageHelper) GetDocLinkForResourceType

func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, moduleName string, typeName string) string

GetDocLinkForResourceType returns the godoc URL for a type belonging to a resource provider.

func (DocLanguageHelper) GetEnumName added in v2.16.0

func (d DocLanguageHelper) GetEnumName(e *schema.Enum, typeName string) (string, error)

GetEnumName returns the enum name specific to Go.

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 Go-specific type given a Pulumi schema type.

func (d DocLanguageHelper) GetModuleDocLink(pkg *schema.Package, modName string) (string, string)

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 Go.

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 GoPackageInfo added in v2.1.0

type GoPackageInfo struct {
	// Base path for package imports
	//
	//    github.com/pulumi/pulumi-kubernetes/sdk/go/kubernetes
	ImportBasePath string `json:"importBasePath,omitempty"`

	// Map from module -> package name
	//
	//    { "flowcontrol.apiserver.k8s.io/v1alpha1": "flowcontrol/v1alpha1" }
	//
	ModuleToPackage map[string]string `json:"moduleToPackage,omitempty"`

	// Map from package name -> package alias
	//
	//    { "github.com/pulumi/pulumi-kubernetes/sdk/go/kubernetes/flowcontrol/v1alpha1": "flowcontrolv1alpha1" }
	//
	PackageImportAliases map[string]string `json:"packageImportAliases,omitempty"`

	// Generate container types (arrays, maps, pointer output types etc.) for each resource.
	// These are typically used to support external references.
	GenerateResourceContainerTypes bool `json:"generateResourceContainerTypes,omitempty"`
}

GoPackageInfo holds information required to generate the Go SDK from a schema.

type LanguageResource added in v2.2.0

type LanguageResource struct {
	*schema.Resource

	Alias   string // The package alias (e.g. appsv1)
	Name    string // The resource name (e.g. Deployment)
	Package string // The package name (e.g. github.com/pulumi/pulumi-kubernetes/sdk/v2/go/kubernetes/apps/v1)
}

LanguageResource is derived from the schema and can be used by downstream codegen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL