describe_instances.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. package ecs
  2. //Licensed under the Apache License, Version 2.0 (the "License");
  3. //you may not use this file except in compliance with the License.
  4. //You may obtain a copy of the License at
  5. //
  6. //http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. //Unless required by applicable law or agreed to in writing, software
  9. //distributed under the License is distributed on an "AS IS" BASIS,
  10. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. //See the License for the specific language governing permissions and
  12. //limitations under the License.
  13. //
  14. // Code generated by Alibaba Cloud SDK Code Generator.
  15. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. func (client *Client) DescribeInstances(request *DescribeInstancesRequest) (response *DescribeInstancesResponse, err error) {
  21. response = CreateDescribeInstancesResponse()
  22. err = client.DoAction(request, response)
  23. return
  24. }
  25. func (client *Client) DescribeInstancesWithChan(request *DescribeInstancesRequest) (<-chan *DescribeInstancesResponse, <-chan error) {
  26. responseChan := make(chan *DescribeInstancesResponse, 1)
  27. errChan := make(chan error, 1)
  28. err := client.AddAsyncTask(func() {
  29. defer close(responseChan)
  30. defer close(errChan)
  31. response, err := client.DescribeInstances(request)
  32. responseChan <- response
  33. errChan <- err
  34. })
  35. if err != nil {
  36. errChan <- err
  37. close(responseChan)
  38. close(errChan)
  39. }
  40. return responseChan, errChan
  41. }
  42. func (client *Client) DescribeInstancesWithCallback(request *DescribeInstancesRequest, callback func(response *DescribeInstancesResponse, err error)) <-chan int {
  43. result := make(chan int, 1)
  44. err := client.AddAsyncTask(func() {
  45. var response *DescribeInstancesResponse
  46. var err error
  47. defer close(result)
  48. response, err = client.DescribeInstances(request)
  49. callback(response, err)
  50. result <- 1
  51. })
  52. if err != nil {
  53. defer close(result)
  54. callback(nil, err)
  55. result <- 0
  56. }
  57. return result
  58. }
  59. type DescribeInstancesRequest struct {
  60. *requests.RpcRequest
  61. PublicIpAddresses string `position:"Query" name:"PublicIpAddresses"`
  62. ZoneId string `position:"Query" name:"ZoneId"`
  63. Filter2Key string `position:"Query" name:"Filter.2.Key"`
  64. EipAddresses string `position:"Query" name:"EipAddresses"`
  65. InstanceType string `position:"Query" name:"InstanceType"`
  66. InstanceTypeFamily string `position:"Query" name:"InstanceTypeFamily"`
  67. Filter2Value string `position:"Query" name:"Filter.2.Value"`
  68. Tag3Key string `position:"Query" name:"Tag.3.Key"`
  69. Tag5Value string `position:"Query" name:"Tag.5.Value"`
  70. Filter1Value string `position:"Query" name:"Filter.1.Value"`
  71. Tag1Key string `position:"Query" name:"Tag.1.Key"`
  72. Tag1Value string `position:"Query" name:"Tag.1.Value"`
  73. ResourceOwnerId string `position:"Query" name:"ResourceOwnerId"`
  74. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  75. PrivateIpAddresses string `position:"Query" name:"PrivateIpAddresses"`
  76. VSwitchId string `position:"Query" name:"VSwitchId"`
  77. InternetChargeType string `position:"Query" name:"InternetChargeType"`
  78. Status string `position:"Query" name:"Status"`
  79. SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
  80. InstanceIds string `position:"Query" name:"InstanceIds"`
  81. KeyPairName string `position:"Query" name:"KeyPairName"`
  82. OwnerId string `position:"Query" name:"OwnerId"`
  83. Tag5Key string `position:"Query" name:"Tag.5.Key"`
  84. IoOptimized string `position:"Query" name:"IoOptimized"`
  85. LockReason string `position:"Query" name:"LockReason"`
  86. InstanceName string `position:"Query" name:"InstanceName"`
  87. Filter1Key string `position:"Query" name:"Filter.1.Key"`
  88. Tag2Key string `position:"Query" name:"Tag.2.Key"`
  89. Filter4Key string `position:"Query" name:"Filter.4.Key"`
  90. InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"`
  91. Tag4Key string `position:"Query" name:"Tag.4.Key"`
  92. PageSize string `position:"Query" name:"PageSize"`
  93. DeviceAvailable string `position:"Query" name:"DeviceAvailable"`
  94. Filter4Value string `position:"Query" name:"Filter.4.Value"`
  95. Filter3Value string `position:"Query" name:"Filter.3.Value"`
  96. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  97. Tag4Value string `position:"Query" name:"Tag.4.Value"`
  98. InnerIpAddresses string `position:"Query" name:"InnerIpAddresses"`
  99. Filter3Key string `position:"Query" name:"Filter.3.Key"`
  100. ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
  101. RdmaIpAddresses string `position:"Query" name:"RdmaIpAddresses"`
  102. PageNumber string `position:"Query" name:"PageNumber"`
  103. ImageId string `position:"Query" name:"ImageId"`
  104. HpcClusterId string `position:"Query" name:"HpcClusterId"`
  105. VpcId string `position:"Query" name:"VpcId"`
  106. InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
  107. Tag3Value string `position:"Query" name:"Tag.3.Value"`
  108. Tag2Value string `position:"Query" name:"Tag.2.Value"`
  109. }
  110. type DescribeInstancesResponse struct {
  111. *responses.BaseResponse
  112. RequestId string `json:"RequestId" xml:"RequestId"`
  113. TotalCount int `json:"TotalCount" xml:"TotalCount"`
  114. PageNumber int `json:"PageNumber" xml:"PageNumber"`
  115. PageSize int `json:"PageSize" xml:"PageSize"`
  116. Instances struct {
  117. Instance []struct {
  118. InstanceId string `json:"InstanceId" xml:"InstanceId"`
  119. InstanceName string `json:"InstanceName" xml:"InstanceName"`
  120. Description string `json:"Description" xml:"Description"`
  121. ImageId string `json:"ImageId" xml:"ImageId"`
  122. OSName string `json:"OSName" xml:"OSName"`
  123. OSType string `json:"OSType" xml:"OSType"`
  124. RegionId string `json:"RegionId" xml:"RegionId"`
  125. ZoneId string `json:"ZoneId" xml:"ZoneId"`
  126. ClusterId string `json:"ClusterId" xml:"ClusterId"`
  127. InstanceType string `json:"InstanceType" xml:"InstanceType"`
  128. Cpu int `json:"Cpu" xml:"Cpu"`
  129. Memory int `json:"Memory" xml:"Memory"`
  130. HostName string `json:"HostName" xml:"HostName"`
  131. Status string `json:"Status" xml:"Status"`
  132. SerialNumber string `json:"SerialNumber" xml:"SerialNumber"`
  133. InternetChargeType string `json:"InternetChargeType" xml:"InternetChargeType"`
  134. InternetMaxBandwidthIn int `json:"InternetMaxBandwidthIn" xml:"InternetMaxBandwidthIn"`
  135. InternetMaxBandwidthOut int `json:"InternetMaxBandwidthOut" xml:"InternetMaxBandwidthOut"`
  136. VlanId string `json:"VlanId" xml:"VlanId"`
  137. CreationTime string `json:"CreationTime" xml:"CreationTime"`
  138. InstanceNetworkType string `json:"InstanceNetworkType" xml:"InstanceNetworkType"`
  139. InstanceChargeType string `json:"InstanceChargeType" xml:"InstanceChargeType"`
  140. SaleCycle string `json:"SaleCycle" xml:"SaleCycle"`
  141. ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"`
  142. AutoReleaseTime string `json:"AutoReleaseTime" xml:"AutoReleaseTime"`
  143. IoOptimized bool `json:"IoOptimized" xml:"IoOptimized"`
  144. DeviceAvailable bool `json:"DeviceAvailable" xml:"DeviceAvailable"`
  145. InstanceTypeFamily string `json:"InstanceTypeFamily" xml:"InstanceTypeFamily"`
  146. LocalStorageCapacity int64 `json:"LocalStorageCapacity" xml:"LocalStorageCapacity"`
  147. LocalStorageAmount int `json:"LocalStorageAmount" xml:"LocalStorageAmount"`
  148. GPUAmount int `json:"GPUAmount" xml:"GPUAmount"`
  149. GPUSpec string `json:"GPUSpec" xml:"GPUSpec"`
  150. SpotStrategy string `json:"SpotStrategy" xml:"SpotStrategy"`
  151. SpotPriceLimit float64 `json:"SpotPriceLimit" xml:"SpotPriceLimit"`
  152. ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"`
  153. KeyPairName string `json:"KeyPairName" xml:"KeyPairName"`
  154. Recyclable bool `json:"Recyclable" xml:"Recyclable"`
  155. HpcClusterId string `json:"HpcClusterId" xml:"HpcClusterId"`
  156. SecurityGroupIds struct {
  157. SecurityGroupId []string `json:"SecurityGroupId" xml:"SecurityGroupId"`
  158. } `json:"SecurityGroupIds" xml:"SecurityGroupIds"`
  159. PublicIpAddress struct {
  160. IpAddress []string `json:"IpAddress" xml:"IpAddress"`
  161. } `json:"PublicIpAddress" xml:"PublicIpAddress"`
  162. InnerIpAddress struct {
  163. IpAddress []string `json:"IpAddress" xml:"IpAddress"`
  164. } `json:"InnerIpAddress" xml:"InnerIpAddress"`
  165. RdmaIpAddress struct {
  166. IpAddress []string `json:"IpAddress" xml:"IpAddress"`
  167. } `json:"RdmaIpAddress" xml:"RdmaIpAddress"`
  168. VpcAttributes struct {
  169. VpcId string `json:"VpcId" xml:"VpcId"`
  170. VSwitchId string `json:"VSwitchId" xml:"VSwitchId"`
  171. NatIpAddress string `json:"NatIpAddress" xml:"NatIpAddress"`
  172. PrivateIpAddress struct {
  173. IpAddress []string `json:"IpAddress" xml:"IpAddress"`
  174. } `json:"PrivateIpAddress" xml:"PrivateIpAddress"`
  175. } `json:"VpcAttributes" xml:"VpcAttributes"`
  176. EipAddress struct {
  177. AllocationId string `json:"AllocationId" xml:"AllocationId"`
  178. IpAddress string `json:"IpAddress" xml:"IpAddress"`
  179. Bandwidth int `json:"Bandwidth" xml:"Bandwidth"`
  180. InternetChargeType string `json:"InternetChargeType" xml:"InternetChargeType"`
  181. IsSupportUnassociate bool `json:"IsSupportUnassociate" xml:"IsSupportUnassociate"`
  182. } `json:"EipAddress" xml:"EipAddress"`
  183. NetworkInterfaces struct {
  184. NetworkInterface []struct {
  185. NetworkInterfaceId string `json:"NetworkInterfaceId" xml:"NetworkInterfaceId"`
  186. MacAddress string `json:"MacAddress" xml:"MacAddress"`
  187. PrimaryIpAddress string `json:"PrimaryIpAddress" xml:"PrimaryIpAddress"`
  188. } `json:"NetworkInterface" xml:"NetworkInterface"`
  189. } `json:"NetworkInterfaces" xml:"NetworkInterfaces"`
  190. OperationLocks struct {
  191. LockReason []struct {
  192. LockReason string `json:"LockReason" xml:"LockReason"`
  193. LockMsg string `json:"LockMsg" xml:"LockMsg"`
  194. } `json:"LockReason" xml:"LockReason"`
  195. } `json:"OperationLocks" xml:"OperationLocks"`
  196. Tags struct {
  197. Tag []struct {
  198. TagKey string `json:"TagKey" xml:"TagKey"`
  199. TagValue string `json:"TagValue" xml:"TagValue"`
  200. } `json:"Tag" xml:"Tag"`
  201. } `json:"Tags" xml:"Tags"`
  202. } `json:"Instance" xml:"Instance"`
  203. } `json:"Instances" xml:"Instances"`
  204. }
  205. func CreateDescribeInstancesRequest() (request *DescribeInstancesRequest) {
  206. request = &DescribeInstancesRequest{
  207. RpcRequest: &requests.RpcRequest{},
  208. }
  209. request.InitWithApiInfo("Ecs", "2014-05-26", "DescribeInstances", "", "")
  210. return
  211. }
  212. func CreateDescribeInstancesResponse() (response *DescribeInstancesResponse) {
  213. response = &DescribeInstancesResponse{
  214. BaseResponse: &responses.BaseResponse{},
  215. }
  216. return
  217. }