scaling_group.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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 "yunion.io/x/onecloud/pkg/apis"
  16. type ScalingGroupCreateInput struct {
  17. apis.VirtualResourceCreateInput
  18. apis.EnabledBaseResourceCreateInput
  19. VpcResourceInput
  20. // description: cloud region id or name
  21. // required: true
  22. // example: cr-test-one
  23. Cloudregion string `json:"cloudregion"`
  24. //swagger:ignore
  25. CloudregionId string `json:"cloudregion_id"`
  26. // description: hypervisor
  27. // example: kvm
  28. Hypervisor string `json:"hypervisor"`
  29. // description: 多个网络(ID或者Name),
  30. // example: n-test-one
  31. Networks []string `json:"networks"`
  32. // description: 最小实例数
  33. // example: 0
  34. MinInstanceNumber int `json:"min_instance_number"`
  35. // description: 最大实例数
  36. // example: 10
  37. MaxInstanceNumber int `json:"max_instance_number"`
  38. // description: 期望实例数
  39. // example: 1
  40. DesireInstanceNumber int `json:"desire_instance_number"`
  41. // description: 主机模板 id or name
  42. // example: gt-test-one
  43. GuestTemplate string `json:"guest_template"`
  44. // swagger:ignore
  45. GuestTemplateId string `json:"guest_template_id"`
  46. // description: 扩容策略
  47. // enum: ["balanced"]
  48. // required: false
  49. // example: balanced
  50. ExpansionPrinciple string `json:"expansion_principle"`
  51. // description: 缩容策略
  52. // enum: ["earliest","latest","config_earliest","config_latest"]
  53. // example: latest
  54. ShrinkPrinciple string `json:"shrink_principle"`
  55. // description: 检查健康模式
  56. // enum: ["normal","loadbalancer"]
  57. // example: normal
  58. HealthCheckMode string `json:"health_check_mode"`
  59. // description: 健康检查周期
  60. // example: 300
  61. HealthCheckCycle int `json:"health_check_cycle"`
  62. // description: 健康检查缓冲时间
  63. // example: 180
  64. HealthCheckGov int `json:"health_check_gov"`
  65. // description: 负载均衡后端服务器组
  66. // example: lbg-nihao
  67. LbBackendGroup string `json:"lb_backend_group"`
  68. // swagger:ignore
  69. BackendGroupId string `json:"backend_group_id"`
  70. // description: 负载均衡后端服务器统一端口
  71. // example: 8080
  72. LoadbalancerBackendPort int `json:"loadbalancer_backend_port"`
  73. // description: 负载均衡后端服务器的weight
  74. // example: 10
  75. LoadbalancerBackendWeight int `json:"loadbalancer_backend_weight"`
  76. }
  77. type ScalingGroupListInput struct {
  78. apis.VirtualResourceListInput
  79. RegionalFilterListInput
  80. LoadbalancerBackendGroupFilterListInput
  81. VpcFilterListInput
  82. GroupFilterListInput
  83. GuestTemplateFilterListInput
  84. apis.EnabledResourceBaseListInput
  85. // description: hypervisor
  86. // example: kvm
  87. Hypervisor string `json:"hypervisor"`
  88. // desription: 平台
  89. // example: OneCloud
  90. Brand string `json:"brand"`
  91. }
  92. type ScalingGroupDetails struct {
  93. apis.VirtualResourceDetails
  94. CloudregionResourceInfo
  95. LoadbalancerBackendGroupResourceInfo
  96. VpcResourceInfo
  97. GroupResourceInfo
  98. GuestTemplateResourceInfo
  99. SScalingGroup
  100. // description: 实例数
  101. // example: 0
  102. InstanceNumber int `json:"instance_number"`
  103. // description: 伸缩策略的数量
  104. // example: 3
  105. ScalingPolicyNumber int `json:"scaling_policy_number"`
  106. // description: 平台
  107. // example: OneCloud
  108. Brand string `json:"brand"`
  109. // description: 网络信息
  110. Networks []ScalingGroupNetwork `json:"networks"`
  111. }
  112. type ScalingGroupNetwork struct {
  113. Id string `json:"id"`
  114. Name string `json:"name"`
  115. GuestIpStart string `json:"guest_ip_start"`
  116. GuestIpEnd string `json:"guest_ip_end"`
  117. }
  118. type ScalingGroupResourceInfo struct {
  119. // description: 伸缩组名称
  120. // example: sg-nihao
  121. ScalingGroup string `json:"scaling_group"`
  122. // description: 伸缩组ID
  123. // example: sg-1234
  124. ScalingGroupId string `json:"scaling_group_id"`
  125. }
  126. type ScalingGroupFilterListInput struct {
  127. // description: 伸缩组 Id or Name
  128. // example: sg-1234
  129. ScalingGroup string `json:"scaling_group"`
  130. }
  131. type SGPerformDetachScalingGroupInput struct {
  132. // description: 伸缩组 Id or Name
  133. // example: sg-1234
  134. ScalingGroup string `json:"scaling_group"`
  135. // description: 是否删除机器
  136. // example: false
  137. DeleteServer bool `json:"delete_server"`
  138. // description: 自动行为
  139. // example: true
  140. Auto bool `json:"auto"`
  141. }