resource

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 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 — a user who learns one spelling has learned both.

Index

Constants

This section is empty.

Variables

View Source
var Kinds = []Kind{
	{
		Singular: "finding",
		Plural:   "findings",
		Aliases:  []string{"fnd"},
		New:      func() client.Object { return &v1alpha1.Finding{} },
		NewList:  func() client.ObjectList { return &v1alpha1.FindingList{} },
	},
	{
		Singular: "investigation",
		Plural:   "investigations",
		Aliases:  []string{"inv"},
		New:      func() client.Object { return &v1alpha1.Investigation{} },
		NewList:  func() client.ObjectList { return &v1alpha1.InvestigationList{} },
	},
	{
		Singular: "remediation",
		Plural:   "remediations",
		Aliases:  []string{"rem"},
		New:      func() client.Object { return &v1alpha1.Remediation{} },
		NewList:  func() client.ObjectList { return &v1alpha1.RemediationList{} },
	},
	{
		Singular: "findingrollup",
		Plural:   "findingrollups",

		Aliases: []string{"fr", "rollup", "rollups"},
		New:     func() client.Object { return &v1alpha1.FindingRollup{} },
		NewList: func() client.ObjectList { return &v1alpha1.FindingRollupList{} },
	},
	{
		Singular: "repository",
		Plural:   "repositories",
		Aliases:  []string{"repo", "repos"},
		New:      func() client.Object { return &v1alpha1.Repository{} },
		NewList:  func() client.ObjectList { return &v1alpha1.RepositoryList{} },
	},
	{
		Singular: "integration",
		Plural:   "integrations",
		New:      func() client.Object { return &v1alpha1.Integration{} },
		NewList:  func() client.ObjectList { return &v1alpha1.IntegrationList{} },
	},
	{
		Singular: "forge",
		Plural:   "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.

Functions

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 — the completion source.

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
	// 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