pulumiconfig

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedType is returned when the type of a field is not supported by the validator.
	ErrUnsupportedType = errors.New("unsupported type")
)

Functions

func GetConfig

func GetConfig(ctx *pulumi.Context, obj interface{}, validators ...Validator) error

GetConfig retrieves configuration values from the Pulumi project and populates the provided object. It also runs any associated validations to ensure the configuration's integrity.

Types

type ConvertType

type ConvertType string
const (
	Int64   ConvertType = "int64"
	Uint64  ConvertType = "uint64"
	Float64 ConvertType = "float64"
)

type FieldValidation

type FieldValidation struct {
	Tag      string                             // The tag name used in struct fields for validation.
	Validate func(fl validator.FieldLevel) bool // The actual field validation function.
}

FieldValidation holds the information required for field-level validation.

func (FieldValidation) Register

func (fv FieldValidation) Register(validate *validator.Validate) error

Register adds the field validation function to the provided validator instance.

type StructValidation

type StructValidation struct {
	Struct   interface{}                    // The struct type that the validation will apply to.
	Validate func(sl validator.StructLevel) // The actual struct validation function.
}

StructValidation holds the information required for struct-level validation.

func (StructValidation) Register

func (sv StructValidation) Register(validate *validator.Validate) error

Register adds the struct validation function to the provided validator instance.

type Validation

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

type Validator

type Validator interface {
	Register(validate *validator.Validate) error
}

Validator is an interface that wraps the Register method, providing a standardized way to register different types of validations.

func GetValidations

func GetValidations(ctx *pulumi.Context) []Validator

GetValidations returns a slice of Validator with all custom validators defined for Pulumi config.

Jump to

Keyboard shortcuts

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