schema

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromHCLBody

func FromHCLBody(body hcl.Body) (map[string]*SchemaAttribute, error)

func IsPrimitive

func IsPrimitive(value interface{}) bool

Types

type NestingMode

type NestingMode int
const (
	NestingSingle NestingMode
	NestingGroup
	NestingList
	NestingSet
	NestingMap
)

type ProviderSchema

type ProviderSchema struct {
	ResourceSchema map[string]*Schema `json:"resource_schemas,omitempty"`
}

type Schema

type Schema struct {
	Block *SchemaBlock `json:"block,omitempty"`
}

type SchemaAttribute

type SchemaAttribute struct {
	Name          string   `json:"name,omitempty"`
	AttributeType cty.Type `json:"type,omitempty"`

	Required      bool        `json:"required,omitempty"`
	Optional      bool        `json:"optional,omitempty"`
	Default       interface{} `json:"default,omitempty"`
	Content       string      `json:"content,omitempty"`
	AttributePath string      `json:"attribute_path,omitempty"`

	PossibleValues           []string                    `json:"possible_values,omitempty"`
	NestingMode              NestingMode                 `json:"nesting_mode,omitempty"`
	Fields                   map[string]*SchemaAttribute `json:"fields,omitempty"`
	ResourceOrDataSourceName string                      `json:"resource_or_data_source_name,omitempty"`
}

func (SchemaAttribute) MarshalJSON

func (attr SchemaAttribute) MarshalJSON() ([]byte, error)

type SchemaBlock

type SchemaBlock struct {
	Attributes   map[string]*SchemaAttribute `json:"attributes,omitempty"`
	NestedBlocks map[string]*SchemaBlockType `json:"block_types,omitempty"`
}

func FromHCLFile

func FromHCLFile(fileName string) (*SchemaBlock, error)

type SchemaBlockType

type SchemaBlockType struct {
	NestingMode NestingMode  `json:"nesting_mode,omitempty"`
	Block       *SchemaBlock `json:"block,omitempty"`

	Required bool `json:"required,omitempty"`
	Optional bool `json:"optional,omitempty"`
}

type TerraformObject

type TerraformObject struct {
	Name       string                      `json:"name"`
	Fields     map[string]*SchemaAttribute `json:"fields"`
	ExampleHCL string                      `json:"example_hcl"`
	Details    string                      `json:"details"` // Start from first h2 header (after description)
}

type TerraformObjects

type TerraformObjects map[string]*TerraformObject

Jump to

Keyboard shortcuts

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