wire.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 WireCreateInput struct {
  17. apis.StatusInfrasResourceBaseCreateInput
  18. // 带宽大小,单位: Mbps
  19. // default: 0
  20. Bandwidth int `json:"bandwidth"`
  21. // Deprecated
  22. // swagger:ignore
  23. Bw int `json:"bw" yunion-deprecated-by:"bandwidth"`
  24. // mtu
  25. // minimum: 0
  26. // maximum: 1000000
  27. // default: 0
  28. Mtu int `json:"mtu"`
  29. VpcResourceInput
  30. ZoneResourceInput
  31. }
  32. type WireUsage struct {
  33. // IP子网数量
  34. // example: 1
  35. Networks int `json:"networks"`
  36. // Host数量
  37. // example: 1
  38. HostCount int `json:"host_count"`
  39. }
  40. type WireDetails struct {
  41. apis.StatusInfrasResourceBaseDetails
  42. VpcResourceInfo
  43. ZoneResourceInfoBase
  44. SWire
  45. WireUsage
  46. }
  47. func (self WireDetails) GetMetricTags() map[string]string {
  48. ret := map[string]string{
  49. "id": self.Id,
  50. "wire_name": self.Name,
  51. "brand": self.Brand,
  52. "domain_id": self.DomainId,
  53. "project_domain": self.ProjectDomain,
  54. "external_id": self.ExternalId,
  55. }
  56. return ret
  57. }
  58. type WireResourceInfoBase struct {
  59. // 二层网络(WIRE)的名称
  60. Wire string `json:"wire"`
  61. }
  62. type WireResourceInfo struct {
  63. WireResourceInfoBase
  64. // VPC ID
  65. VpcId string `json:"vpc_id"`
  66. VpcResourceInfo
  67. // 可用区ID
  68. ZoneId string `json:"zone_id"`
  69. // 可用区
  70. Zone string `json:"zone"`
  71. }
  72. type SSimpleWire struct {
  73. Wire string `json:"wire"`
  74. WireId string `json:"wire_id"`
  75. }
  76. type WireUpdateInput struct {
  77. apis.InfrasResourceBaseUpdateInput
  78. // bandwidth in MB
  79. Bandwidth *int `json:"bandwidth"`
  80. // MTU
  81. // example: 1500
  82. Mtu *int `json:"mtu"`
  83. }
  84. type WireListInput struct {
  85. apis.StatusInfrasResourceBaseListInput
  86. apis.ExternalizedResourceBaseListInput
  87. VpcFilterListInput
  88. ZonalFilterListBase
  89. HostResourceInput
  90. Bandwidth *int `json:"bandwidth"`
  91. HostType string `json:"host_type"`
  92. // 按子网数量排序
  93. // pattern:asc|desc
  94. OrderByNetworkCount string `json:"order_by_network_count"`
  95. }
  96. type WireMergeInput struct {
  97. // description: wire id or name to be merged
  98. // required: true
  99. // example: test-wire
  100. Target string `json:"target"`
  101. // description: if merge networks under wire
  102. // required: false
  103. MergeNetwork bool `json:"merge_network"`
  104. }
  105. type WireMergeFromInput struct {
  106. // description: wire ids or names to be merged from
  107. // required: true
  108. Sources []string `json:"sources"`
  109. // description: if merge networks under wire
  110. // required: false
  111. MergeNetwork bool `json:"merge_network"`
  112. }
  113. type WireMergeNetworkInput struct {
  114. }
  115. type WireTopologyInput struct {
  116. }