Documentation
¶
Overview ¶
Package statusrows contains the domain logic for expanding an auth handler's status into per-cluster (per-instance) sessions. It is consumed by the CLI auth status/list commands (and reusable by embedders) so the command layer stays thin: the command builds display rows, this package decides which clusters, which representative token per cluster, which session is active, and how each cluster is labeled.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusterLabel ¶
ClusterLabel returns the display label for a cluster URL: the reverse-mapped alias selector when rawURL matches a configured/resolved alias, else the trimmed display host.
func InstanceAliases ¶
InstanceAliases returns a selector->URL map for reverse-mapping a cluster URL back to its short name. It merges static hostname aliases with the resolver's already-cached inventory entries (no network fetch), so both statically aliased and dynamically resolved fleets render the short selector. Static aliases win over resolver entries on selector collisions. Returns nil when nothing is configured.
Types ¶
type InstanceSession ¶
type InstanceSession struct {
// ClusterLabel is the display label for the cluster: the reverse-mapped
// alias when the token hostname matches a configured/resolved alias, else
// the trimmed host.
ClusterLabel string
// Active marks the most recently used session (newest CachedAt).
Active bool
// Token is the representative cached token for the cluster.
Token *auth.CachedTokenInfo
}
InstanceSession is one per-cluster cached session selected for display.
func Expand ¶
func Expand(ctx context.Context, handlerName string, handler auth.Handler, status *auth.Status) []InstanceSession
Expand returns one session per cached cluster when the handler advertises CapInstanceHostname and exposes per-instance cached tokens (each carrying a Hostname). It returns nil when the handler is not an instance handler, is unauthenticated, does not implement TokenLister, or has no hostname-bearing cached tokens -- callers then render the handler's single base row unchanged.
Sessions are one per cluster (deduplicated by Hostname): when a handler returns several tokens for the same instance -- e.g. a user login plus minted service-account tokens -- a single representative token is chosen (a user/login flow wins over a machine flow; ties break by most-recent CachedAt) so a service token is never rendered as if it were the login session. Sessions are ordered deterministically by hostname, with Active marking the most-recently-used cluster.