api_params.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. package docker
  2. import "encoding/json"
  3. type APIHistory struct {
  4. ID string `json:"Id"`
  5. Tags []string `json:",omitempty"`
  6. Created int64
  7. CreatedBy string `json:",omitempty"`
  8. }
  9. type APIImages struct {
  10. Repository string `json:",omitempty"`
  11. Tag string `json:",omitempty"`
  12. ID string `json:"Id"`
  13. Created int64
  14. Size int64
  15. VirtualSize int64
  16. }
  17. type APIInfo struct {
  18. Debug bool
  19. Containers int
  20. Images int
  21. NFd int `json:",omitempty"`
  22. NGoroutines int `json:",omitempty"`
  23. MemoryLimit bool `json:",omitempty"`
  24. SwapLimit bool `json:",omitempty"`
  25. IPv4Forwarding bool `json:",omitempty"`
  26. LXCVersion string `json:",omitempty"`
  27. NEventsListener int `json:",omitempty"`
  28. KernelVersion string `json:",omitempty"`
  29. IndexServerAddress string `json:",omitempty"`
  30. DevmapperPool string `json:",omitempty"`
  31. DevmapperDataUsed uint64 `json:",omitempty"`
  32. DevmapperDataTotal uint64 `json:",omitempty"`
  33. DevmapperMetadataUsed uint64 `json:",omitempty"`
  34. DevmapperMetadataTotal uint64 `json:",omitempty"`
  35. }
  36. type APITop struct {
  37. Titles []string
  38. Processes [][]string
  39. }
  40. type APIRmi struct {
  41. Deleted string `json:",omitempty"`
  42. Untagged string `json:",omitempty"`
  43. }
  44. type APIContainers struct {
  45. ID string `json:"Id"`
  46. Image string
  47. Command string
  48. Created int64
  49. Status string
  50. Ports []APIPort
  51. SizeRw int64
  52. SizeRootFs int64
  53. }
  54. func (self *APIContainers) ToLegacy() APIContainersOld {
  55. return APIContainersOld{
  56. ID: self.ID,
  57. Image: self.Image,
  58. Command: self.Command,
  59. Created: self.Created,
  60. Status: self.Status,
  61. Ports: displayablePorts(self.Ports),
  62. SizeRw: self.SizeRw,
  63. SizeRootFs: self.SizeRootFs,
  64. }
  65. }
  66. type APIContainersOld struct {
  67. ID string `json:"Id"`
  68. Image string
  69. Command string
  70. Created int64
  71. Status string
  72. Ports string
  73. SizeRw int64
  74. SizeRootFs int64
  75. }
  76. type APISearch struct {
  77. Name string
  78. Description string
  79. }
  80. type APIID struct {
  81. ID string `json:"Id"`
  82. }
  83. type APIRun struct {
  84. ID string `json:"Id"`
  85. Warnings []string `json:",omitempty"`
  86. }
  87. type APIPort struct {
  88. PrivatePort int64
  89. PublicPort int64
  90. Type string
  91. }
  92. func (port *APIPort) MarshalJSON() ([]byte, error) {
  93. return json.Marshal(map[string]interface{}{
  94. "PrivatePort": port.PrivatePort,
  95. "PublicPort": port.PublicPort,
  96. "Type": port.Type,
  97. })
  98. }
  99. type APIVersion struct {
  100. Version string
  101. GitCommit string `json:",omitempty"`
  102. GoVersion string `json:",omitempty"`
  103. }
  104. type APIWait struct {
  105. StatusCode int
  106. }
  107. type APIAuth struct {
  108. Status string
  109. }
  110. type APIImageConfig struct {
  111. ID string `json:"Id"`
  112. *Config
  113. }
  114. type APICopy struct {
  115. Resource string
  116. HostPath string
  117. }