Documentation
¶
Overview ¶
Package registry is the single source of truth for the cacheable Jira metadata resources: their identity, default freshness window, and fetch. It is deliberately free of cobra command wiring so any consumer — the cache command group, `jira boards list`, `jira issue link types`, the refresh-all runner — can depend on the resource metadata without pulling in the command builders.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Registry = []Resource{ {Name: "labels", Short: "Cache and print the global Jira label list", TTLMinutes: ttlHour, Fetch: fetchLabelsForCache}, {Name: "projects", Short: "Cache and print the visible Jira project list", TTLMinutes: 7 * ttlDay, Fetch: fetchProjectsForCache}, {Name: "epics", Short: "Cache and print the visible epic list", TTLMinutes: 4 * ttlHour, Fetch: fetchEpicsForCache}, {Name: "fields", Short: "Cache and print the visible Jira field list", TTLMinutes: 14 * ttlDay, Fetch: fetchFieldsForCache}, {Name: "issuetypes", Short: "Cache and print the visible Jira issue-type list", TTLMinutes: 30 * ttlDay, Fetch: fetchIssueTypesForCache}, {Name: "linktypes", Short: "Cache and print the configured issue-link types", EnvelopeKey: "link_types", TTLMinutes: 90 * ttlDay, Fetch: fetchLinkTypesForCache}, {Name: "boards", Short: "Cache and print the visible Jira agile boards", TTLMinutes: 28 * ttlDay, Fetch: nil}, {Name: "statuses", Short: "Cache and print the visible Jira status list", TTLMinutes: 30 * ttlDay, Fetch: fetchStatusesForCache}, {Name: "priorities", Short: "Cache and print the visible Jira priority list", TTLMinutes: 90 * ttlDay, Fetch: fetchPrioritiesForCache}, }
Functions ¶
func ResourceNames ¶
func ResourceNames() []string
ResourceNames returns the resource names in registry order.
func TTLMinutesFor ¶
TTLMinutesFor returns the default freshness window in minutes for a resource. An unknown name falls back to 60 minutes — the historical default — so a lookup miss degrades to today's behavior rather than a zero TTL.
Types ¶
type Resource ¶
type Resource struct {
// Name identifies the resource — subcommand, cache file, and op label.
Name string
// Short is the cobra one-line command summary.
Short string
// EnvelopeKey is the envelope data key the resource list is emitted
// under. Empty means "same as Name".
EnvelopeKey string
// TTLMinutes is the default --ttl-minutes for the resource's primer.
TTLMinutes int
// Fetch retrieves the resource from Jira and returns the JSON list to
// cache. A nil Fetch marks a resource with a bespoke command (boards),
// which the generic primer factory skips.
Fetch func(ctx context.Context, client *jira.Client) (json.RawMessage, error)
}
Resource describes one cacheable Jira metadata resource. The Name is used three ways that must stay in lock-step: the `cache <name>` subcommand, the on-disk cache file name, and the `cache.<name>` operation label. EnvelopeKey is the data key the list is emitted under — usually Name, but linktypes emits "link_types".