Documentation
¶
Overview ¶
Package state manages local SQLite state for instance caching.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
Open returns an open SQLite database at ~/.ssmx/state.db, creating it and running migrations if it doesn't exist.
func UpsertInstances ¶
func UpsertInstances(ctx context.Context, db *sql.DB, profile, region string, instances []CachedInstance) error
UpsertInstances replaces the cached instance list for the given profile+region. All existing rows for that profile+region are removed before inserting the new batch, so instances that have disappeared from AWS are not left in the cache.
Types ¶
type CachedInstance ¶
type CachedInstance struct {
InstanceID string
Name string
State string
SSMStatus string
PrivateIP string
AgentVersion string
Region string
Profile string
PlatformName string
AvailabilityZone string
CachedAt time.Time
}
CachedInstance is a row from the instance_cache table.
func GetCachedInstances ¶
func GetCachedInstances(ctx context.Context, db *sql.DB, profile, region string) ([]CachedInstance, error)
GetCachedInstances returns all cached instances for the given profile+region that were cached within the TTL window.
Click to show internal directories.
Click to hide internal directories.