spec

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package spec contains types and functions used for parsing, and validating a Specification.

Index

Constants

View Source
const (
	Version0_1 = "0.1"
)

Variables

View Source
var (
	//go:embed v0.1/schema.json
	JSONSchemaVersion0_1 []byte
)

Functions

func Validate

func Validate(ctx context.Context, document []byte) error

Validate loads the schema version specified in the document, and validates the document.

Types

type Specification

type Specification struct {
	// DataSources defines a slice of datasource.DataSource type.
	DataSources datasource.DataSources `json:"datasources,omitempty"`

	// Provider defines an instance of the provider.Provider type.
	Provider *provider.Provider `json:"provider,omitempty"`

	// Resources defines a slice of resource.Resource type.
	Resources resource.Resources `json:"resources,omitempty"`

	// Version defines the Provider Code Specification JSON schema version
	Version string `json:"version,omitempty"`
}

Specification defines the data source(s), provider, and resource(s) for a Terraform provider.

func Parse

func Parse(ctx context.Context, document []byte) (Specification, error)

Parse returns a Specification from the JSON document contents, or any validation errors.

func (Specification) Validate

func (s Specification) Validate(ctx context.Context) error

Validate delegates validation to each of datasource.DataSources, *provider.Provider and resource.Resources.

Jump to

Keyboard shortcuts

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