gsi

package module
v0.0.0-...-2635a03 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SafeJSON

func SafeJSON(p interface{}, indent bool) string

safeJSON returns a string after marshalling the supplied parameter into JSON. Accepts an optional argument to trigger pretty/indented formatting of the JSON string

func SafeYAML

func SafeYAML(p interface{}) string

safeYAML returns a string after marshalling the supplied parameter into YAML

Types

type CPU

type CPU struct {
	Vendor  string `json:"vendor"`
	Model   string `json:"model"`
	Cpus    uint   `json:"cpus"`    // number of physical CPUs
	Cores   uint   `json:"cores"`   // number of physical CPU cores
	Threads uint   `json:"threads"` // number of logical (HT) CPU cores
}

CPU information.

func (*CPU) JSONString

func (i *CPU) JSONString(indent bool) string

func (*CPU) YAMLString

func (i *CPU) YAMLString() string

type Memory

type Memory struct {
	Total uint64 `json:"total"`
}

Memory information.

func (*Memory) JSONString

func (i *Memory) JSONString(indent bool) string

func (*Memory) YAMLString

func (i *Memory) YAMLString() string

type Network

type Network struct {
	NetworkInferface []NetworkInferface `json:"network_inferface"`
	NetworkDevice    []NetworkDevice    `json:"network_device"`
}

func (*Network) JSONString

func (i *Network) JSONString(indent bool) string

func (*Network) YAMLString

func (i *Network) YAMLString() string

type NetworkDevice

type NetworkDevice struct {
	Name       string  `json:"name"`
	Driver     string  `json:"driver"`
	MacAddress string  `json:"mac_address"`
	PCIAddress *string `json:"pci_address,omitempty"`
	Speed      string  `json:"speed"`
	Duplex     string  `json:"duplex"`
}

type NetworkInferface

type NetworkInferface struct {
	Name       string   `json:"name"`
	MTU        int      `json:"mtu"`
	MacAddress string   `json:"mac_address"`
	Flags      []string `json:"flags"`
	IpAddress  []string `json:"ip_address"`
}

type OS

type OS struct {
	Name         string `json:"name"`
	Vendor       string `json:"vendor"`
	Version      string `json:"version"`
	Architecture string `json:"architecture"`
	Kernel       string `json:"kernel"`
}

OS information.

func (*OS) JSONString

func (i *OS) JSONString(indent bool) string

func (*OS) YAMLString

func (i *OS) YAMLString() string

type SystemInfo

type SystemInfo struct {
	OS      *OS      `json:"os"`
	CPU     *CPU     `json:"cpu"`
	Memory  *Memory  `json:"memory"`
	Network *Network `json:"network"`
}

func GetSystemInfo

func GetSystemInfo() (*SystemInfo, error)

func (*SystemInfo) JSONString

func (i *SystemInfo) JSONString(indent bool) string

JSONString returns a string with the host information formatted as JSON under a top-level "host:" key

func (*SystemInfo) YAMLString

func (i *SystemInfo) YAMLString() string

YAMLString returns a string with the host information formatted as YAML under a top-level "host:" key

Jump to

Keyboard shortcuts

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