controller

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseController

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

BaseController struct implements the Controller interface.

func NewController

func NewController(injector di.Injector) *BaseController

NewController creates a new controller.

func (*BaseController) CreateCommonComponents

func (c *BaseController) CreateCommonComponents() error

CreateCommonComponents creates the common components.

func (*BaseController) CreateEnvComponents

func (c *BaseController) CreateEnvComponents() error

CreateEnvComponents creates the env components.

func (*BaseController) CreateProjectComponents

func (c *BaseController) CreateProjectComponents() error

CreateProjectComponents creates the project components.

func (*BaseController) CreateServiceComponents

func (c *BaseController) CreateServiceComponents() error

CreateServiceComponents creates the service components.

func (*BaseController) CreateStackComponents

func (c *BaseController) CreateStackComponents() error

CreateStackComponents creates the stack components.

func (*BaseController) CreateVirtualizationComponents

func (c *BaseController) CreateVirtualizationComponents() error

CreateVirtualizationComponents creates the virtualization components.

func (*BaseController) Initialize

func (c *BaseController) Initialize() error

Initialize the controller. Initializes the config handler as well.

func (*BaseController) InitializeComponents

func (c *BaseController) InitializeComponents() error

InitializeComponents initializes all components.

func (*BaseController) ResolveAllEnvPrinters

func (c *BaseController) ResolveAllEnvPrinters() []env.EnvPrinter

ResolveAllEnvPrinters resolves all envPrinter instances.

func (*BaseController) ResolveAllGenerators

func (c *BaseController) ResolveAllGenerators() []generators.Generator

ResolveAllGenerators resolves all generator instances.

func (*BaseController) ResolveAllServices

func (c *BaseController) ResolveAllServices() []services.Service

ResolveAllServices resolves all service instances.

func (*BaseController) ResolveBlueprintHandler

func (c *BaseController) ResolveBlueprintHandler() blueprint.BlueprintHandler

ResolveBlueprintHandler resolves the blueprintHandler instance.

func (*BaseController) ResolveConfigHandler

func (c *BaseController) ResolveConfigHandler() config.ConfigHandler

ResolveConfigHandler resolves the configHandler instance.

func (*BaseController) ResolveContainerRuntime

func (c *BaseController) ResolveContainerRuntime() virt.ContainerRuntime

ResolveContainerRuntime resolves the requested containerRuntime instance.

func (*BaseController) ResolveEnvPrinter

func (c *BaseController) ResolveEnvPrinter(name string) env.EnvPrinter

ResolveEnvPrinter resolves the envPrinter instance.

func (*BaseController) ResolveInjector

func (c *BaseController) ResolveInjector() di.Injector

ResolveInjector resolves the injector instance.

func (*BaseController) ResolveNetworkManager

func (c *BaseController) ResolveNetworkManager() network.NetworkManager

ResolveNetworkManager resolves the networkManager instance.

func (*BaseController) ResolveSecureShell

func (c *BaseController) ResolveSecureShell() shell.Shell

ResolveSecureShell resolves the secureShell instance.

func (*BaseController) ResolveService

func (c *BaseController) ResolveService(name string) services.Service

ResolveService resolves the requested service instance.

func (*BaseController) ResolveShell

func (c *BaseController) ResolveShell() shell.Shell

ResolveShell resolves the shell instance.

func (*BaseController) ResolveStack

func (c *BaseController) ResolveStack() stack.Stack

ResolveStack resolves the requested stack instance.

func (*BaseController) ResolveToolsManager added in v0.3.0

func (c *BaseController) ResolveToolsManager() tools.ToolsManager

ResolveToolsManager resolves the toolsManager instance.

func (*BaseController) ResolveVirtualMachine

func (c *BaseController) ResolveVirtualMachine() virt.VirtualMachine

ResolveVirtualMachine resolves the requested virtualMachine instance.

func (*BaseController) WriteConfigurationFiles

func (c *BaseController) WriteConfigurationFiles() error

WriteConfigurationFiles writes the configuration files.

type Controller

type Controller interface {
	Initialize() error
	InitializeComponents() error
	CreateCommonComponents() error
	CreateProjectComponents() error
	CreateEnvComponents() error
	CreateServiceComponents() error
	CreateVirtualizationComponents() error
	CreateStackComponents() error
	ResolveInjector() di.Injector
	ResolveConfigHandler() config.ConfigHandler
	ResolveEnvPrinter(name string) env.EnvPrinter
	ResolveAllEnvPrinters() []env.EnvPrinter
	ResolveShell() shell.Shell
	ResolveSecureShell() shell.Shell
	ResolveNetworkManager() network.NetworkManager
	ResolveToolsManager() tools.ToolsManager
	ResolveBlueprintHandler() blueprint.BlueprintHandler
	ResolveService(name string) services.Service
	ResolveAllServices() []services.Service
	ResolveVirtualMachine() virt.VirtualMachine
	ResolveContainerRuntime() virt.ContainerRuntime
	ResolveStack() stack.Stack
	ResolveAllGenerators() []generators.Generator
	WriteConfigurationFiles() error
}

Controller interface defines the methods for the controller.

type MockController

type MockController struct {
	BaseController
	InitializeFunc                     func() error
	InitializeComponentsFunc           func() error
	CreateCommonComponentsFunc         func() error
	CreateProjectComponentsFunc        func() error
	CreateEnvComponentsFunc            func() error
	CreateServiceComponentsFunc        func() error
	CreateVirtualizationComponentsFunc func() error
	CreateStackComponentsFunc          func() error
	ResolveInjectorFunc                func() di.Injector
	ResolveConfigHandlerFunc           func() config.ConfigHandler
	ResolveEnvPrinterFunc              func(name string) env.EnvPrinter
	ResolveAllEnvPrintersFunc          func() []env.EnvPrinter
	ResolveShellFunc                   func() shell.Shell
	ResolveSecureShellFunc             func() shell.Shell
	ResolveToolsManagerFunc            func() tools.ToolsManager
	ResolveNetworkManagerFunc          func() network.NetworkManager
	ResolveServiceFunc                 func(name string) services.Service
	ResolveAllServicesFunc             func() []services.Service
	ResolveVirtualMachineFunc          func() virt.VirtualMachine
	ResolveContainerRuntimeFunc        func() virt.ContainerRuntime
	ResolveAllGeneratorsFunc           func() []generators.Generator
	ResolveStackFunc                   func() stack.Stack
	ResolveBlueprintHandlerFunc        func() blueprint.BlueprintHandler
	WriteConfigurationFilesFunc        func() error
}

MockController is a mock implementation of the Controller interface

func NewMockController

func NewMockController(injector di.Injector) *MockController

func (*MockController) CreateCommonComponents

func (m *MockController) CreateCommonComponents() error

CreateCommonComponents calls the mock CreateCommonComponentsFunc if set, otherwise creates mock components

func (*MockController) CreateEnvComponents

func (m *MockController) CreateEnvComponents() error

CreateEnvComponents calls the mock CreateEnvComponentsFunc if set, otherwise creates mock components

func (*MockController) CreateProjectComponents

func (m *MockController) CreateProjectComponents() error

CreateProjectComponents calls the mock CreateProjectComponentsFunc if set, otherwise creates mock components

func (*MockController) CreateServiceComponents

func (m *MockController) CreateServiceComponents() error

CreateServiceComponents calls the mock CreateServiceComponentsFunc if set, otherwise creates mock components

func (*MockController) CreateStackComponents

func (c *MockController) CreateStackComponents() error

CreateStackComponents calls the mock CreateStackComponentsFunc if set, otherwise creates mock components

func (*MockController) CreateVirtualizationComponents

func (c *MockController) CreateVirtualizationComponents() error

CreateVirtualizationComponents calls the mock CreateVirtualizationComponentsFunc if set, otherwise creates mock components

func (*MockController) Initialize

func (m *MockController) Initialize() error

Initialize calls the mock InitializeFunc if set, otherwise calls the parent function

func (*MockController) InitializeComponents

func (m *MockController) InitializeComponents() error

InitializeComponents calls the mock InitializeComponentsFunc if set, otherwise calls the parent function

func (*MockController) ResolveAllEnvPrinters

func (c *MockController) ResolveAllEnvPrinters() []env.EnvPrinter

ResolveAllEnvPrinters calls the mock ResolveAllEnvPrintersFunc if set, otherwise calls the parent function

func (*MockController) ResolveAllGenerators

func (c *MockController) ResolveAllGenerators() []generators.Generator

ResolveAllGenerators calls the mock ResolveAllGeneratorsFunc if set, otherwise calls the parent function

func (*MockController) ResolveAllServices

func (c *MockController) ResolveAllServices() []services.Service

ResolveAllServices calls the mock ResolveAllServicesFunc if set, otherwise calls the parent function

func (*MockController) ResolveBlueprintHandler added in v0.3.0

func (c *MockController) ResolveBlueprintHandler() blueprint.BlueprintHandler

ResolveBlueprintHandler calls the mock ResolveBlueprintHandlerFunc if set, otherwise calls the parent function

func (*MockController) ResolveConfigHandler

func (c *MockController) ResolveConfigHandler() config.ConfigHandler

ResolveConfigHandler calls the mock ResolveConfigHandlerFunc if set, otherwise calls the parent function

func (*MockController) ResolveContainerRuntime

func (c *MockController) ResolveContainerRuntime() virt.ContainerRuntime

ResolveContainerRuntime calls the mock ResolveContainerRuntimeFunc if set, otherwise calls the parent function

func (*MockController) ResolveEnvPrinter

func (c *MockController) ResolveEnvPrinter(name string) env.EnvPrinter

ResolveEnvPrinter calls the mock ResolveEnvPrinterFunc if set, otherwise calls the parent function

func (*MockController) ResolveInjector

func (c *MockController) ResolveInjector() di.Injector

ResolveInjector calls the mock ResolveInjectorFunc if set, otherwise returns a mock injector

func (*MockController) ResolveNetworkManager

func (c *MockController) ResolveNetworkManager() network.NetworkManager

ResolveNetworkManager calls the mock ResolveNetworkManagerFunc if set, otherwise calls the parent function

func (*MockController) ResolveSecureShell

func (c *MockController) ResolveSecureShell() shell.Shell

ResolveSecureShell calls the mock ResolveSecureShellFunc if set, otherwise calls the parent function

func (*MockController) ResolveService

func (c *MockController) ResolveService(name string) services.Service

ResolveService calls the mock ResolveServiceFunc if set, otherwise calls the parent function

func (*MockController) ResolveShell

func (c *MockController) ResolveShell() shell.Shell

ResolveShell calls the mock ResolveShellFunc if set, otherwise calls the parent function

func (*MockController) ResolveStack

func (c *MockController) ResolveStack() stack.Stack

ResolveStack calls the mock ResolveStackFunc if set, otherwise calls the parent function

func (*MockController) ResolveToolsManager added in v0.3.0

func (c *MockController) ResolveToolsManager() tools.ToolsManager

ResolveToolsManager calls the mock ResolveToolsManagerFunc if set, otherwise calls the parent function

func (*MockController) ResolveVirtualMachine

func (c *MockController) ResolveVirtualMachine() virt.VirtualMachine

ResolveVirtualMachine calls the mock ResolveVirtualMachineFunc if set, otherwise calls the parent function

func (*MockController) WriteConfigurationFiles

func (c *MockController) WriteConfigurationFiles() error

WriteConfigurationFiles calls the mock WriteConfigurationFilesFunc if set, otherwise calls the parent function

type RealController

type RealController struct {
	BaseController
}

RealController struct implements the RealController interface.

func NewRealController

func NewRealController(injector di.Injector) *RealController

NewRealController creates a new controller.

func (*RealController) CreateCommonComponents

func (c *RealController) CreateCommonComponents() error

CreateCommonComponents sets up config and shell for command execution. It registers and initializes these components.

func (*RealController) CreateEnvComponents

func (c *RealController) CreateEnvComponents() error

CreateEnvComponents creates components required for env and exec commands Registers environment printers for AWS, Docker, Kube, Omni, Sops, Talos, Terraform, and Windsor. AWS and Docker printers are conditional on their respective configurations being enabled. Each printer is created and registered with the dependency injector. Returns nil on successful registration of all environment components.

func (*RealController) CreateProjectComponents

func (c *RealController) CreateProjectComponents() error

Initializes project components like generators and tools manager. Registers and initializes blueprint, terraform, and kustomize generators. Determines and sets the tools manager: aqua, asdf, or default, based on config or setup.

func (*RealController) CreateServiceComponents

func (c *RealController) CreateServiceComponents() error

CreateServiceComponents sets up services based on config, including DNS, Git livereload, Localstack, and Docker registries. If Talos is used, it registers control plane and worker services for the cluster.

func (*RealController) CreateStackComponents

func (c *RealController) CreateStackComponents() error

CreateStackComponents creates stack components

func (*RealController) CreateVirtualizationComponents

func (c *RealController) CreateVirtualizationComponents() error

CreateVirtualizationComponents sets up virtualization based on config. Registers network, SSH, and VM components for Colima. Adds Docker runtime if enabled.

Jump to

Keyboard shortcuts

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