model

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalAction

type ApprovalAction = cloud.ApprovalAction

ApprovalAction is an alias for cloud.ApprovalAction

type ApprovalResultMsg

type ApprovalResultMsg struct {
	Err error
}

ApprovalResultMsg represents the result of an approval action

type ApprovalsMsg

type ApprovalsMsg struct {
	Approvals []ApprovalAction
	Provider  cloud.Provider
}

ApprovalsMsg represents a message containing approvals

type AuthenticationState

type AuthenticationState struct {
	// Current authentication method
	Method string

	// Authentication configuration
	AuthConfig map[string]string

	// Available authentication methods
	AvailableMethods []string

	// Current authentication config key being set
	CurrentAuthConfigKey string

	// Authentication status
	IsAuthenticated bool

	// Error message if authentication failed
	AuthError string
}

AuthenticationState represents the authentication state for different providers

type Category

type Category struct {
	ID          string
	Name        string
	Description string
	Available   bool
}

Category represents a service category

type CategoryInfo

type CategoryInfo struct {
	ID          string
	Name        string
	Description string
	Available   bool
}

CategoryInfo represents information about a category

type ErrMsg

type ErrMsg struct {
	Err error
}

ErrMsg represents an error message

type FunctionStatus

type FunctionStatus = cloud.FunctionStatus

FunctionStatus is an alias for cloud.FunctionStatus

type FunctionStatusMsg

type FunctionStatusMsg struct {
	Functions []FunctionStatus
	Provider  cloud.Provider
}

FunctionStatusMsg represents a message containing function status

type InputState

type InputState struct {
	// Generic input fields
	TextValues map[string]string // e.g., "comment" -> "This is a comment"
	BoolValues map[string]bool   // e.g., "approve" -> true

	// Operation-specific state
	OperationState map[string]interface{} // Operation-specific state
}

InputState represents the state of user input

type LambdaExecuteResultMsg added in v0.1.5

type LambdaExecuteResultMsg struct {
	Result *cloud.LambdaExecuteResult
	Err    error
}

LambdaExecuteResultMsg represents the result of a Lambda execution

type Model

type Model struct {
	// UI Components
	Table     table.Model
	TextInput textinput.Model
	TextArea  textarea.Model
	Viewport  viewport.Model
	Spinner   spinner.Model
	Styles    styles.Styles

	// Window dimensions
	Width  int
	Height int

	// View state
	CurrentView constants.View
	ManualInput bool
	Err         error
	Error       string // Error message
	Success     string // Success message

	// Viewport state
	ViewportReady bool // Tracks if the viewport has been properly initialized

	// Loading state
	IsLoading  bool
	LoadingMsg string

	// Provider Registry
	Registry *cloud.ProviderRegistry

	// Provider state
	ProviderState ProviderState

	// Input state
	InputState InputState

	// Legacy fields for backward compatibility
	// These will be gradually migrated to the new structure
	AwsProfile        string
	AwsRegion         string
	Profiles          []string
	Regions           []string
	Provider          cloud.Provider
	Approvals         []cloud.ApprovalAction
	Pipelines         []cloud.PipelineStatus
	Functions         []cloud.FunctionStatus
	Services          []Service
	Categories        []Category
	Operations        []Operation
	SelectedService   *Service
	SelectedCategory  *Category
	SelectedOperation *Operation
	SelectedApproval  *cloud.ApprovalAction
	SelectedFunction  *cloud.FunctionStatus
	ApproveAction     bool
	Summary           string
	SelectedPipeline  *cloud.PipelineStatus
	ManualCommitID    bool
	CommitID          string
	ApprovalComment   string

	// Lambda execution state
	LambdaPayload string
	LambdaResult  *cloud.LambdaExecuteResult

	// Operation flow tracking
	IsExecuteLambdaFlow bool

	// UI focus state
	IsViewportFocused bool

	// Lambda input mode (when true, Enter adds new lines; when false, Enter executes)
	IsLambdaInputMode bool
}

Model represents the application state

func New

func New() *Model

New creates and initializes a new Model

func (*Model) Clone

func (m *Model) Clone() *Model

Clone creates a deep copy of the model

func (*Model) GetApprovalComment

func (m *Model) GetApprovalComment() string

GetApprovalComment returns the approval comment from the input state

func (*Model) GetApprovals

func (m *Model) GetApprovals() []cloud.ApprovalAction

GetApprovals returns the approvals from the provider-specific state

func (*Model) GetApproveAction

func (m *Model) GetApproveAction() bool

GetApproveAction returns the approve action from the input state

func (*Model) GetAuthConfig

func (m *Model) GetAuthConfig(key string) string

func (*Model) GetAwsProfile

func (m *Model) GetAwsProfile() string

GetAwsProfile returns the AWS profile from the provider config

func (*Model) GetAwsRegion

func (m *Model) GetAwsRegion() string

GetAwsRegion returns the AWS region from the provider config

func (*Model) GetCommitID

func (m *Model) GetCommitID() string

GetCommitID returns the commit ID from the input state

func (*Model) GetFunctions

func (m *Model) GetFunctions() []cloud.FunctionStatus

GetFunctions returns the functions from the provider-specific state

func (*Model) GetInputBool

func (m *Model) GetInputBool(key string) bool

func (*Model) GetInputText

func (m *Model) GetInputText(key string) string

func (*Model) GetLambdaPayload added in v0.1.5

func (m *Model) GetLambdaPayload() string

GetLambdaPayload returns the Lambda payload

func (*Model) GetLambdaResult added in v0.1.5

func (m *Model) GetLambdaResult() *cloud.LambdaExecuteResult

GetLambdaResult returns the Lambda execution result

func (*Model) GetManualCommitID

func (m *Model) GetManualCommitID() bool

GetManualCommitID returns whether to use manual commit ID

func (*Model) GetPipelines

func (m *Model) GetPipelines() []cloud.PipelineStatus

GetPipelines returns the pipelines from the provider-specific state

func (*Model) GetProviderConfig

func (m *Model) GetProviderConfig(key string) string

func (*Model) GetSelectedApproval

func (m *Model) GetSelectedApproval() *cloud.ApprovalAction

GetSelectedApproval returns the selected approval from the provider-specific state

func (*Model) GetSelectedFunction

func (m *Model) GetSelectedFunction() *cloud.FunctionStatus

GetSelectedFunction returns the selected function from the provider-specific state

func (*Model) GetSelectedPipeline

func (m *Model) GetSelectedPipeline() *cloud.PipelineStatus

GetSelectedPipeline returns the selected pipeline from the provider-specific state

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) ResetApprovalState

func (m *Model) ResetApprovalState()

ResetApprovalState resets the approval state

func (*Model) ResetTextInput

func (m *Model) ResetTextInput()

ResetTextInput resets the text input

func (*Model) SetApprovalComment

func (m *Model) SetApprovalComment(comment string)

SetApprovalComment sets the approval comment in the input state

func (*Model) SetApprovals

func (m *Model) SetApprovals(approvals []cloud.ApprovalAction)

SetApprovals sets the approvals in the provider-specific state

func (*Model) SetApproveAction

func (m *Model) SetApproveAction(approve bool)

SetApproveAction sets the approve action in the input state

func (*Model) SetAuthConfig

func (m *Model) SetAuthConfig(key, value string)

func (*Model) SetAwsProfile

func (m *Model) SetAwsProfile(profile string)

SetAwsProfile sets the AWS profile in the provider config

func (*Model) SetAwsRegion

func (m *Model) SetAwsRegion(region string)

SetAwsRegion sets the AWS region in the provider config

func (*Model) SetCommitID

func (m *Model) SetCommitID(commitID string)

SetCommitID sets the commit ID in the input state

func (*Model) SetFunctions

func (m *Model) SetFunctions(functions []cloud.FunctionStatus)

SetFunctions sets the functions in the provider-specific state

func (*Model) SetInputBool

func (m *Model) SetInputBool(key string, value bool)

func (*Model) SetInputText

func (m *Model) SetInputText(key, value string)

func (*Model) SetLambdaPayload added in v0.1.5

func (m *Model) SetLambdaPayload(payload string)

SetLambdaPayload sets the Lambda payload

func (*Model) SetLambdaResult added in v0.1.5

func (m *Model) SetLambdaResult(result *cloud.LambdaExecuteResult)

SetLambdaResult sets the Lambda execution result

func (*Model) SetManualCommitID

func (m *Model) SetManualCommitID(manual bool)

SetManualCommitID sets whether to use manual commit ID

func (*Model) SetPipelines

func (m *Model) SetPipelines(pipelines []cloud.PipelineStatus)

SetPipelines sets the pipelines in the provider-specific state

func (*Model) SetProviderConfig

func (m *Model) SetProviderConfig(key, value string)

Helper methods for working with the model

func (*Model) SetSelectedApproval

func (m *Model) SetSelectedApproval(approval *cloud.ApprovalAction)

SetSelectedApproval sets the selected approval in the provider-specific state

func (*Model) SetSelectedFunction

func (m *Model) SetSelectedFunction(function *cloud.FunctionStatus)

SetSelectedFunction sets the selected function

func (*Model) SetSelectedPipeline

func (m *Model) SetSelectedPipeline(pipeline *cloud.PipelineStatus)

SetSelectedPipeline sets the selected pipeline in the provider-specific state

func (*Model) SetTextInputForApproval

func (m *Model) SetTextInputForApproval(isApproval bool)

SetTextInputForApproval configures the text input for approval

type Operation

type Operation struct {
	ID          string
	Name        string
	Description string
}

Operation represents a service operation

type OperationInfo

type OperationInfo struct {
	ID          string
	Name        string
	Description string
}

OperationInfo represents information about an operation

type PipelineExecutionMsg

type PipelineExecutionMsg struct {
	Err error
}

PipelineExecutionMsg represents the result of a pipeline execution

type PipelineStatus

type PipelineStatus = cloud.PipelineStatus

PipelineStatus is an alias for cloud.PipelineStatus

type PipelineStatusMsg

type PipelineStatusMsg struct {
	Pipelines []PipelineStatus
	Provider  cloud.Provider
}

PipelineStatusMsg represents a message containing pipeline status

type ProviderState

type ProviderState struct {
	// Selected provider
	ProviderName string

	// Provider configuration
	Config map[string]string // Generic configuration (e.g., "profile", "region")

	// Available configuration options
	ConfigOptions map[string][]string // e.g., "profile" -> ["default", "dev", "prod"]

	// Current configuration key being set
	CurrentConfigKey string

	// Authentication state
	AuthState AuthenticationState

	// Selected service, category, and operation
	SelectedService   *ServiceInfo
	SelectedCategory  *CategoryInfo
	SelectedOperation *OperationInfo

	// Provider-specific state (stored as generic interface{})
	ProviderSpecificState map[string]interface{}
}

ProviderState represents the state of the selected provider, service, category, and operation

type Service

type Service struct {
	ID          string
	Name        string
	Description string
	Available   bool
}

Service represents a cloud service

type ServiceInfo

type ServiceInfo struct {
	ID          string
	Name        string
	Description string
	Available   bool
}

ServiceInfo represents information about a service

type StageStatus

type StageStatus = cloud.StageStatus

StageStatus is an alias for cloud.StageStatus

Jump to

Keyboard shortcuts

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