UpdateSnapshotPolicy.go 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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 UpdateSnapshotPolicyRequest struct {
  22. core.JDCloudRequest
  23. /* 地域ID */
  24. RegionId string `json:"regionId"`
  25. /* 策略ID */
  26. PolicyId string `json:"policyId"`
  27. /* 策略名称 */
  28. Name string `json:"name"`
  29. /* 策略执行周期,单位:秒,不小于12小时 */
  30. Interval int `json:"interval"`
  31. /* 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` */
  32. EffectiveTime string `json:"effectiveTime"`
  33. /* 快照保留时间,单位:秒,0:表示不删除 */
  34. SnapshotLifecycle int `json:"snapshotLifecycle"`
  35. /* 联系人信息 (Optional) */
  36. ContactInfo *disk.ContactInfo `json:"contactInfo"`
  37. /* 策略状态。1:启用 2:禁用 */
  38. Status int `json:"status"`
  39. }
  40. /*
  41. * param regionId: 地域ID (Required)
  42. * param policyId: 策略ID (Required)
  43. * param name: 策略名称 (Required)
  44. * param interval: 策略执行周期,单位:秒,不小于12小时 (Required)
  45. * param effectiveTime: 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Required)
  46. * param snapshotLifecycle: 快照保留时间,单位:秒,0:表示不删除 (Required)
  47. * param status: 策略状态。1:启用 2:禁用 (Required)
  48. *
  49. * @Deprecated, not compatible when mandatory parameters changed
  50. */
  51. func NewUpdateSnapshotPolicyRequest(
  52. regionId string,
  53. policyId string,
  54. name string,
  55. interval int,
  56. effectiveTime string,
  57. snapshotLifecycle int,
  58. status int,
  59. ) *UpdateSnapshotPolicyRequest {
  60. return &UpdateSnapshotPolicyRequest{
  61. JDCloudRequest: core.JDCloudRequest{
  62. URL: "/regions/{regionId}/snapshotPolicy/{policyId}",
  63. Method: "PATCH",
  64. Header: nil,
  65. Version: "v1",
  66. },
  67. RegionId: regionId,
  68. PolicyId: policyId,
  69. Name: name,
  70. Interval: interval,
  71. EffectiveTime: effectiveTime,
  72. SnapshotLifecycle: snapshotLifecycle,
  73. Status: status,
  74. }
  75. }
  76. /*
  77. * param regionId: 地域ID (Required)
  78. * param policyId: 策略ID (Required)
  79. * param name: 策略名称 (Required)
  80. * param interval: 策略执行周期,单位:秒,不小于12小时 (Required)
  81. * param effectiveTime: 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Required)
  82. * param snapshotLifecycle: 快照保留时间,单位:秒,0:表示不删除 (Required)
  83. * param contactInfo: 联系人信息 (Optional)
  84. * param status: 策略状态。1:启用 2:禁用 (Required)
  85. */
  86. func NewUpdateSnapshotPolicyRequestWithAllParams(
  87. regionId string,
  88. policyId string,
  89. name string,
  90. interval int,
  91. effectiveTime string,
  92. snapshotLifecycle int,
  93. contactInfo *disk.ContactInfo,
  94. status int,
  95. ) *UpdateSnapshotPolicyRequest {
  96. return &UpdateSnapshotPolicyRequest{
  97. JDCloudRequest: core.JDCloudRequest{
  98. URL: "/regions/{regionId}/snapshotPolicy/{policyId}",
  99. Method: "PATCH",
  100. Header: nil,
  101. Version: "v1",
  102. },
  103. RegionId: regionId,
  104. PolicyId: policyId,
  105. Name: name,
  106. Interval: interval,
  107. EffectiveTime: effectiveTime,
  108. SnapshotLifecycle: snapshotLifecycle,
  109. ContactInfo: contactInfo,
  110. Status: status,
  111. }
  112. }
  113. /* This constructor has better compatible ability when API parameters changed */
  114. func NewUpdateSnapshotPolicyRequestWithoutParam() *UpdateSnapshotPolicyRequest {
  115. return &UpdateSnapshotPolicyRequest{
  116. JDCloudRequest: core.JDCloudRequest{
  117. URL: "/regions/{regionId}/snapshotPolicy/{policyId}",
  118. Method: "PATCH",
  119. Header: nil,
  120. Version: "v1",
  121. },
  122. }
  123. }
  124. /* param regionId: 地域ID(Required) */
  125. func (r *UpdateSnapshotPolicyRequest) SetRegionId(regionId string) {
  126. r.RegionId = regionId
  127. }
  128. /* param policyId: 策略ID(Required) */
  129. func (r *UpdateSnapshotPolicyRequest) SetPolicyId(policyId string) {
  130. r.PolicyId = policyId
  131. }
  132. /* param name: 策略名称(Required) */
  133. func (r *UpdateSnapshotPolicyRequest) SetName(name string) {
  134. r.Name = name
  135. }
  136. /* param interval: 策略执行周期,单位:秒,不小于12小时(Required) */
  137. func (r *UpdateSnapshotPolicyRequest) SetInterval(interval int) {
  138. r.Interval = interval
  139. }
  140. /* param effectiveTime: 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00`(Required) */
  141. func (r *UpdateSnapshotPolicyRequest) SetEffectiveTime(effectiveTime string) {
  142. r.EffectiveTime = effectiveTime
  143. }
  144. /* param snapshotLifecycle: 快照保留时间,单位:秒,0:表示不删除(Required) */
  145. func (r *UpdateSnapshotPolicyRequest) SetSnapshotLifecycle(snapshotLifecycle int) {
  146. r.SnapshotLifecycle = snapshotLifecycle
  147. }
  148. /* param contactInfo: 联系人信息(Optional) */
  149. func (r *UpdateSnapshotPolicyRequest) SetContactInfo(contactInfo *disk.ContactInfo) {
  150. r.ContactInfo = contactInfo
  151. }
  152. /* param status: 策略状态。1:启用 2:禁用(Required) */
  153. func (r *UpdateSnapshotPolicyRequest) SetStatus(status int) {
  154. r.Status = status
  155. }
  156. // GetRegionId returns path parameter 'regionId' if exist,
  157. // otherwise return empty string
  158. func (r UpdateSnapshotPolicyRequest) GetRegionId() string {
  159. return r.RegionId
  160. }
  161. type UpdateSnapshotPolicyResponse struct {
  162. RequestID string `json:"requestId"`
  163. Error core.ErrorResponse `json:"error"`
  164. Result UpdateSnapshotPolicyResult `json:"result"`
  165. }
  166. type UpdateSnapshotPolicyResult struct {
  167. Id string `json:"id"`
  168. Name string `json:"name"`
  169. Pin string `json:"pin"`
  170. Interval int `json:"interval"`
  171. EffectiveTime string `json:"effectiveTime"`
  172. LastTriggerTime string `json:"lastTriggerTime"`
  173. NextTriggerTime string `json:"nextTriggerTime"`
  174. SnapshotLifecycle int `json:"snapshotLifecycle"`
  175. ContactInfo disk.ContactInfo `json:"contactInfo"`
  176. CreateTime string `json:"createTime"`
  177. UpdateTime string `json:"updateTime"`
  178. Status int `json:"status"`
  179. DiskCount int `json:"diskCount"`
  180. }