sku_const.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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/cloudmux/pkg/apis/compute"
  17. "yunion.io/x/onecloud/pkg/apis"
  18. "yunion.io/x/onecloud/pkg/apis/billing"
  19. )
  20. const (
  21. SkuCategoryGeneralPurpose = compute.SkuCategoryGeneralPurpose // 通用型
  22. SkuCategoryBurstable = compute.SkuCategoryBurstable // 突发性能型
  23. SkuCategoryComputeOptimized = compute.SkuCategoryComputeOptimized // 计算优化型
  24. SkuCategoryMemoryOptimized = compute.SkuCategoryMemoryOptimized // 内存优化型
  25. SkuCategoryStorageIOOptimized = compute.SkuCategoryStorageIOOptimized // 存储IO优化型
  26. SkuCategoryHardwareAccelerated = compute.SkuCategoryHardwareAccelerated // 硬件加速型
  27. SkuCategoryHighStorage = compute.SkuCategoryHighStorage // 高存储型
  28. SkuCategoryHighMemory = compute.SkuCategoryHighMemory // 高内存型
  29. )
  30. const (
  31. SkuStatusAvailable = compute.SkuStatusAvailable
  32. SkuStatusSoldout = compute.SkuStatusSoldout
  33. SkuStatusCreating = "creating"
  34. SkuStatusCreatFailed = "create_failed"
  35. SkuStatusDeleting = "deleting"
  36. SkuStatusDeleteFailed = "delete_failed"
  37. SkuStatusUnknown = "unknown"
  38. SkuStatusReady = compute.SkuStatusReady
  39. )
  40. var InstanceFamilies = compute.InstanceFamilies
  41. var SKU_FAMILIES = []string{
  42. SkuCategoryGeneralPurpose,
  43. SkuCategoryBurstable,
  44. SkuCategoryComputeOptimized,
  45. SkuCategoryMemoryOptimized,
  46. SkuCategoryStorageIOOptimized,
  47. SkuCategoryHardwareAccelerated,
  48. SkuCategoryHighStorage,
  49. SkuCategoryHighMemory,
  50. }
  51. type ServerSkuListInput struct {
  52. apis.EnabledStatusStandaloneResourceListInput
  53. apis.DomainizedResourceListInput
  54. ManagedResourceListInput
  55. ZonalFilterListInput
  56. billing.BillingResourceListInput
  57. UsableResourceListInput
  58. // filter sku by memory size in MB
  59. MemorySizeMb []int `json:"memory_size_mb"`
  60. // filter sku by CPU core count
  61. CpuCoreCount []int `json:"cpu_core_count"`
  62. // 后付费状态
  63. PostpaidStatus string `json:"postpaid_status"`
  64. // 预付费状态
  65. PrepaidStatus string `json:"prepaid_status"`
  66. // 按套餐名称去重
  67. Distinct bool `json:"distinct"`
  68. // 根据cpu架构过滤
  69. // enmu: arm, x86
  70. CpuArch []string `json:"cpu_arch"`
  71. // 按关联虚拟机数量排序
  72. OrderByTotalGuestCount string `json:"order_by_total_guest_count"`
  73. }
  74. type ElasticcacheSkuListInput struct {
  75. apis.StatusStandaloneResourceListInput
  76. apis.ExternalizedResourceBaseListInput
  77. ManagedResourceListInput
  78. UsableResourceListInput
  79. billing.BillingResourceListInput
  80. ZonalFilterListInput
  81. // filter sku by memory size in MB
  82. MemorySizeMb int `json:"memory_size_mb"`
  83. InstanceSpec []string `json:"instance_spec"`
  84. EngineArch []string `json:"engine_arch"`
  85. LocalCategory []string `json:"local_category"`
  86. PrepaidStatus []string `json:"prepaid_status"`
  87. PostpaidStatus []string `json:"postpaid_sStatus"`
  88. // 引擎 redis|memcached
  89. Engine []string `json:"engine"`
  90. // 引擎版本 3.0
  91. EngineVersion []string `json:"engine_version"`
  92. // CPU 架构 x86|ARM
  93. CpuArch []string `json:"cpu_arch"`
  94. // 存储类型 DRAM|SCM
  95. StorageType []string `json:"storage_type"`
  96. // standrad|enhanced
  97. PerformanceType []string `json:"performance_type"`
  98. // single(单副本) | double(双副本) | readone (单可读) | readthree (3可读) | readfive(5只读)
  99. NodeType []string `json:"node_type"`
  100. }
  101. type DBInstanceSkuListInput struct {
  102. apis.EnabledStatusStandaloneResourceListInput
  103. apis.ExternalizedResourceBaseListInput
  104. apis.DomainizedResourceListInput
  105. ManagedResourceListInput
  106. RegionalFilterListInput
  107. billing.BillingResourceListInput
  108. // StorageType
  109. StorageType []string `json:"storage_type"`
  110. VcpuCount []int `json:"vcpu_count"`
  111. VmemSizeMb []int `json:"vmem_size_mb"`
  112. Category []string `json:"category"`
  113. Engine []string `json:"engine"`
  114. EngineVersion []string `json:"engine_version"`
  115. Zone1 []string `json:"zone1"`
  116. Zone2 []string `json:"zone2"`
  117. Zone3 []string `json:"zone3"`
  118. }
  119. type SkuSyncInput struct {
  120. // 云平台名称
  121. // example: Google
  122. Provider string `json:"provider,omitempty"`
  123. // 区域ID
  124. CloudregionIds []string `json:"cloudregion_ids"`
  125. }
  126. type SkuTaskQueryInput struct {
  127. // 异步任务ID
  128. TaskIds []string `json:"task_ids"`
  129. }
  130. type CloudregionSkuSyncInput struct {
  131. SkuSyncInput
  132. // 同步资源类型
  133. // choices: serversku|elasticcachesku|dbinstance_sku
  134. Resource string `json:"resource"`
  135. }
  136. type SyncImagesInput struct {
  137. }