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
- func Encode(kind outputschema.Kind, meta Meta, data any) ([]byte, error)
- func String(s string, unknown ...string) *string
- type AWSProfile
- type AWSRegion
- type AWSResource
- type BootstrapSection
- type BootstrapStatusData
- type BootstrapStep
- type Browser
- type CICheck
- type CPU
- type CloudCLI
- type CloudNativeAWSData
- type CloudNativeData
- type ContainerRuntime
- type ContainersData
- type DNS
- type Database
- type DatabaseClient
- type DatabaseServer
- type DatabasesData
- type Disk
- type Document
- type EnvVar
- type GPG
- type GPGKey
- type GPU
- type GitData
- type Host
- type Interface
- type Keyring
- type Language
- type Listener
- type Memory
- type Meta
- type NetworkData
- type PackageManager
- type PackageSource
- type PackagesData
- type PortsData
- type ProjectsData
- type Repository
- type Runtime
- type RuntimesData
- type SSHAgent
- type SSHKey
- type SecurityData
- type ServiceCounts
- type StatusData
- type SystemInfo
- type SystemctlData
- type Tool
- type Update
- type VPN
- type VersionData
- type Virtualization
- type WiFi
Constants ¶
const ( CategoryLanguage = "language" CategoryVersionManager = "version-manager" CategoryGaming = "gaming" )
Runtime categories.
const ( FilterAll = "all" FilterDirty = "dirty" FilterClean = "clean" )
Repository filters of a StatusProjects document.
const ( DirtyUncommittedChanges = "uncommitted-changes" DirtyUnpushedCommits = "unpushed-commits" DirtyNoUpstream = "no-upstream" DirtyCIFailed = "ci-failed" DirtyCIPending = "ci-pending" )
Reasons a repository is dirty.
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.
const ( SystemdUnsupportedOS = "unsupported-os" SystemdNotInstalled = "not-installed" )
Reasons systemd cannot be queried.
const ( ProtocolTCP = "tcp" ProtocolUDP = "udp" )
Transport protocols of a listening socket.
const ( ManagerSystem = "system" ManagerLanguage = "language" ManagerRuntime = "runtime" ManagerInfrastructure = "infrastructure" )
Package manager categories.
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 ¶
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 ¶
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 ¶
BootstrapStep is a step that is not in place, and why.
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 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 ¶
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 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 ¶
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 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 ¶
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"`
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 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 ¶
VersionData is the data of a Version document.
type Virtualization ¶
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.