github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/cmd/podman/cliconfig/config.go (about)

     1  package cliconfig
     2  
     3  import (
     4  	"net"
     5  	"os"
     6  
     7  	"github.com/containers/common/pkg/config"
     8  	"github.com/sirupsen/logrus"
     9  	"github.com/spf13/cobra"
    10  )
    11  
    12  type PodmanCommand struct {
    13  	*cobra.Command
    14  	InputArgs   []string
    15  	GlobalFlags MainFlags
    16  	Remote      bool
    17  }
    18  
    19  type MainFlags struct {
    20  	CGroupManager     string
    21  	CniConfigDir      string
    22  	ConmonPath        string
    23  	DefaultMountsFile string
    24  	EventsBackend     string
    25  	HooksDir          []string
    26  	MaxWorks          int
    27  	Namespace         string
    28  	Root              string
    29  	Runroot           string
    30  	Runtime           string
    31  	StorageDriver     string
    32  	StorageOpts       []string
    33  	Syslog            bool
    34  	Trace             bool
    35  	NetworkCmdPath    string
    36  
    37  	Config     string
    38  	CpuProfile string
    39  	LogLevel   string
    40  	TmpDir     string
    41  
    42  	RemoteUserName       string
    43  	RemoteHost           string
    44  	VarlinkAddress       string
    45  	ConnectionName       string
    46  	RemoteConfigFilePath string
    47  	Port                 int
    48  	IdentityFile         string
    49  	IgnoreHosts          bool
    50  }
    51  
    52  type AttachValues struct {
    53  	PodmanCommand
    54  	DetachKeys string
    55  	Latest     bool
    56  	NoStdin    bool
    57  	SigProxy   bool
    58  }
    59  
    60  type AutoUpdateValues struct {
    61  	PodmanCommand
    62  }
    63  
    64  type ImagesValues struct {
    65  	PodmanCommand
    66  	All       bool
    67  	Digests   bool
    68  	Filter    []string
    69  	Format    string
    70  	Noheading bool
    71  	NoTrunc   bool
    72  	Quiet     bool
    73  	Sort      string
    74  	History   bool
    75  }
    76  
    77  type EventValues struct {
    78  	PodmanCommand
    79  	Filter []string
    80  	Format string
    81  	Since  string
    82  	Stream bool
    83  	Until  string
    84  }
    85  
    86  type TagValues struct {
    87  	PodmanCommand
    88  }
    89  
    90  type TreeValues struct {
    91  	PodmanCommand
    92  	WhatRequires bool
    93  }
    94  
    95  type WaitValues struct {
    96  	PodmanCommand
    97  	Interval uint
    98  	Latest   bool
    99  }
   100  
   101  type CheckpointValues struct {
   102  	PodmanCommand
   103  	Keep           bool
   104  	LeaveRunning   bool
   105  	TcpEstablished bool
   106  	All            bool
   107  	Latest         bool
   108  	Export         string
   109  	IgnoreRootfs   bool
   110  }
   111  
   112  type CommitValues struct {
   113  	PodmanCommand
   114  	Change         []string
   115  	Format         string
   116  	Message        string
   117  	Author         string
   118  	Pause          bool
   119  	Quiet          bool
   120  	IncludeVolumes bool
   121  	ImageIDFile    string
   122  }
   123  
   124  type ContainersPrune struct {
   125  	PodmanCommand
   126  }
   127  
   128  type DiffValues struct {
   129  	PodmanCommand
   130  	Archive bool
   131  	Format  string
   132  	Latest  bool
   133  }
   134  
   135  type ExecValues struct {
   136  	PodmanCommand
   137  	DetachKeys  string
   138  	Env         []string
   139  	EnvFile     []string
   140  	Privileged  bool
   141  	Interactive bool
   142  	Tty         bool
   143  	User        string
   144  	Latest      bool
   145  	Workdir     string
   146  	PreserveFDs int
   147  }
   148  
   149  type ImageExistsValues struct {
   150  	PodmanCommand
   151  }
   152  
   153  type ContainerExistsValues struct {
   154  	PodmanCommand
   155  }
   156  
   157  type PodExistsValues struct {
   158  	PodmanCommand
   159  }
   160  
   161  type ExportValues struct {
   162  	PodmanCommand
   163  	Output string
   164  }
   165  type GenerateKubeValues struct {
   166  	PodmanCommand
   167  	Service  bool
   168  	Filename string
   169  }
   170  
   171  type GenerateSystemdValues struct {
   172  	PodmanCommand
   173  	Name          bool
   174  	New           bool
   175  	Files         bool
   176  	RestartPolicy string
   177  	StopTimeout   uint
   178  }
   179  
   180  type HistoryValues struct {
   181  	PodmanCommand
   182  	Human   bool
   183  	NoTrunc bool
   184  	Quiet   bool
   185  	Format  string
   186  }
   187  type PruneImagesValues struct {
   188  	PodmanCommand
   189  	All    bool
   190  	Force  bool
   191  	Filter []string
   192  }
   193  
   194  type PruneContainersValues struct {
   195  	PodmanCommand
   196  	Force  bool
   197  	Filter []string
   198  }
   199  
   200  type PodPruneValues struct {
   201  	PodmanCommand
   202  	Force bool
   203  }
   204  
   205  type ImportValues struct {
   206  	PodmanCommand
   207  	Change  []string
   208  	Message string
   209  	Quiet   bool
   210  }
   211  
   212  type InfoValues struct {
   213  	PodmanCommand
   214  	Debug  bool
   215  	Format string
   216  }
   217  
   218  type InitValues struct {
   219  	PodmanCommand
   220  	All    bool
   221  	Latest bool
   222  }
   223  
   224  type InspectValues struct {
   225  	PodmanCommand
   226  	TypeObject string
   227  	Format     string
   228  	Size       bool
   229  	Latest     bool
   230  }
   231  
   232  type KillValues struct {
   233  	PodmanCommand
   234  	All    bool
   235  	Signal string
   236  	Latest bool
   237  }
   238  
   239  type LoadValues struct {
   240  	PodmanCommand
   241  	Input           string
   242  	Quiet           bool
   243  	SignaturePolicy string
   244  }
   245  
   246  type LoginValues struct {
   247  	PodmanCommand
   248  	Password      string
   249  	StdinPassword bool
   250  	Username      string
   251  	Authfile      string
   252  	CertDir       string
   253  	GetLogin      bool
   254  	TlsVerify     bool
   255  }
   256  
   257  type LogoutValues struct {
   258  	PodmanCommand
   259  	Authfile string
   260  	All      bool
   261  }
   262  
   263  type LogsValues struct {
   264  	PodmanCommand
   265  	Details    bool
   266  	Follow     bool
   267  	Since      string
   268  	Tail       int64
   269  	Timestamps bool
   270  	Latest     bool
   271  	UseName    bool
   272  }
   273  
   274  type MountValues struct {
   275  	PodmanCommand
   276  	All     bool
   277  	Format  string
   278  	NoTrunc bool
   279  	Latest  bool
   280  }
   281  
   282  type NetworkCreateValues struct {
   283  	PodmanCommand
   284  	Driver     string
   285  	DisableDNS bool
   286  	Gateway    net.IP
   287  	Internal   bool
   288  	IPamDriver string
   289  	IPRange    net.IPNet
   290  	IPV6       bool
   291  	Network    net.IPNet
   292  	MacVLAN    string
   293  }
   294  
   295  type NetworkListValues struct {
   296  	PodmanCommand
   297  	Filter []string
   298  	Quiet  bool
   299  }
   300  
   301  type NetworkRmValues struct {
   302  	PodmanCommand
   303  	Force bool
   304  }
   305  
   306  type NetworkInspectValues struct {
   307  	PodmanCommand
   308  }
   309  
   310  type PauseValues struct {
   311  	PodmanCommand
   312  	All bool
   313  }
   314  
   315  type HealthCheckValues struct {
   316  	PodmanCommand
   317  }
   318  
   319  type KubePlayValues struct {
   320  	PodmanCommand
   321  	Authfile           string
   322  	CertDir            string
   323  	Creds              string
   324  	Network            string
   325  	Quiet              bool
   326  	SignaturePolicy    string
   327  	TlsVerify          bool
   328  	SeccompProfileRoot string
   329  }
   330  
   331  type PodCreateValues struct {
   332  	PodmanCommand
   333  	CgroupParent string
   334  	Infra        bool
   335  	InfraImage   string
   336  	InfraCommand string
   337  	LabelFile    []string
   338  	Labels       []string
   339  	Name         string
   340  	Hostname     string
   341  	PodIDFile    string
   342  	Publish      []string
   343  	Share        string
   344  }
   345  
   346  type PodInspectValues struct {
   347  	PodmanCommand
   348  	Latest bool
   349  }
   350  
   351  type PodKillValues struct {
   352  	PodmanCommand
   353  	All    bool
   354  	Signal string
   355  	Latest bool
   356  }
   357  
   358  type PodPauseValues struct {
   359  	PodmanCommand
   360  	All    bool
   361  	Latest bool
   362  }
   363  
   364  type PodPsValues struct {
   365  	PodmanCommand
   366  	CtrNames  bool
   367  	CtrIDs    bool
   368  	CtrStatus bool
   369  	Filter    string
   370  	Format    string
   371  	Latest    bool
   372  	Namespace bool
   373  	NoTrunc   bool
   374  	Quiet     bool
   375  	Sort      string
   376  }
   377  
   378  type PodRestartValues struct {
   379  	PodmanCommand
   380  	All    bool
   381  	Latest bool
   382  }
   383  
   384  type PodRmValues struct {
   385  	PodmanCommand
   386  	All    bool
   387  	Ignore bool
   388  	Force  bool
   389  	Latest bool
   390  }
   391  
   392  type PodStartValues struct {
   393  	PodmanCommand
   394  	All    bool
   395  	Latest bool
   396  }
   397  type PodStatsValues struct {
   398  	PodmanCommand
   399  	All      bool
   400  	NoStream bool
   401  	NoReset  bool
   402  	Format   string
   403  	Latest   bool
   404  }
   405  
   406  type PodStopValues struct {
   407  	PodmanCommand
   408  	All     bool
   409  	Ignore  bool
   410  	Latest  bool
   411  	Timeout uint
   412  }
   413  
   414  type PodTopValues struct {
   415  	PodmanCommand
   416  	Latest          bool
   417  	ListDescriptors bool
   418  }
   419  type PodUnpauseValues struct {
   420  	PodmanCommand
   421  	All    bool
   422  	Latest bool
   423  }
   424  
   425  type PortValues struct {
   426  	PodmanCommand
   427  	All    bool
   428  	Latest bool
   429  }
   430  
   431  type PsValues struct {
   432  	PodmanCommand
   433  	All       bool
   434  	Filter    []string
   435  	Format    string
   436  	Last      int
   437  	Latest    bool
   438  	Namespace bool
   439  	NoTrunct  bool
   440  	Pod       bool
   441  	Quiet     bool
   442  	Size      bool
   443  	Sort      string
   444  	Sync      bool
   445  	Watch     uint
   446  }
   447  
   448  type PullValues struct {
   449  	PodmanCommand
   450  	AllTags         bool
   451  	Authfile        string
   452  	CertDir         string
   453  	Creds           string
   454  	OverrideArch    string
   455  	OverrideOS      string
   456  	Quiet           bool
   457  	SignaturePolicy string
   458  	TlsVerify       bool
   459  }
   460  
   461  type PushValues struct {
   462  	PodmanCommand
   463  	Authfile         string
   464  	CertDir          string
   465  	Compress         bool
   466  	Creds            string
   467  	Digestfile       string
   468  	Format           string
   469  	Quiet            bool
   470  	RemoveSignatures bool
   471  	SignBy           string
   472  	SignaturePolicy  string
   473  	TlsVerify        bool
   474  }
   475  
   476  type RefreshValues struct {
   477  	PodmanCommand
   478  }
   479  
   480  type RestartValues struct {
   481  	PodmanCommand
   482  	All        bool
   483  	AutoUpdate bool
   484  	Latest     bool
   485  	Running    bool
   486  	Timeout    uint
   487  }
   488  
   489  type RestoreValues struct {
   490  	PodmanCommand
   491  	All             bool
   492  	Keep            bool
   493  	Latest          bool
   494  	TcpEstablished  bool
   495  	Import          string
   496  	Name            string
   497  	IgnoreRootfs    bool
   498  	IgnoreStaticIP  bool
   499  	IgnoreStaticMAC bool
   500  }
   501  
   502  type RmValues struct {
   503  	PodmanCommand
   504  	All      bool
   505  	Force    bool
   506  	Ignore   bool
   507  	Latest   bool
   508  	Storage  bool
   509  	Volumes  bool
   510  	CIDFiles []string
   511  }
   512  
   513  type RmiValues struct {
   514  	PodmanCommand
   515  	All   bool
   516  	Force bool
   517  }
   518  
   519  type RunlabelValues struct {
   520  	PodmanCommand
   521  	Authfile        string
   522  	CertDir         string
   523  	Creds           string
   524  	Display         bool
   525  	Name            string
   526  	Opt1            string
   527  	Opt2            string
   528  	Opt3            string
   529  	Quiet           bool
   530  	Replace         bool
   531  	SignaturePolicy string
   532  	TlsVerify       bool
   533  }
   534  type SaveValues struct {
   535  	PodmanCommand
   536  	Compress bool
   537  	Format   string
   538  	Output   string
   539  	Quiet    bool
   540  }
   541  
   542  type SearchValues struct {
   543  	PodmanCommand
   544  	Authfile  string
   545  	Filter    []string
   546  	Format    string
   547  	Limit     int
   548  	NoTrunc   bool
   549  	TlsVerify bool
   550  }
   551  
   552  type TrustValues struct {
   553  	PodmanCommand
   554  }
   555  
   556  type SignValues struct {
   557  	PodmanCommand
   558  	Directory string
   559  	SignBy    string
   560  	CertDir   string
   561  }
   562  
   563  type StartValues struct {
   564  	PodmanCommand
   565  	Attach      bool
   566  	DetachKeys  string
   567  	Interactive bool
   568  	Latest      bool
   569  	SigProxy    bool
   570  }
   571  
   572  type StatsValues struct {
   573  	PodmanCommand
   574  	All      bool
   575  	Format   string
   576  	Latest   bool
   577  	NoReset  bool
   578  	NoStream bool
   579  }
   580  
   581  type StopValues struct {
   582  	PodmanCommand
   583  	All      bool
   584  	Ignore   bool
   585  	Latest   bool
   586  	Timeout  uint
   587  	CIDFiles []string
   588  }
   589  
   590  type TopValues struct {
   591  	PodmanCommand
   592  	Latest          bool
   593  	ListDescriptors bool
   594  }
   595  
   596  type UmountValues struct {
   597  	PodmanCommand
   598  	All    bool
   599  	Force  bool
   600  	Latest bool
   601  }
   602  
   603  type UnpauseValues struct {
   604  	PodmanCommand
   605  	All bool
   606  }
   607  
   608  type VarlinkValues struct {
   609  	PodmanCommand
   610  	Timeout int64
   611  }
   612  
   613  type ServiceValues struct {
   614  	PodmanCommand
   615  	Varlink bool
   616  	Timeout int64
   617  }
   618  
   619  type SetTrustValues struct {
   620  	PodmanCommand
   621  	PolicyPath  string
   622  	PubKeysFile []string
   623  	TrustType   string
   624  }
   625  
   626  type ShowTrustValues struct {
   627  	PodmanCommand
   628  	Json         bool
   629  	PolicyPath   string
   630  	Raw          bool
   631  	RegistryPath string
   632  }
   633  
   634  type VersionValues struct {
   635  	PodmanCommand
   636  	Format string
   637  }
   638  
   639  type VolumeCreateValues struct {
   640  	PodmanCommand
   641  	Driver string
   642  	Label  []string
   643  	Opt    []string
   644  }
   645  type VolumeInspectValues struct {
   646  	PodmanCommand
   647  	All    bool
   648  	Format string
   649  }
   650  
   651  type VolumeLsValues struct {
   652  	PodmanCommand
   653  	Filter string
   654  	Format string
   655  	Quiet  bool
   656  }
   657  
   658  type VolumePruneValues struct {
   659  	PodmanCommand
   660  	Force bool
   661  }
   662  
   663  type VolumeRmValues struct {
   664  	PodmanCommand
   665  	All   bool
   666  	Force bool
   667  }
   668  
   669  type CleanupValues struct {
   670  	PodmanCommand
   671  	All         bool
   672  	Latest      bool
   673  	Remove      bool
   674  	RemoveImage bool
   675  }
   676  
   677  type SystemPruneValues struct {
   678  	PodmanCommand
   679  	All    bool
   680  	Force  bool
   681  	Volume bool
   682  }
   683  
   684  type SystemResetValues struct {
   685  	PodmanCommand
   686  	Force bool
   687  }
   688  
   689  type SystemRenumberValues struct {
   690  	PodmanCommand
   691  }
   692  
   693  type SystemMigrateValues struct {
   694  	PodmanCommand
   695  	NewRuntime string
   696  }
   697  
   698  type SystemDfValues struct {
   699  	PodmanCommand
   700  	Verbose bool
   701  	Format  string
   702  }
   703  
   704  type UntagValues struct {
   705  	PodmanCommand
   706  }
   707  
   708  func GetDefaultConfig() *config.Config {
   709  	var err error
   710  	conf, err := config.NewConfig("")
   711  	if err != nil {
   712  		logrus.Errorf("Error loading container config %v\n", err)
   713  		os.Exit(1)
   714  	}
   715  	return conf
   716  }