github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/pkg/domain/entities/images.go (about) 1 package entities 2 3 import ( 4 "time" 5 6 "github.com/containers/common/pkg/config" 7 "github.com/containers/image/v5/manifest" 8 "github.com/containers/image/v5/types" 9 "github.com/containers/podman/v2/pkg/inspect" 10 "github.com/containers/podman/v2/pkg/trust" 11 docker "github.com/docker/docker/api/types" 12 "github.com/docker/docker/api/types/container" 13 "github.com/opencontainers/go-digest" 14 v1 "github.com/opencontainers/image-spec/specs-go/v1" 15 ) 16 17 type Image struct { 18 ID string `json:"Id"` 19 RepoTags []string `json:",omitempty"` 20 RepoDigests []string `json:",omitempty"` 21 Parent string `json:",omitempty"` 22 Comment string `json:",omitempty"` 23 Created string `json:",omitempty"` 24 Container string `json:",omitempty"` 25 ContainerConfig *container.Config `json:",omitempty"` 26 DockerVersion string `json:",omitempty"` 27 Author string `json:",omitempty"` 28 Config *container.Config `json:",omitempty"` 29 Architecture string `json:",omitempty"` 30 Variant string `json:",omitempty"` 31 Os string `json:",omitempty"` 32 OsVersion string `json:",omitempty"` 33 Size int64 `json:",omitempty"` 34 VirtualSize int64 `json:",omitempty"` 35 GraphDriver docker.GraphDriverData `json:",omitempty"` 36 RootFS docker.RootFS `json:",omitempty"` 37 Metadata docker.ImageMetadata `json:",omitempty"` 38 39 // Podman extensions 40 Digest digest.Digest `json:",omitempty"` 41 PodmanVersion string `json:",omitempty"` 42 ManifestType string `json:",omitempty"` 43 User string `json:",omitempty"` 44 History []v1.History `json:",omitempty"` 45 NamesHistory []string `json:",omitempty"` 46 HealthCheck *manifest.Schema2HealthConfig `json:",omitempty"` 47 } 48 49 func (i *Image) Id() string { // nolint 50 return i.ID 51 } 52 53 type ImageSummary struct { 54 ID string `json:"Id"` 55 ParentId string // nolint 56 RepoTags []string `json:",omitempty"` 57 Created int64 58 Size int64 `json:",omitempty"` 59 SharedSize int `json:",omitempty"` 60 VirtualSize int64 `json:",omitempty"` 61 Labels map[string]string `json:",omitempty"` 62 Containers int `json:",omitempty"` 63 ReadOnly bool `json:",omitempty"` 64 Dangling bool `json:",omitempty"` 65 66 // Podman extensions 67 Names []string `json:",omitempty"` 68 Digest string `json:",omitempty"` 69 Digests []string `json:",omitempty"` 70 ConfigDigest string `json:",omitempty"` 71 History []string `json:",omitempty"` 72 } 73 74 func (i *ImageSummary) Id() string { // nolint 75 return i.ID 76 } 77 78 func (i *ImageSummary) IsReadOnly() bool { 79 return i.ReadOnly 80 } 81 82 func (i *ImageSummary) IsDangling() bool { 83 return i.Dangling 84 } 85 86 // ImageRemoveOptions can be used to alter image removal. 87 type ImageRemoveOptions struct { 88 // All will remove all images. 89 All bool 90 // Foce will force image removal including containers using the images. 91 Force bool 92 } 93 94 // ImageRemoveResponse is the response for removing one or more image(s) from storage 95 // and images what was untagged vs actually removed. 96 type ImageRemoveReport struct { 97 // Deleted images. 98 Deleted []string `json:",omitempty"` 99 // Untagged images. Can be longer than Deleted. 100 Untagged []string `json:",omitempty"` 101 // ExitCode describes the exit codes as described in the `podman rmi` 102 // man page. 103 ExitCode int 104 } 105 106 type ImageHistoryOptions struct{} 107 108 type ImageHistoryLayer struct { 109 ID string `json:"id"` 110 Created time.Time `json:"created,omitempty"` 111 CreatedBy string `json:",omitempty"` 112 Tags []string `json:"tags,omitempty"` 113 Size int64 `json:"size"` 114 Comment string `json:"comment,omitempty"` 115 } 116 117 type ImageHistoryReport struct { 118 Layers []ImageHistoryLayer 119 } 120 121 // ImagePullOptions are the arguments for pulling images. 122 type ImagePullOptions struct { 123 // AllTags can be specified to pull all tags of an image. Note 124 // that this only works if the image does not include a tag. 125 AllTags bool 126 // Authfile is the path to the authentication file. Ignored for remote 127 // calls. 128 Authfile string 129 // CertDir is the path to certificate directories. Ignored for remote 130 // calls. 131 CertDir string 132 // Username for authenticating against the registry. 133 Username string 134 // Password for authenticating against the registry. 135 Password string 136 // OverrideArch will overwrite the local architecture for image pulls. 137 OverrideArch string 138 // OverrideOS will overwrite the local operating system (OS) for image 139 // pulls. 140 OverrideOS string 141 // OverrideVariant will overwrite the local variant for image pulls. 142 OverrideVariant string 143 // Quiet can be specified to suppress pull progress when pulling. Ignored 144 // for remote calls. 145 Quiet bool 146 // SignaturePolicy to use when pulling. Ignored for remote calls. 147 SignaturePolicy string 148 // SkipTLSVerify to skip HTTPS and certificate verification. 149 SkipTLSVerify types.OptionalBool 150 // PullPolicy whether to pull new image 151 PullPolicy config.PullPolicy 152 } 153 154 // ImagePullReport is the response from pulling one or more images. 155 type ImagePullReport struct { 156 // Stream used to provide output from c/image 157 Stream string `json:"stream,omitempty"` 158 // Error contains text of errors from c/image 159 Error string `json:"error,omitempty"` 160 // Images contains the ID's of the images pulled 161 Images []string `json:"images,omitempty"` 162 // ID contains image id (retained for backwards compatibility) 163 ID string `json:"id,omitempty"` 164 } 165 166 // ImagePushOptions are the arguments for pushing images. 167 type ImagePushOptions struct { 168 // Authfile is the path to the authentication file. Ignored for remote 169 // calls. 170 Authfile string 171 // CertDir is the path to certificate directories. Ignored for remote 172 // calls. 173 CertDir string 174 // Compress tarball image layers when pushing to a directory using the 'dir' 175 // transport. Default is same compression type as source. Ignored for remote 176 // calls. 177 Compress bool 178 // Username for authenticating against the registry. 179 Username string 180 // Password for authenticating against the registry. 181 Password string 182 // DigestFile, after copying the image, write the digest of the resulting 183 // image to the file. Ignored for remote calls. 184 DigestFile string 185 // Format is the Manifest type (oci, v2s1, or v2s2) to use when pushing an 186 // image using the 'dir' transport. Default is manifest type of source. 187 // Ignored for remote calls. 188 Format string 189 // Quiet can be specified to suppress pull progress when pulling. Ignored 190 // for remote calls. 191 Quiet bool 192 // RemoveSignatures, discard any pre-existing signatures in the image. 193 // Ignored for remote calls. 194 RemoveSignatures bool 195 // SignaturePolicy to use when pulling. Ignored for remote calls. 196 SignaturePolicy string 197 // SignBy adds a signature at the destination using the specified key. 198 // Ignored for remote calls. 199 SignBy string 200 // SkipTLSVerify to skip HTTPS and certificate verification. 201 SkipTLSVerify types.OptionalBool 202 } 203 204 // ImageSearchOptions are the arguments for searching images. 205 type ImageSearchOptions struct { 206 // Authfile is the path to the authentication file. Ignored for remote 207 // calls. 208 Authfile string 209 // Filters for the search results. 210 Filters []string 211 // Limit the number of results. 212 Limit int 213 // NoTrunc will not truncate the output. 214 NoTrunc bool 215 // SkipTLSVerify to skip HTTPS and certificate verification. 216 SkipTLSVerify types.OptionalBool 217 // ListTags search the available tags of the repository 218 ListTags bool 219 } 220 221 // ImageSearchReport is the response from searching images. 222 type ImageSearchReport struct { 223 // Index is the image index (e.g., "docker.io" or "quay.io") 224 Index string 225 // Name is the canoncical name of the image (e.g., "docker.io/library/alpine"). 226 Name string 227 // Description of the image. 228 Description string 229 // Stars is the number of stars of the image. 230 Stars int 231 // Official indicates if it's an official image. 232 Official string 233 // Automated indicates if the image was created by an automated build. 234 Automated string 235 // Tag is the repository tag 236 Tag string 237 } 238 239 // Image List Options 240 type ImageListOptions struct { 241 All bool `json:"all" schema:"all"` 242 Filter []string `json:"Filter,omitempty"` 243 } 244 245 type ImagePruneOptions struct { 246 All bool `json:"all" schema:"all"` 247 Filter []string `json:"filter" schema:"filter"` 248 } 249 250 type ImagePruneReport struct { 251 Report Report 252 Size int64 253 } 254 255 type ImageTagOptions struct{} 256 type ImageUntagOptions struct{} 257 258 // ImageInspectReport is the data when inspecting an image. 259 type ImageInspectReport struct { 260 *inspect.ImageData 261 } 262 263 type ImageLoadOptions struct { 264 Name string 265 Tag string 266 Input string 267 Quiet bool 268 SignaturePolicy string 269 } 270 271 type ImageLoadReport struct { 272 Names []string 273 } 274 275 type ImageImportOptions struct { 276 Changes []string 277 Message string 278 Quiet bool 279 Reference string 280 SignaturePolicy string 281 Source string 282 SourceIsURL bool 283 } 284 285 type ImageImportReport struct { 286 Id string // nolint 287 } 288 289 // ImageSaveOptions provide options for saving images. 290 type ImageSaveOptions struct { 291 // Compress layers when saving to a directory. 292 Compress bool 293 // Format of saving the image: oci-archive, oci-dir (directory with oci 294 // manifest type), docker-archive, docker-dir (directory with v2s2 295 // manifest type). 296 Format string 297 // MultiImageArchive denotes if the created archive shall include more 298 // than one image. Additional tags will be interpreted as references 299 // to images which are added to the archive. 300 MultiImageArchive bool 301 // Output - write image to the specified path. 302 Output string 303 // Do not save the signature from the source image 304 RemoveSignatures bool 305 // Quiet - suppress output when copying images 306 Quiet bool 307 } 308 309 // ImageTreeOptions provides options for ImageEngine.Tree() 310 type ImageTreeOptions struct { 311 WhatRequires bool // Show all child images and layers of the specified image 312 } 313 314 // ImageTreeReport provides results from ImageEngine.Tree() 315 type ImageTreeReport struct { 316 Tree string // TODO: Refactor move presentation work out of server 317 } 318 319 // ShowTrustOptions are the cli options for showing trust 320 type ShowTrustOptions struct { 321 JSON bool 322 PolicyPath string 323 Raw bool 324 RegistryPath string 325 } 326 327 // ShowTrustReport describes the results of show trust 328 type ShowTrustReport struct { 329 Raw []byte 330 SystemRegistriesDirPath string 331 JSONOutput []byte 332 Policies []*trust.Policy 333 } 334 335 // SetTrustOptions describes the CLI options for setting trust 336 type SetTrustOptions struct { 337 PolicyPath string 338 PubKeysFile []string 339 Type string 340 } 341 342 // SignOptions describes input options for the CLI signing 343 type SignOptions struct { 344 Directory string 345 SignBy string 346 CertDir string 347 } 348 349 // SignReport describes the result of signing 350 type SignReport struct{} 351 352 // ImageMountOptions describes the input values for mounting images 353 // in the CLI 354 type ImageMountOptions struct { 355 All bool 356 Format string 357 } 358 359 // ImageUnmountOptions are the options from the cli for unmounting 360 type ImageUnmountOptions struct { 361 All bool 362 Force bool 363 } 364 365 // ImageMountReport describes the response from image mount 366 type ImageMountReport struct { 367 Err error 368 Id string // nolint 369 Name string 370 Repositories []string 371 Path string 372 } 373 374 // ImageUnmountReport describes the response from umounting an image 375 type ImageUnmountReport struct { 376 Err error 377 Id string // nolint 378 }