tfgen

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 51 Imported by: 282

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: goconst

Index

Constants

View Source
const (
	Success = 0
	Warning = 1
	Failure = 2
	Fatal   = 3
)

Failure severity values

Variables

View Source
var AllLanguages = []Language{Golang, NodeJS, Python, CSharp}

Functions

func GenerateSchema

func GenerateSchema(info tfbridge.ProviderInfo, sink diag.Sink) (pschema.PackageSpec, error)

func LoadGoMod

func LoadGoMod() (*modfile.File, error)

func Main

func Main(pkg string, version string, prov tfbridge.ProviderInfo)

Main executes the TFGen process for the given package pkg and provider prov.

Types

type CoverageTracker added in v3.6.0

type CoverageTracker struct {
	ProviderName    string // Name of the provider
	ProviderVersion string // Version of the provider

	EncounteredExamples map[string]*GeneralExampleInfo // Mapping example names to their general information
	// contains filtered or unexported fields
}

Main overarching structure for storing coverage data on how many examples were processed, how many failed, and for what reason. At different stages, the code translator notifies the tracker of what is going on. Notifications are treated as an ordered stream of events. INTERFACE: foundExample(), languageConversionSuccess(), languageConversionFailure(), languageConversionPanic().

type DocKind

type DocKind string

DocKind indicates what kind of entity's documentation is being requested.

const (
	// ResourceDocs indicates documentation pertaining to resource entities.
	ResourceDocs DocKind = "resources"
	// DataSourceDocs indicates documentation pertaining to data source entities.
	DataSourceDocs DocKind = "data-sources"
)

type GeneralExampleInfo added in v3.6.0

type GeneralExampleInfo struct {
	Name                   string
	OriginalHCL            string
	LanguagesConvertedTo   map[string]*LanguageConversionResult // Mapping language names to their conversion diagnostics
	NameFoundMultipleTimes bool                                 // Current name has already been encountered before
}

General information about an example, and how successful it was at being converted to different languages

type GenerateOptions

type GenerateOptions struct {
	ModuleFormat string
}

type Generator

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

func NewGenerator

func NewGenerator(opts GeneratorOptions) (*Generator, error)

NewGenerator returns a code-generator for the given language runtime and package info.

func (*Generator) Generate

func (g *Generator) Generate() error

Generate creates Pulumi packages from the information it was initialized with.

type GeneratorOptions

type GeneratorOptions struct {
	Package            string
	Version            string
	Language           Language
	ProviderInfo       tfbridge.ProviderInfo
	Root               afero.Fs
	ProviderInfoSource il.ProviderInfoSource
	PluginHost         plugin.Host
	TerraformVersion   string
	Sink               diag.Sink
	Debug              bool
	SkipDocs           bool
	SkipExamples       bool
	CoverageTracker    *CoverageTracker
}

type Language

type Language string
const (
	Golang Language = "go"
	NodeJS Language = "nodejs"
	Python Language = "python"
	CSharp Language = "dotnet"
	Schema Language = "schema"
)

type LanguageConversionResult added in v3.6.0

type LanguageConversionResult struct {
	TargetLanguage  string
	FailureSeverity int    // [Success, Warning, Failure, Fatal]
	FailureInfo     string // Additional in-depth information

	// !! Current example name has already been converted for this specific language before.
	// Either the example is duplicated, or a bug is present !!
	MultipleTranslations bool
}

Individual language information concerning how successfully an example was converted to Pulumi

Jump to

Keyboard shortcuts

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