github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/pkg/domain/entities/types.go (about) 1 package entities 2 3 import ( 4 "errors" 5 "net" 6 7 "github.com/containers/buildah/imagebuildah" 8 "github.com/containers/podman/v2/libpod/events" 9 "github.com/containers/podman/v2/pkg/specgen" 10 "github.com/containers/storage/pkg/archive" 11 ) 12 13 type Container struct { 14 IDOrNamed 15 } 16 17 type Volume struct { 18 Identifier 19 } 20 21 type Report struct { 22 Id []string //nolint 23 Err map[string]error 24 } 25 26 type PodDeleteReport struct{ Report } 27 28 type VolumeDeleteOptions struct{} 29 type VolumeDeleteReport struct{ Report } 30 31 // NetOptions reflect the shared network options between 32 // pods and containers 33 type NetOptions struct { 34 AddHosts []string 35 Aliases []string 36 CNINetworks []string 37 UseImageResolvConf bool 38 DNSOptions []string 39 DNSSearch []string 40 DNSServers []net.IP 41 Network specgen.Namespace 42 NoHosts bool 43 PublishPorts []specgen.PortMapping 44 StaticIP *net.IP 45 StaticMAC *net.HardwareAddr 46 // NetworkOptions are additional options for each network 47 NetworkOptions map[string][]string 48 } 49 50 // All CLI inspect commands and inspect sub-commands use the same options 51 type InspectOptions struct { 52 // Format - change the output to JSON or a Go template. 53 Format string `json:",omitempty"` 54 // Latest - inspect the latest container Podman is aware of. 55 Latest bool `json:",omitempty"` 56 // Size (containers only) - display total file size. 57 Size bool `json:",omitempty"` 58 // Type -- return JSON for specified type. 59 Type string `json:",omitempty"` 60 // All -- inspect all 61 All bool `json:",omitempty"` 62 } 63 64 // All API and CLI diff commands and diff sub-commands use the same options 65 type DiffOptions struct { 66 Format string `json:",omitempty"` // CLI only 67 Latest bool `json:",omitempty"` // API and CLI, only supported by containers 68 Archive bool `json:",omitempty"` // CLI only 69 } 70 71 // DiffReport provides changes for object 72 type DiffReport struct { 73 Changes []archive.Change 74 } 75 76 type EventsOptions struct { 77 FromStart bool 78 EventChan chan *events.Event 79 Filter []string 80 Stream bool 81 Since string 82 Until string 83 } 84 85 // ContainerCreateResponse is the response struct for creating a container 86 type ContainerCreateResponse struct { 87 // ID of the container created 88 ID string `json:"Id"` 89 // Warnings during container creation 90 Warnings []string `json:"Warnings"` 91 } 92 93 type ErrorModel struct { 94 // API root cause formatted for automated parsing 95 // example: API root cause 96 Because string `json:"cause"` 97 // human error message, formatted for a human to read 98 // example: human error message 99 Message string `json:"message"` 100 // http response code 101 ResponseCode int `json:"response"` 102 } 103 104 func (e ErrorModel) Error() string { 105 return e.Message 106 } 107 108 func (e ErrorModel) Cause() error { 109 return errors.New(e.Because) 110 } 111 112 func (e ErrorModel) Code() int { 113 return e.ResponseCode 114 } 115 116 // BuildOptions describe the options for building container images. 117 type BuildOptions struct { 118 imagebuildah.BuildOptions 119 } 120 121 // BuildReport is the image-build report. 122 type BuildReport struct { 123 // ID of the image. 124 ID string 125 }