console

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package console is a lightweight, server-rendered web UI for inspecting and managing a doze-aws Stack — an "AWS console, but local and better". It is itself just another client of the gateway (in-process), so it never bypasses the real API. HTMX (vendored, embedded) drives partial updates; there is no SPA build step and the whole thing ships inside the Go binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PresignURL

func PresignURL(host, bucket, key string, ttl time.Duration) string

PresignURL builds a share link the gateway accepts: doze-aws parses the SigV4 presigned form without verifying the signature, but DOES enforce the expiry — so the link genuinely stops working when it says it will.

func QueueARN

func QueueARN(name string) string

QueueARN builds the queue's ARN (fixed local identity).

Types

type Bucket

type Bucket struct {
	Name    string
	Created string
}

type BucketConfig

type BucketConfig struct {
	Name string // CORS, Lifecycle, Policy, Website, Encryption
	Set  bool
	Raw  string
}

type BucketProps

type BucketProps struct {
	Name       string
	ARN        string
	Region     string
	Versioning string // Enabled | Suspended | Disabled
	ObjectLock bool
	Tags       []KV
	Configs    []BucketConfig // which optional configs exist, with raw payloads
}

BucketProps is everything the bucket Properties tab shows.

type Bus

type Bus struct {
	Name     string
	ARN      string
	Rules    int
	RuleList []Rule // the rules behind Rules — BuildGraph reuses them
}

type Console

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

Console is the web-UI http.Handler. Mount it under a path prefix (default "/_console") alongside the AWS gateway.

func New

func New(opts Options) (*Console, error)

New builds a console over the given gateway handler.

func (*Console) ServeHTTP

func (c *Console) ServeHTTP(w http.ResponseWriter, r *http.Request)

type CreateFunctionOpts

type CreateFunctionOpts struct {
	Name    string
	Runtime string
	Handler string
	Code    string // local path (the _local_ extension)
	Timeout int
	Memory  int
	Env     map[string]string
}

CreateFunctionOpts is the create-function form's payload.

type EBArchive

type EBArchive struct {
	Name      string
	ARN       string
	Events    int64
	Retention int
	State     string
	Created   string
	Pattern   string
}

type EBReplay

type EBReplay struct {
	Name    string
	State   string
	Started string
}

type FlowDiagram

type FlowDiagram struct {
	Label string
	Nodes []FlowNode // local coordinates within this card's SVG
	Edges []FlowEdge // edges internal to this flow
	W, H  int
}

FlowDiagram is one independent connected flow, rendered as its own card with a self-contained SVG (local coordinates).

type FlowEdge

type FlowEdge struct {
	From string
	To   string
	Kind string // notify | sub | target | esm | redrive
	Hot  bool   // carried traffic recently (best-effort: has depth/invocations)
}

type FlowGraph

type FlowGraph struct {
	Diagrams  []FlowDiagram // one per independent flow
	Unwired   []FlowNode    // unconnected resources (chips)
	NodeCount int
	Conns     int
	Flows     int
}

type FlowNode

type FlowNode struct {
	ID      string // stable: "sqs:orders"
	Svc     string // s3 | sns | sqs | eb | lambda
	Name    string
	Sub     string // small caption ("2 msgs", "1 sub")
	X, Y    int    // absolute layout position (px), assigned per flow band
	Unwired bool   // no edges touch it
	URL     string
}

type Function

type Function struct {
	Name       string
	ARN        string
	Runtime    string
	Handler    string
	Timeout    int
	MemorySize int
	Modified   string
	Env        map[string]string
	CodeSize   int64
	Version    string
	DLQ        string
	OnSuccess  string // async destination ARN
	OnFailure  string // async destination ARN
	Mappings   []Mapping
}

type GSI

type GSI struct {
	Name      string
	HashKey   string
	HashType  string
	RangeKey  string
	RangeType string
}

type GSICreate

type GSICreate struct {
	Name                string
	HashKey, HashType   string
	RangeKey, RangeType string
}

GSICreate is one global secondary index requested at table-creation time.

type InvokeResult

type InvokeResult struct {
	Payload  string
	FnError  string
	Logs     string
	Duration string
	Status   int
	Async    bool
}

InvokeResult is one playground invocation's outcome.

type Item

type Item struct {
	PK      string
	SK      string
	Preview string            // truncated single-line JSON of the non-key attributes
	Attrs   map[string]string // per-attribute display values (feeds real columns)
	JSON    string            // full pretty plain-JSON
	KeyJSON string            // the primary-key AV map as JSON (for DeleteItem)
}

Item is one scanned row prepared for display.

type KV

type KV struct{ K, V string }

type Key

type Key struct {
	ID          string
	ARN         string
	Alias       string
	Description string
	Spec        string
	Usage       string
	State       string
	Enabled     bool
	RotationOn  bool
	Created     string
	SigAlgos    []string // SIGN_VERIFY keys
	MacAlgos    []string // GENERATE_VERIFY_MAC keys
	Aliases     []string
}

type LambdaRuntimeState

type LambdaRuntimeState struct {
	Warm     bool
	Runners  int
	IdleSecs int
	SleepAt  int64 // unix seconds the warm pool will scale to zero; 0 = no countdown
}

LambdaRuntimeState is a function's live process state (doze extension).

func (LambdaRuntimeState) Counting

func (s LambdaRuntimeState) Counting() bool

Counting reports whether a live sleep countdown is running.

func (LambdaRuntimeState) IdleLabel

func (s LambdaRuntimeState) IdleLabel() string

IdleLabel renders the idle window compactly, e.g. "10m", "1h", "45s".

func (LambdaRuntimeState) SleepLabel

func (s LambdaRuntimeState) SleepLabel() string

SleepLabel renders the initial countdown for the server-side render; the client then ticks it every second.

func (LambdaRuntimeState) SleepLeft

func (s LambdaRuntimeState) SleepLeft() int

SleepLeft is the seconds remaining until the process sleeps, from the server's clock. The client re-bases this against its own clock the moment it receives it, so a skewed browser clock can't drift the countdown.

type Mapping

type Mapping struct {
	UUID      string
	SourceARN string
	BatchSize int
	State     string
}

type MoveTask

type MoveTask struct {
	Status  string // RUNNING | COMPLETED | FAILED | CANCELLED
	Dest    string
	Moved   int64
	Failure string
}

MoveTask is one redrive task's progress.

type MsgAttr

type MsgAttr struct{ Name, Type, Value string }

MsgAttr is one user message attribute (metadata alongside the body).

type MsgSummary

type MsgSummary struct {
	Kind     string        // chip label: "s3 event", "sns · orders", "eb event", "json", "text"
	Svc      string        // service color for the chip; "" = neutral
	Line     string        // the one-line summary
	Note     string        // envelope/meta context shown in the expanded view
	BodyHTML template.HTML // pretty, syntax-lit body for the expanded view
	Raw      string        // the display body as plain text (copy target)
}

MsgSummary is the display form of a message body. The console generates the AWS event shapes it delivers (S3 notifications, SNS envelopes, EventBridge events), so it can recognize them and lead with what happened instead of a wall of wire JSON.

type Neighbor

type Neighbor struct {
	Svc  string
	Name string
	Kind string // the edge kind (sub / target / esm / redrive / dlq / dest / notify)
	URL  string
}

Neighbor is one adjacent resource in a Connections view.

type Neighborhood

type Neighborhood struct {
	Upstream   []Neighbor // edges INTO this node
	Downstream []Neighbor // edges OUT of this node
}

Neighborhood is a resource's 1-hop wiring: what feeds it and where it drains.

type NotifyRule

type NotifyRule struct {
	Kind   string // sqs | sns | lambda
	Name   string // destination resource name
	Events []string
	Prefix string
	Suffix string
}

NotifyRule is one editable bucket-notification wiring.

type ObjVersion

type ObjVersion struct {
	VersionID    string
	IsLatest     bool
	DeleteMarker bool
	Size         int64
	LastModified string
}

ObjVersion is one entry in an object's version history.

type Object

type Object struct {
	Key          string
	Size         int64
	LastModified string
	IsPrefix     bool // a "folder" (CommonPrefix) rather than a real object
}

type ObjectMeta

type ObjectMeta struct {
	Key          string
	Size         string
	SizeBytes    int64
	ContentType  string
	ETag         string
	LastModified string
	StorageClass string
	IsImage      bool
	IsText       bool
}

ObjectMeta is the metadata surfaced in the object detail drawer.

type Options

type Options struct {
	// Peers resolves each AWS service to an endpoint the console reads and writes
	// through. Embedded: peers.InProcess over the stack's service handlers. Module
	// topology: peers.FromEnv() (per-service unix sockets). The console routes
	// each request to the owning service via gateway.Route, so one console fronts
	// either topology unchanged.
	Peers peers.Directory
	// Recorder, if set, feeds the Traffic surface. Wrap the gateway with
	// NewRecorder for external SDK/CLI calls and pass that recorder here. Leave
	// nil in topologies where the console doesn't sit in the external request
	// path (the Traffic surface then reports capture off).
	Recorder *Recorder
	// Prefix is the URL path the console is mounted under; defaults to
	// "/_console".
	Prefix string
}

Options configures the console.

type Parameter

type Parameter struct {
	Name     string
	Type     string
	Value    string
	Version  int64
	ARN      string
	Modified string
	Labels   []string
}

type QueryOpts

type QueryOpts struct {
	Index       string // GSI name, or "" for the base table
	PKValue     string
	SKOp        string // "", "=", "<", "<=", ">", ">=", "begins_with", "between"
	SKValue     string
	SKValue2    string            // for "between"
	Filter      string            // optional FilterExpression on non-key attributes
	FilterVals  map[string]any    // :binding → typed AttributeValue for the filter
	FilterNames map[string]string // #alias → attribute name for the filter
	Limit       int
	Cursor      string // opaque pagination cursor (ExclusiveStartKey)
}

QueryOpts describes a key-based query against the base table or a GSI.

type Queue

type Queue struct {
	Name      string
	Available int    // ApproximateNumberOfMessages
	InFlight  int    // ApproximateNumberOfMessagesNotVisible
	DLQ       string // redrive target queue name, "" when none (from the same attrs fetch)
}

type Recorder

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

Recorder is gateway middleware that keeps a ring buffer of the most recent AWS API calls an external SDK/CLI made against the endpoint. The console's own in-process client bypasses it (it talks to the raw gateway), so the tail only shows the app's traffic — the answer to "what did my app just do?".

func NewRecorder

func NewRecorder(next http.Handler) *Recorder

NewRecorder wraps the AWS gateway handler with traffic capture.

func (*Recorder) Clear

func (rec *Recorder) Clear()

Clear empties the ring. Seq keeps counting up so live-poll hashes stay monotonic across a clear.

func (*Recorder) Entries

func (rec *Recorder) Entries(sinceSeq int64) []TrafficEntry

Entries returns recorded calls, newest first, with Seq > sinceSeq.

func (*Recorder) Get

func (rec *Recorder) Get(seq int64) (TrafficEntry, bool)

Get returns the entry with the given sequence number, if it is still in the ring (the inspector drawer loads entries by seq).

func (*Recorder) LastSeq

func (rec *Recorder) LastSeq() int64

LastSeq returns the sequence number of the newest recorded call — the cheap "anything new?" probe the live poll checks before rendering rows.

func (*Recorder) ServeHTTP

func (rec *Recorder) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Rule

type Rule struct {
	Name     string
	ARN      string
	Bus      string
	Pattern  string
	Schedule string
	State    string
	Targets  []Target
}

type SQSCreateOpts

type SQSCreateOpts struct {
	Name              string
	FIFO              bool
	ContentBasedDedup bool   // FIFO: dedup by body hash instead of explicit IDs
	VisibilityTimeout string // seconds
	RetentionSeconds  string
	DelaySeconds      string
	DLQName           string // existing queue name for the redrive policy
	MaxReceiveCount   string
}

SQSCreateOpts carries the console create dialog's full option set.

type SQSMessage

type SQSMessage struct {
	MessageID     string
	ReceiptHandle string
	Body          string
	SentAt        string
	GroupID       string // FIFO: MessageGroupId
	DedupID       string // FIFO: MessageDeduplicationId
	SeqNo         string // FIFO: SequenceNumber
	Receives      string // ApproximateReceiveCount (real receives; peeks don't count)
	Attrs         []MsgAttr
	Sum           MsgSummary // display form, filled by the handler before render
}

type Secret

type Secret struct {
	Name           string
	ARN            string
	Description    string
	Changed        string
	Value          string
	VersionID      string
	Stages         map[string][]string // version id -> stages
	Deleted        bool                // pending deletion (restorable)
	DeletedAt      string
	RotationOn     bool
	RotationLambda string
	RotationDays   int
	LastRotated    string
}

type SendOpts

type SendOpts struct {
	GroupID string    // FIFO: required group
	DedupID string    // FIFO: explicit dedup ID; blank auto-generates one
	Delay   string    // standard queues: per-message DelaySeconds
	Attrs   []MsgAttr // message attributes (metadata)
}

SendOpts carries everything a message can be published with.

type Subscription

type Subscription struct {
	ARN          string
	Protocol     string
	Endpoint     string
	FilterPolicy string // JSON, "" when none
	RawDelivery  bool
}

type Table

type Table struct {
	Name      string
	Status    string
	ItemCount int64
	SizeBytes int64
	ARN       string
	HashKey   string
	HashType  string
	RangeKey  string
	RangeType string
	GSIs      []GSI
	TTLAttr   string // attribute driving TTL, "" when disabled
	TTLStatus string // ENABLED | DISABLED | ENABLING | DISABLING
}

type TableCreateOpts

type TableCreateOpts struct {
	Name                string
	HashKey, HashType   string
	RangeKey, RangeType string
	GSIs                []GSICreate
	TTLAttr             string // enable TTL on this attribute after creation
}

TableCreateOpts is the full create-table request the console form builds.

type Target

type Target struct {
	ID  string
	ARN string
}

type Topic

type Topic struct {
	Name    string
	ARN     string
	Subs    int
	SubList []Subscription // the subscriptions behind Subs — BuildGraph reuses them
}

type TrafficEntry

type TrafficEntry struct {
	Seq      int64
	At       time.Time
	Service  string
	Action   string
	Resource string
	Status   int
	Millis   float64
	ReqBody  string // captured for JSON/query bodies (bounded); redacted
	RespBody string // first 8KB of a text response; redacted
	RespCT   string // response Content-Type
	Method   string
	Path     string // path + query, for replay
	Host     string
	CT       string // Content-Type
	Target   string // X-Amz-Target
}

TrafficEntry is one recorded call.

func (TrafficEntry) Curl

func (e TrafficEntry) Curl() string

Curl renders the entry as a replayable curl command. The body is the recorder's redacted copy, so masked secrets stay masked in the repro.

Jump to

Keyboard shortcuts

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