Documentation
¶
Overview ¶
Package types provides JSON output types for nbc commands.
This package is intended for use by external applications that want to parse nbc's JSON output programmatically. All types are serializable to JSON and match the structure of nbc's --json output.
Example usage:
import "github.com/frostyard/nbc/pkg/types" // Parse nbc status --json output var status types.StatusOutput json.Unmarshal(data, &status) // Parse nbc list --json output var list types.ListOutput json.Unmarshal(data, &list)
Index ¶
- type CacheListOutput
- type CachedImageMetadata
- type DiskOutput
- type DownloadOutput
- type EventType
- type LintIssue
- type LintOutput
- type LintResult
- type LintSeverity
- type ListOutput
- type PartitionOutput
- type ProgressEvent
- type StagedUpdate
- type StatusOutput
- type UpdateCheck
- type UpdateCheckOutput
- type ValidateOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheListOutput ¶
type CacheListOutput struct {
CacheType string `json:"cache_type"`
CacheDir string `json:"cache_dir"`
Images []CachedImageMetadata `json:"images"`
}
CacheListOutput represents the JSON output structure for the cache list command
type CachedImageMetadata ¶
type CachedImageMetadata struct {
ImageRef string `json:"image_ref"` // Original image reference
ImageDigest string `json:"image_digest"` // Image manifest digest (sha256:...)
DownloadDate string `json:"download_date"` // When the image was downloaded
Architecture string `json:"architecture"` // Image architecture (amd64, arm64, etc.)
Labels map[string]string `json:"labels,omitempty"` // Container image labels
OSReleasePrettyName string `json:"os_release_pretty_name"` // PRETTY_NAME from os-release
OSReleaseVersionID string `json:"os_release_version_id"` // VERSION_ID from os-release
OSReleaseID string `json:"os_release_id"` // ID from os-release (e.g., debian, fedora)
SizeBytes int64 `json:"size_bytes"` // Total uncompressed size in bytes
}
CachedImageMetadata contains metadata about a cached container image
type DiskOutput ¶
type DiskOutput struct {
Device string `json:"device"`
Size uint64 `json:"size"`
SizeHuman string `json:"size_human"`
Model string `json:"model,omitempty"`
IsRemovable bool `json:"is_removable"`
Partitions []PartitionOutput `json:"partitions"`
}
DiskOutput represents a disk in JSON output
type DownloadOutput ¶
type DownloadOutput struct {
ImageRef string `json:"image_ref"`
ImageDigest string `json:"image_digest"`
CacheDir string `json:"cache_dir"`
SizeBytes int64 `json:"size_bytes"`
Architecture string `json:"architecture"`
OSName string `json:"os_name,omitempty"`
}
DownloadOutput represents the JSON output structure for the download command
type LintIssue ¶
type LintIssue struct {
Check string `json:"check"`
Severity LintSeverity `json:"severity"`
Message string `json:"message"`
Path string `json:"path,omitempty"`
Fixed bool `json:"fixed,omitempty"` // True if the issue was automatically fixed
}
LintIssue represents a single lint issue found in a container image
type LintOutput ¶
type LintOutput struct {
Image string `json:"image,omitempty"`
Local bool `json:"local,omitempty"`
Issues []LintIssue `json:"issues"`
ErrorCount int `json:"error_count"`
WarnCount int `json:"warning_count"`
FixedCount int `json:"fixed_count,omitempty"`
Success bool `json:"success"`
}
LintOutput represents the JSON output structure for the lint command
type LintResult ¶
type LintResult struct {
Issues []LintIssue `json:"issues"`
ErrorCount int `json:"error_count"`
WarnCount int `json:"warning_count"`
FixedCount int `json:"fixed_count,omitempty"`
}
LintResult contains all issues found by the linter
type LintSeverity ¶
type LintSeverity string
LintSeverity represents the severity of a lint issue
const ( SeverityError LintSeverity = "error" SeverityWarning LintSeverity = "warning" )
type ListOutput ¶
type ListOutput struct {
Disks []DiskOutput `json:"disks"`
}
ListOutput represents the JSON output structure for the list command
type PartitionOutput ¶
type PartitionOutput struct {
Device string `json:"device"`
Size uint64 `json:"size"`
SizeHuman string `json:"size_human"`
MountPoint string `json:"mount_point,omitempty"`
FileSystem string `json:"filesystem,omitempty"`
}
PartitionOutput represents a partition in JSON output
type ProgressEvent ¶
type ProgressEvent struct {
Type EventType `json:"type"`
Timestamp string `json:"timestamp"`
Step int `json:"step,omitempty"`
TotalSteps int `json:"total_steps,omitempty"`
StepName string `json:"step_name,omitempty"`
Message string `json:"message,omitempty"`
Percent int `json:"percent,omitempty"`
Details any `json:"details,omitempty"`
}
ProgressEvent represents a single line of JSON Lines output for streaming progress. Used by install and update commands for real-time progress updates.
type StagedUpdate ¶
type StagedUpdate struct {
ImageRef string `json:"image_ref"`
ImageDigest string `json:"image_digest"`
SizeBytes int64 `json:"size_bytes"`
Ready bool `json:"ready"` // true if different from installed version
}
StagedUpdate represents a pre-downloaded update ready to apply
type StatusOutput ¶
type StatusOutput struct {
Image string `json:"image"`
Digest string `json:"digest,omitempty"`
Device string `json:"device"`
ActiveRoot string `json:"active_root,omitempty"`
ActiveSlot string `json:"active_slot,omitempty"`
RootMountMode string `json:"root_mount_mode,omitempty"`
BootloaderType string `json:"bootloader_type"`
FilesystemType string `json:"filesystem_type"`
InstallDate string `json:"install_date,omitempty"`
KernelArgs []string `json:"kernel_args,omitempty"`
UpdateCheck *UpdateCheck `json:"update_check,omitempty"`
StagedUpdate *StagedUpdate `json:"staged_update,omitempty"`
}
StatusOutput represents the JSON output structure for the status command
type UpdateCheck ¶
type UpdateCheck struct {
Available bool `json:"available"`
RemoteDigest string `json:"remote_digest,omitempty"`
CurrentDigest string `json:"current_digest,omitempty"`
Error string `json:"error,omitempty"`
}
UpdateCheck represents the update check result in status JSON output
type UpdateCheckOutput ¶
type UpdateCheckOutput struct {
UpdateNeeded bool `json:"update_needed"`
Image string `json:"image"`
Device string `json:"device"`
CurrentDigest string `json:"current_digest,omitempty"`
NewDigest string `json:"new_digest,omitempty"`
Message string `json:"message,omitempty"`
}
UpdateCheckOutput represents the JSON output structure for the update --check command