events.go 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package models
  2. type Action string
  3. const (
  4. Create Action = "CREATE"
  5. Update Action = "UPDATE"
  6. Delete Action = "DELETE"
  7. DeleteAll Action = "DELETE_ALL"
  8. Login Action = "LOGIN"
  9. LogOut Action = "LOGOUT"
  10. Connect Action = "CONNECT"
  11. Sync Action = "SYNC"
  12. RefreshKey Action = "REFRESH_KEY"
  13. RefreshAllKeys Action = "REFRESH_ALL_KEYS"
  14. SyncAll Action = "SYNC_ALL"
  15. UpgradeAll Action = "UPGRADE_ALL"
  16. Disconnect Action = "DISCONNECT"
  17. JoinHostToNet Action = "JOIN_HOST_TO_NETWORK"
  18. RemoveHostFromNet Action = "REMOVE_HOST_FROM_NETWORK"
  19. EnableMFA Action = "ENABLE_MFA"
  20. DisableMFA Action = "DISABLE_MFA"
  21. EnforceMFA Action = "ENFORCE_MFA"
  22. UnenforceMFA Action = "UNENFORCE_MFA"
  23. EnableBasicAuth Action = "ENABLE_BASIC_AUTH"
  24. DisableBasicAuth Action = "DISABLE_BASIC_AUTH"
  25. EnableTelemetry Action = "ENABLE_TELEMETRY"
  26. DisableTelemetry Action = "DISABLE_TELEMETRY"
  27. UpdateClientSettings Action = "UPDATE_CLIENT_SETTINGS"
  28. UpdateAuthenticationSecuritySettings Action = "UPDATE_AUTHENTICATION_SECURITY_SETTINGS"
  29. UpdateMonitoringAndDebuggingSettings Action = "UPDATE_MONITORING_AND_DEBUGGING_SETTINGS"
  30. UpdateSMTPSettings Action = "UPDATE_EMAIL_SETTINGS"
  31. UpdateIDPSettings Action = "UPDATE_IDP_SETTINGS"
  32. )
  33. type SubjectType string
  34. const (
  35. UserSub SubjectType = "USER"
  36. UserAccessTokenSub SubjectType = "USER_ACCESS_TOKEN"
  37. DeviceSub SubjectType = "DEVICE"
  38. NodeSub SubjectType = "NODE"
  39. GatewaySub SubjectType = "GATEWAY"
  40. SettingSub SubjectType = "SETTING"
  41. AclSub SubjectType = "ACL"
  42. TagSub SubjectType = "TAG"
  43. UserRoleSub SubjectType = "USER_ROLE"
  44. UserGroupSub SubjectType = "USER_GROUP"
  45. UserInviteSub SubjectType = "USER_INVITE"
  46. PendingUserSub SubjectType = "PENDING_USER"
  47. EgressSub SubjectType = "EGRESS"
  48. NetworkSub SubjectType = "NETWORK"
  49. DashboardSub SubjectType = "DASHBOARD"
  50. EnrollmentKeySub SubjectType = "ENROLLMENT_KEY"
  51. ClientAppSub SubjectType = "CLIENT-APP"
  52. NameserverSub SubjectType = "NAMESERVER"
  53. )
  54. func (sub SubjectType) String() string {
  55. return string(sub)
  56. }
  57. type Origin string
  58. const (
  59. Dashboard Origin = "DASHBOARD"
  60. Api Origin = "API"
  61. NMCTL Origin = "NMCTL"
  62. ClientApp Origin = "CLIENT-APP"
  63. )
  64. type Subject struct {
  65. ID string `json:"id"`
  66. Name string `json:"name"`
  67. Type SubjectType `json:"subject_type"`
  68. Info interface{} `json:"info"`
  69. }
  70. type Diff struct {
  71. Old interface{}
  72. New interface{}
  73. }
  74. type Event struct {
  75. Action Action
  76. Source Subject
  77. Origin Origin
  78. Target Subject
  79. TriggeredBy string
  80. NetworkID NetworkID
  81. Diff Diff
  82. }