events.go 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. UpdateDisplaySettings Action = "UPDATE_DISPLAY_SETTINGS"
  31. UpdateAccessibilitySettings Action = "UPDATE_ACCESSIBILITY_SETTINGS"
  32. UpdateSMTPSettings Action = "UPDATE_EMAIL_SETTINGS"
  33. UpdateIDPSettings Action = "UPDATE_IDP_SETTINGS"
  34. )
  35. type SubjectType string
  36. const (
  37. UserSub SubjectType = "USER"
  38. UserAccessTokenSub SubjectType = "USER_ACCESS_TOKEN"
  39. DeviceSub SubjectType = "DEVICE"
  40. NodeSub SubjectType = "NODE"
  41. GatewaySub SubjectType = "GATEWAY"
  42. SettingSub SubjectType = "SETTING"
  43. AclSub SubjectType = "ACL"
  44. TagSub SubjectType = "TAG"
  45. UserRoleSub SubjectType = "USER_ROLE"
  46. UserGroupSub SubjectType = "USER_GROUP"
  47. UserInviteSub SubjectType = "USER_INVITE"
  48. PendingUserSub SubjectType = "PENDING_USER"
  49. EgressSub SubjectType = "EGRESS"
  50. NetworkSub SubjectType = "NETWORK"
  51. DashboardSub SubjectType = "DASHBOARD"
  52. EnrollmentKeySub SubjectType = "ENROLLMENT_KEY"
  53. ClientAppSub SubjectType = "CLIENT-APP"
  54. NameserverSub SubjectType = "NAMESERVER"
  55. )
  56. func (sub SubjectType) String() string {
  57. return string(sub)
  58. }
  59. type Origin string
  60. const (
  61. Dashboard Origin = "DASHBOARD"
  62. Api Origin = "API"
  63. NMCTL Origin = "NMCTL"
  64. ClientApp Origin = "CLIENT-APP"
  65. )
  66. type Subject struct {
  67. ID string `json:"id"`
  68. Name string `json:"name"`
  69. Type SubjectType `json:"subject_type"`
  70. Info interface{} `json:"info"`
  71. }
  72. type Diff struct {
  73. Old interface{}
  74. New interface{}
  75. }
  76. type Event struct {
  77. Action Action
  78. Source Subject
  79. Origin Origin
  80. Target Subject
  81. TriggeredBy string
  82. NetworkID NetworkID
  83. Diff Diff
  84. }