github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/libpod/define/info.go (about)

     1  package define
     2  
     3  import (
     4  	"github.com/containers/storage/pkg/idtools"
     5  )
     6  
     7  // Info is the overall struct that describes the host system
     8  // running libpod/podman
     9  type Info struct {
    10  	Host       *HostInfo              `json:"host"`
    11  	Store      *StoreInfo             `json:"store"`
    12  	Registries map[string]interface{} `json:"registries"`
    13  	Plugins    Plugins                `json:"plugins"`
    14  	Version    Version                `json:"version"`
    15  }
    16  
    17  // SecurityInfo describes the libpod host
    18  type SecurityInfo struct {
    19  	AppArmorEnabled     bool   `json:"apparmorEnabled"`
    20  	DefaultCapabilities string `json:"capabilities"`
    21  	Rootless            bool   `json:"rootless"`
    22  	SECCOMPEnabled      bool   `json:"seccompEnabled"`
    23  	SECCOMPProfilePath  string `json:"seccompProfilePath"`
    24  	SELinuxEnabled      bool   `json:"selinuxEnabled"`
    25  }
    26  
    27  // HostInfo describes the libpod host
    28  type HostInfo struct {
    29  	Arch              string           `json:"arch"`
    30  	BuildahVersion    string           `json:"buildahVersion"`
    31  	CgroupManager     string           `json:"cgroupManager"`
    32  	CgroupsVersion    string           `json:"cgroupVersion"`
    33  	CgroupControllers []string         `json:"cgroupControllers"`
    34  	Conmon            *ConmonInfo      `json:"conmon"`
    35  	CPUs              int              `json:"cpus"`
    36  	CPUUtilization    *CPUUsage        `json:"cpuUtilization"`
    37  	Distribution      DistributionInfo `json:"distribution"`
    38  	EventLogger       string           `json:"eventLogger"`
    39  	Hostname          string           `json:"hostname"`
    40  	IDMappings        IDMappings       `json:"idMappings,omitempty"`
    41  	Kernel            string           `json:"kernel"`
    42  	LogDriver         string           `json:"logDriver"`
    43  	MemFree           int64            `json:"memFree"`
    44  	MemTotal          int64            `json:"memTotal"`
    45  	NetworkBackend    string           `json:"networkBackend"`
    46  	OCIRuntime        *OCIRuntimeInfo  `json:"ociRuntime"`
    47  	OS                string           `json:"os"`
    48  	// RemoteSocket returns the UNIX domain socket the Podman service is listening on
    49  	RemoteSocket *RemoteSocket          `json:"remoteSocket,omitempty"`
    50  	RuntimeInfo  map[string]interface{} `json:"runtimeInfo,omitempty"`
    51  	// ServiceIsRemote is true when the podman/libpod service is remote to the client
    52  	ServiceIsRemote bool         `json:"serviceIsRemote"`
    53  	Security        SecurityInfo `json:"security"`
    54  	Slirp4NetNS     SlirpInfo    `json:"slirp4netns,omitempty"`
    55  	SwapFree        int64        `json:"swapFree"`
    56  	SwapTotal       int64        `json:"swapTotal"`
    57  	Uptime          string       `json:"uptime"`
    58  	Linkmode        string       `json:"linkmode"`
    59  }
    60  
    61  // RemoteSocket describes information about the API socket
    62  type RemoteSocket struct {
    63  	Path   string `json:"path,omitempty"`
    64  	Exists bool   `json:"exists,omitempty"`
    65  }
    66  
    67  // SlirpInfo describes the slirp executable that is being used
    68  type SlirpInfo struct {
    69  	Executable string `json:"executable"`
    70  	Package    string `json:"package"`
    71  	Version    string `json:"version"`
    72  }
    73  
    74  // IDMappings describe the GID and UID mappings
    75  type IDMappings struct {
    76  	GIDMap []idtools.IDMap `json:"gidmap"`
    77  	UIDMap []idtools.IDMap `json:"uidmap"`
    78  }
    79  
    80  // DistributionInfo describes the host distribution for libpod
    81  type DistributionInfo struct {
    82  	Distribution string `json:"distribution"`
    83  	Variant      string `json:"variant,omitempty"`
    84  	Version      string `json:"version"`
    85  	Codename     string `json:"codename,omitempty"`
    86  }
    87  
    88  // ConmonInfo describes the conmon executable being used
    89  type ConmonInfo struct {
    90  	Package string `json:"package"`
    91  	Path    string `json:"path"`
    92  	Version string `json:"version"`
    93  }
    94  
    95  // OCIRuntimeInfo describes the runtime (crun or runc) being
    96  // used with podman
    97  type OCIRuntimeInfo struct {
    98  	Name    string `json:"name"`
    99  	Package string `json:"package"`
   100  	Path    string `json:"path"`
   101  	Version string `json:"version"`
   102  }
   103  
   104  // StoreInfo describes the container storage and its
   105  // attributes
   106  type StoreInfo struct {
   107  	ConfigFile      string                 `json:"configFile"`
   108  	ContainerStore  ContainerStore         `json:"containerStore"`
   109  	GraphDriverName string                 `json:"graphDriverName"`
   110  	GraphOptions    map[string]interface{} `json:"graphOptions"`
   111  	GraphRoot       string                 `json:"graphRoot"`
   112  	// GraphRootAllocated is how much space the graphroot has in bytes
   113  	GraphRootAllocated uint64 `json:"graphRootAllocated"`
   114  	// GraphRootUsed is how much of graphroot is used in bytes
   115  	GraphRootUsed   uint64            `json:"graphRootUsed"`
   116  	GraphStatus     map[string]string `json:"graphStatus"`
   117  	ImageCopyTmpDir string            `json:"imageCopyTmpDir"`
   118  	ImageStore      ImageStore        `json:"imageStore"`
   119  	RunRoot         string            `json:"runRoot"`
   120  	VolumePath      string            `json:"volumePath"`
   121  }
   122  
   123  // ImageStore describes the image store.  Right now only the number
   124  // of images present
   125  type ImageStore struct {
   126  	Number int `json:"number"`
   127  }
   128  
   129  // ContainerStore describes the quantity of containers in the
   130  // store by status
   131  type ContainerStore struct {
   132  	Number  int `json:"number"`
   133  	Paused  int `json:"paused"`
   134  	Running int `json:"running"`
   135  	Stopped int `json:"stopped"`
   136  }
   137  
   138  type Plugins struct {
   139  	Volume  []string `json:"volume"`
   140  	Network []string `json:"network"`
   141  	Log     []string `json:"log"`
   142  	// Authorization is provided for compatibility, will always be nil as Podman has no daemon
   143  	Authorization []string `json:"authorization"`
   144  }
   145  
   146  type CPUUsage struct {
   147  	UserPercent   float64 `json:"userPercent"`
   148  	SystemPercent float64 `json:"systemPercent"`
   149  	IdlePercent   float64 `json:"idlePercent"`
   150  }