CreateSnapshot.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. )
  21. type CreateSnapshotRequest struct {
  22. core.JDCloudRequest
  23. /* 地域ID */
  24. RegionId string `json:"regionId"`
  25. /* 创建快照规格 */
  26. SnapshotSpec *disk.SnapshotSpec `json:"snapshotSpec"`
  27. /* 幂等性校验参数 */
  28. ClientToken string `json:"clientToken"`
  29. }
  30. /*
  31. * param regionId: 地域ID (Required)
  32. * param snapshotSpec: 创建快照规格 (Required)
  33. * param clientToken: 幂等性校验参数 (Required)
  34. *
  35. * @Deprecated, not compatible when mandatory parameters changed
  36. */
  37. func NewCreateSnapshotRequest(
  38. regionId string,
  39. snapshotSpec *disk.SnapshotSpec,
  40. clientToken string,
  41. ) *CreateSnapshotRequest {
  42. return &CreateSnapshotRequest{
  43. JDCloudRequest: core.JDCloudRequest{
  44. URL: "/regions/{regionId}/snapshots",
  45. Method: "POST",
  46. Header: nil,
  47. Version: "v1",
  48. },
  49. RegionId: regionId,
  50. SnapshotSpec: snapshotSpec,
  51. ClientToken: clientToken,
  52. }
  53. }
  54. /*
  55. * param regionId: 地域ID (Required)
  56. * param snapshotSpec: 创建快照规格 (Required)
  57. * param clientToken: 幂等性校验参数 (Required)
  58. */
  59. func NewCreateSnapshotRequestWithAllParams(
  60. regionId string,
  61. snapshotSpec *disk.SnapshotSpec,
  62. clientToken string,
  63. ) *CreateSnapshotRequest {
  64. return &CreateSnapshotRequest{
  65. JDCloudRequest: core.JDCloudRequest{
  66. URL: "/regions/{regionId}/snapshots",
  67. Method: "POST",
  68. Header: nil,
  69. Version: "v1",
  70. },
  71. RegionId: regionId,
  72. SnapshotSpec: snapshotSpec,
  73. ClientToken: clientToken,
  74. }
  75. }
  76. /* This constructor has better compatible ability when API parameters changed */
  77. func NewCreateSnapshotRequestWithoutParam() *CreateSnapshotRequest {
  78. return &CreateSnapshotRequest{
  79. JDCloudRequest: core.JDCloudRequest{
  80. URL: "/regions/{regionId}/snapshots",
  81. Method: "POST",
  82. Header: nil,
  83. Version: "v1",
  84. },
  85. }
  86. }
  87. /* param regionId: 地域ID(Required) */
  88. func (r *CreateSnapshotRequest) SetRegionId(regionId string) {
  89. r.RegionId = regionId
  90. }
  91. /* param snapshotSpec: 创建快照规格(Required) */
  92. func (r *CreateSnapshotRequest) SetSnapshotSpec(snapshotSpec *disk.SnapshotSpec) {
  93. r.SnapshotSpec = snapshotSpec
  94. }
  95. /* param clientToken: 幂等性校验参数(Required) */
  96. func (r *CreateSnapshotRequest) SetClientToken(clientToken string) {
  97. r.ClientToken = clientToken
  98. }
  99. // GetRegionId returns path parameter 'regionId' if exist,
  100. // otherwise return empty string
  101. func (r CreateSnapshotRequest) GetRegionId() string {
  102. return r.RegionId
  103. }
  104. type CreateSnapshotResponse struct {
  105. RequestID string `json:"requestId"`
  106. Error core.ErrorResponse `json:"error"`
  107. Result CreateSnapshotResult `json:"result"`
  108. }
  109. type CreateSnapshotResult struct {
  110. SnapshotId string `json:"snapshotId"`
  111. }