github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/domain/entities/containers.go (about) 1 package entities 2 3 import ( 4 "io" 5 "net/url" 6 "os" 7 "time" 8 9 nettypes "github.com/containers/common/libnetwork/types" 10 "github.com/containers/image/v5/types" 11 "github.com/hanks177/podman/v4/libpod/define" 12 "github.com/hanks177/podman/v4/pkg/specgen" 13 "github.com/containers/storage/pkg/archive" 14 ) 15 16 // ContainerRunlabelOptions are the options to execute container-runlabel. 17 type ContainerRunlabelOptions struct { 18 // Authfile - path to an authentication file. 19 Authfile string 20 // CertDir - path to a directory containing TLS certifications and 21 // keys. 22 CertDir string 23 // Credentials - `user:password` to use when pulling an image. 24 Credentials string 25 // Display - do not execute but print the command. 26 Display bool 27 // Replace - replace an existing container with a new one from the 28 // image. 29 Replace bool 30 // Name - use this name when executing the runlabel container. 31 Name string 32 // Optional1 - fist optional parameter for install. 33 Optional1 string 34 // Optional2 - second optional parameter for install. 35 Optional2 string 36 // Optional3 - third optional parameter for install. 37 Optional3 string 38 // Pull - pull the specified image if it's not in the local storage. 39 Pull bool 40 // Quiet - suppress output when pulling images. 41 Quiet bool 42 // SignaturePolicy - path to a signature-policy file. 43 SignaturePolicy string 44 // SkipTLSVerify - skip HTTPS and certificate verifications when 45 // contacting registries. 46 SkipTLSVerify types.OptionalBool 47 } 48 49 // ContainerRunlabelReport contains the results from executing container-runlabel. 50 type ContainerRunlabelReport struct{} 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 Ignore bool 85 Latest bool 86 Timeout *uint 87 } 88 89 type StopReport struct { 90 Err error 91 Id string //nolint 92 RawInput string 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 RawInput string 115 } 116 117 type RestartOptions struct { 118 All bool 119 Latest bool 120 Running bool 121 Timeout *uint 122 } 123 124 type RestartReport struct { 125 Err error 126 Id string //nolint 127 } 128 129 type RmOptions struct { 130 All bool 131 Depend bool 132 Force bool 133 Ignore bool 134 Latest bool 135 Timeout *uint 136 Volumes bool 137 } 138 139 type ContainerInspectReport struct { 140 *define.InspectContainerData 141 } 142 143 type ContainerStatReport struct { 144 define.FileInfo 145 } 146 147 type CommitOptions struct { 148 Author string 149 Changes []string 150 Format string 151 ImageName string 152 IncludeVolumes bool 153 Message string 154 Pause bool 155 Quiet bool 156 Squash bool 157 Writer io.Writer 158 } 159 160 type CopyOptions struct { 161 // If used with ContainerCopyFromArchive and set to true 162 // it will change ownership of files from the source tar archive 163 // to the primary uid/gid of the destination container. 164 Chown bool 165 // Map to translate path names. 166 Rename map[string]string 167 // NoOverwriteDirNonDir when true prevents an existing directory or file from being overwritten 168 // by the other type 169 NoOverwriteDirNonDir bool 170 } 171 172 type CommitReport struct { 173 Id string //nolint 174 } 175 176 type ContainerExportOptions struct { 177 Output string 178 } 179 180 type CheckpointOptions struct { 181 All bool 182 Export string 183 CreateImage string 184 IgnoreRootFS bool 185 IgnoreVolumes bool 186 Keep bool 187 Latest bool 188 LeaveRunning bool 189 TCPEstablished bool 190 PreCheckPoint bool 191 WithPrevious bool 192 Compression archive.Compression 193 PrintStats bool 194 FileLocks bool 195 } 196 197 type CheckpointReport struct { 198 Err error `json:"-"` 199 Id string `json:"Id` //nolint 200 RuntimeDuration int64 `json:"runtime_checkpoint_duration"` 201 CRIUStatistics *define.CRIUCheckpointRestoreStatistics `json:"criu_statistics"` 202 } 203 204 type RestoreOptions struct { 205 All bool 206 IgnoreRootFS bool 207 IgnoreVolumes bool 208 IgnoreStaticIP bool 209 IgnoreStaticMAC bool 210 Import string 211 CheckpointImage bool 212 Keep bool 213 Latest bool 214 Name string 215 TCPEstablished bool 216 ImportPrevious string 217 PublishPorts []string 218 Pod string 219 PrintStats bool 220 FileLocks bool 221 } 222 223 type RestoreReport struct { 224 Err error `json:"-"` 225 Id string `json:"Id` //nolint 226 RuntimeDuration int64 `json:"runtime_restore_duration"` 227 CRIUStatistics *define.CRIUCheckpointRestoreStatistics `json:"criu_statistics"` 228 } 229 230 type ContainerCreateReport struct { 231 Id string //nolint 232 } 233 234 // AttachOptions describes the cli and other values 235 // needed to perform an attach 236 type AttachOptions struct { 237 DetachKeys string 238 Latest bool 239 NoStdin bool 240 SigProxy bool 241 Stdin *os.File 242 Stdout *os.File 243 Stderr *os.File 244 } 245 246 // ContainerLogsOptions describes the options to extract container logs. 247 type ContainerLogsOptions struct { 248 // Show extra details provided to the logs. 249 Details bool 250 // Follow the log output. 251 Follow bool 252 // Display logs for the latest container only. Ignored on the remote client. 253 Latest bool 254 // Show container names in the output. 255 Names bool 256 // Show logs since this timestamp. 257 Since time.Time 258 // Show logs until this timestamp. 259 Until time.Time 260 // Number of lines to display at the end of the output. 261 Tail int64 262 // Show timestamps in the logs. 263 Timestamps bool 264 // Show different colors in the logs. 265 Colors bool 266 // Write the stdout to this Writer. 267 StdoutWriter io.Writer 268 // Write the stderr to this Writer. 269 StderrWriter io.Writer 270 } 271 272 // ExecOptions describes the cli values to exec into 273 // a container 274 type ExecOptions struct { 275 Cmd []string 276 DetachKeys string 277 Envs map[string]string 278 Interactive bool 279 Latest bool 280 PreserveFDs uint 281 Privileged bool 282 Tty bool 283 User string 284 WorkDir string 285 } 286 287 // ContainerExistsOptions describes the cli values to check if a container exists 288 type ContainerExistsOptions struct { 289 External bool 290 } 291 292 // ContainerStartOptions describes the val from the 293 // CLI needed to start a container 294 type ContainerStartOptions struct { 295 Filters map[string][]string 296 All bool 297 Attach bool 298 DetachKeys string 299 Interactive bool 300 Latest bool 301 SigProxy bool 302 Stdout *os.File 303 Stderr *os.File 304 Stdin *os.File 305 } 306 307 // ContainerStartReport describes the response from starting 308 // containers from the cli 309 type ContainerStartReport struct { 310 Id string //nolint 311 RawInput string 312 Err error 313 ExitCode int 314 } 315 316 // ContainerListOptions describes the CLI options 317 // for listing containers 318 type ContainerListOptions struct { 319 All bool 320 Filters map[string][]string 321 Format string 322 Last int 323 Latest bool 324 Namespace bool 325 Pod bool 326 Quiet bool 327 Size bool 328 External bool 329 Sort string 330 Sync bool 331 Watch uint 332 } 333 334 // ContainerRunOptions describes the options needed 335 // to run a container from the CLI 336 type ContainerRunOptions struct { 337 CIDFile string 338 Detach bool 339 DetachKeys string 340 ErrorStream *os.File 341 InputStream *os.File 342 OutputStream *os.File 343 PreserveFDs uint 344 Rm bool 345 SigProxy bool 346 Spec *specgen.SpecGenerator 347 Passwd bool 348 } 349 350 // ContainerRunReport describes the results of running 351 // a container 352 type ContainerRunReport struct { 353 ExitCode int 354 Id string //nolint 355 } 356 357 // ContainerCleanupOptions are the CLI values for the 358 // cleanup command 359 type ContainerCleanupOptions struct { 360 All bool 361 Exec string 362 Latest bool 363 Remove bool 364 RemoveImage bool 365 } 366 367 // ContainerCleanupReport describes the response from a 368 // container cleanup 369 type ContainerCleanupReport struct { 370 CleanErr error 371 Id string //nolint 372 RmErr error 373 RmiErr error 374 } 375 376 // ContainerInitOptions describes input options 377 // for the container init cli 378 type ContainerInitOptions struct { 379 All bool 380 Latest bool 381 } 382 383 // ContainerInitReport describes the results of a 384 // container init 385 type ContainerInitReport struct { 386 Err error 387 Id string //nolint 388 } 389 390 // ContainerMountOptions describes the input values for mounting containers 391 // in the CLI 392 type ContainerMountOptions struct { 393 All bool 394 Format string 395 Latest bool 396 NoTruncate bool 397 } 398 399 // ContainerUnmountOptions are the options from the cli for unmounting 400 type ContainerUnmountOptions struct { 401 All bool 402 Force bool 403 Latest bool 404 } 405 406 // ContainerMountReport describes the response from container mount 407 type ContainerMountReport struct { 408 Err error 409 Id string //nolint 410 Name string 411 Path string 412 } 413 414 // ContainerUnmountReport describes the response from umounting a container 415 type ContainerUnmountReport struct { 416 Err error 417 Id string //nolint 418 } 419 420 // ContainerPruneOptions describes the options needed 421 // to prune a container from the CLI 422 type ContainerPruneOptions struct { 423 Filters url.Values `json:"filters" schema:"filters"` 424 } 425 426 // ContainerPortOptions describes the options to obtain 427 // port information on containers 428 type ContainerPortOptions struct { 429 All bool 430 Latest bool 431 } 432 433 // ContainerPortReport describes the output needed for 434 // the CLI to output ports 435 type ContainerPortReport struct { 436 Id string //nolint 437 Ports []nettypes.PortMapping 438 } 439 440 // ContainerCpOptions describes input options for cp. 441 type ContainerCpOptions struct { 442 // Pause the container while copying. 443 Pause bool 444 // Extract the tarfile into the destination directory. 445 Extract bool 446 } 447 448 // ContainerStatsOptions describes input options for getting 449 // stats on containers 450 type ContainerStatsOptions struct { 451 // Operate on the latest known container. Only supported for local 452 // clients. 453 Latest bool 454 // Stream stats. 455 Stream bool 456 // Interval in seconds 457 Interval int 458 } 459 460 // ContainerStatsReport is used for streaming container stats. 461 type ContainerStatsReport struct { 462 // Error from reading stats. 463 Error error 464 // Results, set when there is no error. 465 Stats []define.ContainerStats 466 } 467 468 // ContainerRenameOptions describes input options for renaming a container. 469 type ContainerRenameOptions struct { 470 // NewName is the new name that will be given to the container. 471 NewName string 472 } 473 474 // ContainerCloneOptions contains options for cloning an existing continer 475 type ContainerCloneOptions struct { 476 ID string 477 Destroy bool 478 CreateOpts ContainerCreateOptions 479 Image string 480 RawImageName string 481 Run bool 482 Force bool 483 }