Documentation
¶
Overview ¶
Package resource is the noun half of the patchy grammar: it maps what a user types (finding, findings, fnd) onto the kind, list type and API resource name the command then works with.
The aliases are not invented here. Each one is the shortName the CRD already declares (api/v1alpha1, +kubebuilder:resource:shortName), so `patchy get fnd` and `kubectl get fnd` always mean the same thing.
All is the one spelling that is not a kind. `get` takes it to mean every kind at once, and Lookup rejects it, so no verb picks it up by accident.
Index ¶
Constants ¶
const All = "all"
All is the pseudo-noun `get` accepts to mean every kind at once. It is not a Kind, because nothing can be described, reviewed or acted on collectively. Lookup rejects it and only `get` recognises it.
Variables ¶
var Kinds = []Kind{ { Singular: "finding", Plural: "findings", Title: "Findings", Aliases: []string{"fnd"}, New: func() client.Object { return &v1alpha1.Finding{} }, NewList: func() client.ObjectList { return &v1alpha1.FindingList{} }, }, { Singular: "investigation", Plural: "investigations", Title: "Investigations", Aliases: []string{"inv"}, New: func() client.Object { return &v1alpha1.Investigation{} }, NewList: func() client.ObjectList { return &v1alpha1.InvestigationList{} }, }, { Singular: "remediation", Plural: "remediations", Title: "Remediations", Aliases: []string{"rem"}, New: func() client.Object { return &v1alpha1.Remediation{} }, NewList: func() client.ObjectList { return &v1alpha1.RemediationList{} }, }, { Singular: "findingrollup", Plural: "findingrollups", Title: "Finding rollups", Aliases: []string{"fr", "rollup", "rollups"}, New: func() client.Object { return &v1alpha1.FindingRollup{} }, NewList: func() client.ObjectList { return &v1alpha1.FindingRollupList{} }, }, { Singular: "repository", Plural: "repositories", Title: "Repositories", Aliases: []string{"repo", "repos"}, New: func() client.Object { return &v1alpha1.Repository{} }, NewList: func() client.ObjectList { return &v1alpha1.RepositoryList{} }, }, { Singular: "integration", Plural: "integrations", Title: "Integrations", New: func() client.Object { return &v1alpha1.Integration{} }, NewList: func() client.ObjectList { return &v1alpha1.IntegrationList{} }, }, { Singular: "backfillrequest", Plural: "backfillrequests", Title: "Backfill requests", Aliases: []string{"bfr"}, New: func() client.Object { return &v1alpha1.BackfillRequest{} }, NewList: func() client.ObjectList { return &v1alpha1.BackfillRequestList{} }, }, { Singular: "forge", Plural: "forges", Title: "Forges", New: func() client.Object { return &v1alpha1.Forge{} }, NewList: func() client.ObjectList { return &v1alpha1.ForgeList{} }, }, }
Kinds are the nouns, in the order `patchy api-resources`-style help lists them: the pipeline state machine first, then its configuration. `get all` prints them in this order too, so the sequence is the pipeline's own.
Functions ¶
Types ¶
type Kind ¶
type Kind struct {
// Singular is the canonical spelling, used in messages ("finding fnd-1").
Singular string
// Plural is the API resource name, and what the URL path uses.
Plural string
// Title heads this kind's table when several are listed together, so it
// is written for a reader rather than for a URL path.
Title string
// Aliases are the other accepted spellings: the plural, plus the CRD's
// declared shortName.
Aliases []string
// New returns an empty object of the kind.
New func() client.Object
// NewList returns an empty list of the kind.
NewList func() client.ObjectList
}
Kind describes one noun the CLI understands.