DescribeDisks.go 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
  20. common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models"
  21. )
  22. type DescribeDisksRequest struct {
  23. core.JDCloudRequest
  24. /* 地域ID */
  25. RegionId string `json:"regionId"`
  26. /* 页码, 默认为1, 取值范围:[1,∞) (Optional) */
  27. PageNumber *int `json:"pageNumber"`
  28. /* 分页大小,默认为20,取值范围:[10,100] (Optional) */
  29. PageSize *int `json:"pageSize"`
  30. /* Tag筛选条件 (Optional) */
  31. Tags []disk.TagFilter `json:"tags"`
  32. /* diskId - 云硬盘ID,精确匹配,支持多个
  33. diskType - 云硬盘类型,精确匹配,支持多个,取值为 ssd,premium-hdd,ssd.io1,ssd.gp1,hdd.std1
  34. instanceId - 云硬盘所挂载主机的ID,精确匹配,支持多个
  35. instanceType - 云硬盘所挂载主机的类型,精确匹配,支持多个
  36. status - 可用区,精确匹配,支持多个
  37. az - 云硬盘状态,精确匹配,支持多个
  38. name - 云硬盘名称,模糊匹配,支持单个
  39. multiAttach - 云硬盘是否多点挂载,精确匹配,支持单个
  40. encrypted - 云硬盘是否加密,精确匹配,支持单个
  41. policyId - 绑定policyId的云硬盘,精确匹配,支持多个
  42. notPolicyId - 未绑定policyId的云硬盘,精确匹配,支持多个
  43. (Optional) */
  44. Filters []common.Filter `json:"filters"`
  45. }
  46. /*
  47. * param regionId: 地域ID (Required)
  48. *
  49. * @Deprecated, not compatible when mandatory parameters changed
  50. */
  51. func NewDescribeDisksRequest(
  52. regionId string,
  53. ) *DescribeDisksRequest {
  54. return &DescribeDisksRequest{
  55. JDCloudRequest: core.JDCloudRequest{
  56. URL: "/regions/{regionId}/disks",
  57. Method: "GET",
  58. Header: nil,
  59. Version: "v1",
  60. },
  61. RegionId: regionId,
  62. }
  63. }
  64. /*
  65. * param regionId: 地域ID (Required)
  66. * param pageNumber: 页码, 默认为1, 取值范围:[1,∞) (Optional)
  67. * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional)
  68. * param tags: Tag筛选条件 (Optional)
  69. * param filters: diskId - 云硬盘ID,精确匹配,支持多个
  70. diskType - 云硬盘类型,精确匹配,支持多个,取值为 ssd,premium-hdd,ssd.io1,ssd.gp1,hdd.std1
  71. instanceId - 云硬盘所挂载主机的ID,精确匹配,支持多个
  72. instanceType - 云硬盘所挂载主机的类型,精确匹配,支持多个
  73. status - 可用区,精确匹配,支持多个
  74. az - 云硬盘状态,精确匹配,支持多个
  75. name - 云硬盘名称,模糊匹配,支持单个
  76. multiAttach - 云硬盘是否多点挂载,精确匹配,支持单个
  77. encrypted - 云硬盘是否加密,精确匹配,支持单个
  78. policyId - 绑定policyId的云硬盘,精确匹配,支持多个
  79. notPolicyId - 未绑定policyId的云硬盘,精确匹配,支持多个
  80. (Optional)
  81. */
  82. func NewDescribeDisksRequestWithAllParams(
  83. regionId string,
  84. pageNumber *int,
  85. pageSize *int,
  86. tags []disk.TagFilter,
  87. filters []common.Filter,
  88. ) *DescribeDisksRequest {
  89. return &DescribeDisksRequest{
  90. JDCloudRequest: core.JDCloudRequest{
  91. URL: "/regions/{regionId}/disks",
  92. Method: "GET",
  93. Header: nil,
  94. Version: "v1",
  95. },
  96. RegionId: regionId,
  97. PageNumber: pageNumber,
  98. PageSize: pageSize,
  99. Tags: tags,
  100. Filters: filters,
  101. }
  102. }
  103. /* This constructor has better compatible ability when API parameters changed */
  104. func NewDescribeDisksRequestWithoutParam() *DescribeDisksRequest {
  105. return &DescribeDisksRequest{
  106. JDCloudRequest: core.JDCloudRequest{
  107. URL: "/regions/{regionId}/disks",
  108. Method: "GET",
  109. Header: nil,
  110. Version: "v1",
  111. },
  112. }
  113. }
  114. /* param regionId: 地域ID(Required) */
  115. func (r *DescribeDisksRequest) SetRegionId(regionId string) {
  116. r.RegionId = regionId
  117. }
  118. /* param pageNumber: 页码, 默认为1, 取值范围:[1,∞)(Optional) */
  119. func (r *DescribeDisksRequest) SetPageNumber(pageNumber int) {
  120. r.PageNumber = &pageNumber
  121. }
  122. /* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */
  123. func (r *DescribeDisksRequest) SetPageSize(pageSize int) {
  124. r.PageSize = &pageSize
  125. }
  126. /* param tags: Tag筛选条件(Optional) */
  127. func (r *DescribeDisksRequest) SetTags(tags []disk.TagFilter) {
  128. r.Tags = tags
  129. }
  130. /* param filters: diskId - 云硬盘ID,精确匹配,支持多个
  131. diskType - 云硬盘类型,精确匹配,支持多个,取值为 ssd,premium-hdd,ssd.io1,ssd.gp1,hdd.std1
  132. instanceId - 云硬盘所挂载主机的ID,精确匹配,支持多个
  133. instanceType - 云硬盘所挂载主机的类型,精确匹配,支持多个
  134. status - 可用区,精确匹配,支持多个
  135. az - 云硬盘状态,精确匹配,支持多个
  136. name - 云硬盘名称,模糊匹配,支持单个
  137. multiAttach - 云硬盘是否多点挂载,精确匹配,支持单个
  138. encrypted - 云硬盘是否加密,精确匹配,支持单个
  139. policyId - 绑定policyId的云硬盘,精确匹配,支持多个
  140. notPolicyId - 未绑定policyId的云硬盘,精确匹配,支持多个
  141. (Optional) */
  142. func (r *DescribeDisksRequest) SetFilters(filters []common.Filter) {
  143. r.Filters = filters
  144. }
  145. // GetRegionId returns path parameter 'regionId' if exist,
  146. // otherwise return empty string
  147. func (r DescribeDisksRequest) GetRegionId() string {
  148. return r.RegionId
  149. }
  150. type DescribeDisksResponse struct {
  151. RequestID string `json:"requestId"`
  152. Error core.ErrorResponse `json:"error"`
  153. Result DescribeDisksResult `json:"result"`
  154. }
  155. type DescribeDisksResult struct {
  156. Disks []disk.Disk `json:"disks"`
  157. TotalCount int `json:"totalCount"`
  158. }