Documentation
¶
Index ¶
- Constants
- type ConnectionTestResult
- type Environment
- type Filter
- type Handler
- type SQLiteStore
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) Create(ctx context.Context, env *Environment) error
- func (s *SQLiteStore) Delete(ctx context.Context, id string) error
- func (s *SQLiteStore) Get(ctx context.Context, id string) (*Environment, error)
- func (s *SQLiteStore) List(ctx context.Context, filter Filter) ([]Environment, error)
- func (s *SQLiteStore) Update(ctx context.Context, env *Environment) error
- type Store
Constants ¶
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 Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler exposes environment CRUD endpoints over HTTP.
func NewHandler ¶
NewHandler creates a new environment HTTP handler.
func (*Handler) RegisterRoutes ¶
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.