output

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package output defines allbctl's machine-readable output: the envelope every `--output json` document shares and one data type per document kind.

These types are a public contract, described field by field by the JSON Schemas under schemas/output. They are designed for consumers rather than mirroring the structs the commands gather into: lowerCamelCase keys, numbers as numbers, an explicit null (or installed: false) for what is absent, and never a null array. Changing a field here means changing its schema, the golden files in testdata and the docs in the same commit; the schemas forbid unknown properties, so the tests fail otherwise.

Index

Constants

View Source
const (
	CategoryLanguage       = "language"
	CategoryVersionManager = "version-manager"
	CategoryGaming         = "gaming"
)

Runtime categories.

View Source
const (
	FilterAll   = "all"
	FilterDirty = "dirty"
	FilterClean = "clean"
)

Repository filters of a StatusProjects document.

View Source
const (
	DirtyUncommittedChanges = "uncommitted-changes"
	DirtyUnpushedCommits    = "unpushed-commits"
	DirtyNoUpstream         = "no-upstream"
	DirtyCIFailed           = "ci-failed"
	DirtyCIPending          = "ci-pending"
)

Reasons a repository is dirty.

View Source
const (
	// ProbeOK: the tool answered.
	ProbeOK = "ok"
	// ProbeNotInstalled: the tool is not on this machine.
	ProbeNotInstalled = "notInstalled"
	// ProbeNotConfigured: the tool has nothing to ask (no reachable SSH
	// agent, no GnuPG keyring), so it was not run.
	ProbeNotConfigured = "notConfigured"
	// ProbeTimedOut: the tool was stopped for not answering in time.
	ProbeTimedOut = "timedOut"
	// ProbeError: the tool ran and failed.
	ProbeError = "error"
	// ProbeUnsupported: this operating system has no such thing.
	ProbeUnsupported = "unsupported"
)

How asking one of the key-inventory tools went. Only ProbeOK makes the keys (or key count) next to it a complete answer.

View Source
const (
	SystemdUnsupportedOS = "unsupported-os"
	SystemdNotInstalled  = "not-installed"
)

Reasons systemd cannot be queried.

View Source
const (
	ProtocolTCP = "tcp"
	ProtocolUDP = "udp"
)

Transport protocols of a listening socket.

View Source
const (
	ManagerSystem         = "system"
	ManagerLanguage       = "language"
	ManagerRuntime        = "runtime"
	ManagerInfrastructure = "infrastructure"
)

Package manager categories.

View Source
const CINone = "none"

CINone is the ciStatus of a repository without (reachable) CI; the other states are success, failure and pending.

Variables

This section is empty.

Functions

func Encode

func Encode(kind outputschema.Kind, meta Meta, data any) ([]byte, error)

Encode renders the document of the given kind as indented JSON followed by a newline. data must be a pointer to the kind's data type; its nil slices are replaced by empty ones first, so that an array is never null.

func String

func String(s string, unknown ...string) *string

String returns a pointer to s, or nil when s is empty or one of the placeholders the text output uses for "unknown".

Types

type AWSProfile

type AWSProfile struct {
	Name          string      `json:"name"`
	Default       bool        `json:"default"`
	Connected     bool        `json:"connected"`
	DefaultRegion *string     `json:"defaultRegion"`
	Error         *string     `json:"error"`
	Regions       []AWSRegion `json:"regions"`
}

AWSProfile is one AWS CLI profile and the resources it can see.

type AWSRegion

type AWSRegion struct {
	Name          string        `json:"name"`
	Default       bool          `json:"default"`
	ResourceCount int64         `json:"resourceCount"`
	Resources     []AWSResource `json:"resources"`
}

AWSRegion is the resources found in one region.

type AWSResource

type AWSResource struct {
	Type  string `json:"type"`
	Count int64  `json:"count"`
}

AWSResource counts the resources of one type.

type BootstrapSection

type BootstrapSection struct {
	Name       string          `json:"name"`
	Configured bool            `json:"configured"`
	Report     []string        `json:"report"`
	NotInPlace []BootstrapStep `json:"notInPlace"`
}

BootstrapSection is one top-level bootstrap configuration.

type BootstrapStatusData

type BootstrapStatusData struct {
	Configured      bool               `json:"configured"`
	OperatingSystem string             `json:"operatingSystem"`
	Sections        []BootstrapSection `json:"sections"`
}

BootstrapStatusData is the data of a BootstrapStatus document.

type BootstrapStep

type BootstrapStep struct {
	Step   string `json:"step"`
	Reason string `json:"reason"`
}

BootstrapStep is a step that is not in place, and why.

type Browser

type Browser struct {
	Name    string  `json:"name"`
	Version *string `json:"version"`
}

Browser is a web browser that was found.

type CICheck

type CICheck struct {
	Name       string  `json:"name"`
	Conclusion *string `json:"conclusion"`
}

CICheck is one CI check run of a repository's current commit.

type CPU

type CPU struct {
	Model            *string  `json:"model"`
	Architecture     string   `json:"architecture"`
	ClockGHz         *float64 `json:"clockGHz"`
	PhysicalCores    int      `json:"physicalCores"`
	LogicalCores     int      `json:"logicalCores"`
	ThreadsPerCore   int      `json:"threadsPerCore"`
	Sockets          int      `json:"sockets"`
	CoresPerSocket   int      `json:"coresPerSocket"`
	PerformanceCores *int     `json:"performanceCores"`
	EfficiencyCores  *int     `json:"efficiencyCores"`
}

CPU describes the processor.

type CloudCLI

type CloudCLI struct {
	Name             string  `json:"name"`
	Installed        bool    `json:"installed"`
	Configured       bool    `json:"configured"`
	Version          *string `json:"version"`
	KustomizeVersion *string `json:"kustomizeVersion"`
	ProfileCount     int     `json:"profileCount"`
	Connected        bool    `json:"connected"`
}

CloudCLI is one cloud provider's CLI. Profile names can identify an account, so only their count is carried.

type CloudNativeAWSData

type CloudNativeAWSData struct {
	Installed bool         `json:"installed"`
	Version   *string      `json:"version"`
	Profiles  []AWSProfile `json:"profiles"`
}

CloudNativeAWSData is the data of a StatusCloudNativeAws document.

type CloudNativeData

type CloudNativeData struct {
	CLIs []CloudCLI `json:"clis"`
}

CloudNativeData is the data of a StatusCloudNative document.

type ContainerRuntime

type ContainerRuntime struct {
	Name              string   `json:"name"`
	Installed         bool     `json:"installed"`
	RunningContainers int      `json:"runningContainers"`
	ImageCount        int      `json:"imageCount"`
	Images            []string `json:"images"`
}

ContainerRuntime is one container CLI and what it manages.

type ContainersData

type ContainersData struct {
	Runtimes       []ContainerRuntime `json:"runtimes"`
	Virtualization Virtualization     `json:"virtualization"`
}

ContainersData is the data of a StatusContainers document.

type DNS

type DNS struct {
	System []string `json:"system"`
	VPN    []string `json:"vpn"`
}

DNS lists the configured DNS servers.

type Database

type Database struct {
	Name        string          `json:"name"`
	Installed   bool            `json:"installed"`
	Running     bool            `json:"running"`
	Version     *string         `json:"version"`
	Update      *Update         `json:"update"`
	Client      DatabaseClient  `json:"client"`
	Server      *DatabaseServer `json:"server"`
	FileCount   int             `json:"fileCount"`
	Files       []string        `json:"files"`
	Environment []EnvVar        `json:"environment"`
}

Database is one database system allbctl knows how to detect.

type DatabaseClient

type DatabaseClient struct {
	Binary string  `json:"binary"`
	Path   *string `json:"path"`
}

DatabaseClient is a database's client program.

type DatabaseServer

type DatabaseServer struct {
	Binary  string  `json:"binary"`
	Path    *string `json:"path"`
	Version *string `json:"version"`
}

DatabaseServer is a database's server program.

type DatabasesData

type DatabasesData struct {
	Databases []Database `json:"databases"`
}

DatabasesData is the data of a StatusDatabases document.

type Disk

type Disk struct {
	Device      string  `json:"device"`
	Mountpoint  string  `json:"mountpoint"`
	Filesystem  string  `json:"filesystem"`
	TotalBytes  uint64  `json:"totalBytes"`
	UsedBytes   uint64  `json:"usedBytes"`
	FreeBytes   uint64  `json:"freeBytes"`
	UsedPercent float64 `json:"usedPercent"`
}

Disk describes one disk holding user data.

type Document

type Document struct {
	APIVersion     string `json:"apiVersion"`
	Kind           string `json:"kind"`
	GeneratedAt    string `json:"generatedAt"`
	AllbctlVersion string `json:"allbctlVersion"`
	Host           Host   `json:"host"`
	Data           any    `json:"data"`
}

Document is the envelope around every command's data.

type EnvVar

type EnvVar struct {
	Name     string `json:"name"`
	Value    string `json:"value"`
	Redacted bool   `json:"redacted"`
}

EnvVar is an environment variable whose value has been through pkg/redact.

type GPG

type GPG struct {
	Installed bool `json:"installed"`
	// Status is one of the Probe… constants.
	Status string   `json:"status"`
	Keys   []GPGKey `json:"keys"`
}

GPG lists the GPG public keys.

type GPGKey

type GPGKey struct {
	Algorithm *string `json:"algorithm"`
	KeyID     string  `json:"keyId"`
	UserID    string  `json:"userId"`
}

GPGKey is one GPG public key.

type GPU

type GPU struct {
	Name              string  `json:"name"`
	Vendor            *string `json:"vendor"`
	MemoryBytes       *int64  `json:"memoryBytes"`
	Driver            *string `json:"driver"`
	ComputeCapability *string `json:"computeCapability"`
	GraphicsClockMHz  *int    `json:"graphicsClockMHz"`
	MemoryClockMHz    *int    `json:"memoryClockMHz"`
}

GPU describes one graphics adapter.

type GitData

type GitData struct {
	Installed  bool    `json:"installed"`
	UserName   *string `json:"userName"`
	UserEmail  *string `json:"userEmail"`
	CoreEditor *string `json:"coreEditor"`
}

GitData is the data of a StatusGit document.

type Host

type Host struct {
	OS   string `json:"os"`
	Arch string `json:"arch"`
}

Host identifies the platform a document describes.

type Interface

type Interface struct {
	Name     string  `json:"name"`
	IPv4     *string `json:"ipv4"`
	Up       bool    `json:"up"`
	Loopback bool    `json:"loopback"`
	VPN      bool    `json:"vpn"`
	Primary  bool    `json:"primary"`
}

Interface is one network interface.

type Keyring

type Keyring struct {
	Supported bool `json:"supported"`
	// Status is one of the Probe… constants.
	Status   string `json:"status"`
	KeyCount int    `json:"keyCount"`
}

Keyring summarizes the Linux kernel user keyring.

type Language

type Language struct {
	Name      string `json:"name"`
	SizeBytes int64  `json:"sizeBytes"`
	Percent   int    `json:"percent"`
}

Language is one language's share of a repository.

type Listener

type Listener struct {
	Protocol string  `json:"protocol"`
	Address  string  `json:"address"`
	Port     *int    `json:"port"`
	Process  *string `json:"process"`
	PID      *int    `json:"pid"`
}

Listener is one listening socket.

type Memory

type Memory struct {
	TotalBytes *uint64 `json:"totalBytes"`
}

Memory describes main memory.

type Meta

type Meta struct {
	// GeneratedAt is when the data was gathered; it is rendered in UTC.
	GeneratedAt time.Time
	// AllbctlVersion is the version of the running binary.
	AllbctlVersion string
	Host           Host
}

Meta is what the envelope says about the run that produced a document.

type NetworkData

type NetworkData struct {
	InternetReachable bool        `json:"internetReachable"`
	PublicIP          *string     `json:"publicIp"`
	DefaultGateway    *string     `json:"defaultGateway"`
	PrimaryInterface  *string     `json:"primaryInterface"`
	VPN               VPN         `json:"vpn"`
	WiFi              *WiFi       `json:"wifi"`
	DNS               DNS         `json:"dns"`
	Interfaces        []Interface `json:"interfaces"`
}

NetworkData is the data of a StatusNetwork document.

type PackageManager

type PackageManager struct {
	Tool
	Category string `json:"category"`
}

PackageManager is a package or version manager allbctl looks for.

type PackageSource

type PackageSource struct {
	Name             string   `json:"name"`
	Installed        bool     `json:"installed"`
	Unit             string   `json:"unit"`
	PackageCount     int      `json:"packageCount"`
	UpdatesAvailable int      `json:"updatesAvailable"`
	QueryCommand     string   `json:"queryCommand"`
	Listing          []string `json:"listing"`
}

PackageSource is a package manager and what it has installed.

type PackagesData

type PackagesData struct {
	Managers []PackageSource `json:"managers"`
}

PackagesData is the data of a StatusPackages document.

type PortsData

type PortsData struct {
	TCPCount   int        `json:"tcpCount"`
	UDPCount   int        `json:"udpCount"`
	TotalCount int        `json:"totalCount"`
	Listeners  []Listener `json:"listeners"`
}

PortsData is the data of a StatusPorts document.

type ProjectsData

type ProjectsData struct {
	Directory       string       `json:"directory"`
	DirectoryExists bool         `json:"directoryExists"`
	Filter          string       `json:"filter"`
	TotalCount      int          `json:"totalCount"`
	DirtyCount      int          `json:"dirtyCount"`
	Repositories    []Repository `json:"repositories"`
}

ProjectsData is the data of a StatusProjects document.

type Repository

type Repository struct {
	Path             string     `json:"path"`
	Remote           *string    `json:"remote"`
	ModifiedAt       string     `json:"modifiedAt"`
	Dirty            bool       `json:"dirty"`
	DirtyReasons     []string   `json:"dirtyReasons"`
	UncommittedFiles int        `json:"uncommittedFiles"`
	UntrackedFiles   int        `json:"untrackedFiles"`
	UnpushedCommits  int        `json:"unpushedCommits"`
	CIStatus         string     `json:"ciStatus"`
	CIChecks         []CICheck  `json:"ciChecks"`
	Languages        []Language `json:"languages"`
	StatusLines      []string   `json:"statusLines"`
}

Repository is one git repository.

type Runtime

type Runtime struct {
	Tool
	Category string `json:"category"`
}

Runtime is a language runtime or version manager allbctl probes for.

type RuntimesData

type RuntimesData struct {
	Runtimes []Runtime `json:"runtimes"`
}

RuntimesData is the data of a StatusRuntimes document.

type SSHAgent

type SSHAgent struct {
	Installed bool `json:"installed"`
	// Status is one of the Probe… constants.
	Status string   `json:"status"`
	Keys   []SSHKey `json:"keys"`
}

SSHAgent lists the identities loaded in the SSH agent.

type SSHKey

type SSHKey struct {
	Bits        *int    `json:"bits"`
	Fingerprint string  `json:"fingerprint"`
	Comment     string  `json:"comment"`
	Type        *string `json:"type"`
}

SSHKey is one identity of the SSH agent.

type SecurityData

type SecurityData struct {
	SSHAgent SSHAgent `json:"sshAgent"`
	GPG      GPG      `json:"gpg"`
	Keyring  Keyring  `json:"keyring"`
}

SecurityData is the data of a StatusSecurity document. It only ever holds public identifiers of keys.

type ServiceCounts

type ServiceCounts struct {
	Running int `json:"running"`
	Failed  int `json:"failed"`
}

ServiceCounts counts the service units of one systemd manager.

type StatusData

type StatusData struct {
	System          SystemInfo       `json:"system"`
	CPU             CPU              `json:"cpu"`
	GPUs            []GPU            `json:"gpus"`
	Memory          Memory           `json:"memory"`
	Disks           []Disk           `json:"disks"`
	Runtimes        RuntimesData     `json:"runtimes"`
	Databases       DatabasesData    `json:"databases"`
	Network         NetworkData      `json:"network"`
	Ports           PortsData        `json:"ports"`
	Browsers        []Browser        `json:"browsers"`
	AIAgents        []Tool           `json:"aiAgents"`
	PackageManagers []PackageManager `json:"packageManagers"`
	Packages        PackagesData     `json:"packages"`
	CloudNative     CloudNativeData  `json:"cloudNative"`
	Projects        ProjectsData     `json:"projects"`
}

StatusData is the data of a Status document: the full system report. The Runtimes, Databases, Network, Ports, Packages, CloudNative and Projects sections are the data of the corresponding subcommand's document.

type SystemInfo

type SystemInfo struct {
	User            *string `json:"user"`
	Hostname        *string `json:"hostname"`
	Platform        *string `json:"platform"`
	PlatformVersion *string `json:"platformVersion"`
	Shell           *string `json:"shell"`
	Terminal        *string `json:"terminal"`
	Hardware        *string `json:"hardware"`
}

SystemInfo identifies the machine and the session.

type SystemctlData

type SystemctlData struct {
	Available         bool          `json:"available"`
	UnavailableReason *string       `json:"unavailableReason"`
	System            ServiceCounts `json:"system"`
	User              ServiceCounts `json:"user"`
}

SystemctlData is the data of a StatusSystemctl document.

type Tool

type Tool struct {
	Name      string  `json:"name"`
	Installed bool    `json:"installed"`
	Version   *string `json:"version"`
	Update    *Update `json:"update"`
}

Tool is a program allbctl looks for: installed or not, and at which version.

type Update

type Update struct {
	Version string `json:"version"`
	LTS     bool   `json:"lts"`
}

Update is a newer release of an installed tool.

type VPN

type VPN struct {
	Active    bool    `json:"active"`
	Interface *string `json:"interface"`
	Gateway   *string `json:"gateway"`
}

VPN is the state of the VPN tunnel.

type VersionData

type VersionData struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
}

VersionData is the data of a Version document.

type Virtualization

type Virtualization struct {
	Virtualized bool    `json:"virtualized"`
	Type        *string `json:"type"`
}

Virtualization says whether the host is itself a guest.

type WiFi

type WiFi struct {
	SSID         string   `json:"ssid"`
	FrequencyGHz *float64 `json:"frequencyGHz"`
	Standard     *string  `json:"standard"`
	SignalDBm    *int     `json:"signalDbm"`
	Quality      *string  `json:"quality"`
	SpeedMbps    *float64 `json:"speedMbps"`
}

WiFi describes the wireless network of the primary interface.

Jump to

Keyboard shortcuts

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