CreateSnapshotPolicy.go 6.2 KB

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