config

package
v0.5.61 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestFile

func CreateTestFile(t *testing.T, contents string) string

createTestFile creates a hcl file from the given contents

func CreateTestFiles

func CreateTestFiles(t *testing.T, contents ...string) string

createsTestFiles creates a temporary directory and stores temp files into it returns directory containing files cleanup function usage: d, cleanup := createTestFiles(t, `cluster "abc" {}`, `docs "bcdf" {}`) defer cleanup()

func LoadState added in v0.5.38

func LoadState() (*hclconfig.Config, error)

func NewParser added in v0.5.38

func NewParser(callback hclconfig.WalkCallback, variables map[string]string, variablesFiles []string) *hclconfig.Parser

setupHCLConfig configures the HCLConfig package and registers the custom types

func ParseVars

func ParseVars(value map[string]cty.Value) map[string]interface{}

ParseVars converts a map[string]cty.Value into map[string]interface where the interface are generic go types like string, number, bool, slice, map

func RegisterResource added in v0.5.38

func RegisterResource(name string, r types.Resource, p Provider)

RegisterResource allows a resource to register itself with the parser

func SaveState added in v0.5.38

func SaveState(c *hclconfig.Config) error

Types

type ConfigWrapper added in v0.5.38

type ConfigWrapper struct {
	Type  string
	Value interface{}
}

ConfigWrapper allows the provider config to be deserialized to a type

type Provider added in v0.5.38

type Provider interface {
	// Init is called when the provider is created, it is passed a logger that
	// can be used for any logging purposes. Any other clients must be created
	// by the provider
	Init(types.Resource, sdk.Logger) error

	// Create is called when a resource does not exist or creation has previously
	// failed and 'up' is run
	Create() error

	// Destroy is called when a resource is failed or created and 'down' is run
	Destroy() error

	// Refresh is called when a resource is created and 'up' is run
	Refresh() error

	// Changed returns if a resource has changed since the last run
	Changed() (bool, error)

	// Lookup is a utility to determine the existence of a resource
	Lookup() ([]string, error)
}

Provider defines an interface to be implemented by providers

type Providers added in v0.5.38

type Providers interface {
	GetProvider(c types.Resource) Provider
}

func NewProviders added in v0.5.38

func NewProviders(c *clients.Clients) Providers

type ProvidersImpl added in v0.5.38

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

func (*ProvidersImpl) GetProvider added in v0.5.38

func (p *ProvidersImpl) GetProvider(r types.Resource) Provider

Jump to

Keyboard shortcuts

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