environment

package
v0.0.0-...-dac86b4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusActive         = "active"
	StatusProvisioning   = "provisioning"
	StatusError          = "error"
	StatusDecommissioned = "decommissioned"
)

Status constants for environment lifecycle.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionTestResult

type ConnectionTestResult struct {
	Success bool          `json:"success"`
	Message string        `json:"message"`
	Latency time.Duration `json:"latency"`
}

ConnectionTestResult holds the outcome of a connectivity test.

type Environment

type Environment struct {
	ID         string            `json:"id"`
	WorkflowID string            `json:"workflow_id"`
	Name       string            `json:"name"`
	Provider   string            `json:"provider"`
	Region     string            `json:"region"`
	Config     map[string]any    `json:"config"`
	Secrets    map[string]string `json:"secrets,omitempty"`
	Status     string            `json:"status"`
	CreatedAt  time.Time         `json:"created_at"`
	UpdatedAt  time.Time         `json:"updated_at"`
}

Environment represents a deployment target (e.g., staging, production) associated with a workflow and cloud provider.

type Filter

type Filter struct {
	WorkflowID string
	Provider   string
	Status     string
}

Filter specifies optional criteria for listing environments.

type Handler

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

Handler exposes environment CRUD endpoints over HTTP.

func NewHandler

func NewHandler(store Store) *Handler

NewHandler creates a new environment HTTP handler.

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers environment endpoints on the given mux.

type SQLiteStore

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

SQLiteStore implements Store backed by a SQLite database.

func NewSQLiteStore

func NewSQLiteStore(dbPath string) (*SQLiteStore, error)

NewSQLiteStore opens the SQLite database at dbPath and creates the environments table if it does not already exist.

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

Close closes the underlying database connection.

func (*SQLiteStore) Create

func (s *SQLiteStore) Create(ctx context.Context, env *Environment) error

Create inserts a new environment. A UUID is generated for ID, and CreatedAt/UpdatedAt are set to now.

func (*SQLiteStore) Delete

func (s *SQLiteStore) Delete(ctx context.Context, id string) error

Delete removes an environment by ID.

func (*SQLiteStore) Get

func (s *SQLiteStore) Get(ctx context.Context, id string) (*Environment, error)

Get retrieves a single environment by ID.

func (*SQLiteStore) List

func (s *SQLiteStore) List(ctx context.Context, filter Filter) ([]Environment, error)

List returns environments matching the optional filter criteria.

func (*SQLiteStore) Update

func (s *SQLiteStore) Update(ctx context.Context, env *Environment) error

Update modifies an existing environment. UpdatedAt is set to now.

type Store

type Store interface {
	Create(ctx context.Context, env *Environment) error
	Get(ctx context.Context, id string) (*Environment, error)
	List(ctx context.Context, filter Filter) ([]Environment, error)
	Update(ctx context.Context, env *Environment) error
	Delete(ctx context.Context, id string) error
}

Store defines CRUD operations for environments.

Jump to

Keyboard shortcuts

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