DescribeImages.go 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. // Copyright 2018 JDCLOUD.COM
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. // NOTE: This class is auto generated by the jdcloud code generator program.
  16. package apis
  17. import (
  18. "github.com/jdcloud-api/jdcloud-sdk-go/core"
  19. vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models"
  20. )
  21. type DescribeImagesRequest struct {
  22. core.JDCloudRequest
  23. /* 地域ID */
  24. RegionId string `json:"regionId"`
  25. /* 镜像来源,如果没有指定ids参数,此参数必传;取值范围:public、shared、thirdparty、private、community (Optional) */
  26. ImageSource *string `json:"imageSource"`
  27. /* 产品线标识,非必传,不传的时候返回全部产品线镜像 (Optional) */
  28. ServiceCode *string `json:"serviceCode"`
  29. /* 是否下线,默认值为false;imageSource为public或者thirdparty时,此参数才有意义,其它情况下此参数无效;指定镜像ID查询时,此参数无效 (Optional) */
  30. Offline *bool `json:"offline"`
  31. /* 操作系统平台,取值范围:Windows Server、CentOS、Ubuntu (Optional) */
  32. Platform *string `json:"platform"`
  33. /* 镜像ID列表,如果指定了此参数,其它参数可为空 (Optional) */
  34. Ids []string `json:"ids"`
  35. /* 根据镜像名称模糊查找 (Optional) */
  36. ImageName *string `json:"imageName"`
  37. /* 镜像支持的系统盘类型,[localDisk,cloudDisk] (Optional) */
  38. RootDeviceType *string `json:"rootDeviceType"`
  39. /* 镜像的使用权限[all, specifiedUsers,ownerOnly],可选参数,仅当imageSource取值private时有效 (Optional) */
  40. LaunchPermission *string `json:"launchPermission"`
  41. /* <a href="http://docs.jdcloud.com/virtual-machines/api/image_status">参考镜像状态</a> (Optional) */
  42. Status *string `json:"status"`
  43. /* 页码;默认为1 (Optional) */
  44. PageNumber *int `json:"pageNumber"`
  45. /* 分页大小;默认为20;取值范围[10, 100] (Optional) */
  46. PageSize *int `json:"pageSize"`
  47. }
  48. /*
  49. * param regionId: 地域ID (Required)
  50. *
  51. * @Deprecated, not compatible when mandatory parameters changed
  52. */
  53. func NewDescribeImagesRequest(
  54. regionId string,
  55. ) *DescribeImagesRequest {
  56. return &DescribeImagesRequest{
  57. JDCloudRequest: core.JDCloudRequest{
  58. URL: "/regions/{regionId}/images",
  59. Method: "GET",
  60. Header: nil,
  61. Version: "v1",
  62. },
  63. RegionId: regionId,
  64. }
  65. }
  66. /*
  67. * param regionId: 地域ID (Required)
  68. * param imageSource: 镜像来源,如果没有指定ids参数,此参数必传;取值范围:public、shared、thirdparty、private、community (Optional)
  69. * param serviceCode: 产品线标识,非必传,不传的时候返回全部产品线镜像 (Optional)
  70. * param offline: 是否下线,默认值为false;imageSource为public或者thirdparty时,此参数才有意义,其它情况下此参数无效;指定镜像ID查询时,此参数无效 (Optional)
  71. * param platform: 操作系统平台,取值范围:Windows Server、CentOS、Ubuntu (Optional)
  72. * param ids: 镜像ID列表,如果指定了此参数,其它参数可为空 (Optional)
  73. * param imageName: 根据镜像名称模糊查找 (Optional)
  74. * param rootDeviceType: 镜像支持的系统盘类型,[localDisk,cloudDisk] (Optional)
  75. * param launchPermission: 镜像的使用权限[all, specifiedUsers,ownerOnly],可选参数,仅当imageSource取值private时有效 (Optional)
  76. * param status: <a href="http://docs.jdcloud.com/virtual-machines/api/image_status">参考镜像状态</a> (Optional)
  77. * param pageNumber: 页码;默认为1 (Optional)
  78. * param pageSize: 分页大小;默认为20;取值范围[10, 100] (Optional)
  79. */
  80. func NewDescribeImagesRequestWithAllParams(
  81. regionId string,
  82. imageSource *string,
  83. serviceCode *string,
  84. offline *bool,
  85. platform *string,
  86. ids []string,
  87. imageName *string,
  88. rootDeviceType *string,
  89. launchPermission *string,
  90. status *string,
  91. pageNumber *int,
  92. pageSize *int,
  93. ) *DescribeImagesRequest {
  94. return &DescribeImagesRequest{
  95. JDCloudRequest: core.JDCloudRequest{
  96. URL: "/regions/{regionId}/images",
  97. Method: "GET",
  98. Header: nil,
  99. Version: "v1",
  100. },
  101. RegionId: regionId,
  102. ImageSource: imageSource,
  103. ServiceCode: serviceCode,
  104. Offline: offline,
  105. Platform: platform,
  106. Ids: ids,
  107. ImageName: imageName,
  108. RootDeviceType: rootDeviceType,
  109. LaunchPermission: launchPermission,
  110. Status: status,
  111. PageNumber: pageNumber,
  112. PageSize: pageSize,
  113. }
  114. }
  115. /* This constructor has better compatible ability when API parameters changed */
  116. func NewDescribeImagesRequestWithoutParam() *DescribeImagesRequest {
  117. return &DescribeImagesRequest{
  118. JDCloudRequest: core.JDCloudRequest{
  119. URL: "/regions/{regionId}/images",
  120. Method: "GET",
  121. Header: nil,
  122. Version: "v1",
  123. },
  124. }
  125. }
  126. /* param regionId: 地域ID(Required) */
  127. func (r *DescribeImagesRequest) SetRegionId(regionId string) {
  128. r.RegionId = regionId
  129. }
  130. /* param imageSource: 镜像来源,如果没有指定ids参数,此参数必传;取值范围:public、shared、thirdparty、private、community(Optional) */
  131. func (r *DescribeImagesRequest) SetImageSource(imageSource string) {
  132. r.ImageSource = &imageSource
  133. }
  134. /* param serviceCode: 产品线标识,非必传,不传的时候返回全部产品线镜像(Optional) */
  135. func (r *DescribeImagesRequest) SetServiceCode(serviceCode string) {
  136. r.ServiceCode = &serviceCode
  137. }
  138. /* param offline: 是否下线,默认值为false;imageSource为public或者thirdparty时,此参数才有意义,其它情况下此参数无效;指定镜像ID查询时,此参数无效(Optional) */
  139. func (r *DescribeImagesRequest) SetOffline(offline bool) {
  140. r.Offline = &offline
  141. }
  142. /* param platform: 操作系统平台,取值范围:Windows Server、CentOS、Ubuntu(Optional) */
  143. func (r *DescribeImagesRequest) SetPlatform(platform string) {
  144. r.Platform = &platform
  145. }
  146. /* param ids: 镜像ID列表,如果指定了此参数,其它参数可为空(Optional) */
  147. func (r *DescribeImagesRequest) SetIds(ids []string) {
  148. r.Ids = ids
  149. }
  150. /* param imageName: 根据镜像名称模糊查找(Optional) */
  151. func (r *DescribeImagesRequest) SetImageName(imageName string) {
  152. r.ImageName = &imageName
  153. }
  154. /* param rootDeviceType: 镜像支持的系统盘类型,[localDisk,cloudDisk](Optional) */
  155. func (r *DescribeImagesRequest) SetRootDeviceType(rootDeviceType string) {
  156. r.RootDeviceType = &rootDeviceType
  157. }
  158. /* param launchPermission: 镜像的使用权限[all, specifiedUsers,ownerOnly],可选参数,仅当imageSource取值private时有效(Optional) */
  159. func (r *DescribeImagesRequest) SetLaunchPermission(launchPermission string) {
  160. r.LaunchPermission = &launchPermission
  161. }
  162. /* param status: <a href="http://docs.jdcloud.com/virtual-machines/api/image_status">参考镜像状态</a>(Optional) */
  163. func (r *DescribeImagesRequest) SetStatus(status string) {
  164. r.Status = &status
  165. }
  166. /* param pageNumber: 页码;默认为1(Optional) */
  167. func (r *DescribeImagesRequest) SetPageNumber(pageNumber int) {
  168. r.PageNumber = &pageNumber
  169. }
  170. /* param pageSize: 分页大小;默认为20;取值范围[10, 100](Optional) */
  171. func (r *DescribeImagesRequest) SetPageSize(pageSize int) {
  172. r.PageSize = &pageSize
  173. }
  174. // GetRegionId returns path parameter 'regionId' if exist,
  175. // otherwise return empty string
  176. func (r DescribeImagesRequest) GetRegionId() string {
  177. return r.RegionId
  178. }
  179. type DescribeImagesResponse struct {
  180. RequestID string `json:"requestId"`
  181. Error core.ErrorResponse `json:"error"`
  182. Result DescribeImagesResult `json:"result"`
  183. }
  184. type DescribeImagesResult struct {
  185. Images []vm.Image `json:"images"`
  186. TotalCount int `json:"totalCount"`
  187. }