Documentation
¶
Overview ¶
This includes automatic login detection and supports multiple authentication methods including service principals, managed identities, and federated tokens.
Index ¶
Constants ¶
const ( AuthTypeExisting = "existing_login" AuthTypeServicePrincipal = "service_principal" AuthTypeFederatedToken = "federated_token" AuthTypeUserAssignedManagedID = "user_assigned_managed_identity" AuthTypeSystemAssignedManagedID = "system_assigned_managed_identity" )
Login types
Variables ¶
var NewShellProc = func(timeout int) Proc { return command.NewShellProcess("az", timeout) }
NewShellProc is a package-level Proc factory used so tests can override process creation and avoid invoking the real `az` binary.
Functions ¶
func CreateCommandExecutorFunc ¶
func CreateCommandExecutorFunc(cmd string) tools.CommandExecutorFunc
CreateCommandExecutorFunc creates a CommandExecutor for a specific az command
func EnsureAzCliLogin ¶ added in v0.0.7
func EnsureAzCliLogin(cfg *config.ConfigData) (string, error)
EnsureAzCliLogin ensures az CLI is available and attempts to auto-login using environment variables
func EnsureAzCliLoginWithProc ¶ added in v0.0.7
func EnsureAzCliLoginWithProc(proc Proc, cfg *config.ConfigData) (string, error)
EnsureAzCliLoginWithProc is the testable implementation that uses an injected Proc.
Types ¶
type AzExecutor ¶
type AzExecutor struct{}
AzExecutor implements the CommandExecutor interface for az commands
func (*AzExecutor) Execute ¶
func (e *AzExecutor) Execute(ctx context.Context, params map[string]interface{}, cfg *config.ConfigData) (string, error)
Execute handles general az command execution
func (*AzExecutor) ExecuteSpecificCommand ¶
func (e *AzExecutor) ExecuteSpecificCommand(ctx context.Context, cmd string, params map[string]interface{}, cfg *config.ConfigData) (string, error)
ExecuteSpecificCommand executes a specific az command with the given arguments
type FleetExecutor ¶ added in v0.0.3
type FleetExecutor struct {
*AzExecutor
// contains filtered or unexported fields
}
FleetExecutor handles structured fleet command execution
func NewFleetExecutor ¶ added in v0.0.3
func NewFleetExecutor() *FleetExecutor
NewFleetExecutor creates a new fleet command executor
func (*FleetExecutor) Execute ¶ added in v0.0.3
func (e *FleetExecutor) Execute(ctx context.Context, params map[string]interface{}, cfg *config.ConfigData) (string, error)
Execute processes structured fleet commands
func (*FleetExecutor) GetCommandForValidation ¶ added in v0.0.3
func (e *FleetExecutor) GetCommandForValidation(operation, resource, args string) string
GetCommandForValidation returns the constructed command for security validation
type Proc ¶ added in v0.0.7
type Proc interface {
// Run executes the given command (arguments may be included in the string) and
// returns the command output and an error. Implementations MUST return the
// combined stdout+stderr output in the string return value. The error should
// be non-nil when the underlying process fails to start or returns a
// non-zero exit status. This contract is relied upon by callers that inspect
// output text (for example searching for an "ERROR:" prefix) as well as
// the returned error value.
Run(cmd string) (string, error)
}
Proc is a minimal interface used by this package so tests can inject a fake process.