describe_container_groups.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. //Licensed under the Apache License, Version 2.0 (the "License");
  2. //you may not use this file except in compliance with the License.
  3. //You may obtain a copy of the License at
  4. //
  5. //http://www.apache.org/licenses/LICENSE-2.0
  6. //
  7. //Unless required by applicable law or agreed to in writing, software
  8. //distributed under the License is distributed on an "AS IS" BASIS,
  9. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. //See the License for the specific language governing permissions and
  11. //limitations under the License.
  12. //
  13. // Code generated by Alibaba Cloud SDK Code Generator.
  14. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  15. package eci
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. // DescribeContainerGroups invokes the eci.DescribeContainerGroups API synchronously
  21. // api document: https://help.aliyun.com/api/eci/describecontainergroups.html
  22. func (client *Client) DescribeContainerGroups(request *DescribeContainerGroupsRequest) (response *DescribeContainerGroupsResponse, err error) {
  23. response = CreateDescribeContainerGroupsResponse()
  24. err = client.DoAction(request, response)
  25. return
  26. }
  27. // DescribeContainerGroupsWithChan invokes the eci.DescribeContainerGroups API asynchronously
  28. // api document: https://help.aliyun.com/api/eci/describecontainergroups.html
  29. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  30. func (client *Client) DescribeContainerGroupsWithChan(request *DescribeContainerGroupsRequest) (<-chan *DescribeContainerGroupsResponse, <-chan error) {
  31. responseChan := make(chan *DescribeContainerGroupsResponse, 1)
  32. errChan := make(chan error, 1)
  33. err := client.AddAsyncTask(func() {
  34. defer close(responseChan)
  35. defer close(errChan)
  36. response, err := client.DescribeContainerGroups(request)
  37. if err != nil {
  38. errChan <- err
  39. } else {
  40. responseChan <- response
  41. }
  42. })
  43. if err != nil {
  44. errChan <- err
  45. close(responseChan)
  46. close(errChan)
  47. }
  48. return responseChan, errChan
  49. }
  50. // DescribeContainerGroupsWithCallback invokes the eci.DescribeContainerGroups API asynchronously
  51. // api document: https://help.aliyun.com/api/eci/describecontainergroups.html
  52. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  53. func (client *Client) DescribeContainerGroupsWithCallback(request *DescribeContainerGroupsRequest, callback func(response *DescribeContainerGroupsResponse, err error)) <-chan int {
  54. result := make(chan int, 1)
  55. err := client.AddAsyncTask(func() {
  56. var response *DescribeContainerGroupsResponse
  57. var err error
  58. defer close(result)
  59. response, err = client.DescribeContainerGroups(request)
  60. callback(response, err)
  61. result <- 1
  62. })
  63. if err != nil {
  64. defer close(result)
  65. callback(nil, err)
  66. result <- 0
  67. }
  68. return result
  69. }
  70. // DescribeContainerGroupsRequest is the request struct for api DescribeContainerGroups
  71. type DescribeContainerGroupsRequest struct {
  72. *requests.RpcRequest
  73. OwnerId requests.Integer `position:"Query" name:"OwnerId"`
  74. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  75. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  76. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  77. RegionId string `position:"Query" name:"RegionId"`
  78. ZoneId string `position:"Query" name:"ZoneId"`
  79. VSwitchId string `position:"Query" name:"VSwitchId"`
  80. NextToken string `position:"Query" name:"NextToken"`
  81. Limit requests.Integer `position:"Query" name:"Limit"`
  82. Tag *[]DescribeContainerGroupsTag `position:"Query" name:"Tag" type:"Repeated"`
  83. ContainerGroupIds string `position:"Query" name:"ContainerGroupIds"`
  84. ContainerGroupName string `position:"Query" name:"ContainerGroupName"`
  85. Status string `position:"Query" name:"Status"`
  86. }
  87. type DescribeContainerGroupsTag struct {
  88. Key string `name:"Key"`
  89. Value string `name:"Value"`
  90. }
  91. // DescribeContainerGroupsResponse is the response struct for api DescribeContainerGroups
  92. type DescribeContainerGroupsResponse struct {
  93. *responses.BaseResponse
  94. RequestId string `json:"RequestId" xml:"RequestId"`
  95. NextToken string `json:"NextToken" xml:"NextToken"`
  96. TotalCount int `json:"TotalCount" xml:"TotalCount"`
  97. ContainerGroups DescribeContainerGroupsContainerGroups `json:"ContainerGroups" xml:"ContainerGroups"`
  98. }
  99. type DescribeContainerGroupsContainerGroups struct {
  100. ContainerGroup []DescribeContainerGroupsContainerGroup `json:"ContainerGroup" xml:"ContainerGroup"`
  101. }
  102. type DescribeContainerGroupsContainerGroup struct {
  103. ContainerGroupId string `json:"ContainerGroupId" xml:"ContainerGroupId"`
  104. ContainerGroupName string `json:"ContainerGroupName" xml:"ContainerGroupName"`
  105. RegionId string `json:"RegionId" xml:"RegionId"`
  106. ZoneId string `json:"ZoneId" xml:"ZoneId"`
  107. Memory float32 `json:"Memory" xml:"Memory"`
  108. Cpu float32 `json:"Cpu" xml:"Cpu"`
  109. VSwitchId string `json:"VSwitchId" xml:"VSwitchId"`
  110. SecurityGroupId string `json:"SecurityGroupId" xml:"SecurityGroupId"`
  111. RestartPolicy string `json:"RestartPolicy" xml:"RestartPolicy"`
  112. IntranetIp string `json:"IntranetIp" xml:"IntranetIp"`
  113. Status string `json:"Status" xml:"Status"`
  114. InternetIp string `json:"InternetIp" xml:"InternetIp"`
  115. CreationTime string `json:"CreationTime" xml:"CreationTime"`
  116. SucceededTime string `json:"SucceededTime" xml:"SucceededTime"`
  117. EniInstanceId string `json:"EniInstanceId" xml:"EniInstanceId"`
  118. Tags []DescribeContainerGroupsTags `json:"Tags" xml:"Tags"`
  119. Events []DescribeContainerGroupsEvents `json:"Events" xml:"Events"`
  120. Containers []DescribeContainerGroupsContainers `json:"Containers" xml:"Containers"`
  121. Volumes []DescribeContainerGroupsVolumes `json:"Volumes" xml:"Volumes"`
  122. InitContainers []DescribeContainerGroupsInitContainers `json:"InitContainers" xml:"InitContainers"`
  123. }
  124. type DescribeContainerGroupsTags struct {
  125. Label []DescribeContainerGroupsLabel `json:"Label" xml:"Label"`
  126. }
  127. type DescribeContainerGroupsLabel struct {
  128. Key string `json:"Key" xml:"Key"`
  129. Value string `json:"Value" xml:"Value"`
  130. }
  131. type DescribeContainerGroupsEvents struct {
  132. Event []DescribeContainerGroupsEvent `json:"Event" xml:"Event"`
  133. }
  134. type DescribeContainerGroupsEvent struct {
  135. Count int `json:"Count" xml:"Count"`
  136. Type string `json:"Type" xml:"Type"`
  137. Name string `json:"Name" xml:"Name"`
  138. Message string `json:"Message" xml:"Message"`
  139. FirstTimestamp string `json:"FirstTimestamp" xml:"FirstTimestamp"`
  140. LastTimestamp string `json:"LastTimestamp" xml:"LastTimestamp"`
  141. Reason string `json:"Reason" xml:"Reason"`
  142. }
  143. type DescribeContainerGroupsContainers struct {
  144. Container []DescribeContainerGroupsContainer `json:"Container" xml:"Container"`
  145. }
  146. type DescribeContainerGroupsContainer struct {
  147. Name string `json:"Name" xml:"Name"`
  148. Image string `json:"Image" xml:"Image"`
  149. Memory float32 `json:"Memory" xml:"Memory"`
  150. Cpu float32 `json:"Cpu" xml:"Cpu"`
  151. RestartCount int `json:"RestartCount" xml:"RestartCount"`
  152. WorkingDir string `json:"WorkingDir" xml:"WorkingDir"`
  153. ImagePullPolicy string `json:"ImagePullPolicy" xml:"ImagePullPolicy"`
  154. VolumeMounts []DescribeContainerGroupsVolumeMounts `json:"VolumeMounts" xml:"VolumeMounts"`
  155. Ports []DescribeContainerGroupsPorts `json:"Ports" xml:"Ports"`
  156. EnvironmentVars []DescribeContainerGroupsEnvironmentVars `json:"EnvironmentVars" xml:"EnvironmentVars"`
  157. }
  158. type DescribeContainerGroupsVolumeMounts struct {
  159. VolumeMount []DescribeContainerGroupsVolumeMount `json:"VolumeMount" xml:"VolumeMount"`
  160. }
  161. type DescribeContainerGroupsVolumeMount struct {
  162. Name string `json:"Name" xml:"Name"`
  163. MountPath string `json:"MountPath" xml:"MountPath"`
  164. ReadOnly bool `json:"ReadOnly" xml:"ReadOnly"`
  165. }
  166. type DescribeContainerGroupsPorts struct {
  167. Port []DescribeContainerGroupsPort `json:"Port" xml:"Port"`
  168. }
  169. type DescribeContainerGroupsPort struct {
  170. Port int `json:"Port" xml:"Port"`
  171. Protocol string `json:"Protocol" xml:"Protocol"`
  172. }
  173. type DescribeContainerGroupsEnvironmentVars struct {
  174. EnvironmentVar []DescribeContainerGroupsEnvironmentVar `json:"EnvironmentVar" xml:"EnvironmentVar"`
  175. }
  176. type DescribeContainerGroupsEnvironmentVar struct {
  177. Key string `json:"Key" xml:"Key"`
  178. Value string `json:"Value" xml:"Value"`
  179. }
  180. type DescribeContainerGroupsVolumes struct {
  181. Volume []DescribeContainerGroupsVolume `json:"Volume" xml:"Volume"`
  182. }
  183. type DescribeContainerGroupsVolume struct {
  184. Type string `json:"Type" xml:"Type"`
  185. Name string `json:"Name" xml:"Name"`
  186. NFSVolumePath string `json:"NFSVolumePath" xml:"NFSVolumePath"`
  187. NFSVolumeServer string `json:"NFSVolumeServer" xml:"NFSVolumeServer"`
  188. NFSVolumeReadOnly bool `json:"NFSVolumeReadOnly" xml:"NFSVolumeReadOnly"`
  189. ConfigFileVolumeConfigFileToPaths []DescribeContainerGroupsConfigFileVolumeConfigFileToPaths `json:"ConfigFileVolumeConfigFileToPaths" xml:"ConfigFileVolumeConfigFileToPaths"`
  190. }
  191. type DescribeContainerGroupsConfigFileVolumeConfigFileToPaths struct {
  192. ConfigFileVolumeConfigFileToPath []DescribeContainerGroupsConfigFileVolumeConfigFileToPath `json:"ConfigFileVolumeConfigFileToPath" xml:"ConfigFileVolumeConfigFileToPath"`
  193. }
  194. type DescribeContainerGroupsConfigFileVolumeConfigFileToPath struct {
  195. Content string `json:"Content" xml:"Content"`
  196. Path string `json:"Path" xml:"Path"`
  197. }
  198. type DescribeContainerGroupsInitContainers struct {
  199. Container []DescribeContainerGroupsContainer `json:"Container" xml:"Container"`
  200. }
  201. // CreateDescribeContainerGroupsRequest creates a request to invoke DescribeContainerGroups API
  202. func CreateDescribeContainerGroupsRequest() (request *DescribeContainerGroupsRequest) {
  203. request = &DescribeContainerGroupsRequest{
  204. RpcRequest: &requests.RpcRequest{},
  205. }
  206. request.InitWithApiInfo("Eci", "2018-08-08", "DescribeContainerGroups", "eci", "openAPI")
  207. return
  208. }
  209. // CreateDescribeContainerGroupsResponse creates a response to parse from DescribeContainerGroups response
  210. func CreateDescribeContainerGroupsResponse() (response *DescribeContainerGroupsResponse) {
  211. response = &DescribeContainerGroupsResponse{
  212. BaseResponse: &responses.BaseResponse{},
  213. }
  214. return
  215. }