types.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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 string
  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. Status string
  188. Running bool
  189. Paused bool
  190. Restarting bool
  191. OOMKilled bool
  192. Dead bool
  193. Pid int
  194. ExitCode int
  195. Error string
  196. StartedAt string
  197. FinishedAt string
  198. }
  199. // GET "/containers/{name:.*}/json"
  200. type ContainerJSONBase struct {
  201. Id string
  202. Created string
  203. Path string
  204. Args []string
  205. State *ContainerState
  206. Image string
  207. NetworkSettings *network.Settings
  208. ResolvConfPath string
  209. HostnamePath string
  210. HostsPath string
  211. LogPath string
  212. Name string
  213. RestartCount int
  214. Driver string
  215. ExecDriver string
  216. MountLabel string
  217. ProcessLabel string
  218. AppArmorProfile string
  219. ExecIDs []string
  220. HostConfig *runconfig.HostConfig
  221. GraphDriver GraphDriverData
  222. }
  223. type ContainerJSON struct {
  224. *ContainerJSONBase
  225. Mounts []MountPoint
  226. Config *runconfig.Config
  227. }
  228. // backcompatibility struct along with ContainerConfig. Note this is not
  229. // used by the Windows daemon.
  230. type ContainerJSONPre120 struct {
  231. *ContainerJSONBase
  232. Volumes map[string]string
  233. VolumesRW map[string]bool
  234. Config *ContainerConfig
  235. }
  236. type ContainerConfig struct {
  237. *runconfig.Config
  238. // backward compatibility, they now live in HostConfig
  239. Memory int64
  240. MemorySwap int64
  241. CpuShares int64
  242. Cpuset string
  243. }
  244. // MountPoint represents a mount point configuration inside the container.
  245. type MountPoint struct {
  246. Name string `json:",omitempty"`
  247. Source string
  248. Destination string
  249. Driver string `json:",omitempty"`
  250. Mode string
  251. RW bool
  252. }