storage.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package api
  2. const (
  3. // LocalStorage means the storage service is local file system.
  4. LocalStorage = -1
  5. // DatabaseStorage means the storage service is database.
  6. DatabaseStorage = 0
  7. )
  8. type StorageType string
  9. const (
  10. StorageS3 StorageType = "S3"
  11. )
  12. type StorageConfig struct {
  13. S3Config *StorageS3Config `json:"s3Config"`
  14. }
  15. type StorageS3Config struct {
  16. EndPoint string `json:"endPoint"`
  17. Path string `json:"path"`
  18. Region string `json:"region"`
  19. AccessKey string `json:"accessKey"`
  20. SecretKey string `json:"secretKey"`
  21. Bucket string `json:"bucket"`
  22. URLPrefix string `json:"urlPrefix"`
  23. URLSuffix string `json:"urlSuffix"`
  24. }
  25. type Storage struct {
  26. ID int `json:"id"`
  27. Name string `json:"name"`
  28. Type StorageType `json:"type"`
  29. Config *StorageConfig `json:"config"`
  30. }
  31. type StorageCreate struct {
  32. Name string `json:"name"`
  33. Type StorageType `json:"type"`
  34. Config *StorageConfig `json:"config"`
  35. }
  36. type StoragePatch struct {
  37. ID int `json:"id"`
  38. Type StorageType `json:"type"`
  39. Name *string `json:"name"`
  40. Config *StorageConfig `json:"config"`
  41. }
  42. type StorageFind struct {
  43. ID *int `json:"id"`
  44. }
  45. type StorageDelete struct {
  46. ID int `json:"id"`
  47. }