serversku.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. "yunion.io/x/onecloud/pkg/apis"
  17. )
  18. const (
  19. SERVER_SKU_PROJECT_SRC_KEY = "project_src"
  20. SERVER_SKU_PROJECT_SRC_VALUE_LOCAL = "local"
  21. )
  22. type ServerSkuCreateInput struct {
  23. apis.EnabledStatusStandaloneResourceCreateInput
  24. // 区域名称或Id,建议使用Id
  25. // default: default
  26. CloudregionId string `json:"cloudregion_id"`
  27. // 可用区名称或Id, 建议使用Id
  28. // required: false
  29. ZoneId string `json:"zone_id"`
  30. // swagger:ignore
  31. InstanceTypeFamily string `json:"instance_type_family"`
  32. // 套餐类型
  33. //
  34. //
  35. //
  36. // | instance_type_category | 说明 |
  37. // | ----- | --- |
  38. // |general_purpose |通用型 |
  39. // |burstable |突发性能型 |
  40. // |compute_optimized |计算优化型 |
  41. // |memory_optimized |内存优化型 |
  42. // |storage_optimized |存储IO优化型 |
  43. // |hardware_accelerated |硬件加速型 |
  44. // |high_storage |高存储型 |
  45. // |high_memory |高内存型 |
  46. // default: general_purpose
  47. InstanceTypeCategory string `json:"instance_type_category"`
  48. // swagger:ignore
  49. LocalCategory string `json:"local_category"`
  50. // 预付费状态
  51. // default: available
  52. PrepaidStatus string `json:"prepaid_status"`
  53. // 后付费状态
  54. // default: available
  55. PostpaidStatus string `json:"postpaid_status"`
  56. // Cpu核数
  57. // minimum: 1
  58. // maximum: 256
  59. // required: true
  60. CpuCoreCount int64 `json:"cpu_core_count"`
  61. // 内存大小
  62. // minimum: 512
  63. // maximum: 524288
  64. // required: true
  65. MemorySizeMB int64 `json:"memory_size_mb"`
  66. // swagger:ignore
  67. OsName string `json:"os_name"`
  68. // swagger:ignore
  69. SysDiskResizable *bool `json:"sys_disk_resizable"`
  70. // swagger:ignore
  71. SysDiskType string `json:"sys_disk_type"`
  72. // swagger:ignore
  73. SysDiskMinSizeGB int `json:"sys_disk_min_size_gb"`
  74. // swagger:ignore
  75. SysDiskMaxSizeGB int `json:"sys_disk_max_size_gb"`
  76. // swagger:ignore
  77. AttachedDiskType string `json:"attached_disk_type"`
  78. // swagger:ignore
  79. AttachedDiskSizeGB int `json:"attached_disk_size_gb"`
  80. // swagger:ignore
  81. AttachedDiskCount int `json:"attached_disk_count"`
  82. // swagger:ignore
  83. DataDiskTypes string `json:"data_disk_types"`
  84. // swagger:ignore
  85. DataDiskMaxCount int `json:"data_disk_max_count"`
  86. // swagger:ignore
  87. NicType string `json:"nic_type"`
  88. // swagger:ignore
  89. NicMaxCount int `json:"nic_max_count"`
  90. // swagger:ignore
  91. GpuAttachable *bool `json:"gpu_attachable"`
  92. // swagger:ignore
  93. GpuSpec string `json:"gpu_spec"`
  94. // swagger:ignore
  95. GpuCount int `json:"gpu_count"`
  96. // swagger:ignore
  97. GpuMaxCount int `json:"gpu_max_count"`
  98. // swagger:ignore
  99. Provider string `json:"provider"`
  100. }
  101. type ServerSkuDetails struct {
  102. apis.EnabledStatusStandaloneResourceDetails
  103. ZoneResourceInfoBase
  104. CloudregionResourceInfo
  105. SServerSku
  106. // 云环境
  107. CloudEnv string `json:"cloud_env"`
  108. // 绑定云主机数量
  109. TotalGuestCount int `json:"total_guest_count"`
  110. }
  111. type ServerSkuUpdateInput struct {
  112. apis.EnabledStatusStandaloneResourceBaseUpdateInput
  113. // 预付费状态
  114. // default: available
  115. PrepaidStatus string `json:"prepaid_status"`
  116. // 后付费状态
  117. // default: available
  118. PostpaidStatus string `json:"postpaid_status"`
  119. InstanceTypeFamily string `json:"instance_type_family"`
  120. InstanceTypeCategory string `json:"instance_type_category"`
  121. LocalCategory string `json:"local_category"` // 记录本地分类
  122. OsName string `json:"os_name"` // Windows|Linux|Any
  123. SysDiskResizable *bool `json:"sys_disk_resizable"`
  124. SysDiskType string `json:"sys_disk_type"`
  125. SysDiskMinSizeGB *int `json:"sys_disk_min_size_gb"` // not required。 windows比较新的版本都是50G左右。
  126. SysDiskMaxSizeGB *int `json:"sys_disk_max_size_gb"` // not required
  127. AttachedDiskType string `json:"attached_disk_type"`
  128. AttachedDiskSizeGB *int `json:"attached_disk_size_gb"`
  129. AttachedDiskCount *int `json:"attached_disk_count"`
  130. DataDiskTypes string `json:"data_disk_types"`
  131. DataDiskMaxCount *int `json:"data_disk_max_count"`
  132. NicType string `json:"nic_type"`
  133. NicMaxCount *int `json:"nic_max_count"`
  134. GpuAttachable *bool `json:"gpu_attachable"`
  135. GpuSpec string `json:"gpu_spec"`
  136. GpuCount *int `json:"gpu_count"`
  137. GpuMaxCount *int `json:"gpu_max_count"`
  138. }