events.go 3.2 KB

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