datasource.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package models
  2. import (
  3. "errors"
  4. "time"
  5. )
  6. const (
  7. DS_GRAPHITE = "graphite"
  8. DS_INFLUXDB = "influxdb"
  9. DS_ES = "es"
  10. DS_ACCESS_DIRECT = "direct"
  11. DS_ACCESS_PROXY = "proxy"
  12. )
  13. // Typed errors
  14. var (
  15. ErrDataSourceNotFound = errors.New("Data source not found")
  16. )
  17. type DsType string
  18. type DsAccess string
  19. type DataSource struct {
  20. Id int64
  21. AccountId int64
  22. Name string
  23. Type DsType
  24. Access DsAccess
  25. Url string
  26. Password string
  27. User string
  28. BasicAuth bool
  29. Created time.Time
  30. Updated time.Time
  31. }
  32. type GetDataSourcesQuery struct {
  33. AccountId int64
  34. Result []*DataSource
  35. }
  36. type GetDataSourceByIdQuery struct {
  37. Id int64
  38. AccountId int64
  39. Result DataSource
  40. }
  41. type AddDataSourceCommand struct {
  42. AccountId int64
  43. Name string
  44. Type DsType
  45. Access DsAccess
  46. Url string
  47. Password string
  48. User string
  49. }
  50. type UpdateDataSourceCommand struct {
  51. Id int64
  52. AccountId int64
  53. Name string
  54. Type DsType
  55. Access DsAccess
  56. Url string
  57. Password string
  58. User string
  59. }
  60. type DeleteDataSourceCommand struct {
  61. Id int64
  62. AccountId int64
  63. }