hnspolicy.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. Proxy PolicyType = "PROXY"
  19. )
  20. type NatPolicy struct {
  21. Type PolicyType `json:"Type"`
  22. Protocol string `json:",omitempty"`
  23. InternalPort uint16 `json:",omitempty"`
  24. ExternalPort uint16 `json:",omitempty"`
  25. ExternalPortReserved bool `json:",omitempty"`
  26. }
  27. type QosPolicy struct {
  28. Type PolicyType `json:"Type"`
  29. MaximumOutgoingBandwidthInBytes uint64
  30. }
  31. type IsolationPolicy struct {
  32. Type PolicyType `json:"Type"`
  33. VLAN uint
  34. VSID uint
  35. InDefaultIsolation bool
  36. }
  37. type VlanPolicy struct {
  38. Type PolicyType `json:"Type"`
  39. VLAN uint
  40. }
  41. type VsidPolicy struct {
  42. Type PolicyType `json:"Type"`
  43. VSID uint
  44. }
  45. type PaPolicy struct {
  46. Type PolicyType `json:"Type"`
  47. PA string `json:"PA"`
  48. }
  49. type OutboundNatPolicy struct {
  50. Policy
  51. VIP string `json:"VIP,omitempty"`
  52. Exceptions []string `json:"ExceptionList,omitempty"`
  53. Destinations []string `json:",omitempty"`
  54. }
  55. type ProxyPolicy struct {
  56. Type PolicyType `json:"Type"`
  57. IP string `json:",omitempty"`
  58. Port string `json:",omitempty"`
  59. ExceptionList []string `json:",omitempty"`
  60. Destination string `json:",omitempty"`
  61. OutboundNat bool `json:",omitempty"`
  62. }
  63. type ActionType string
  64. type DirectionType string
  65. type RuleType string
  66. const (
  67. Allow ActionType = "Allow"
  68. Block ActionType = "Block"
  69. In DirectionType = "In"
  70. Out DirectionType = "Out"
  71. Host RuleType = "Host"
  72. Switch RuleType = "Switch"
  73. )
  74. type ACLPolicy struct {
  75. Type PolicyType `json:"Type"`
  76. Id string `json:"Id,omitempty"`
  77. Protocol uint16 `json:",omitempty"`
  78. Protocols string `json:"Protocols,omitempty"`
  79. InternalPort uint16 `json:",omitempty"`
  80. Action ActionType
  81. Direction DirectionType
  82. LocalAddresses string `json:",omitempty"`
  83. RemoteAddresses string `json:",omitempty"`
  84. LocalPorts string `json:"LocalPorts,omitempty"`
  85. LocalPort uint16 `json:",omitempty"`
  86. RemotePorts string `json:"RemotePorts,omitempty"`
  87. RemotePort uint16 `json:",omitempty"`
  88. RuleType RuleType `json:"RuleType,omitempty"`
  89. Priority uint16 `json:",omitempty"`
  90. ServiceName string `json:",omitempty"`
  91. }
  92. type Policy struct {
  93. Type PolicyType `json:"Type"`
  94. }