instance_backup.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // Copyright 2019 Yunion
  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. package compute
  15. import (
  16. "time"
  17. "yunion.io/x/onecloud/pkg/apis"
  18. )
  19. const (
  20. INSTANCE_BACKUP_STATUS_CREATING = "creating"
  21. INSTANCE_BACKUP_STATUS_CREATE_FAILED = "create_failed"
  22. INSTANCE_BACKUP_STATUS_DELETING = "deleting"
  23. INSTANCE_BACKUP_STATUS_DELETE_FAILED = "delete_failed"
  24. INSTANCE_BACKUP_STATUS_RECOVERY = "recovery"
  25. INSTANCE_BACKUP_STATUS_RECOVERY_FAILED = "recovery_failed"
  26. INSTANCE_BACKUP_STATUS_READY = "ready"
  27. INSTANCE_BACKUP_STATUS_PACK = "pack"
  28. INSTANCE_BACKUP_STATUS_PACK_FAILED = "pack_failed"
  29. INSTANCE_BACKUP_STATUS_CREATING_FROM_PACKAGE = "creating_from_package"
  30. INSTANCE_BACKUP_STATUS_CREATE_FROM_PACKAGE_FAILED = "create_from_package_failed"
  31. INSTANCE_BACKUP_STATUS_SNAPSHOT = "snapshot"
  32. INSTANCE_BACKUP_STATUS_SNAPSHOT_FAILED = "snapshot_failed"
  33. INSTANCE_BACKUP_STATUS_SAVING = "saving"
  34. INSTANCE_BACKUP_STATUS_SAVE_FAILED = "save_failed"
  35. )
  36. type InstanceBackupListInput struct {
  37. apis.VirtualResourceListInput
  38. apis.MultiArchResourceBaseListInput
  39. ManagedResourceListInput
  40. ServerFilterListInput
  41. // 按虚拟机名称排序
  42. // pattern:asc|desc
  43. OrderByGuest string `json:"order_by_guest"`
  44. // 操作系统类型
  45. OsType []string `json:"os_type"`
  46. }
  47. type InstanceBackupDetails struct {
  48. apis.VirtualResourceDetails
  49. ManagedResourceInfo
  50. apis.EncryptedResourceDetails
  51. // 云主机状态
  52. GuestStatus string `json:"guest_status"`
  53. // 云主机名称
  54. Guest string `json:"guest"`
  55. // 存储类型
  56. BackupStorageName string `json:"backup_storage_name"`
  57. // 主机快照大小
  58. Size int `json:"size"`
  59. // 硬盘备份详情
  60. DiskBackups []SSimpleBackup `json:"disk_backups"`
  61. }
  62. type SSimpleBackup struct {
  63. // 备份Id
  64. Id string `json:"id"`
  65. // 备份名称
  66. Name string `json:"name"`
  67. // 备份大小
  68. SizeMb int `json:"size_mb"`
  69. // 磁盘大小
  70. DiskSizeMb int `json:"disk_size_mb"`
  71. // 磁盘类型
  72. DiskType string `json:"disk_type"`
  73. // 备份存储Id
  74. BackupStorageId string `json:"backup_storage_id"`
  75. // 快照状态
  76. Status string `json:"status"`
  77. // 密钥
  78. EncryptKeyId string `json:"encrypt_key_id"`
  79. // 创建时间
  80. CreatedAt time.Time `json:"created_at"`
  81. }
  82. type InstanceBackupRecoveryInput struct {
  83. // description: name of guest
  84. Name string `json:"name"`
  85. }
  86. type InstanceBackupPackInput struct {
  87. PackageName string `json:"package_name"`
  88. }
  89. type InstanceBackupManagerCreateFromPackageInput struct {
  90. apis.VirtualResourceCreateInput
  91. BackupStorageId string `json:"backup_storage_id"`
  92. PackageName string `json:"package_name"`
  93. }