Documentation
¶
Overview ¶
Package coverage builds the disco-vs-upstream type coverage matrix for every registered cloud provider. Each provider implements Provider and registers itself via init() — see internal/providers/<p>/coverage.go.
Coverage truth source = the emits []TypeDecl declared on each scanner's serviceEntry, aggregated through the provider's Emits() method. Upstream truth source = a live registry call (CFN ListTypes / ARM Providers/List / GCP Discovery API) executed at command time. The matching engine reconciles the two sets via per-provider alias maps to produce the final matrix.
Index ¶
- func AlgorithmicUpstreamKey(discoType string) string
- func Names() []string
- func PascalToKebab(s string) string
- func Register(p Provider)
- func RenderJSON(w io.Writer, matrices []Matrix) error
- func RenderMarkdown(w io.Writer, matrices []Matrix) error
- func RenderTable(w io.Writer, matrices []Matrix) error
- type Bucket
- type FetchOptions
- type Matrix
- type Provider
- type Row
- type TypeDecl
- type UpstreamType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlgorithmicUpstreamKey ¶
AlgorithmicUpstreamKey is the fallback mapping used when no alias is registered for a given disco-type. Today this is just the lowercased disco-type itself — alias maps are the source of truth for accurate matching, and the fallback exists only so that providers whose upstream-key shape happens to equal the disco-type can omit alias entries.
Per-provider algorithmic conversions (CFN PascalCase, ARM camelCase, GCP resource-collection forms) live in the provider's coverage.go alias-map builder, where the disco<->upstream rules are visible alongside the provider's other quirks.
func PascalToKebab ¶
PascalToKebab converts a PascalCase or mixed-case identifier to kebab-case. Lifted from cmd/types_aws.go so per-provider alias-map builders can reuse it. Inserts '-' at lower→upper transitions and before the trailing capital of an acronym run (e.g. "DBInstance" → "db-instance").
func Register ¶
func Register(p Provider)
Register adds a Provider to the global registry. Called from each provider package's init().
func RenderJSON ¶
RenderJSON emits a structured matrix slice for tooling. Shape mirrors the in-memory Matrix/Row types directly so consumers can decode into the same structs.
func RenderMarkdown ¶
RenderMarkdown writes a per-provider markdown matrix (covered / uncovered / synthetic / upstream-missing). Suitable for `disco coverage -o markdown` piped into docs/coverage.md or pasted into the README.
Types ¶
type FetchOptions ¶
FetchOptions carry per-invocation knobs from the cmd. Each provider reads only the fields it cares about — AWS uses Region/Profile, Azure uses Subscription, GCP ignores all three.
type Matrix ¶
Matrix groups rows by provider for rendering.
func Build ¶
func Build(providerName string, emits []TypeDecl, aliases map[string]string, algorithmic func(string) string, upstream []UpstreamType) Matrix
Build assembles the coverage matrix for one provider. emits and upstream are deduped by their canonical keys (DiscoType / UpstreamKey) before matching. A disco-type marked Synthetic short-circuits to BucketSynthetic regardless of upstream presence; a non-synthetic disco-type whose alias resolves to an upstream key not in the live registry produces BucketUpstreamMissing — the drift signal called out in ROADMAP G5.
type Provider ¶
type Provider interface {
Name() string
Fetch(ctx context.Context, opts FetchOptions) ([]UpstreamType, error)
Emits() []TypeDecl
Aliases() map[string]string // disco-type -> upstream key (overrides)
AlgorithmicKey(discoType string) string // fallback when no alias entry exists
}
Provider is implemented by each cloud provider package. Aggregates emits from registeredServices, exposes the live Fetch, and supplies the alias map + an algorithmic fallback used when a disco-type has no explicit alias.
type Row ¶
type Row struct {
Provider string `json:"provider"`
Service string `json:"service"`
DiscoType string `json:"disco_type,omitempty"` // empty when row is upstream-only (uncovered)
UpstreamKey string `json:"upstream_key,omitempty"` // empty when row is synthetic
Bucket Bucket `json:"bucket"`
}
Row is one entry in the coverage matrix.
type TypeDecl ¶
type TypeDecl struct {
Service string // disco's service segment (e.g. "ec2", "compute", "microsoft.compute")
DiscoType string // canonical disco type, e.g. "aws:ec2:instance"
Synthetic bool // true = no upstream registry entry expected (disco-only)
}
TypeDecl is one disco resource type declared by a scanner's emits field.
type UpstreamType ¶
type UpstreamType struct {
Key string // canonical upstream identifier, provider-specific shape
Service string // grouping bucket for matrix rendering
}
UpstreamType is one entry returned by a provider's live registry Fetch.