describe_disks.go 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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) DescribeDisks(request *DescribeDisksRequest) (response *DescribeDisksResponse, err error) {
  21. response = CreateDescribeDisksResponse()
  22. err = client.DoAction(request, response)
  23. return
  24. }
  25. func (client *Client) DescribeDisksWithChan(request *DescribeDisksRequest) (<-chan *DescribeDisksResponse, <-chan error) {
  26. responseChan := make(chan *DescribeDisksResponse, 1)
  27. errChan := make(chan error, 1)
  28. err := client.AddAsyncTask(func() {
  29. defer close(responseChan)
  30. defer close(errChan)
  31. response, err := client.DescribeDisks(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) DescribeDisksWithCallback(request *DescribeDisksRequest, callback func(response *DescribeDisksResponse, err error)) <-chan int {
  46. result := make(chan int, 1)
  47. err := client.AddAsyncTask(func() {
  48. var response *DescribeDisksResponse
  49. var err error
  50. defer close(result)
  51. response, err = client.DescribeDisks(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 DescribeDisksRequest struct {
  63. *requests.RpcRequest
  64. Tag4Value string `position:"Query" name:"Tag.4.Value"`
  65. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  66. SnapshotId string `position:"Query" name:"SnapshotId"`
  67. Tag2Key string `position:"Query" name:"Tag.2.Key"`
  68. Filter2Value string `position:"Query" name:"Filter.2.Value"`
  69. AutoSnapshotPolicyId string `position:"Query" name:"AutoSnapshotPolicyId"`
  70. Tag3Key string `position:"Query" name:"Tag.3.Key"`
  71. PageNumber requests.Integer `position:"Query" name:"PageNumber"`
  72. DiskName string `position:"Query" name:"DiskName"`
  73. Tag1Value string `position:"Query" name:"Tag.1.Value"`
  74. DeleteAutoSnapshot requests.Boolean `position:"Query" name:"DeleteAutoSnapshot"`
  75. ResourceGroupId string `position:"Query" name:"ResourceGroupId"`
  76. DiskChargeType string `position:"Query" name:"DiskChargeType"`
  77. LockReason string `position:"Query" name:"LockReason"`
  78. Filter1Key string `position:"Query" name:"Filter.1.Key"`
  79. PageSize requests.Integer `position:"Query" name:"PageSize"`
  80. DiskIds string `position:"Query" name:"DiskIds"`
  81. DeleteWithInstance requests.Boolean `position:"Query" name:"DeleteWithInstance"`
  82. Tag3Value string `position:"Query" name:"Tag.3.Value"`
  83. EnableAutoSnapshot requests.Boolean `position:"Query" name:"EnableAutoSnapshot"`
  84. DryRun requests.Boolean `position:"Query" name:"DryRun"`
  85. Tag5Key string `position:"Query" name:"Tag.5.Key"`
  86. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  87. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  88. Filter1Value string `position:"Query" name:"Filter.1.Value"`
  89. Portable requests.Boolean `position:"Query" name:"Portable"`
  90. EnableAutomatedSnapshotPolicy requests.Boolean `position:"Query" name:"EnableAutomatedSnapshotPolicy"`
  91. Filter2Key string `position:"Query" name:"Filter.2.Key"`
  92. OwnerId requests.Integer `position:"Query" name:"OwnerId"`
  93. DiskType string `position:"Query" name:"DiskType"`
  94. Tag5Value string `position:"Query" name:"Tag.5.Value"`
  95. Tag1Key string `position:"Query" name:"Tag.1.Key"`
  96. AdditionalAttributes *[]string `position:"Query" name:"AdditionalAttributes" type:"Repeated"`
  97. EnableShared requests.Boolean `position:"Query" name:"EnableShared"`
  98. InstanceId string `position:"Query" name:"InstanceId"`
  99. Encrypted requests.Boolean `position:"Query" name:"Encrypted"`
  100. Tag2Value string `position:"Query" name:"Tag.2.Value"`
  101. ZoneId string `position:"Query" name:"ZoneId"`
  102. Tag4Key string `position:"Query" name:"Tag.4.Key"`
  103. Category string `position:"Query" name:"Category"`
  104. Status string `position:"Query" name:"Status"`
  105. }
  106. type DescribeDisksResponse struct {
  107. *responses.BaseResponse
  108. RequestId string `json:"RequestId" xml:"RequestId"`
  109. TotalCount int `json:"TotalCount" xml:"TotalCount"`
  110. PageNumber int `json:"PageNumber" xml:"PageNumber"`
  111. PageSize int `json:"PageSize" xml:"PageSize"`
  112. Disks struct {
  113. Disk []struct {
  114. DiskId string `json:"DiskId" xml:"DiskId"`
  115. RegionId string `json:"RegionId" xml:"RegionId"`
  116. ZoneId string `json:"ZoneId" xml:"ZoneId"`
  117. DiskName string `json:"DiskName" xml:"DiskName"`
  118. Description string `json:"Description" xml:"Description"`
  119. Type string `json:"Type" xml:"Type"`
  120. Category string `json:"Category" xml:"Category"`
  121. Size int `json:"Size" xml:"Size"`
  122. ImageId string `json:"ImageId" xml:"ImageId"`
  123. SourceSnapshotId string `json:"SourceSnapshotId" xml:"SourceSnapshotId"`
  124. AutoSnapshotPolicyId string `json:"AutoSnapshotPolicyId" xml:"AutoSnapshotPolicyId"`
  125. ProductCode string `json:"ProductCode" xml:"ProductCode"`
  126. Portable bool `json:"Portable" xml:"Portable"`
  127. Status string `json:"Status" xml:"Status"`
  128. InstanceId string `json:"InstanceId" xml:"InstanceId"`
  129. Device string `json:"Device" xml:"Device"`
  130. DeleteWithInstance bool `json:"DeleteWithInstance" xml:"DeleteWithInstance"`
  131. DeleteAutoSnapshot bool `json:"DeleteAutoSnapshot" xml:"DeleteAutoSnapshot"`
  132. EnableAutoSnapshot bool `json:"EnableAutoSnapshot" xml:"EnableAutoSnapshot"`
  133. EnableAutomatedSnapshotPolicy bool `json:"EnableAutomatedSnapshotPolicy" xml:"EnableAutomatedSnapshotPolicy"`
  134. CreationTime string `json:"CreationTime" xml:"CreationTime"`
  135. AttachedTime string `json:"AttachedTime" xml:"AttachedTime"`
  136. DetachedTime string `json:"DetachedTime" xml:"DetachedTime"`
  137. DiskChargeType string `json:"DiskChargeType" xml:"DiskChargeType"`
  138. ExpiredTime string `json:"ExpiredTime" xml:"ExpiredTime"`
  139. ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"`
  140. Encrypted bool `json:"Encrypted" xml:"Encrypted"`
  141. MountInstanceNum int `json:"MountInstanceNum" xml:"MountInstanceNum"`
  142. IOPS int `json:"IOPS" xml:"IOPS"`
  143. IOPSRead int `json:"IOPSRead" xml:"IOPSRead"`
  144. IOPSWrite int `json:"IOPSWrite" xml:"IOPSWrite"`
  145. OperationLocks struct {
  146. OperationLock []struct {
  147. LockReason string `json:"LockReason" xml:"LockReason"`
  148. } `json:"OperationLock" xml:"OperationLock"`
  149. } `json:"OperationLocks" xml:"OperationLocks"`
  150. MountInstances struct {
  151. MountInstance []struct {
  152. InstanceId string `json:"InstanceId" xml:"InstanceId"`
  153. Device string `json:"Device" xml:"Device"`
  154. AttachedTime string `json:"AttachedTime" xml:"AttachedTime"`
  155. } `json:"MountInstance" xml:"MountInstance"`
  156. } `json:"MountInstances" xml:"MountInstances"`
  157. Tags struct {
  158. Tag []struct {
  159. TagKey string `json:"TagKey" xml:"TagKey"`
  160. TagValue string `json:"TagValue" xml:"TagValue"`
  161. } `json:"Tag" xml:"Tag"`
  162. } `json:"Tags" xml:"Tags"`
  163. } `json:"Disk" xml:"Disk"`
  164. } `json:"Disks" xml:"Disks"`
  165. }
  166. func CreateDescribeDisksRequest() (request *DescribeDisksRequest) {
  167. request = &DescribeDisksRequest{
  168. RpcRequest: &requests.RpcRequest{},
  169. }
  170. request.InitWithApiInfo("Ecs", "2014-05-26", "DescribeDisks", "ecs", "openAPI")
  171. return
  172. }
  173. func CreateDescribeDisksResponse() (response *DescribeDisksResponse) {
  174. response = &DescribeDisksResponse{
  175. BaseResponse: &responses.BaseResponse{},
  176. }
  177. return
  178. }