Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzAccountResponse ¶
type AzAccountResponse struct {
User AzAccountUser `json:"user"`
}
AzAccountResponse represents the structure of an Azure account response containing user information from the Azure CLI account output.
type AzAccountUser ¶
AzAccountUser represents a user account in Azure with basic identification details. It contains the user name and account type information as retrieved from Azure CLI.
type AzCli ¶
type AzCli struct {
// contains filtered or unexported fields
}
AzCli represents a wrapper around the Azure CLI command-line interface. It provides functionality to execute Azure CLI commands through a command runner.
func NewCli ¶
func NewCli( commandRunner exec.CommandRunner, ) (AzCli, error)
NewCli creates a new AzCli instance with the provided command runner. The command runner is used to execute Azure CLI commands.
Parameters:
- commandRunner: An implementation of exec.CommandRunner interface to execute commands
Returns:
- AzCli: A new AzCli instance
- error: An error if initialization fails, nil otherwise
func (AzCli) Account ¶
func (az AzCli) Account(ctx context.Context) (AzAccountResponse, error)
Account retrieves the current Azure account information. It executes 'az account show' command and returns the account details in a structured format. If az CLI is not authenticated, it returns an error indicating authentication is required. Returns AzAccountResponse containing account details or an error if the operation fails.
func (AzCli) CheckInstalled ¶
CheckInstalled checks if the Azure CLI ('az') is available in the system's PATH. It verifies whether the 'az' command can be found and executed from any directory. Returns nil if the Azure CLI is installed and accessible, or an error if not found.