guestimage.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 image
  15. import (
  16. "time"
  17. "yunion.io/x/jsonutils"
  18. "yunion.io/x/onecloud/pkg/apis"
  19. )
  20. type GuestImageDetails struct {
  21. apis.SharableVirtualResourceDetails
  22. apis.EncryptedResourceDetails
  23. SGuestImage
  24. //Status string `json:"status"`
  25. Size int64 `json:"size"`
  26. MinRamMb int32 `json:"min_ram_mb"`
  27. DiskFormat string `json:"disk_format"`
  28. RootImage SubImageInfo `json:"root_image"`
  29. DataImages []SubImageInfo `json:"data_images"`
  30. Properties *jsonutils.JSONDict `json:"properties"`
  31. DisableDelete bool `json:"disable_delete"`
  32. }
  33. type SubImageInfo struct {
  34. ID string `json:"id"`
  35. Name string `json:"name"`
  36. MinDiskMB int32 `json:"min_disk_mb"`
  37. DiskFormat string `json:"disk_format"`
  38. Size int64 `json:"size"`
  39. Status string `json:"status"`
  40. CreatedAt time.Time `json:"created_at"`
  41. EncryptKeyId string `json:"encrypt_key_id"`
  42. DisableDelete bool `json:"disable_delete"`
  43. }
  44. type GuestImageCreateInputBase struct {
  45. apis.SharableVirtualResourceCreateInput
  46. apis.EncryptedResourceCreateInput
  47. // 备注
  48. Notes string `json:"notes"`
  49. // 镜像格式
  50. DiskFormat string `json:"disk_format"`
  51. // 是否有删除保护
  52. Protected *bool `json:"protected"`
  53. }
  54. type GuestImageCreateInputSubimage struct {
  55. // Id
  56. Id string `json:"id"`
  57. // 磁盘格式
  58. DiskFormat string `json:"disk_format"`
  59. // 磁盘大小
  60. VirtualSize int `json:"virtual_size"`
  61. }
  62. type GuestImageCreateInput struct {
  63. GuestImageCreateInputBase
  64. // 镜像列表
  65. Images []GuestImageCreateInputSubimage `json:"images"`
  66. // 镜像大小, 单位Byte
  67. Size *int64 `json:"size"`
  68. // CPU架构 x86_64 or aarch64
  69. OsArch string `json:"os_arch"`
  70. // 镜像属性
  71. Properties map[string]string `json:"properties"`
  72. }