Help us shape the future of Go! Take the 2026 Go Developer Survey

azcli

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package azcli runs the Azure CLI as a cancellable child process.

Callers must never place secret values in argv. Secure deployment values belong in owner-only parameter files or Key Vault references.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandName

func CommandName(args []string) string

CommandName returns the space-joined command path.

func CommandPath

func CommandPath(args []string) []string

CommandPath returns the leading command words before the first option.

func IsReadOnly

func IsReadOnly(args []string) bool

IsReadOnly reports whether args name an allowlisted read-only or what-if command.

Types

type Executor

type Executor interface {
	Run(ctx context.Context, args ...string) (Result, error)
}

Executor runs one Azure CLI invocation. Implementations must honor ctx.

func ReadOnly

func ReadOnly(next Executor) Executor

ReadOnly refuses any command that is not allowlisted before it reaches next.

type ExecutorFunc

type ExecutorFunc func(context.Context, ...string) (Result, error)

ExecutorFunc adapts a function to Executor.

func (ExecutorFunc) Run

func (f ExecutorFunc) Run(ctx context.Context, args ...string) (Result, error)

type ExitError

type ExitError struct {
	Code   int
	Stderr string
}

ExitError reports a non-zero Azure CLI exit. Stderr is retained for callers that redact it before display.

func (*ExitError) Error

func (e *ExitError) Error() string

type Process

type Process struct {
	// Path overrides PATH lookup; empty means "az".
	Path string
	// WaitDelay bounds how long output pipes may outlive a cancelled process.
	WaitDelay time.Duration
}

Process runs the az binary found on PATH when the first command executes.

func (Process) Run

func (p Process) Run(ctx context.Context, args ...string) (Result, error)

type Result

type Result struct {
	Stdout string
	Stderr string
}

Result is the captured output of one Azure CLI invocation.

Jump to

Keyboard shortcuts

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