events.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. )
  55. func (sub SubjectType) String() string {
  56. return string(sub)
  57. }
  58. type Origin string
  59. const (
  60. Dashboard Origin = "DASHBOARD"
  61. Api Origin = "API"
  62. NMCTL Origin = "NMCTL"
  63. ClientApp Origin = "CLIENT-APP"
  64. )
  65. type Subject struct {
  66. ID string `json:"id"`
  67. Name string `json:"name"`
  68. Type SubjectType `json:"subject_type"`
  69. Info interface{} `json:"info"`
  70. }
  71. type Diff struct {
  72. Old interface{}
  73. New interface{}
  74. }
  75. type Event struct {
  76. Action Action
  77. Source Subject
  78. Origin Origin
  79. Target Subject
  80. TriggeredBy string
  81. NetworkID NetworkID
  82. Diff Diff
  83. }