github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/pkg/domain/entities/containers.go (about)

     1  package entities
     2  
     3  import (
     4  	"io"
     5  	"net/url"
     6  	"os"
     7  	"time"
     8  
     9  	"github.com/containers/image/v5/types"
    10  	"github.com/containers/podman/v2/libpod/define"
    11  	"github.com/containers/podman/v2/pkg/specgen"
    12  	"github.com/cri-o/ocicni/pkg/ocicni"
    13  )
    14  
    15  // ContainerRunlabelOptions are the options to execute container-runlabel.
    16  type ContainerRunlabelOptions struct {
    17  	// Authfile - path to an authentication file.
    18  	Authfile string
    19  	// CertDir - path to a directory containing TLS certifications and
    20  	// keys.
    21  	CertDir string
    22  	// Credentials - `user:password` to use when pulling an image.
    23  	Credentials string
    24  	// Display - do not execute but print the command.
    25  	Display bool
    26  	// Replace - replace an existing container with a new one from the
    27  	// image.
    28  	Replace bool
    29  	// Name - use this name when executing the runlabel container.
    30  	Name string
    31  	// Optional1 - fist optional parameter for install.
    32  	Optional1 string
    33  	// Optional2 - second optional parameter for install.
    34  	Optional2 string
    35  	// Optional3 - third optional parameter for install.
    36  	Optional3 string
    37  	// Pull - pull the specified image if it's not in the local storage.
    38  	Pull bool
    39  	// Quiet - suppress output when pulling images.
    40  	Quiet bool
    41  	// SignaturePolicy - path to a signature-policy file.
    42  	SignaturePolicy string
    43  	// SkipTLSVerify - skip HTTPS and certificate verifications when
    44  	// contacting registries.
    45  	SkipTLSVerify types.OptionalBool
    46  }
    47  
    48  // ContainerRunlabelReport contains the results from executing container-runlabel.
    49  type ContainerRunlabelReport struct {
    50  }
    51  
    52  type WaitOptions struct {
    53  	Condition define.ContainerStatus
    54  	Interval  time.Duration
    55  	Latest    bool
    56  }
    57  
    58  type WaitReport struct {
    59  	Id       string //nolint
    60  	Error    error
    61  	ExitCode int32
    62  }
    63  
    64  type BoolReport struct {
    65  	Value bool
    66  }
    67  
    68  // StringSliceReport wraps a string slice.
    69  type StringSliceReport struct {
    70  	Value []string
    71  }
    72  
    73  type PauseUnPauseOptions struct {
    74  	All bool
    75  }
    76  
    77  type PauseUnpauseReport struct {
    78  	Err error
    79  	Id  string //nolint
    80  }
    81  
    82  type StopOptions struct {
    83  	All      bool
    84  	CIDFiles []string
    85  	Ignore   bool
    86  	Latest   bool
    87  	Timeout  *uint
    88  }
    89  
    90  type StopReport struct {
    91  	Err error
    92  	Id  string //nolint
    93  }
    94  
    95  type TopOptions struct {
    96  	// CLI flags.
    97  	ListDescriptors bool
    98  	Latest          bool
    99  
   100  	// Options for the API.
   101  	Descriptors []string
   102  	NameOrID    string
   103  }
   104  
   105  type KillOptions struct {
   106  	All    bool
   107  	Latest bool
   108  	Signal string
   109  }
   110  
   111  type KillReport struct {
   112  	Err error
   113  	Id  string //nolint
   114  }
   115  
   116  type RestartOptions struct {
   117  	All     bool
   118  	Latest  bool
   119  	Running bool
   120  	Timeout *uint
   121  }
   122  
   123  type RestartReport struct {
   124  	Err error
   125  	Id  string //nolint
   126  }
   127  
   128  type RmOptions struct {
   129  	All      bool
   130  	CIDFiles []string
   131  	Force    bool
   132  	Ignore   bool
   133  	Latest   bool
   134  	Volumes  bool
   135  }
   136  
   137  type RmReport struct {
   138  	Err error
   139  	Id  string //nolint
   140  }
   141  
   142  type ContainerInspectReport struct {
   143  	*define.InspectContainerData
   144  }
   145  
   146  type CommitOptions struct {
   147  	Author         string
   148  	Changes        []string
   149  	Format         string
   150  	ImageName      string
   151  	IncludeVolumes bool
   152  	Message        string
   153  	Pause          bool
   154  	Quiet          bool
   155  	Writer         io.Writer
   156  }
   157  
   158  type CommitReport struct {
   159  	Id string //nolint
   160  }
   161  
   162  type ContainerExportOptions struct {
   163  	Output string
   164  }
   165  
   166  type CheckpointOptions struct {
   167  	All            bool
   168  	Export         string
   169  	IgnoreRootFS   bool
   170  	Keep           bool
   171  	Latest         bool
   172  	LeaveRunning   bool
   173  	TCPEstablished bool
   174  }
   175  
   176  type CheckpointReport struct {
   177  	Err error
   178  	Id  string //nolint
   179  }
   180  
   181  type RestoreOptions struct {
   182  	All             bool
   183  	IgnoreRootFS    bool
   184  	IgnoreStaticIP  bool
   185  	IgnoreStaticMAC bool
   186  	Import          string
   187  	Keep            bool
   188  	Latest          bool
   189  	Name            string
   190  	TCPEstablished  bool
   191  }
   192  
   193  type RestoreReport struct {
   194  	Err error
   195  	Id  string //nolint
   196  }
   197  
   198  type ContainerCreateReport struct {
   199  	Id string //nolint
   200  }
   201  
   202  // AttachOptions describes the cli and other values
   203  // needed to perform an attach
   204  type AttachOptions struct {
   205  	DetachKeys string
   206  	Latest     bool
   207  	NoStdin    bool
   208  	SigProxy   bool
   209  	Stdin      *os.File
   210  	Stdout     *os.File
   211  	Stderr     *os.File
   212  }
   213  
   214  // ContainerLogsOptions describes the options to extract container logs.
   215  type ContainerLogsOptions struct {
   216  	// Show extra details provided to the logs.
   217  	Details bool
   218  	// Follow the log output.
   219  	Follow bool
   220  	// Display logs for the latest container only. Ignored on the remote client.
   221  	Latest bool
   222  	// Show container names in the output.
   223  	Names bool
   224  	// Show logs since this timestamp.
   225  	Since time.Time
   226  	// Number of lines to display at the end of the output.
   227  	Tail int64
   228  	// Show timestamps in the logs.
   229  	Timestamps bool
   230  	// Write the logs to Writer.
   231  	Writer io.Writer
   232  }
   233  
   234  // ExecOptions describes the cli values to exec into
   235  // a container
   236  type ExecOptions struct {
   237  	Cmd         []string
   238  	DetachKeys  string
   239  	Envs        map[string]string
   240  	Interactive bool
   241  	Latest      bool
   242  	PreserveFDs uint
   243  	Privileged  bool
   244  	Tty         bool
   245  	User        string
   246  	WorkDir     string
   247  }
   248  
   249  // ContainerExistsOptions describes the cli values to check if a container exists
   250  type ContainerExistsOptions struct {
   251  	External bool
   252  }
   253  
   254  // ContainerStartOptions describes the val from the
   255  // CLI needed to start a container
   256  type ContainerStartOptions struct {
   257  	Attach      bool
   258  	DetachKeys  string
   259  	Interactive bool
   260  	Latest      bool
   261  	SigProxy    bool
   262  	Stdout      *os.File
   263  	Stderr      *os.File
   264  	Stdin       *os.File
   265  }
   266  
   267  // ContainerStartReport describes the response from starting
   268  // containers from the cli
   269  type ContainerStartReport struct {
   270  	Id       string //nolint
   271  	RawInput string
   272  	Err      error
   273  	ExitCode int
   274  }
   275  
   276  // ContainerListOptions describes the CLI options
   277  // for listing containers
   278  type ContainerListOptions struct {
   279  	All       bool
   280  	Filters   map[string][]string
   281  	Format    string
   282  	Last      int
   283  	Latest    bool
   284  	Namespace bool
   285  	Pod       bool
   286  	Quiet     bool
   287  	Size      bool
   288  	Sort      string
   289  	Storage   bool
   290  	Sync      bool
   291  	Watch     uint
   292  }
   293  
   294  // ContainerRunOptions describes the options needed
   295  // to run a container from the CLI
   296  type ContainerRunOptions struct {
   297  	CIDFile      string
   298  	Detach       bool
   299  	DetachKeys   string
   300  	ErrorStream  *os.File
   301  	InputStream  *os.File
   302  	OutputStream *os.File
   303  	PreserveFDs  uint
   304  	Rm           bool
   305  	SigProxy     bool
   306  	Spec         *specgen.SpecGenerator
   307  }
   308  
   309  // ContainerRunReport describes the results of running
   310  // a container
   311  type ContainerRunReport struct {
   312  	ExitCode int
   313  	Id       string //nolint
   314  }
   315  
   316  // ContainerCleanupOptions are the CLI values for the
   317  // cleanup command
   318  type ContainerCleanupOptions struct {
   319  	All         bool
   320  	Exec        string
   321  	Latest      bool
   322  	Remove      bool
   323  	RemoveImage bool
   324  }
   325  
   326  // ContainerCleanupReport describes the response from a
   327  // container cleanup
   328  type ContainerCleanupReport struct {
   329  	CleanErr error
   330  	Id       string //nolint
   331  	RmErr    error
   332  	RmiErr   error
   333  }
   334  
   335  // ContainerInitOptions describes input options
   336  // for the container init cli
   337  type ContainerInitOptions struct {
   338  	All    bool
   339  	Latest bool
   340  }
   341  
   342  // ContainerInitReport describes the results of a
   343  // container init
   344  type ContainerInitReport struct {
   345  	Err error
   346  	Id  string //nolint
   347  }
   348  
   349  //ContainerMountOptions describes the input values for mounting containers
   350  // in the CLI
   351  type ContainerMountOptions struct {
   352  	All        bool
   353  	Format     string
   354  	Latest     bool
   355  	NoTruncate bool
   356  }
   357  
   358  // ContainerUnmountOptions are the options from the cli for unmounting
   359  type ContainerUnmountOptions struct {
   360  	All    bool
   361  	Force  bool
   362  	Latest bool
   363  }
   364  
   365  // ContainerMountReport describes the response from container mount
   366  type ContainerMountReport struct {
   367  	Err  error
   368  	Id   string //nolint
   369  	Name string
   370  	Path string
   371  }
   372  
   373  // ContainerUnmountReport describes the response from umounting a container
   374  type ContainerUnmountReport struct {
   375  	Err error
   376  	Id  string //nolint
   377  }
   378  
   379  // ContainerPruneOptions describes the options needed
   380  // to prune a container from the CLI
   381  type ContainerPruneOptions struct {
   382  	Filters url.Values `json:"filters" schema:"filters"`
   383  }
   384  
   385  // ContainerPruneReport describes the results after pruning the
   386  // stopped containers.
   387  type ContainerPruneReport struct {
   388  	ID  map[string]int64
   389  	Err map[string]error
   390  }
   391  
   392  // ContainerPortOptions describes the options to obtain
   393  // port information on containers
   394  type ContainerPortOptions struct {
   395  	All    bool
   396  	Latest bool
   397  }
   398  
   399  // ContainerPortReport describes the output needed for
   400  // the CLI to output ports
   401  type ContainerPortReport struct {
   402  	Id    string //nolint
   403  	Ports []ocicni.PortMapping
   404  }
   405  
   406  // ContainerCpOptions describes input options for cp
   407  type ContainerCpOptions struct {
   408  	Pause   bool
   409  	Extract bool
   410  }
   411  
   412  // ContainerCpReport describes the output from a cp operation
   413  type ContainerCpReport struct {
   414  }
   415  
   416  // ContainerStatsOptions describes input options for getting
   417  // stats on containers
   418  type ContainerStatsOptions struct {
   419  	// Operate on the latest known container.  Only supported for local
   420  	// clients.
   421  	Latest bool
   422  	// Stream stats.
   423  	Stream bool
   424  }
   425  
   426  // ContainerStatsReport is used for streaming container stats.
   427  type ContainerStatsReport struct {
   428  	// Error from reading stats.
   429  	Error error
   430  	// Results, set when there is no error.
   431  	Stats []define.ContainerStats
   432  }