resource

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

View Source
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: "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

func IsAll added in v0.7.1

func IsAll(noun string) bool

IsAll reports whether the noun is the every-kind pseudo-noun.

func Names

func Names() []string

Names lists the canonical singular of every kind, for help and error text.

func Spellings

func Spellings() []string

Spellings lists every accepted spelling, sorted. It feeds completion.

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.

func Lookup

func Lookup(noun string) (Kind, error)

Lookup resolves a user-typed noun. Matching is case-insensitive and accepts the singular, the plural, or any declared alias.

func (Kind) Run

func (k Kind) Run() bool

Run reports whether the kind is an agent run (an Investigation or Remediation): the two kinds that own a report, an attempt ordinal and a deterministic child name, which is what `review` needs to know.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL