guesttemplate.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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/jsonutils"
  17. "yunion.io/x/onecloud/pkg/apis"
  18. billing_api "yunion.io/x/onecloud/pkg/apis/billing"
  19. )
  20. type GuestTemplateInput struct {
  21. // description: the content of guest template
  22. // required: true
  23. Content *jsonutils.JSONDict `json:"content"`
  24. VmemSize int `json:"vmem_size"`
  25. VcpuCount int `json:"vcpu_count"`
  26. OsType string `json:"os_type"`
  27. Hypervisor string `json:"hypervisor"`
  28. CloudregionId string `json:"cloudregion_id"`
  29. VpcId string `json:"vpc_id"`
  30. ImageType string `json:"image_type"`
  31. ImageId string `json:"image_id"`
  32. InstanceType string `json:"instance_type"`
  33. BillingType billing_api.TBillingType `json:"billing_type"`
  34. }
  35. type GuestTemplateCreateInput struct {
  36. apis.SharableVirtualResourceCreateInput
  37. GuestTemplateInput
  38. }
  39. type GuestTemplateUpdateInput struct {
  40. apis.SharableVirtualResourceBaseUpdateInput
  41. GuestTemplateInput
  42. }
  43. type GuestTemplateDetails struct {
  44. apis.SharableVirtualResourceDetails
  45. CloudregionResourceInfo
  46. VpcResourceInfo
  47. SGuestTemplate
  48. Secgroups []string `json:"secgroups"`
  49. Zone string `json:"zone"`
  50. ZoneId string `json:"zone_id"`
  51. Brand string `json:"brand"`
  52. ConfigInfo GuestTemplateConfigInfo `json:"config_info"`
  53. }
  54. type GuestTemplateListInput struct {
  55. apis.SharableVirtualResourceListInput
  56. RegionalFilterListInput
  57. VpcFilterListInput
  58. BillingType string `json:"billing_type"`
  59. Brand string `json:"brand"`
  60. }
  61. type GuestTemplateConfigInfo struct {
  62. Metadata map[string]string `json:"metadata"`
  63. Secgroup string `json:"secgroup"`
  64. Sku GuestTemplateSku `json:"sku"`
  65. Disks []GuestTemplateDisk `json:"disks"`
  66. Keypair string `json:"keypair"`
  67. Nets []GuestTemplateNetwork `json:"nets"`
  68. IsolatedDeviceConfig []IsolatedDeviceConfig `json:"isolated_device_config"`
  69. Image string `json:"image"`
  70. ResetPassword bool `json:"reset_password"`
  71. }
  72. type GuestTemplateDisk struct {
  73. Backend string `json:"backend"`
  74. DiskType string `json:"disk_type"`
  75. Index int `json:"index"`
  76. SizeMb int `json:"size_mb"`
  77. }
  78. type GuestTemplateNetwork struct {
  79. ID string `json:"id"`
  80. Name string `json:"name"`
  81. GuestIpStart string `json:"guest_ip_start"`
  82. GuestIpEnd string `json:"guest_ip_end"`
  83. VlanId int `json:"vlan_id"`
  84. VpcId string `json:"vpc_id"`
  85. VpcName string `json:"vpc_name"`
  86. }
  87. type GuestTemplateSku struct {
  88. Name string `json:"name"`
  89. CpuCoreCount int `json:"cpu_core_count"`
  90. MemorySizeMb int `json:"memory_size_mb"`
  91. InstanceTypeCategory string `json:"instance_type_category"`
  92. InstanceTypeFamily string `json:"instance_type_family"`
  93. }
  94. type GuestTemplatePublicInput struct {
  95. apis.Meta
  96. // description: the scope about public operator
  97. // required: true
  98. // example: system
  99. Scope string `json:"scope"`
  100. }
  101. type GuestTemplateValidateInput struct {
  102. apis.Meta
  103. // description: the hypervisor about guest template
  104. Hypervisor string `json:"hypervisor"`
  105. CloudregionId string `json:"cloudregion_id"`
  106. }
  107. type GuestTemplateResourceInfo struct {
  108. // 主机模板名称
  109. GuestTemplate string `json:"guest_template"`
  110. // 主机模板ID
  111. GuestTemplateId string `json:"guest_template_id"`
  112. }