DescribeSnapshots.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 DescribeSnapshotsRequest 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. /* 查找快照的类型,可以为private,others,shared,默认为private (Optional) */
  31. SnapshotSource *string `json:"snapshotSource"`
  32. /* snapshotId - 云硬盘快照ID,支持多个
  33. diskId - 生成快照的云硬盘ID,支持多个
  34. status - 快照状态,精确匹配,支持多个,取值为 creating、available、copying、deleting、error_create、error_delete
  35. name - 快照名称,模糊匹配,支持单个
  36. (Optional) */
  37. Filters []common.Filter `json:"filters"`
  38. }
  39. /*
  40. * param regionId: 地域ID (Required)
  41. *
  42. * @Deprecated, not compatible when mandatory parameters changed
  43. */
  44. func NewDescribeSnapshotsRequest(
  45. regionId string,
  46. ) *DescribeSnapshotsRequest {
  47. return &DescribeSnapshotsRequest{
  48. JDCloudRequest: core.JDCloudRequest{
  49. URL: "/regions/{regionId}/snapshots",
  50. Method: "GET",
  51. Header: nil,
  52. Version: "v1",
  53. },
  54. RegionId: regionId,
  55. }
  56. }
  57. /*
  58. * param regionId: 地域ID (Required)
  59. * param pageNumber: 页码, 默认为1, 取值范围:[1,∞) (Optional)
  60. * param pageSize: 分页大小,默认为20,取值范围:[10,100] (Optional)
  61. * param snapshotSource: 查找快照的类型,可以为private,others,shared,默认为private (Optional)
  62. * param filters: snapshotId - 云硬盘快照ID,支持多个
  63. diskId - 生成快照的云硬盘ID,支持多个
  64. status - 快照状态,精确匹配,支持多个,取值为 creating、available、copying、deleting、error_create、error_delete
  65. name - 快照名称,模糊匹配,支持单个
  66. (Optional)
  67. */
  68. func NewDescribeSnapshotsRequestWithAllParams(
  69. regionId string,
  70. pageNumber *int,
  71. pageSize *int,
  72. snapshotSource *string,
  73. filters []common.Filter,
  74. ) *DescribeSnapshotsRequest {
  75. return &DescribeSnapshotsRequest{
  76. JDCloudRequest: core.JDCloudRequest{
  77. URL: "/regions/{regionId}/snapshots",
  78. Method: "GET",
  79. Header: nil,
  80. Version: "v1",
  81. },
  82. RegionId: regionId,
  83. PageNumber: pageNumber,
  84. PageSize: pageSize,
  85. SnapshotSource: snapshotSource,
  86. Filters: filters,
  87. }
  88. }
  89. /* This constructor has better compatible ability when API parameters changed */
  90. func NewDescribeSnapshotsRequestWithoutParam() *DescribeSnapshotsRequest {
  91. return &DescribeSnapshotsRequest{
  92. JDCloudRequest: core.JDCloudRequest{
  93. URL: "/regions/{regionId}/snapshots",
  94. Method: "GET",
  95. Header: nil,
  96. Version: "v1",
  97. },
  98. }
  99. }
  100. /* param regionId: 地域ID(Required) */
  101. func (r *DescribeSnapshotsRequest) SetRegionId(regionId string) {
  102. r.RegionId = regionId
  103. }
  104. /* param pageNumber: 页码, 默认为1, 取值范围:[1,∞)(Optional) */
  105. func (r *DescribeSnapshotsRequest) SetPageNumber(pageNumber int) {
  106. r.PageNumber = &pageNumber
  107. }
  108. /* param pageSize: 分页大小,默认为20,取值范围:[10,100](Optional) */
  109. func (r *DescribeSnapshotsRequest) SetPageSize(pageSize int) {
  110. r.PageSize = &pageSize
  111. }
  112. /* param snapshotSource: 查找快照的类型,可以为private,others,shared,默认为private(Optional) */
  113. func (r *DescribeSnapshotsRequest) SetSnapshotSource(snapshotSource string) {
  114. r.SnapshotSource = &snapshotSource
  115. }
  116. /* param filters: snapshotId - 云硬盘快照ID,支持多个
  117. diskId - 生成快照的云硬盘ID,支持多个
  118. status - 快照状态,精确匹配,支持多个,取值为 creating、available、copying、deleting、error_create、error_delete
  119. name - 快照名称,模糊匹配,支持单个
  120. (Optional) */
  121. func (r *DescribeSnapshotsRequest) SetFilters(filters []common.Filter) {
  122. r.Filters = filters
  123. }
  124. // GetRegionId returns path parameter 'regionId' if exist,
  125. // otherwise return empty string
  126. func (r DescribeSnapshotsRequest) GetRegionId() string {
  127. return r.RegionId
  128. }
  129. type DescribeSnapshotsResponse struct {
  130. RequestID string `json:"requestId"`
  131. Error core.ErrorResponse `json:"error"`
  132. Result DescribeSnapshotsResult `json:"result"`
  133. }
  134. type DescribeSnapshotsResult struct {
  135. Snapshots []disk.Snapshot `json:"snapshots"`
  136. TotalCount int `json:"totalCount"`
  137. }