cmd

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName string = "policy"
)

Variables

This section is empty.

Functions

func ConfigExpander

func ConfigExpander() kong.Resolver

Types

type ApplyCmd

type ApplyCmd struct {
	Template    string `name:"template" arg:"" required:"true" help:"name of the template to apply"`
	Output      string `name:"output" short:"o" help:"output directory (defaults to current directory)" default:"."`
	Overwrite   bool   `name:"overwrite" help:"overwrite existing files" default:"false"`
	RegoVersion string `name:"rego-version" enum:"rego.v0, rego.v1" default:"rego.v1" help:"Set rego version flag (enum: rego.v0 or rego.v1)."`
}

func (*ApplyCmd) Run

func (c *ApplyCmd) Run(g *Globals) error

type BuildCmd

type BuildCmd struct {
	Tag                string            `name:"tag" short:"t" help:"Name and optionally a tag in the 'name:tag' format, if not provided it will be 'default:latest'"`
	Path               []string          `name:"path" arg:"" help:"Path to the policy sources." type:"string"`
	Annotations        map[string]string `name:"annotations" short:"a" help:"Annotations to apply to the policy." type:"string:string"`
	RunConfigFile      string            `name:"build-config-file" help:"Set path of configuration file."`
	Target             string            `name:"target" default:"rego" help:"Set the output bundle target type."`
	OptimizationLevel  int               `name:"optimize" short:"O" default:"0" help:"Set optimization level."`
	Entrypoints        []string          `name:"entrypoint" short:"e" help:"Set slash separated entrypoint path."`
	Revision           string            `name:"revision" short:"r" help:"Set output bundle revision."`
	Ignore             []string          `name:"ignore" help:"Set file and directory names to ignore during loading (e.g., '.*' excludes hidden files)."`
	Capabilities       string            `name:"capabilities" help:"Set capabilities.json file path."`
	VerificationKey    string            `name:"verification-key" help:"Set the secret (HMAC) or path of the PEM file containing the public key (RSA and ECDSA)."`
	VerificationKeyID  string            `name:"verification-key-id" default:"default" help:"Name assigned to the verification key used for bundle verification."`
	Algorithm          string            `name:"signing-alg" default:"RS256" help:"Name of the signing algorithm."`
	Scope              string            `name:"scope" help:"Scope to use for bundle signature verification."`
	ExcludeVerifyFiles []string          `name:"exclude-files-verify" help:"Set file names to exclude during bundle verification."`
	SigningKey         string            `name:"signing-key" help:"Set the secret (HMAC) or path of the PEM file containing the private key (RSA and ECDSA)."`
	ClaimsFile         string            `` /* 151-byte string literal not displayed */
	RegoVersion        string            `` /* 138-byte string literal not displayed */
}

func (*BuildCmd) Run

func (c *BuildCmd) Run(g *Globals) error

type CLI

type CLI struct {
	Config    string       `flag:"" short:"c" type:"path" help:"Path to the policy CLI config file." default:"${userHome}/.config/policy/config.yaml"`
	Debug     bool         `flag:"" help:"Enable debug mode."`
	Verbosity int          `flag:"" short:"v" type:"counter" help:"Use to increase output verbosity."`
	Insecure  bool         `flag:"" short:"k" help:"Do not verify TLS connections."`
	Plaintext bool         `flag:"" help:"Use HTTP instead of HTTPS to connect to a registry."`
	Build     BuildCmd     `cmd:"" help:"Build policies."`
	Images    ImagesCmd    `cmd:"" help:"List policy images."`
	Push      PushCmd      `cmd:"" help:"Push policies to a registry."`
	Pull      PullCmd      `cmd:"" help:"Pull policies from a registry."`
	Login     LoginCmd     `cmd:"" help:"Login to a registry."`
	Logout    LogoutCmd    `cmd:"" help:"Logout from a registry."`
	Save      SaveCmd      `cmd:"" help:"Save a policy to a local bundle tarball."`
	Tag       TagCmd       `cmd:"" help:"Create a new tag for an existing policy."`
	Rm        RmCmd        `cmd:"" help:"Removes a policy from the local registry."`
	Inspect   InspectCmd   `cmd:"" help:"Displays information about a policy."`
	Repl      ReplCmd      `cmd:"" help:"Sets you up with a shell for running queries using an OPA instance with a policy loaded."`
	Templates TemplatesCmd `cmd:"" help:"List and apply templates"`
	Version   VersionCmd   `cmd:"" help:"Prints version information."`
}

type Globals

type Globals struct {
	Debug     bool
	Config    string
	Verbosity int
	Insecure  bool
	Plaintext bool
	App       *app.PolicyApp
}

func (*Globals) Setup

func (g *Globals) Setup() func()

type ImagesCmd

type ImagesCmd struct {
	Server    string `name:"server" short:"s" help:"Registry server to connect to." default:"{{ .DefaultDomain }}"`
	ShowEmpty bool   `name:"show-empty" short:"e" help:"Show policies with no images."`
	Org       string `name:"organization" short:"o" help:"Show images for an organization."`
}

func (*ImagesCmd) Run

func (c *ImagesCmd) Run(g *Globals) error

type InspectCmd

type InspectCmd struct {
	Policy string `name:"policy" arg:"" help:"Policy to inspect."`
}

func (*InspectCmd) Run

func (c *InspectCmd) Run(g *Globals) error

type ListCmd

type ListCmd struct{}

func (*ListCmd) Run

func (c *ListCmd) Run(g *Globals) error

type LoginCmd

type LoginCmd struct {
	Server        string `name:"server" short:"s" help:"Server to connect to." default:"{{ .DefaultDomain }}"`
	Username      string `name:"username" required:"" short:"u" help:"Username for logging into the server."`
	Password      string `name:"password" short:"p" help:"Password for logging into the server."`
	PasswordStdin bool   `name:"password-stdin" help:"Take the password from stdin"`
	DefaultDomain bool   `name:"default-domain" short:"d" help:"Do not ask for setting default domain"`
}

func (*LoginCmd) Run

func (c *LoginCmd) Run(g *Globals) error

type LogoutCmd

type LogoutCmd struct {
	Server string `name:"server" short:"s" help:"Server to logout from." default:"{{ .DefaultDomain }}"`
}

func (*LogoutCmd) Run

func (c *LogoutCmd) Run(g *Globals) error

type PullCmd

type PullCmd struct {
	Policies []string `name:"policy" arg:"" help:"Policies to pull from the remote registry."`
}

func (*PullCmd) Run

func (c *PullCmd) Run(g *Globals) error

type PushCmd

type PushCmd struct {
	Policies []string `name:"policy" arg:"" help:"Policies to push."`
}

func (*PushCmd) Run

func (c *PushCmd) Run(g *Globals) error

type ReplCmd

type ReplCmd struct {
	Policy    string `name:"policy" arg:"" help:"Policy to run." type:"string"`
	MaxErrors int    `name:"max-errors" short:"m" help:"Set the number of errors to allow before compilation fails early." default:"10"`
}

func (*ReplCmd) Run

func (c *ReplCmd) Run(g *Globals) error

type RmCmd

type RmCmd struct {
	Policies []string `name:"policy" arg:"" help:"Policies to remove from the local registry."`
	All      bool     `name:"all" short:"a" help:"When remote is set, remove all tags and the policy reference."`
	Force    bool     `name:"force" short:"f" help:"Don't ask for confirmation."`
}

func (*RmCmd) Run

func (c *RmCmd) Run(g *Globals) error

type SaveCmd

type SaveCmd struct {
	Policy string `name:"policy" arg:"" help:"Policy to save."`
	File   string `name:"file" short:"f" help:"Output file path, '-' is accepted for stdout" default:"bundle.tar.gz"`
}

func (*SaveCmd) Run

func (c *SaveCmd) Run(g *Globals) error

type TagCmd

type TagCmd struct {
	Policy string `name:"policy" arg:"" help:"Source policy name." type:"string"`
	Tag    string `name:"tag" arg:"" help:"Name and optionally a tag in the 'name:tag' format"`
}

func (*TagCmd) Run

func (c *TagCmd) Run(g *Globals) error

type TemplatesCmd

type TemplatesCmd struct {
	Apply ApplyCmd `name:"apply" cmd:"" help:"Create or update a policy or related artifacts from a template."`
	List  ListCmd  `name:"list" cmd:"" help:"List all available templates."`
}

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

func (c *VersionCmd) Run(g *Globals) error

Jump to

Keyboard shortcuts

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