cli

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderError

func RenderError(err error, jsonOutput bool) string

func RenderHuman

func RenderHuman(as []domain.EligibleAssignment, verbose bool) string

func RenderJSON

func RenderJSON(as []domain.EligibleAssignment) string

func RenderStatusHuman

func RenderStatusHuman(as []domain.ActiveAssignment, verbose bool) string

func RenderStatusJSON

func RenderStatusJSON(as []domain.ActiveAssignment) string

Types

type ActivateCmd

type ActivateCmd struct {
	Scope         string        `help:"Azure resource scope ID (exact)"`
	Subscription  string        `help:"Subscription ID or exact name"`
	ResourceGroup string        `help:"Resource group name (requires --subscription)"`
	Role          string        `help:"Role display name or definition ID"`
	Reason        string        `help:"Justification for the activation"`
	Duration      time.Duration `help:"How long the role stays active (default from config)"`
	JSON          bool          `help:"Output as JSON"`
}

func (*ActivateCmd) Run

func (c *ActivateCmd) Run(ctx context.Context, services Services, streams *Streams) error

type CLI

type CLI struct {
	Verbose    bool          `short:"v" help:"Enable debug logging to stderr"`
	ConfigPath string        `name:"config" help:"Path to config file"`
	List       ListCmd       `cmd:"" help:"List eligible PIM role assignments"`
	Status     StatusCmd     `cmd:"" help:"List active PIM role assignments"`
	Activate   ActivateCmd   `cmd:"" help:"Activate an eligible PIM role assignment"`
	Deactivate DeactivateCmd `cmd:"" help:"Deactivate an active PIM role assignment"`
	Completion CompletionCmd `cmd:"" help:"Generate shell completion script"`
	Version    VersionCmd    `cmd:"" help:"Show version information"`
}

type CompletionCmd

type CompletionCmd struct {
	Shell string `arg:"" required:"" help:"Shell to generate completions for (bash, zsh, fish, powershell)"`
}

func (*CompletionCmd) Run

func (c *CompletionCmd) Run(streams *Streams) error

type DeactivateCmd added in v0.2.0

type DeactivateCmd struct {
	AssignmentID string `arg:"" name:"assignment-id" help:"Active assignment ID to deactivate" optional:""`
	Reason       string `help:"Justification for the deactivation"`
	JSON         bool   `help:"Output as JSON"`
}

func (*DeactivateCmd) Run added in v0.2.0

func (c *DeactivateCmd) Run(ctx context.Context, services Services, streams *Streams) error

type ListCmd

type ListCmd struct {
	JSON     bool `help:"Output as JSON"`
	Extended bool `help:"Show resource IDs and assignment IDs"`
}

func (*ListCmd) Run

func (c *ListCmd) Run(ctx context.Context, services Services, streams *Streams) error

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(services Services, stdout io.Writer, stderr io.Writer) *Runner

func (*Runner) Log

func (r *Runner) Log() *slog.Logger

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, args []string) (code int)

type Services

type Services struct {
	List       func(*slog.Logger) (*app.ListService, error)
	Status     func(*slog.Logger) (*app.StatusService, error)
	Activate   func(*slog.Logger) (*app.ActivationService, error)
	Deactivate func(*slog.Logger) (*app.DeactivationService, error)
}

type StatusCmd

type StatusCmd struct {
	JSON     bool `help:"Output as JSON"`
	Extended bool `help:"Show more details"`
}

func (*StatusCmd) Run

func (c *StatusCmd) Run(ctx context.Context, services Services, streams *Streams) error

type Streams

type Streams struct {
	Stdout io.Writer
	Stderr io.Writer
	Log    *slog.Logger
	Config *config.Config
}

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

func (c *VersionCmd) Run(streams *Streams) error

Jump to

Keyboard shortcuts

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