describe_instances.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. if err != nil {
  33. errChan <- err
  34. } else {
  35. responseChan <- response
  36. }
  37. })
  38. if err != nil {
  39. errChan <- err
  40. close(responseChan)
  41. close(errChan)
  42. }
  43. return responseChan, errChan
  44. }
  45. func (client *Client) DescribeInstancesWithCallback(request *DescribeInstancesRequest, callback func(response *DescribeInstancesResponse, err error)) <-chan int {
  46. result := make(chan int, 1)
  47. err := client.AddAsyncTask(func() {
  48. var response *DescribeInstancesResponse
  49. var err error
  50. defer close(result)
  51. response, err = client.DescribeInstances(request)
  52. callback(response, err)
  53. result <- 1
  54. })
  55. if err != nil {
  56. defer close(result)
  57. callback(nil, err)
  58. result <- 0
  59. }
  60. return result
  61. }
  62. type DescribeInstancesRequest struct {
  63. *requests.RpcRequest
  64. Tag4Value string `position:"Query" name:"Tag.4.Value"`
  65. InnerIpAddresses string `position:"Query" name:"InnerIpAddresses"`
  66. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  67. Tag2Key string `position:"Query" name:"Tag.2.Key"`
  68. PrivateIpAddresses string `position:"Query" name:"PrivateIpAddresses"`
  69. HpcClusterId string `position:"Query" name:"HpcClusterId"`
  70. Filter2Value string `position:"Query" name:"Filter.2.Value"`
  71. Tag3Key string `position:"Query" name:"Tag.3.Key"`
  72. KeyPairName string `position:"Query" name:"KeyPairName"`
  73. Tag1Value string `position:"Query" name:"Tag.1.Value"`
  74. ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
  75. LockReason string `position:"Query" name:"LockReason"`
  76. Filter1Key string `position:"Query" name:"Filter.1.Key"`
  77. DeviceAvailable requests.Boolean `position:"Query" name:"DeviceAvailable"`
  78. Filter3Value string `position:"Query" name:"Filter.3.Value"`
  79. DryRun requests.Boolean `position:"Query" name:"DryRun"`
  80. Tag5Key string `position:"Query" name:"Tag.5.Key"`
  81. Filter1Value string `position:"Query" name:"Filter.1.Value"`
  82. OwnerId requests.Integer `position:"Query" name:"OwnerId"`
  83. VSwitchId string `position:"Query" name:"VSwitchId"`
  84. InstanceName string `position:"Query" name:"InstanceName"`
  85. InstanceIds string `position:"Query" name:"InstanceIds"`
  86. InternetChargeType string `position:"Query" name:"InternetChargeType"`
  87. ZoneId string `position:"Query" name:"ZoneId"`
  88. Tag4Key string `position:"Query" name:"Tag.4.Key"`
  89. InstanceNetworkType string `position:"Query" name:"InstanceNetworkType"`
  90. Status string `position:"Query" name:"Status"`
  91. ImageId string `position:"Query" name:"ImageId"`
  92. Filter4Value string `position:"Query" name:"Filter.4.Value"`
  93. IoOptimized requests.Boolean `position:"Query" name:"IoOptimized"`
  94. SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
  95. Filter4Key string `position:"Query" name:"Filter.4.Key"`
  96. PageNumber requests.Integer `position:"Query" name:"PageNumber"`
  97. RdmaIpAddresses string `position:"Query" name:"RdmaIpAddresses"`
  98. PageSize requests.Integer `position:"Query" name:"PageSize"`
  99. PublicIpAddresses string `position:"Query" name:"PublicIpAddresses"`
  100. InstanceType string `position:"Query" name:"InstanceType"`
  101. InstanceChargeType string `position:"Query" name:"InstanceChargeType"`
  102. Tag3Value string `position:"Query" name:"Tag.3.Value"`
  103. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  104. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  105. InstanceTypeFamily string `position:"Query" name:"InstanceTypeFamily"`
  106. Filter2Key string `position:"Query" name:"Filter.2.Key"`
  107. Tag5Value string `position:"Query" name:"Tag.5.Value"`
  108. Tag1Key string `position:"Query" name:"Tag.1.Key"`
  109. EipAddresses string `position:"Query" name:"EipAddresses"`
  110. VpcId string `position:"Query" name:"VpcId"`
  111. Tag2Value string `position:"Query" name:"Tag.2.Value"`
  112. Filter3Key string `position:"Query" name:"Filter.3.Key"`
  113. }
  114. type DescribeInstancesResponse struct {
  115. *responses.BaseResponse
  116. RequestId string `json:"RequestId" xml:"RequestId"`
  117. TotalCount int `json:"TotalCount" xml:"TotalCount"`
  118. PageNumber int `json:"PageNumber" xml:"PageNumber"`
  119. PageSize int `json:"PageSize" xml:"PageSize"`
  120. Instances struct {
  121. Instance []struct {
  122. InstanceId string `json:"InstanceId" xml:"InstanceId"`
  123. InstanceName string `json:"InstanceName" xml:"InstanceName"`
  124. Description string `json:"Description" xml:"Description"`
  125. ImageId string `json:"ImageId" xml:"ImageId"`
  126. OSName string `json:"OSName" xml:"OSName"`
  127. OSType string `json:"OSType" xml:"OSType"`
  128. RegionId string `json:"RegionId" xml:"RegionId"`
  129. ZoneId string `json:"ZoneId" xml:"ZoneId"`
  130. ClusterId string `json:"ClusterId" xml:"ClusterId"`
  131. InstanceType string `json:"InstanceType" xml:"InstanceType"`
  132. Cpu int `json:"Cpu" xml:"Cpu"`
  133. Memory int `json:"Memory" xml:"Memory"`
  134. HostName string `json:"HostName" xml:"HostName"`
  135. Status string `json:"Status" xml:"Status"`
  136. SerialNumber string `json:"SerialNumber" xml:"SerialNumber"`
  137. InternetChargeType string `json:"InternetChargeType" xml:"InternetChargeType"`
  138. InternetMaxBandwidthIn int `json:"InternetMaxBandwidthIn" xml:"InternetMaxBandwidthIn"`
  139. InternetMaxBandwidthOut int `json:"InternetMaxBandwidthOut" xml:"InternetMaxBandwidthOut"`
  140. VlanId string `json:"VlanId" xml:"VlanId"`
  141. CreationTime string `json:"CreationTime" xml:"CreationTime"`
  142. StartTime string `json:"StartTime" xml:"StartTime"`
  143. InstanceNetworkType string `json:"InstanceNetworkType" xml:"InstanceNetworkType"`
  144. InstanceChargeType string `json:"InstanceChargeType" xml:"InstanceChargeType"`
  145. SaleCycle string `json:"SaleCycle" xml:"SaleCycle"`
  146. ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"`
  147. AutoReleaseTime string `json:"AutoReleaseTime" xml:"AutoReleaseTime"`
  148. IoOptimized bool `json:"IoOptimized" xml:"IoOptimized"`
  149. DeviceAvailable bool `json:"DeviceAvailable" xml:"DeviceAvailable"`
  150. InstanceTypeFamily string `json:"InstanceTypeFamily" xml:"InstanceTypeFamily"`
  151. LocalStorageCapacity int `json:"LocalStorageCapacity" xml:"LocalStorageCapacity"`
  152. LocalStorageAmount int `json:"LocalStorageAmount" xml:"LocalStorageAmount"`
  153. GPUAmount int `json:"GPUAmount" xml:"GPUAmount"`
  154. GPUSpec string `json:"GPUSpec" xml:"GPUSpec"`
  155. SpotStrategy string `json:"SpotStrategy" xml:"SpotStrategy"`
  156. SpotPriceLimit float64 `json:"SpotPriceLimit" xml:"SpotPriceLimit"`
  157. ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"`
  158. KeyPairName string `json:"KeyPairName" xml:"KeyPairName"`
  159. Recyclable bool `json:"Recyclable" xml:"Recyclable"`
  160. HpcClusterId string `json:"HpcClusterId" xml:"HpcClusterId"`
  161. StoppedMode string `json:"StoppedMode" xml:"StoppedMode"`
  162. SecurityGroupIds struct {
  163. SecurityGroupId []string `json:"SecurityGroupId" xml:"SecurityGroupId"`
  164. } `json:"SecurityGroupIds" xml:"SecurityGroupIds"`
  165. PublicIpAddress struct {
  166. IpAddress []string `json:"IpAddress" xml:"IpAddress"`
  167. } `json:"PublicIpAddress" xml:"PublicIpAddress"`
  168. InnerIpAddress struct {
  169. IpAddress []string `json:"IpAddress" xml:"IpAddress"`
  170. } `json:"InnerIpAddress" xml:"InnerIpAddress"`
  171. RdmaIpAddress struct {
  172. IpAddress []string `json:"IpAddress" xml:"IpAddress"`
  173. } `json:"RdmaIpAddress" xml:"RdmaIpAddress"`
  174. VpcAttributes struct {
  175. VpcId string `json:"VpcId" xml:"VpcId"`
  176. VSwitchId string `json:"VSwitchId" xml:"VSwitchId"`
  177. NatIpAddress string `json:"NatIpAddress" xml:"NatIpAddress"`
  178. PrivateIpAddress struct {
  179. IpAddress []string `json:"IpAddress" xml:"IpAddress"`
  180. } `json:"PrivateIpAddress" xml:"PrivateIpAddress"`
  181. } `json:"VpcAttributes" xml:"VpcAttributes"`
  182. EipAddress struct {
  183. AllocationId string `json:"AllocationId" xml:"AllocationId"`
  184. IpAddress string `json:"IpAddress" xml:"IpAddress"`
  185. Bandwidth int `json:"Bandwidth" xml:"Bandwidth"`
  186. InternetChargeType string `json:"InternetChargeType" xml:"InternetChargeType"`
  187. IsSupportUnassociate bool `json:"IsSupportUnassociate" xml:"IsSupportUnassociate"`
  188. } `json:"EipAddress" xml:"EipAddress"`
  189. NetworkInterfaces struct {
  190. NetworkInterface []struct {
  191. NetworkInterfaceId string `json:"NetworkInterfaceId" xml:"NetworkInterfaceId"`
  192. MacAddress string `json:"MacAddress" xml:"MacAddress"`
  193. PrimaryIpAddress string `json:"PrimaryIpAddress" xml:"PrimaryIpAddress"`
  194. } `json:"NetworkInterface" xml:"NetworkInterface"`
  195. } `json:"NetworkInterfaces" xml:"NetworkInterfaces"`
  196. OperationLocks struct {
  197. LockReason []struct {
  198. LockReason string `json:"LockReason" xml:"LockReason"`
  199. LockMsg string `json:"LockMsg" xml:"LockMsg"`
  200. } `json:"LockReason" xml:"LockReason"`
  201. } `json:"OperationLocks" xml:"OperationLocks"`
  202. Tags struct {
  203. Tag []struct {
  204. TagKey string `json:"TagKey" xml:"TagKey"`
  205. TagValue string `json:"TagValue" xml:"TagValue"`
  206. } `json:"Tag" xml:"Tag"`
  207. } `json:"Tags" xml:"Tags"`
  208. } `json:"Instance" xml:"Instance"`
  209. } `json:"Instances" xml:"Instances"`
  210. }
  211. func CreateDescribeInstancesRequest() (request *DescribeInstancesRequest) {
  212. request = &DescribeInstancesRequest{
  213. RpcRequest: &requests.RpcRequest{},
  214. }
  215. request.InitWithApiInfo("Ecs", "2014-05-26", "DescribeInstances", "ecs", "openAPI")
  216. return
  217. }
  218. func CreateDescribeInstancesResponse() (response *DescribeInstancesResponse) {
  219. response = &DescribeInstancesResponse{
  220. BaseResponse: &responses.BaseResponse{},
  221. }
  222. return
  223. }