types.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. // GET "/images/{name:.*}/json"
  66. type ImageInspect struct {
  67. Id string
  68. Parent string
  69. Comment string
  70. Created time.Time
  71. Container string
  72. ContainerConfig *runconfig.Config
  73. DockerVersion string
  74. Author string
  75. Config *runconfig.Config
  76. Architecture string
  77. Os string
  78. Size int64
  79. VirtualSize int64
  80. }
  81. // GET "/containers/json"
  82. type Port struct {
  83. IP string
  84. PrivatePort int
  85. PublicPort int
  86. Type string
  87. }
  88. type Container struct {
  89. ID string `json:"Id"`
  90. Names []string
  91. Image string
  92. Command string
  93. Created int
  94. Ports []Port
  95. SizeRw int `json:",omitempty"`
  96. SizeRootFs int `json:",omitempty"`
  97. Labels map[string]string
  98. Status string
  99. }
  100. // POST "/containers/"+containerID+"/copy"
  101. type CopyConfig struct {
  102. Resource string
  103. }
  104. // GET "/containers/{name:.*}/top"
  105. type ContainerProcessList struct {
  106. Processes [][]string
  107. Titles []string
  108. }
  109. type Version struct {
  110. Version string
  111. ApiVersion version.Version
  112. GitCommit string
  113. GoVersion string
  114. Os string
  115. Arch string
  116. KernelVersion string `json:",omitempty"`
  117. Experimental bool `json:",omitempty"`
  118. }
  119. // GET "/info"
  120. type Info struct {
  121. ID string
  122. Containers int
  123. Images int
  124. Driver string
  125. DriverStatus [][2]string
  126. MemoryLimit bool
  127. SwapLimit bool
  128. CpuCfsPeriod bool
  129. CpuCfsQuota bool
  130. IPv4Forwarding bool
  131. Debug bool
  132. NFd int
  133. OomKillDisable bool
  134. NGoroutines int
  135. SystemTime string
  136. ExecutionDriver string
  137. LoggingDriver string
  138. NEventsListener int
  139. KernelVersion string
  140. OperatingSystem string
  141. IndexServerAddress string
  142. RegistryConfig interface{}
  143. InitSha1 string
  144. InitPath string
  145. NCPU int
  146. MemTotal int64
  147. DockerRootDir string
  148. HttpProxy string
  149. HttpsProxy string
  150. NoProxy string
  151. Name string
  152. Labels []string
  153. ExperimentalBuild bool
  154. }
  155. // This struct is a temp struct used by execStart
  156. // Config fields is part of ExecConfig in runconfig package
  157. type ExecStartCheck struct {
  158. // ExecStart will first check if it's detached
  159. Detach bool
  160. // Check if there's a tty
  161. Tty bool
  162. }
  163. type ContainerState struct {
  164. Running bool
  165. Paused bool
  166. Restarting bool
  167. OOMKilled bool
  168. Dead bool
  169. Pid int
  170. ExitCode int
  171. Error string
  172. StartedAt time.Time
  173. FinishedAt time.Time
  174. }
  175. // GET "/containers/{name:.*}/json"
  176. type ContainerJSONBase struct {
  177. Id string
  178. Created time.Time
  179. Path string
  180. Args []string
  181. State *ContainerState
  182. Image string
  183. NetworkSettings *network.Settings
  184. ResolvConfPath string
  185. HostnamePath string
  186. HostsPath string
  187. LogPath string
  188. Name string
  189. RestartCount int
  190. Driver string
  191. ExecDriver string
  192. MountLabel string
  193. ProcessLabel string
  194. Volumes map[string]string
  195. VolumesRW map[string]bool
  196. AppArmorProfile string
  197. ExecIDs []string
  198. HostConfig *runconfig.HostConfig
  199. }
  200. type ContainerJSON struct {
  201. *ContainerJSONBase
  202. Config *runconfig.Config
  203. }
  204. // backcompatibility struct along with ContainerConfig
  205. type ContainerJSONRaw struct {
  206. *ContainerJSONBase
  207. Config *ContainerConfig
  208. }
  209. type ContainerConfig struct {
  210. *runconfig.Config
  211. // backward compatibility, they now live in HostConfig
  212. Memory int64
  213. MemorySwap int64
  214. CpuShares int64
  215. Cpuset string
  216. }