describe_instances.go 12 KB

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