Documentation ¶
Overview ¶
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning.
Index ¶
- Constants
- Variables
- func GenerateSchema(info tfbridge.ProviderInfo, sink diag.Sink) (pschema.PackageSpec, error)
- func LoadGoMod() (*modfile.File, error)
- func Main(pkg string, version string, prov tfbridge.ProviderInfo)
- func MainWithCustomGenerate(pkg string, version string, prov tfbridge.ProviderInfo, ...)
- type ConversionError
- type CoverageTracker
- type DocKind
- type DocumentationPage
- type Example
- type GenerateOptions
- type GenerateSchemaOptions
- type GenerateSchemaResult
- type Generator
- type GeneratorOptions
- type Language
- type LanguageConversionResult
- type Renames
Constants ¶
const ( Success = 0 Warning = 1 Failure = 2 Fatal = 3 )
Conversion outcome severity values
Variables ¶
Functions ¶
func GenerateSchema ¶
func GenerateSchema(info tfbridge.ProviderInfo, sink diag.Sink) (pschema.PackageSpec, 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.
func MainWithCustomGenerate ¶
func MainWithCustomGenerate(pkg string, version string, prov tfbridge.ProviderInfo, gen func(GeneratorOptions) error)
Like Main but allows to customize the generation logic past the parsing of cmd-line arguments.
Types ¶
type ConversionError ¶
type ConversionError struct {
// contains filtered or unexported fields
}
A ConversionError occurs when convert.Convert yields a panic. This can be removed when https://github.com/scott-the-programmer/pulumi-terraform-bridge/issues/477 is resolved. ConversionError exposes the stacktrace of the panic so callers can choose to pass the trace along to the user or swallow it.
func (*ConversionError) Error ¶
func (err *ConversionError) Error() string
Return the err-representation of this struct.
func (*ConversionError) StackTrace ¶
func (err *ConversionError) StackTrace() string
StackTrace returns the stacktrace of the error.
func (*ConversionError) Unwrap ¶
func (err *ConversionError) Unwrap() error
Unwrap provides error as returned by the conversion panic.
type CoverageTracker ¶
type CoverageTracker struct { ProviderName string // Name of the provider ProviderVersion string // Version of the provider EncounteredPages map[string]*DocumentationPage // Map linking page IDs to their data // 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 sequence of events.
NOTIFICATION INTERFACE:
foundExample(pageName, hcl)
languageConversionSuccess(targetLanguage)
languageConversionWarning(targetLanguage, warningDiagnostics)
languageConversionFailure(targetLanguage, failureDiagnostics)
languageConversionPanic(targetLanguage, panicInfo)
type DocKind ¶
type DocKind string
DocKind indicates what kind of entity's documentation is being requested.
type DocumentationPage ¶
type DocumentationPage struct { Name string // The unique ID of this documentation page Examples []Example // This page's examples, stored in the order they were found }
A structure encompassing a single page, which contains one or more examples. This closely resembles the web pages seen in Pulumi/Terraform documentation.
type Example ¶
type Example struct { OriginalHCL string // Original HCL code that the example was found with ConversionResults map[string]*LanguageConversionResult // Mapping language names to their conversion results }
Contains information about a single example, consisting of a block of HCL and one or more language conversion results.
type GenerateOptions ¶
type GenerateOptions struct {
ModuleFormat string
}
type GenerateSchemaOptions ¶
type GenerateSchemaOptions struct { ProviderInfo tfbridge.ProviderInfo DiagnosticsSink diag.Sink }
type GenerateSchemaResult ¶
type GenerateSchemaResult struct { PackageSpec pschema.PackageSpec Renames Renames }
func GenerateSchemaWithOptions ¶
func GenerateSchemaWithOptions(opts GenerateSchemaOptions) (*GenerateSchemaResult, error)
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 ¶
Generate creates Pulumi packages from the information it was initialized with.
func (*Generator) Renames ¶
Remanes can be called after a successful call to Generate to extract name mappings.
func (*Generator) UnstableGenerateFromSchema ¶
func (g *Generator) UnstableGenerateFromSchema(genSchemaResult *GenerateSchemaResult) error
GenerateFromSchema creates Pulumi packages from a pulumi schema and the information the generator was initialized with.
This is an unstable API. We have exposed it so other packages within pulumi-terraform-bridge can consume it. We do not recommend other packages consume this API.
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 LanguageConversionResult ¶
type LanguageConversionResult struct { FailureSeverity int // This conversion's outcome: [Success, Warning, Failure, Fatal] FailureInfo string // Additional in-depth information Program string // Converted program // How many times this example has been converted to this language. // It is expected that this will be equal to 1. TranslationCount int }
Individual language information concerning how successfully an example was converted to Pulumi
type Renames ¶
type Renames struct { // Resources[t] stores the Terraform name for a resource identified by the Pulumi token t. Resources map[tokens.Type]string `json:"resources,omitempty"` // Functions[t] stores the Terraform name for a data source that maps to a Pulumi function with token t. Functions map[tokens.ModuleMember]string `json:"functions,omitempty"` // RenamedProperties[t][p] stores the Terraform name of a Pulumi property p on a type identified by Pulumi token // t, when this name is changed, that is RenamedProperties[t][p] != p. Here the t token can represent a Resource // type, a datasource (function) type, or an auxiliary type. RenamedProperties map[tokens.Token]map[tokens.Name]string `json:"renamedProperties,omitempty"` // Similar to RenamedProperties but pertains to provider-level config. RenamedConfigProperties map[tokens.Name]string `json:"renamedConfigProperties,omitempty"` }
Tabulates information about custom inflected or pluralied names. Pulumi bridged providers and Terraform conversion tooling may need to consult these tables to accurately translate between Pulumi and Terraform names.