github.com/containers/podman/v4@v4.9.4/libpod/define/info.go (about)

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