types.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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 basename of the resource.
  116. type ContainerPathStat struct {
  117. Name string `json:"name"`
  118. Size int64 `json:"size"`
  119. Mode os.FileMode `json:"mode"`
  120. Mtime time.Time `json:"mtime"`
  121. LinkTarget string `json:"linkTarget"`
  122. }
  123. // GET "/containers/{name:.*}/top"
  124. type ContainerProcessList struct {
  125. Processes [][]string
  126. Titles []string
  127. }
  128. type Version struct {
  129. Version string
  130. ApiVersion version.Version
  131. GitCommit string
  132. GoVersion string
  133. Os string
  134. Arch string
  135. KernelVersion string `json:",omitempty"`
  136. Experimental bool `json:",omitempty"`
  137. BuildTime string `json:",omitempty"`
  138. }
  139. // GET "/info"
  140. type Info struct {
  141. ID string
  142. Containers int
  143. Images int
  144. Driver string
  145. DriverStatus [][2]string
  146. MemoryLimit bool
  147. SwapLimit bool
  148. CpuCfsPeriod bool
  149. CpuCfsQuota bool
  150. IPv4Forwarding bool
  151. BridgeNfIptables bool
  152. BridgeNfIp6tables bool
  153. Debug bool
  154. NFd int
  155. OomKillDisable bool
  156. NGoroutines int
  157. SystemTime string
  158. ExecutionDriver string
  159. LoggingDriver string
  160. NEventsListener int
  161. KernelVersion string
  162. OperatingSystem string
  163. IndexServerAddress string
  164. RegistryConfig interface{}
  165. InitSha1 string
  166. InitPath string
  167. NCPU int
  168. MemTotal int64
  169. DockerRootDir string
  170. HttpProxy string
  171. HttpsProxy string
  172. NoProxy string
  173. Name string
  174. Labels []string
  175. ExperimentalBuild bool
  176. }
  177. // This struct is a temp struct used by execStart
  178. // Config fields is part of ExecConfig in runconfig package
  179. type ExecStartCheck struct {
  180. // ExecStart will first check if it's detached
  181. Detach bool
  182. // Check if there's a tty
  183. Tty bool
  184. }
  185. type ContainerState struct {
  186. Running bool
  187. Paused bool
  188. Restarting bool
  189. OOMKilled bool
  190. Dead bool
  191. Pid int
  192. ExitCode int
  193. Error string
  194. StartedAt string
  195. FinishedAt string
  196. }
  197. // GET "/containers/{name:.*}/json"
  198. type ContainerJSONBase struct {
  199. Id string
  200. Created string
  201. Path string
  202. Args []string
  203. State *ContainerState
  204. Image string
  205. NetworkSettings *network.Settings
  206. ResolvConfPath string
  207. HostnamePath string
  208. HostsPath string
  209. LogPath string
  210. Name string
  211. RestartCount int
  212. Driver string
  213. ExecDriver string
  214. MountLabel string
  215. ProcessLabel string
  216. AppArmorProfile string
  217. ExecIDs []string
  218. HostConfig *runconfig.HostConfig
  219. GraphDriver GraphDriverData
  220. }
  221. type ContainerJSON struct {
  222. *ContainerJSONBase
  223. Mounts []MountPoint
  224. Config *runconfig.Config
  225. }
  226. // backcompatibility struct along with ContainerConfig
  227. type ContainerJSONPre120 struct {
  228. *ContainerJSONBase
  229. Volumes map[string]string
  230. VolumesRW map[string]bool
  231. Config *ContainerConfig
  232. }
  233. type ContainerConfig struct {
  234. *runconfig.Config
  235. // backward compatibility, they now live in HostConfig
  236. Memory int64
  237. MemorySwap int64
  238. CpuShares int64
  239. Cpuset string
  240. }
  241. // MountPoint represents a mount point configuration inside the container.
  242. type MountPoint struct {
  243. Name string `json:",omitempty"`
  244. Source string
  245. Destination string
  246. Driver string `json:",omitempty"`
  247. Mode string // this is internally named `Relabel`
  248. RW bool
  249. }