describe_images.go 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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) DescribeImages(request *DescribeImagesRequest) (response *DescribeImagesResponse, err error) {
  21. response = CreateDescribeImagesResponse()
  22. err = client.DoAction(request, response)
  23. return
  24. }
  25. func (client *Client) DescribeImagesWithChan(request *DescribeImagesRequest) (<-chan *DescribeImagesResponse, <-chan error) {
  26. responseChan := make(chan *DescribeImagesResponse, 1)
  27. errChan := make(chan error, 1)
  28. err := client.AddAsyncTask(func() {
  29. defer close(responseChan)
  30. defer close(errChan)
  31. response, err := client.DescribeImages(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) DescribeImagesWithCallback(request *DescribeImagesRequest, callback func(response *DescribeImagesResponse, err error)) <-chan int {
  43. result := make(chan int, 1)
  44. err := client.AddAsyncTask(func() {
  45. var response *DescribeImagesResponse
  46. var err error
  47. defer close(result)
  48. response, err = client.DescribeImages(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 DescribeImagesRequest struct {
  60. *requests.RpcRequest
  61. PageSize requests.Integer `position:"Query" name:"PageSize"`
  62. OSType string `position:"Query" name:"OSType"`
  63. IsSupportIoOptimized requests.Boolean `position:"Query" name:"IsSupportIoOptimized"`
  64. Filter2Key string `position:"Query" name:"Filter.2.Key"`
  65. Architecture string `position:"Query" name:"Architecture"`
  66. InstanceType string `position:"Query" name:"InstanceType"`
  67. Tag5Value string `position:"Query" name:"Tag.5.Value"`
  68. Tag3Key string `position:"Query" name:"Tag.3.Key"`
  69. Filter2Value string `position:"Query" name:"Filter.2.Value"`
  70. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  71. SnapshotId string `position:"Query" name:"SnapshotId"`
  72. Filter1Value string `position:"Query" name:"Filter.1.Value"`
  73. Tag1Key string `position:"Query" name:"Tag.1.Key"`
  74. Tag1Value string `position:"Query" name:"Tag.1.Value"`
  75. IsSupportCloudinit requests.Boolean `position:"Query" name:"IsSupportCloudinit"`
  76. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  77. Tag4Value string `position:"Query" name:"Tag.4.Value"`
  78. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  79. ImageOwnerAlias string `position:"Query" name:"ImageOwnerAlias"`
  80. Status string `position:"Query" name:"Status"`
  81. PageNumber requests.Integer `position:"Query" name:"PageNumber"`
  82. OwnerId requests.Integer `position:"Query" name:"OwnerId"`
  83. Tag5Key string `position:"Query" name:"Tag.5.Key"`
  84. ImageId string `position:"Query" name:"ImageId"`
  85. ImageName string `position:"Query" name:"ImageName"`
  86. Tag2Key string `position:"Query" name:"Tag.2.Key"`
  87. Filter1Key string `position:"Query" name:"Filter.1.Key"`
  88. Usage string `position:"Query" name:"Usage"`
  89. DryRun requests.Boolean `position:"Query" name:"DryRun"`
  90. Tag3Value string `position:"Query" name:"Tag.3.Value"`
  91. ShowExpired requests.Boolean `position:"Query" name:"ShowExpired"`
  92. Tag2Value string `position:"Query" name:"Tag.2.Value"`
  93. Tag4Key string `position:"Query" name:"Tag.4.Key"`
  94. }
  95. type DescribeImagesResponse struct {
  96. *responses.BaseResponse
  97. RequestId string `json:"RequestId" xml:"RequestId"`
  98. RegionId string `json:"RegionId" xml:"RegionId"`
  99. TotalCount int `json:"TotalCount" xml:"TotalCount"`
  100. PageNumber int `json:"PageNumber" xml:"PageNumber"`
  101. PageSize int `json:"PageSize" xml:"PageSize"`
  102. Images struct {
  103. Image []struct {
  104. Progress string `json:"Progress" xml:"Progress"`
  105. ImageId string `json:"ImageId" xml:"ImageId"`
  106. ImageName string `json:"ImageName" xml:"ImageName"`
  107. ImageVersion string `json:"ImageVersion" xml:"ImageVersion"`
  108. Description string `json:"Description" xml:"Description"`
  109. Size int `json:"Size" xml:"Size"`
  110. ImageOwnerAlias string `json:"ImageOwnerAlias" xml:"ImageOwnerAlias"`
  111. IsSupportIoOptimized bool `json:"IsSupportIoOptimized" xml:"IsSupportIoOptimized"`
  112. IsSupportCloudinit bool `json:"IsSupportCloudinit" xml:"IsSupportCloudinit"`
  113. OSName string `json:"OSName" xml:"OSName"`
  114. Architecture string `json:"Architecture" xml:"Architecture"`
  115. Status string `json:"Status" xml:"Status"`
  116. ProductCode string `json:"ProductCode" xml:"ProductCode"`
  117. IsSubscribed bool `json:"IsSubscribed" xml:"IsSubscribed"`
  118. CreationTime string `json:"CreationTime" xml:"CreationTime"`
  119. IsSelfShared string `json:"IsSelfShared" xml:"IsSelfShared"`
  120. OSType string `json:"OSType" xml:"OSType"`
  121. Platform string `json:"Platform" xml:"Platform"`
  122. Usage string `json:"Usage" xml:"Usage"`
  123. IsCopied bool `json:"IsCopied" xml:"IsCopied"`
  124. DiskDeviceMappings struct {
  125. DiskDeviceMapping []struct {
  126. SnapshotId string `json:"SnapshotId" xml:"SnapshotId"`
  127. Size string `json:"Size" xml:"Size"`
  128. Device string `json:"Device" xml:"Device"`
  129. Type string `json:"Type" xml:"Type"`
  130. Format string `json:"Format" xml:"Format"`
  131. ImportOSSBucket string `json:"ImportOSSBucket" xml:"ImportOSSBucket"`
  132. ImportOSSObject string `json:"ImportOSSObject" xml:"ImportOSSObject"`
  133. } `json:"DiskDeviceMapping" xml:"DiskDeviceMapping"`
  134. } `json:"DiskDeviceMappings" xml:"DiskDeviceMappings"`
  135. Tags struct {
  136. Tag []struct {
  137. TagKey string `json:"TagKey" xml:"TagKey"`
  138. TagValue string `json:"TagValue" xml:"TagValue"`
  139. } `json:"Tag" xml:"Tag"`
  140. } `json:"Tags" xml:"Tags"`
  141. } `json:"Image" xml:"Image"`
  142. } `json:"Images" xml:"Images"`
  143. }
  144. func CreateDescribeImagesRequest() (request *DescribeImagesRequest) {
  145. request = &DescribeImagesRequest{
  146. RpcRequest: &requests.RpcRequest{},
  147. }
  148. request.InitWithApiInfo("Ecs", "2014-05-26", "DescribeImages", "", "")
  149. return
  150. }
  151. func CreateDescribeImagesResponse() (response *DescribeImagesResponse) {
  152. response = &DescribeImagesResponse{
  153. BaseResponse: &responses.BaseResponse{},
  154. }
  155. return
  156. }