schema

package
v0.0.0-...-722d730 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MPL-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Code generated by "versiongen"; DO NOT EDIT.

Index

Constants

View Source
const (
	ModuleLanguageID    = "terraform"
	VariablesLanguageID = "terraform-vars"
	StackLanguageID     = "terraform-stack"
)

Variables

View Source
var (
	OldestAvailableVersion = version.Must(version.NewVersion("0.12.0"))
	LatestAvailableVersion = version.Must(version.NewVersion("1.10.2"))
)
View Source
var SemanticTokenModifiers = tokmod.SupportedModifiers

Functions

func AnySchemaForVariableCollection

func AnySchemaForVariableCollection(modPath string) *schema.BodySchema

AnySchemaForVariableCollection returns a schema for collecting all variables in a variable file. It doesn't check if a variable has been defined in the module or not.

We can use this schema to collect variable references without waiting on the module metadata.

func BuiltinReferencesForVersion

func BuiltinReferencesForVersion(v *version.Version, modPath string) reference.Targets

BuiltinReferencesForVersion returns known "built-in" reference targets (range-less references available within any module)

func ConvertAttributeTypeToConstraint

func ConvertAttributeTypeToConstraint(attrType cty.Type) schema.Constraint

func CoreModuleSchemaForVersion

func CoreModuleSchemaForVersion(v *version.Version) (*schema.BodySchema, error)

CoreModuleSchemaForVersion finds a module schema which is relevant for the given Terraform version. It will return error if such schema cannot be found.

func FunctionsForConstraint

func FunctionsForConstraint(vc version.Constraints) (map[string]schema.FunctionSignature, error)

func FunctionsForVersion

func FunctionsForVersion(v *version.Version) (map[string]schema.FunctionSignature, error)

func ModuleVarToAttribute

func ModuleVarToAttribute(modVar module.Variable) *schema.AttributeSchema

func ResolveVersion

func ResolveVersion(tfVersion *version.Version, tfCons version.Constraints) *version.Version

ResolveVersion returns Terraform version for which we have schema available based on either given version and/or constraint. Lack of constraint and version implies latest known version.

func SchemaForVariables

func SchemaForVariables(vars map[string]module.Variable, modPath string) (*schema.BodySchema, error)

Types

type CoreSchemaRequiredErr

type CoreSchemaRequiredErr struct{}

func (CoreSchemaRequiredErr) Error

func (e CoreSchemaRequiredErr) Error() string

type FunctionsMerger

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

func NewFunctionsMerger

func NewFunctionsMerger(coreFunctions map[string]schema.FunctionSignature) *FunctionsMerger

func (*FunctionsMerger) FunctionsForModule

func (m *FunctionsMerger) FunctionsForModule(meta *tfmod.Meta) (map[string]schema.FunctionSignature, error)

func (*FunctionsMerger) SetStateReader

func (m *FunctionsMerger) SetStateReader(mr FunctionsStateReader)

func (*FunctionsMerger) SetTerraformVersion

func (m *FunctionsMerger) SetTerraformVersion(v *version.Version)

type FunctionsStateReader

type FunctionsStateReader interface {
	// ProviderSchema returns the schema for a provider we have stored in memory. The can come
	// from different sources.
	ProviderSchema(modPath string, addr tfaddr.Provider, vc version.Constraints) (*ProviderSchema, error)
}

FunctionsStateReader exposes a set of methods to read data from the internal language server state for function merging

type NoCompatibleSchemaErr

type NoCompatibleSchemaErr struct {
	Version     *version.Version
	Constraints version.Constraints
}

func (NoCompatibleSchemaErr) Error

func (e NoCompatibleSchemaErr) Error() string

type ProviderReferences

type ProviderReferences map[tfmod.ProviderRef]tfaddr.Provider

func (ProviderReferences) ReferencesOfProvider

func (pr ProviderReferences) ReferencesOfProvider(addr tfaddr.Provider) []tfmod.ProviderRef

type ProviderSchema

type ProviderSchema struct {
	Provider           *schema.BodySchema
	Resources          map[string]*schema.BodySchema
	EphemeralResources map[string]*schema.BodySchema
	DataSources        map[string]*schema.BodySchema
	Functions          map[string]*schema.FunctionSignature
}

func ProviderSchemaFromJson

func ProviderSchemaFromJson(jsonSchema *tfjson.ProviderSchema, pAddr tfaddr.Provider) *ProviderSchema

func (*ProviderSchema) Copy

func (ps *ProviderSchema) Copy() *ProviderSchema

func (*ProviderSchema) SetProviderVersion

func (ps *ProviderSchema) SetProviderVersion(pAddr tfaddr.Provider, v *version.Version)

type SchemaMerger

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

func NewSchemaMerger

func NewSchemaMerger(coreSchema *schema.BodySchema) *SchemaMerger

func (*SchemaMerger) SchemaForModule

func (m *SchemaMerger) SchemaForModule(meta *tfmod.Meta) (*schema.BodySchema, error)

func (*SchemaMerger) SetStateReader

func (m *SchemaMerger) SetStateReader(mr StateReader)

func (*SchemaMerger) SetTerraformVersion

func (m *SchemaMerger) SetTerraformVersion(v *version.Version)

type StateReader

type StateReader interface {
	// DeclaredModuleCalls returns a map of declared module calls for the given module
	// A declared module call refers to a module block in the configuration
	DeclaredModuleCalls(modPath string) (map[string]tfmod.DeclaredModuleCall, error)

	// InstalledModulePath checks if there is an installed module available for
	// the given normalized source address.
	InstalledModulePath(rootPath string, normalizedSource string) (string, bool)

	// LocalModuleMeta returns the module meta data for a local module. This is the result
	// of the [earlydecoder] when processing module files
	LocalModuleMeta(modPath string) (*tfmod.Meta, error)

	// RegistryModuleMeta returns the module meta data for public registry modules. We fetch this
	// data from the registry API.
	RegistryModuleMeta(addr tfaddr.Module, cons version.Constraints) (*registry.ModuleData, error)

	// ProviderSchema returns the schema for a provider we have stored in memory. The can come
	// from different sources.
	ProviderSchema(modPath string, addr tfaddr.Provider, vc version.Constraints) (*ProviderSchema, error)
}

StateReader exposes a set of methods to read data from the internal language server state

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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