types.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. package types
  2. import (
  3. "os"
  4. "time"
  5. "github.com/docker/docker/daemon/network"
  6. "github.com/docker/docker/pkg/version"
  7. "github.com/docker/docker/runconfig"
  8. )
  9. // ContainerCreateResponse contains the information returned to a client on the
  10. // creation of a new container.
  11. type ContainerCreateResponse struct {
  12. // ID is the ID of the created container.
  13. ID string `json:"Id"`
  14. // Warnings are any warnings encountered during the creation of the container.
  15. Warnings []string `json:"Warnings"`
  16. }
  17. // POST /containers/{name:.*}/exec
  18. type ContainerExecCreateResponse struct {
  19. // ID is the exec ID.
  20. ID string `json:"Id"`
  21. }
  22. // POST /auth
  23. type AuthResponse struct {
  24. // Status is the authentication status
  25. Status string `json:"Status"`
  26. }
  27. // POST "/containers/"+containerID+"/wait"
  28. type ContainerWaitResponse struct {
  29. // StatusCode is the status code of the wait job
  30. StatusCode int `json:"StatusCode"`
  31. }
  32. // POST "/commit?container="+containerID
  33. type ContainerCommitResponse struct {
  34. ID string `json:"Id"`
  35. }
  36. // GET "/containers/{name:.*}/changes"
  37. type ContainerChange struct {
  38. Kind int
  39. Path string
  40. }
  41. // GET "/images/{name:.*}/history"
  42. type ImageHistory struct {
  43. ID string `json:"Id"`
  44. Created int64
  45. CreatedBy string
  46. Tags []string
  47. Size int64
  48. Comment string
  49. }
  50. // DELETE "/images/{name:.*}"
  51. type ImageDelete struct {
  52. Untagged string `json:",omitempty"`
  53. Deleted string `json:",omitempty"`
  54. }
  55. // GET "/images/json"
  56. type Image struct {
  57. ID string `json:"Id"`
  58. ParentId string
  59. RepoTags []string
  60. RepoDigests []string
  61. Created int
  62. Size int
  63. VirtualSize int
  64. Labels map[string]string
  65. }
  66. type GraphDriverData struct {
  67. Name string
  68. Data map[string]string
  69. }
  70. // GET "/images/{name:.*}/json"
  71. type ImageInspect struct {
  72. Id string
  73. Parent string
  74. Comment string
  75. Created time.Time
  76. Container string
  77. ContainerConfig *runconfig.Config
  78. DockerVersion string
  79. Author string
  80. Config *runconfig.Config
  81. Architecture string
  82. Os string
  83. Size int64
  84. VirtualSize int64
  85. GraphDriver GraphDriverData
  86. }
  87. // GET "/containers/json"
  88. type Port struct {
  89. IP string `json:",omitempty"`
  90. PrivatePort int
  91. PublicPort int `json:",omitempty"`
  92. Type string
  93. }
  94. type Container struct {
  95. ID string `json:"Id"`
  96. Names []string
  97. Image string
  98. Command string
  99. Created int
  100. Ports []Port
  101. SizeRw int `json:",omitempty"`
  102. SizeRootFs int `json:",omitempty"`
  103. Labels map[string]string
  104. Status string
  105. HostConfig struct {
  106. NetworkMode string `json:",omitempty"`
  107. }
  108. }
  109. // POST "/containers/"+containerID+"/copy"
  110. type CopyConfig struct {
  111. Resource string
  112. }
  113. // ContainerPathStat is used to encode the header from
  114. // GET /containers/{name:.*}/archive
  115. // "name" is the file or directory name.
  116. // "path" is the absolute path to the resource in the container.
  117. type ContainerPathStat struct {
  118. Name string `json:"name"`
  119. Path string `json:"path"`
  120. Size int64 `json:"size"`
  121. Mode os.FileMode `json:"mode"`
  122. Mtime time.Time `json:"mtime"`
  123. }
  124. // GET "/containers/{name:.*}/top"
  125. type ContainerProcessList struct {
  126. Processes [][]string
  127. Titles []string
  128. }
  129. type Version struct {
  130. Version string
  131. ApiVersion version.Version
  132. GitCommit string
  133. GoVersion string
  134. Os string
  135. Arch string
  136. KernelVersion string `json:",omitempty"`
  137. Experimental bool `json:",omitempty"`
  138. BuildTime string `json:",omitempty"`
  139. }
  140. // GET "/info"
  141. type Info struct {
  142. ID string
  143. Containers int
  144. Images int
  145. Driver string
  146. DriverStatus [][2]string
  147. MemoryLimit bool
  148. SwapLimit bool
  149. CpuCfsPeriod bool
  150. CpuCfsQuota bool
  151. IPv4Forwarding bool
  152. BridgeNfIptables bool
  153. BridgeNfIp6tables bool
  154. Debug bool
  155. NFd int
  156. OomKillDisable bool
  157. NGoroutines int
  158. SystemTime string
  159. ExecutionDriver string
  160. LoggingDriver string
  161. NEventsListener int
  162. KernelVersion string
  163. OperatingSystem string
  164. IndexServerAddress string
  165. RegistryConfig interface{}
  166. InitSha1 string
  167. InitPath string
  168. NCPU int
  169. MemTotal int64
  170. DockerRootDir string
  171. HttpProxy string
  172. HttpsProxy string
  173. NoProxy string
  174. Name string
  175. Labels []string
  176. ExperimentalBuild bool
  177. }
  178. // This struct is a temp struct used by execStart
  179. // Config fields is part of ExecConfig in runconfig package
  180. type ExecStartCheck struct {
  181. // ExecStart will first check if it's detached
  182. Detach bool
  183. // Check if there's a tty
  184. Tty bool
  185. }
  186. type ContainerState struct {
  187. Running bool
  188. Paused bool
  189. Restarting bool
  190. OOMKilled bool
  191. Dead bool
  192. Pid int
  193. ExitCode int
  194. Error string
  195. StartedAt time.Time
  196. FinishedAt time.Time
  197. }
  198. // GET "/containers/{name:.*}/json"
  199. type ContainerJSONBase struct {
  200. Id string
  201. Created time.Time
  202. Path string
  203. Args []string
  204. State *ContainerState
  205. Image string
  206. NetworkSettings *network.Settings
  207. ResolvConfPath string
  208. HostnamePath string
  209. HostsPath string
  210. LogPath string
  211. Name string
  212. RestartCount int
  213. Driver string
  214. ExecDriver string
  215. MountLabel string
  216. ProcessLabel string
  217. AppArmorProfile string
  218. ExecIDs []string
  219. HostConfig *runconfig.HostConfig
  220. GraphDriver GraphDriverData
  221. }
  222. type ContainerJSON struct {
  223. *ContainerJSONBase
  224. Mounts []MountPoint
  225. Config *runconfig.Config
  226. }
  227. // backcompatibility struct along with ContainerConfig
  228. type ContainerJSONPre120 struct {
  229. *ContainerJSONBase
  230. Volumes map[string]string
  231. VolumesRW map[string]bool
  232. Config *ContainerConfig
  233. }
  234. type ContainerConfig struct {
  235. *runconfig.Config
  236. // backward compatibility, they now live in HostConfig
  237. Memory int64
  238. MemorySwap int64
  239. CpuShares int64
  240. Cpuset string
  241. }
  242. // MountPoint represents a mount point configuration inside the container.
  243. type MountPoint struct {
  244. Name string `json:",omitempty"`
  245. Source string
  246. Destination string
  247. Driver string `json:",omitempty"`
  248. Mode string // this is internally named `Relabel`
  249. RW bool
  250. }