api_params.go 3.1 KB

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