acl.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package models
  2. import (
  3. "time"
  4. "github.com/google/uuid"
  5. )
  6. // AllowedTrafficDirection - allowed direction of traffic
  7. type AllowedTrafficDirection int
  8. const (
  9. // TrafficDirectionUni implies traffic is only allowed in one direction (src --> dst)
  10. TrafficDirectionUni AllowedTrafficDirection = iota
  11. // TrafficDirectionBi implies traffic is allowed both direction (src <--> dst )
  12. TrafficDirectionBi
  13. )
  14. type AclPolicyType string
  15. const (
  16. UserPolicy AclPolicyType = "user-policy"
  17. DevicePolicy AclPolicyType = "device-policy"
  18. )
  19. type AclGroupType string
  20. const (
  21. UserAcl AclGroupType = "user"
  22. UserGroupAcl AclGroupType = "user-group"
  23. )
  24. func (g AclGroupType) String() string {
  25. return string(g)
  26. }
  27. type Acl struct {
  28. ID uuid.UUID `json:"id"`
  29. Name string `json:"name"`
  30. NetworkID NetworkID `json:"network_id"`
  31. RuleType AclPolicyType `json:"policy_type"`
  32. Src []string `json:"src_type"`
  33. Dst []string `json:"dst_type"`
  34. AllowedDirection AllowedTrafficDirection `json:"allowed_traffic_direction"`
  35. Enabled bool `json:"enabled"`
  36. CreatedBy string `json:"created_by"`
  37. CreatedAt time.Time `json:"created_at"`
  38. }