vpc.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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 VpcUsage struct {
  17. // 二层网络数量
  18. // example: 1
  19. WireCount int `json:"wire_count"`
  20. // IP子网个数
  21. // example: 2
  22. NetworkCount int `json:"network_count"`
  23. // 路由表个数
  24. // example: 0
  25. RoutetableCount int `json:"routetable_count"`
  26. // NAT网关个数
  27. // example: 0
  28. NatgatewayCount int `json:"natgateway_count"`
  29. // DnsZone个数
  30. // example: 2
  31. DnsZoneCount int `json:"dns_zone_count"`
  32. RequestVpcPeerCount int `json:"request_vpc_peer_count"`
  33. AcceptVpcPeerCount int `json:"accpet_vpc_peer_count"`
  34. }
  35. type VpcDetails struct {
  36. apis.EnabledStatusInfrasResourceBaseDetails
  37. ManagedResourceInfo
  38. CloudregionResourceInfo
  39. GlobalVpcResourceInfo
  40. SVpc
  41. VpcUsage
  42. }
  43. type VpcResourceInfoBase struct {
  44. // Vpc Name
  45. Vpc string `json:"vpc"`
  46. // VPC外部Id
  47. VpcExtId string `json:"vpc_ext_id"`
  48. // 是否为经典网络
  49. IsDefaultVpc bool `json:"is_default_vpc"`
  50. }
  51. type VpcResourceInfo struct {
  52. VpcResourceInfoBase
  53. // VPC归属区域ID
  54. CloudregionId string `json:"cloudregion_id"`
  55. CloudregionResourceInfo
  56. // VPC归属云订阅ID
  57. ManagerId string `json:"manager_id"`
  58. ManagedResourceInfo
  59. }
  60. type VpcSyncstatusInput struct {
  61. }
  62. type VpcCreateInput struct {
  63. apis.EnabledStatusInfrasResourceBaseCreateInput
  64. CloudregionResourceInput
  65. CloudproviderResourceInput
  66. // CIDR_BLOCK
  67. CidrBlock string `json:"cidr_block"`
  68. // CIDR_BLOCK
  69. CidrBlock6 string `json:"cidr_block6"`
  70. // 仅对谷歌云有用,若谷歌云订阅只有一个全局VPC,此参数可不传
  71. // 若有多个全局VPC,谷歌云需要指定其中一个全局VPC
  72. GlobalvpcId string `json:"globalvpc_id"`
  73. // Vpc外网访问模式
  74. ExternalAccessMode string `json:"external_access_mode"`
  75. }
  76. type VpcUpdateInput struct {
  77. apis.EnabledStatusInfrasResourceBaseUpdateInput
  78. // Vpc外网访问模式
  79. ExternalAccessMode string `json:"external_access_mode"`
  80. // CIDR BLOCK of IPv4
  81. CidrBlock string `json:"cidr_block"`
  82. // CIDR BLOCK of IPv6
  83. CidrBlock6 string `json:"cidr_block6"`
  84. }
  85. type VpcResourceInput struct {
  86. // 关联VPC(ID或Name)
  87. VpcId string `json:"vpc_id"`
  88. // swagger:ignore
  89. // Deprecated
  90. // filter by vpc Id
  91. Vpc string `json:"vpc" yunion-deprecated-by:"vpc_id"`
  92. // Vpc外网访问模式
  93. ExternalAccessMode string `json:"external_access_mode"`
  94. }
  95. type VpcListItemInput struct {
  96. // 关联VPC(ID或Name)
  97. VpcId []string `json:"vpc_id"`
  98. // swagger:ignore
  99. // Deprecated
  100. // filter by vpc Id
  101. Vpc []string `json:"vpc" yunion-deprecated-by:"vpc_id"`
  102. // Vpc外网访问模式
  103. ExternalAccessMode string `json:"external_access_mode"`
  104. }
  105. type VpcFilterListInputBase struct {
  106. VpcListItemInput
  107. // 按VPC名称排序
  108. // pattern:asc|desc
  109. OrderByVpc string `json:"order_by_vpc"`
  110. }
  111. type VpcFilterListInput struct {
  112. VpcFilterListInputBase
  113. RegionalFilterListInput
  114. ManagedResourceListInput
  115. }
  116. type VpcTopologyInput struct {
  117. }
  118. type NetworkTopologyOutput struct {
  119. Name string `json:"name"`
  120. Status string `json:"status"`
  121. GuestIpStart string `json:"guest_ip_start"`
  122. GuestIpEnd string `json:"guest_ip_end"`
  123. GuestIpMask int8 `json:"guest_ip_mask"`
  124. VlanId int `json:"vlan_id"`
  125. ServerType TNetworkType `json:"server_type"`
  126. GetNetworkAddressesOutput
  127. // Address []SNetworkUsedAddress `json:"address"`
  128. }
  129. type HostnetworkTopologyOutput struct {
  130. IpAddr string `json:"ip_addr"`
  131. Ip6Addr string `json:"ip6_addr"`
  132. MacAddr string `json:"mac_addr"`
  133. }
  134. type StorageShortDesc struct {
  135. Id string `json:"id"`
  136. Name string `json:"name"`
  137. Status string `json:"status"`
  138. Enabled bool `json:"enabled"`
  139. StorageType string `json:"storage_type"`
  140. CapacityMb int64 `json:"capacity_mb"`
  141. }
  142. type HostTopologyOutput struct {
  143. Name string `json:"name"`
  144. Id string `json:"id"`
  145. Status string `json:"status"`
  146. HostStatus string `json:"host_status"`
  147. HostType string `json:"host_type"`
  148. Networks []HostnetworkTopologyOutput `json:"networks"`
  149. Schedtags []SchedtagShortDescDetails `json:"schedtags"`
  150. Storages []StorageShortDesc `json:"storages"`
  151. }
  152. type WireTopologyOutput struct {
  153. Name string `json:"name"`
  154. Status string `json:"status"`
  155. Bandwidth int `json:"bandwidth"`
  156. Zone string `json:"zone"`
  157. Networks []NetworkTopologyOutput `json:"networks"`
  158. Hosts []HostTopologyOutput `json:"hosts"`
  159. }
  160. type VpcTopologyOutput struct {
  161. Name string `json:"name"`
  162. Status string `json:"status"`
  163. Wires []WireTopologyOutput `json:"wires"`
  164. }