hnspolicy.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. package hns
  2. // Type of Request Support in ModifySystem
  3. type PolicyType string
  4. // RequestType const
  5. const (
  6. Nat PolicyType = "NAT"
  7. ACL PolicyType = "ACL"
  8. PA PolicyType = "PA"
  9. VLAN PolicyType = "VLAN"
  10. VSID PolicyType = "VSID"
  11. VNet PolicyType = "VNET"
  12. L2Driver PolicyType = "L2Driver"
  13. Isolation PolicyType = "Isolation"
  14. QOS PolicyType = "QOS"
  15. OutboundNat PolicyType = "OutBoundNAT"
  16. ExternalLoadBalancer PolicyType = "ELB"
  17. Route PolicyType = "ROUTE"
  18. )
  19. type NatPolicy struct {
  20. Type PolicyType `json:"Type"`
  21. Protocol string
  22. InternalPort uint16
  23. ExternalPort uint16
  24. }
  25. type QosPolicy struct {
  26. Type PolicyType `json:"Type"`
  27. MaximumOutgoingBandwidthInBytes uint64
  28. }
  29. type IsolationPolicy struct {
  30. Type PolicyType `json:"Type"`
  31. VLAN uint
  32. VSID uint
  33. InDefaultIsolation bool
  34. }
  35. type VlanPolicy struct {
  36. Type PolicyType `json:"Type"`
  37. VLAN uint
  38. }
  39. type VsidPolicy struct {
  40. Type PolicyType `json:"Type"`
  41. VSID uint
  42. }
  43. type PaPolicy struct {
  44. Type PolicyType `json:"Type"`
  45. PA string `json:"PA"`
  46. }
  47. type OutboundNatPolicy struct {
  48. Policy
  49. VIP string `json:"VIP,omitempty"`
  50. Exceptions []string `json:"ExceptionList,omitempty"`
  51. }
  52. type ActionType string
  53. type DirectionType string
  54. type RuleType string
  55. const (
  56. Allow ActionType = "Allow"
  57. Block ActionType = "Block"
  58. In DirectionType = "In"
  59. Out DirectionType = "Out"
  60. Host RuleType = "Host"
  61. Switch RuleType = "Switch"
  62. )
  63. type ACLPolicy struct {
  64. Type PolicyType `json:"Type"`
  65. Id string `json:"Id,omitempty"`
  66. Protocol uint16
  67. Protocols string `json:"Protocols,omitempty"`
  68. InternalPort uint16
  69. Action ActionType
  70. Direction DirectionType
  71. LocalAddresses string
  72. RemoteAddresses string
  73. LocalPorts string `json:"LocalPorts,omitempty"`
  74. LocalPort uint16
  75. RemotePorts string `json:"RemotePorts,omitempty"`
  76. RemotePort uint16
  77. RuleType RuleType `json:"RuleType,omitempty"`
  78. Priority uint16
  79. ServiceName string
  80. }
  81. type Policy struct {
  82. Type PolicyType `json:"Type"`
  83. }