decoder

package
v0.0.60 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const LAB_PATH = "labs/%s/hcl/config.hcl"
View Source
const (
	SERVICES_EC2 = "ec2"
)
View Source
const TEST_BUCKET = "test"

///

Variables

This section is empty.

Functions

func GenerateHclConfiguration

func GenerateHclConfiguration[K any](bucketName, labId string, k *K) error

/////////////////////////////////////

func GetFile

func GetFile(bucketName, key string) ([]byte, error)

/////////////

func GetHclConfig

func GetHclConfig(bucketName, fileName string) ([]byte, error)

/////////////////////////////////////

func ResourceIter

func ResourceIter[T any](service string, hclConfig HclConfig, f func(resource *ResourceBody) T) []T

//////////////////

func ResourceValidator

func ResourceValidator[T any](service string, hclConfig HclConfig, f func(t T) error) error

//////////////////

func SimpleDecode

func SimpleDecode[T any](f hcl.Body, t *T) T

/////////////////////

func SubstituteKV

func SubstituteKV(s []string, m map[string]string)

///////////////////// Substitutes the IDs for the names when the IDs are the keys. This was created to handle same named resources.

func ValidateStruct

func ValidateStruct(nameValue string, t interface{}) error

/////////////////////

Types

type HclConfig

type HclConfig struct {
	ResourceBodies []*ResourceBody `hcl:"resource,block"`
}

type IValidateInterface

type IValidateInterface interface {
	GetName() string
}

type ResourceBody

type ResourceBody struct {
	Type string   `hcl:"protocol,label"`
	Name string   `hcl:"name,label"`
	HCL  hcl.Body `hcl:",remain"`
}

///

type Validate

type Validate[T any] struct {
	Name string
}

Jump to

Keyboard shortcuts

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