stack

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: Apache-2.0 Imports: 31 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Stdout      = "stdout"
	NoDiffFound = "All resources are reconciled. No diff found"
)

Variables

View Source
var (
	ErrGettingNonExistingStack                   = errors.New("the stack does not exist")
	ErrUpdatingNonExistingStack                  = errors.New("the stack to update does not exist")
	ErrInvalidStackID                            = errors.New("the stack ID should be a uuid")
	ErrCanOnlyUpdateConfigItemInNonStandardStack = errors.New("can only update config item in non-standard stack")
	ErrGettingNonExistingStateForStack           = errors.New("can not find State in this stack")
	ErrNoManagedResourceToDestroy                = errors.New("no managed resources to destroy")
	ErrDryrunApply                               = errors.New("dryrun-mode is enabled, no resources will be applied")
	ErrDryrunDestroy                             = errors.New("dryrun-mode is enabled, no resources will be destroyed")
	ErrStackInOperation                          = errors.New("the stack is being operated by another request. Please wait until it is completed")
	ErrStackNotPreviewedYet                      = errors.New("the stack has not been previewed yet. Please generate and preview the stack first")
	ErrInvalidRunID                              = errors.New("the run ID should be a uuid")
	ErrInvalidWatchTimeout                       = errors.New("watchTimeout should be a number")
	ErrWorkspaceEmpty                            = errors.New("workspace should not be empty in query")
	ErrRunRequestBodyEmpty                       = errors.New("run request body should not be empty")
	ErrRunCrashed                                = errors.New("run crashed")
)

Functions

func BuildOptions

func BuildOptions(dryrun bool, maxConcurrent int) *engineapi.APIOptions

func GetWorkDirFromSource

func GetWorkDirFromSource(ctx context.Context, stack *entity.Stack, project *entity.Project) (string, string, error)

getWorkDirFromSource returns the workdir based on the source if the source type is local, it will return the path as an absolute path on the local filesystem if the source type is remote (git for example), it will pull the source and return the path to the pulled source

func ProcessChanges

func ProcessChanges(ctx context.Context, w http.ResponseWriter, changes *models.Changes, format string, detail bool) (any, error)

Types

type RunRequestParams added in v0.14.0

type RunRequestParams struct {
	RunID uint
}

type StackCache added in v0.14.0

type StackCache struct {
	LocalDirOnDisk string
	StackPath      string
}

type StackExecuteParams added in v0.13.0

type StackExecuteParams struct {
	Detail              bool
	Dryrun              bool
	SpecID              string
	Force               bool
	ImportResources     bool
	NoCache             bool
	Unlock              bool
	Watch               bool
	WatchTimeoutSeconds int
}

type StackManager

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

func NewStackManager

func NewStackManager(stackRepo repository.StackRepository,
	projectRepo repository.ProjectRepository,
	workspaceRepo repository.WorkspaceRepository,
	resourceRepo repository.ResourceRepository,
	runRepo repository.RunRepository,
	defaultBackend entity.Backend,
	maxConcurrent int,
) *StackManager

func (*StackManager) ApplyStack

func (m *StackManager) ApplyStack(ctx context.Context, params *StackRequestParams, requestPayload request.StackImportRequest) error

func (*StackManager) BuildRunFilterAndSortOptions added in v0.14.0

func (m *StackManager) BuildRunFilterAndSortOptions(ctx context.Context, query *url.Values) (*entity.RunFilter, *entity.SortOptions, error)

func (*StackManager) BuildStackFilterAndSortOptions added in v0.14.0

func (m *StackManager) BuildStackFilterAndSortOptions(ctx context.Context, query *url.Values) (*entity.StackFilter, *entity.SortOptions, error)

func (*StackManager) CreateRun added in v0.14.0

func (m *StackManager) CreateRun(ctx context.Context, requestPayload request.CreateRunRequest) (*entity.Run, error)

func (*StackManager) CreateStack

func (m *StackManager) CreateStack(ctx context.Context, requestPayload request.CreateStackRequest) (*entity.Stack, error)

func (*StackManager) DeleteRunByID added in v0.14.0

func (m *StackManager) DeleteRunByID(ctx context.Context, id uint) error

func (*StackManager) DeleteStackByID

func (m *StackManager) DeleteStackByID(ctx context.Context, id uint) error

func (*StackManager) DestroyStack

func (m *StackManager) DestroyStack(ctx context.Context, params *StackRequestParams, w http.ResponseWriter) error

func (*StackManager) GenerateSpec added in v0.13.0

func (m *StackManager) GenerateSpec(ctx context.Context, params *StackRequestParams) (string, *apiv1.Spec, error)

func (*StackManager) GetRunByID added in v0.14.0

func (m *StackManager) GetRunByID(ctx context.Context, id uint) (*entity.Run, error)

func (*StackManager) GetStackByID

func (m *StackManager) GetStackByID(ctx context.Context, id uint) (*entity.Stack, error)

func (*StackManager) GetWorkdirAndDirectory added in v0.14.0

func (m *StackManager) GetWorkdirAndDirectory(ctx context.Context, params *StackRequestParams, stackEntity *entity.Stack) (directory string, workDir string, err error)

GetWorkdirAndDirectory is a helper function to get the workdir and directory for a stack

func (*StackManager) ImportTerraformResourceID added in v0.13.0

func (m *StackManager) ImportTerraformResourceID(ctx context.Context, sp *v1.Spec, importedResources map[string]string)

func (*StackManager) ListRuns added in v0.14.0

func (m *StackManager) ListRuns(ctx context.Context, filter *entity.RunFilter, sortOptions *entity.SortOptions) (*entity.RunListResult, error)

func (*StackManager) ListStacks

func (m *StackManager) ListStacks(ctx context.Context, filter *entity.StackFilter, sortOptions *entity.SortOptions) (*entity.StackListResult, error)

func (*StackManager) MarkResourcesAsDeleted added in v0.13.0

func (m *StackManager) MarkResourcesAsDeleted(ctx context.Context, release *v1.Release) error

func (*StackManager) PreviewStack

func (m *StackManager) PreviewStack(ctx context.Context, params *StackRequestParams, requestPayload request.StackImportRequest) (*models.Changes, error)

func (*StackManager) ReconcileResources added in v0.13.0

func (m *StackManager) ReconcileResources(ctx context.Context, stackID uint, release *v1.Release) error

func (*StackManager) UpdateRunByID added in v0.14.0

func (m *StackManager) UpdateRunByID(ctx context.Context, id uint, requestPayload request.UpdateRunRequest) (*entity.Run, error)

func (*StackManager) UpdateRunResultAndStatusByID added in v0.14.0

func (m *StackManager) UpdateRunResultAndStatusByID(ctx context.Context, id uint, requestPayload request.UpdateRunResultRequest) (*entity.Run, error)

func (*StackManager) UpdateStackByID

func (m *StackManager) UpdateStackByID(ctx context.Context, id uint, requestPayload request.UpdateStackRequest) (*entity.Stack, error)

func (*StackManager) WriteResources added in v0.13.0

func (m *StackManager) WriteResources(ctx context.Context, release *v1.Release, stack *entity.Stack, workspace, specID string) error

type StackRequestParams added in v0.13.0

type StackRequestParams struct {
	StackID       uint
	Workspace     string
	Format        string
	Operator      string
	ExecuteParams StackExecuteParams
}

Jump to

Keyboard shortcuts

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