staging

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package staging provides use cases for staging operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddInput

type AddInput struct {
	Name        string
	Value       string
	Description string
}

AddInput holds input for the add use case.

type AddOutput

type AddOutput struct {
	Name string
}

AddOutput holds the result of the add use case.

type AddUseCase

type AddUseCase struct {
	Strategy staging.Parser
	Store    staging.StoreReadWriter
}

AddUseCase executes add operations.

func (*AddUseCase) Draft

func (u *AddUseCase) Draft(_ context.Context, input DraftInput) (*DraftOutput, error)

Draft returns the currently staged create value (draft) for re-editing.

func (*AddUseCase) Execute

func (u *AddUseCase) Execute(_ context.Context, input AddInput) (*AddOutput, error)

Execute runs the add use case.

type ApplyEntryResult added in v0.3.0

type ApplyEntryResult struct {
	Name   string
	Status ApplyResultStatus
	Error  error
}

ApplyEntryResult represents the result of applying a single entry.

type ApplyInput

type ApplyInput struct {
	Name            string // Optional: apply only this item
	IgnoreConflicts bool   // Skip conflict detection
}

ApplyInput holds input for the apply use case.

type ApplyOutput

type ApplyOutput struct {
	ServiceName string
	ItemName    string
	// Entry results
	EntryResults   []ApplyEntryResult
	EntrySucceeded int
	EntryFailed    int
	// Tag results
	TagResults   []ApplyTagResult
	TagSucceeded int
	TagFailed    int
	// Conflicts
	Conflicts []string
}

ApplyOutput holds the result of the apply use case.

type ApplyResultStatus

type ApplyResultStatus int

ApplyResultStatus represents the status of an apply operation.

const (
	ApplyResultCreated ApplyResultStatus = iota
	ApplyResultUpdated
	ApplyResultDeleted
	ApplyResultFailed
)

type ApplyTagResult added in v0.3.0

type ApplyTagResult struct {
	Name      string
	AddTags   map[string]string   // Tags that were added/updated
	RemoveTag maputil.Set[string] // Tag keys that were removed
	Error     error
}

ApplyTagResult represents the result of applying tag changes.

type ApplyUseCase

type ApplyUseCase struct {
	Strategy staging.ApplyStrategy
	Store    staging.StoreReadWriter
}

ApplyUseCase executes apply operations.

func (*ApplyUseCase) Execute

func (u *ApplyUseCase) Execute(ctx context.Context, input ApplyInput) (*ApplyOutput, error)

Execute runs the apply use case.

type BaselineInput

type BaselineInput struct {
	Name string
}

BaselineInput holds input for getting baseline value.

type BaselineOutput

type BaselineOutput struct {
	Value string
}

BaselineOutput holds the baseline value for editing.

type DeleteInput

type DeleteInput struct {
	Name           string
	Force          bool // For Secrets Manager: force immediate deletion
	RecoveryWindow int  // For Secrets Manager: days before permanent deletion (7-30)
}

DeleteInput holds input for the delete use case.

type DeleteOutput

type DeleteOutput struct {
	Name              string
	Unstaged          bool // True if a staged CREATE was removed instead of staging DELETE
	HasDeleteOptions  bool
	Force             bool
	RecoveryWindow    int
	ShowDeleteOptions bool
}

DeleteOutput holds the result of the delete use case.

type DeleteUseCase

type DeleteUseCase struct {
	Strategy staging.DeleteStrategy
	Store    staging.StoreReadWriter
}

DeleteUseCase executes delete staging operations.

func (*DeleteUseCase) Execute

func (u *DeleteUseCase) Execute(ctx context.Context, input DeleteInput) (*DeleteOutput, error)

Execute runs the delete use case.

type DiffEntry

type DiffEntry struct {
	Name          string
	Type          DiffEntryType
	Operation     staging.Operation
	AWSValue      string
	AWSIdentifier string
	StagedValue   string
	Description   *string
	Warning       string // For warnings like "already deleted in AWS"
}

DiffEntry represents a single diff result for entries.

type DiffEntryType

type DiffEntryType int

DiffEntryType represents the type of diff entry.

const (
	DiffEntryNormal DiffEntryType = iota
	DiffEntryCreate
	DiffEntryAutoUnstaged
	DiffEntryWarning
)

type DiffInput

type DiffInput struct {
	Name string // Optional: diff only this item
}

DiffInput holds input for the diff use case.

type DiffOutput

type DiffOutput struct {
	ItemName   string
	Entries    []DiffEntry
	TagEntries []DiffTagEntry
}

DiffOutput holds the result of the diff use case.

type DiffTagEntry added in v0.3.0

type DiffTagEntry struct {
	Name   string
	Add    map[string]string   // Tags to add or update
	Remove maputil.Set[string] // Tag keys to remove
}

DiffTagEntry represents a single diff result for tag changes.

type DiffUseCase

type DiffUseCase struct {
	Strategy staging.DiffStrategy
	Store    staging.StoreReadWriter
}

DiffUseCase executes diff operations.

func (*DiffUseCase) Execute

func (u *DiffUseCase) Execute(ctx context.Context, input DiffInput) (*DiffOutput, error)

Execute runs the diff use case.

type DraftInput

type DraftInput struct {
	Name string
}

DraftInput holds input for getting draft (staged create) value.

type DraftOutput

type DraftOutput struct {
	Value    string
	IsStaged bool
}

DraftOutput holds the draft value if any.

type EditInput

type EditInput struct {
	Name        string
	Value       string
	Description string
}

EditInput holds input for the edit use case.

type EditOutput

type EditOutput struct {
	Name string
}

EditOutput holds the result of the edit use case.

type EditUseCase

type EditUseCase struct {
	Strategy staging.EditStrategy
	Store    staging.StoreReadWriter
}

EditUseCase executes edit operations.

func (*EditUseCase) Baseline

func (u *EditUseCase) Baseline(ctx context.Context, input BaselineInput) (*BaselineOutput, error)

Baseline returns the baseline value for editing (staged value if exists, otherwise from AWS).

func (*EditUseCase) Execute

func (u *EditUseCase) Execute(ctx context.Context, input EditInput) (*EditOutput, error)

Execute runs the edit use case.

type ResetInput

type ResetInput struct {
	Spec string // Name with optional version spec
	All  bool   // Reset all staged items for this service
}

ResetInput holds input for the reset use case.

type ResetOutput

type ResetOutput struct {
	Type         ResetResultType
	Name         string
	VersionLabel string
	Count        int // Number of items unstaged (for UnstagedAll)
	ServiceName  string
	ItemName     string
}

ResetOutput holds the result of the reset use case.

type ResetResultType

type ResetResultType int

ResetResultType represents the type of reset result.

const (
	ResetResultUnstaged ResetResultType = iota
	ResetResultUnstagedAll
	ResetResultRestored
	ResetResultNotStaged
	ResetResultNothingStaged
)

type ResetUseCase

type ResetUseCase struct {
	Parser  staging.Parser
	Fetcher staging.ResetStrategy
	Store   staging.StoreReadWriter
}

ResetUseCase executes reset operations.

func (*ResetUseCase) Execute

func (u *ResetUseCase) Execute(ctx context.Context, input ResetInput) (*ResetOutput, error)

Execute runs the reset use case.

type StatusEntry

type StatusEntry struct {
	Name              string
	Operation         staging.Operation
	Value             *string
	Description       *string
	DeleteOptions     *staging.DeleteOptions
	StagedAt          time.Time
	ShowDeleteOptions bool
}

StatusEntry represents a single staged entry (create/update/delete).

type StatusInput

type StatusInput struct {
	Name string // Optional: if set, show only this item
}

StatusInput holds input for the status use case.

type StatusOutput

type StatusOutput struct {
	Service     staging.Service
	ServiceName string
	ItemName    string
	Entries     []StatusEntry
	TagEntries  []StatusTagEntry
}

StatusOutput holds the result of the status use case.

type StatusTagEntry added in v0.3.0

type StatusTagEntry struct {
	Name     string
	Add      map[string]string   // Tags to add or update
	Remove   maputil.Set[string] // Tag keys to remove
	StagedAt time.Time
}

StatusTagEntry represents staged tag changes for an entity.

type StatusUseCase

type StatusUseCase struct {
	Strategy staging.ServiceStrategy
	Store    staging.StoreReader
}

StatusUseCase executes status operations.

func (*StatusUseCase) Execute

func (u *StatusUseCase) Execute(_ context.Context, input StatusInput) (*StatusOutput, error)

Execute runs the status use case.

type TagInput added in v0.2.0

type TagInput struct {
	Name       string
	AddTags    map[string]string   // Tags to add or update
	RemoveTags maputil.Set[string] // Tag keys to remove
}

TagInput holds input for the tag staging use case.

type TagOutput added in v0.2.0

type TagOutput struct {
	Name string
}

TagOutput holds the result of the tag staging use case.

type TagUseCase added in v0.2.0

type TagUseCase struct {
	Strategy staging.EditStrategy
	Store    staging.StoreReadWriter
}

TagUseCase executes tag staging operations.

func (*TagUseCase) Execute added in v0.2.0

func (u *TagUseCase) Execute(ctx context.Context, input TagInput) (*TagOutput, error)

Execute runs the tag staging use case.

Jump to

Keyboard shortcuts

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