utils

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateExampleIacconsoleRcFile added in v0.6.0

func CreateExampleIacconsoleRcFile(iacconsoleRcPath string)

GetiacconsoleConfigContent returns the content for the .iacconsolerc configuration file

func CreateExampleStructure

func CreateExampleStructure(targetDir string, useIaCConsoleDB bool) string

CreateExampleStructure creates an example organization structure with sample configuration files

func ExecuteAgentCommand added in v0.7.0

func ExecuteAgentCommand(conn *websocket.Conn, cmd AgentCommand, state *State)

ExecuteAgentCommand runs a command and streams output to WebSocket

func GetMD5Hash

func GetMD5Hash(text string) string

func ParseAPIURL added in v0.7.0

func ParseAPIURL(apiUrl string) (wsURL string, authHeader string, accountID string, err error)

ParseAPIURL parses the IACCONSOLE_API_URL environment variable

Types

type AgentCommand added in v0.7.0

type AgentCommand struct {
	AgentMessage
	ID         string          `json:"id"`
	Action     string          `json:"action"` // init, plan, apply, destroy
	Org        string          `json:"org"`
	Unit       string          `json:"unit"`
	Dimensions []DimensionPair `json:"dimensions"`
	Workspace  string          `json:"workspace,omitempty"`
	ExtraArgs  []string        `json:"extraArgs,omitempty"`
}

AgentCommand received by agent from server

type AgentComplete added in v0.7.0

type AgentComplete struct {
	AgentMessage
	CommandID string `json:"commandId"`
	ExitCode  int    `json:"exitCode"`
	Error     string `json:"error,omitempty"`
}

AgentComplete sent by agent when command finishes

type AgentError added in v0.7.0

type AgentError struct {
	AgentMessage
	Error string `json:"error"`
}

AgentError sent by server to agent when there's an error

type AgentMessage added in v0.7.0

type AgentMessage struct {
	Type string `json:"type"`
}

AgentMessage is the base structure for all WebSocket messages

type AgentOutput added in v0.7.0

type AgentOutput struct {
	AgentMessage
	CommandID string `json:"commandId"`
	Stream    string `json:"stream"` // stdout, stderr
	Data      string `json:"data"`
	Timestamp int64  `json:"timestamp"`
}

AgentOutput sent by agent to server

type AgentPing added in v0.7.0

type AgentPing struct {
	AgentMessage
}

AgentPing received from browser via server

type AgentPong added in v0.7.0

type AgentPong struct {
	AgentMessage
	Timestamp int64 `json:"timestamp"`
}

AgentPong sent back to browser via server

type AgentRegister added in v0.7.0

type AgentRegister struct {
	AgentMessage
	AgentID string `json:"agentId"`
	Version string `json:"version"`
	OS      string `json:"os"`
	Arch    string `json:"arch"`
}

AgentRegister sent by agent upon connection

type DimensionInIaCConsoleDB added in v0.6.0

type DimensionInIaCConsoleDB struct {
	ID        string
	WorkSpace string
	DimData   map[string]interface{}
}

type DimensionPair added in v0.7.0

type DimensionPair struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type IaCConsoleDBResponse added in v0.6.0

type IaCConsoleDBResponse struct {
	Error      string
	Dimensions []DimensionInIaCConsoleDB
}

type State added in v0.6.0

type State struct {
	UnitName          string
	OrgName           string
	DimensionsFlags   []string
	UnitPath          string
	SharedModulesPath string
	InventoryPath     string
	UnitManifestPath  string
	ParsedDimensions  map[string]string
	CmdWorkTempDir    string
	UnitManifest      unitManifestStruct
	StateS3Path       string
	IacconsoleApiUrl  string
	Workspace         string
}

func (*State) GenerateVarsByDimAndData added in v0.6.0

func (s *State) GenerateVarsByDimAndData(optionType string, dimKey string, dimensionJsonMap map[string]interface{}) error

func (*State) GenerateVarsByDimOptional added in v0.6.0

func (s *State) GenerateVarsByDimOptional(optionType string) error

func (*State) GenerateVarsByDims added in v0.6.0

func (s *State) GenerateVarsByDims() error

func (*State) GenerateVarsByEnvVars added in v0.6.0

func (s *State) GenerateVarsByEnvVars() error

func (*State) GetDimData added in v0.6.0

func (s *State) GetDimData(dimensionKey string, dimensionValue string, skipOnNotFound bool) (map[string]interface{}, error)

func (*State) GetObjectFromViperByOrgOrDefault added in v0.6.0

func (s *State) GetObjectFromViperByOrgOrDefault(keyName string) map[string]any

func (*State) GetStringFromViperByOrgOrDefault added in v0.6.0

func (s *State) GetStringFromViperByOrgOrDefault(keyName string) string

func (*State) ParseDimensions added in v0.6.0

func (s *State) ParseDimensions()

func (*State) ParseUnitManifest added in v0.6.0

func (s *State) ParseUnitManifest(unitManifestFileName string)

func (*State) PrepareTemp added in v0.6.0

func (s *State) PrepareTemp() error

func (*State) SetupBackendConfig added in v0.6.0

func (s *State) SetupBackendConfig() map[string]interface{}

Jump to

Keyboard shortcuts

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