generators

package
v0.5.7-RC1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseGenerator

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

BaseGenerator is a base implementation of the Generator interface

func NewGenerator

func NewGenerator(injector di.Injector) *BaseGenerator

NewGenerator creates a new BaseGenerator

func (*BaseGenerator) Initialize

func (g *BaseGenerator) Initialize() error

Initialize sets up the BaseGenerator by resolving and storing required dependencies. It ensures that the config handler, blueprint handler, and shell are properly initialized.

func (*BaseGenerator) Write

func (g *BaseGenerator) Write() error

Write is a placeholder implementation of the Write method. Concrete implementations should override this method to provide specific generation logic.

type Generator

type Generator interface {
	Initialize() error
	Write() error
}

Generator is the interface that wraps the Write method

type GitGenerator

type GitGenerator struct {
	BaseGenerator
}

GitGenerator is a generator that writes Git configuration files

func NewGitGenerator

func NewGitGenerator(injector di.Injector) *GitGenerator

NewGitGenerator creates a new GitGenerator

func (*GitGenerator) Write

func (g *GitGenerator) Write() error

Write generates the Git configuration files by creating or updating the .gitignore file. It ensures that Windsor-specific entries are added while preserving any existing user-defined entries.

type KustomizeGenerator added in v0.3.0

type KustomizeGenerator struct {
	BaseGenerator
}

KustomizeGenerator is a generator that writes Kustomize files

func NewKustomizeGenerator added in v0.3.0

func NewKustomizeGenerator(injector di.Injector) *KustomizeGenerator

NewKustomizeGenerator creates a new KustomizeGenerator

func (*KustomizeGenerator) Write added in v0.3.0

func (g *KustomizeGenerator) Write() error

Write method creates a "kustomize" directory in the project root if it does not exist. It then generates a "kustomization.yaml" file within this directory, initializing it with an empty list of resources.

type MockGenerator

type MockGenerator struct {
	InitializeFunc func() error
	WriteFunc      func() error
}

MockGenerator is a mock implementation of the Generator interface for testing purposes

func NewMockGenerator

func NewMockGenerator() *MockGenerator

NewMockGenerator creates a new instance of MockGenerator

func (*MockGenerator) Initialize

func (m *MockGenerator) Initialize() error

Initialize calls the mock InitializeFunc if set, otherwise returns nil

func (*MockGenerator) Write

func (m *MockGenerator) Write() error

Write calls the mock WriteFunc if set, otherwise returns nil

type Shims added in v0.5.7

type Shims struct {
	WriteFile   func(name string, data []byte, perm os.FileMode) error
	ReadFile    func(name string) ([]byte, error)
	MkdirAll    func(path string, perm os.FileMode) error
	Stat        func(name string) (os.FileInfo, error)
	MarshalYAML func(v any) ([]byte, error)
	TempDir     func(dir, pattern string) (string, error)
	RemoveAll   func(path string) error
	Chdir       func(dir string) error
	ReadDir     func(name string) ([]os.DirEntry, error)
	Setenv      func(key, value string) error
}

Shims provides mockable wrappers around system and runtime functions

func NewShims added in v0.5.7

func NewShims() *Shims

NewShims creates a new Shims instance with default implementations

type TerraformGenerator

type TerraformGenerator struct {
	BaseGenerator
}

TerraformGenerator is a generator that writes Terraform files

func NewTerraformGenerator

func NewTerraformGenerator(injector di.Injector) *TerraformGenerator

NewTerraformGenerator creates a new TerraformGenerator with the provided dependency injector. It initializes the base generator and prepares it for Terraform file generation.

func (*TerraformGenerator) Write

func (g *TerraformGenerator) Write() error

Write generates Terraform configuration files for all components in the blueprint. It creates the necessary directory structure and writes three types of files: 1. main.tf - Contains module source and variable references 2. variables.tf - Defines all variables used by the module 3. .tfvars - Contains actual variable values for each context The function preserves existing values in .tfvars files while adding new ones.

type VariableInfo added in v0.5.7

type VariableInfo struct {
	Name        string
	Description string
	Default     any
	Sensitive   bool
}

VariableInfo holds metadata for a single Terraform variable

Jump to

Keyboard shortcuts

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