types.go 5.5 KB

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