net_tap_services.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. const (
  17. TapServiceHost = "host"
  18. TapServiceGuest = "guest"
  19. )
  20. type NetTapServiceListInput struct {
  21. apis.EnabledStatusStandaloneResourceListInput
  22. HostId string `json:"host_id" help:"filter by host id or name"`
  23. // 按目的ip地址排序
  24. // pattern:asc|desc
  25. OrderByIp string `json:"order_by_ip"`
  26. // 按镜像源数量排序
  27. // pattern:asc|desc
  28. OrderByFlowCount string `json:"order_by_flow_count"`
  29. }
  30. type NetTapServiceDetails struct {
  31. apis.EnabledStatusStandaloneResourceDetails
  32. // 流量镜像目标名称
  33. Target string `json:"target"`
  34. // 流量镜像目标IP地址
  35. TargetIps string `json:"target_ips"`
  36. // tap flow数量
  37. FlowCount int `json:"flow_count"`
  38. }
  39. type NetTapServiceCreateInput struct {
  40. apis.EnabledStatusStandaloneResourceCreateInput
  41. // TAP服务类型,监听宿主机的网卡还是虚拟机的网卡, 可能值为 host|guest
  42. Type string `json:"type" required:"true" choices:"host|guest" help:"type of tap service"`
  43. // 资源ID,如果Type=host,该值为宿主机的ID,如果Type=guest,该值为虚拟机的ID
  44. TargetId string `json:"target_id" required:"true" help:"id of target device"`
  45. // 监听网卡的Mac地址
  46. MacAddr string `json:"mac_addr" help:"mac address of the device interface for tappping"`
  47. }