usage.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package types
  2. import "time"
  3. type UsageMetric string
  4. const (
  5. CPU UsageMetric = "cpu"
  6. Memory UsageMetric = "memory"
  7. Clusters UsageMetric = "clusters"
  8. Users UsageMetric = "users"
  9. )
  10. type ProjectUsage struct {
  11. // The CPU usage, in vCPUs
  12. ResourceCPU uint `json:"resource_cpu"`
  13. // The memory usage, in mibibytes (?)
  14. ResourceMemory uint `json:"resource_memory"`
  15. // The number of clusters
  16. Clusters uint `json:"clusters"`
  17. // The number of users
  18. Users uint `json:"users"`
  19. }
  20. var BasicPlan = ProjectUsage{
  21. ResourceCPU: 10,
  22. // 20 GB converted to Mebibytes
  23. ResourceMemory: 19074,
  24. Clusters: 1,
  25. Users: 1,
  26. }
  27. var TeamPlan = ProjectUsage{
  28. ResourceCPU: 20,
  29. // 40 GB converted to Mebibytes
  30. ResourceMemory: 38148,
  31. Clusters: 3,
  32. Users: 3,
  33. }
  34. var GrowthPlan = ProjectUsage{
  35. ResourceCPU: 80,
  36. // 160 GB converted to Mebibytes
  37. ResourceMemory: 152592,
  38. Clusters: 0,
  39. Users: 5,
  40. }
  41. // all unlimited
  42. var EnterprisePlan = ProjectUsage{
  43. ResourceCPU: 0,
  44. ResourceMemory: 0,
  45. Clusters: 0,
  46. Users: 0,
  47. }
  48. type GetProjectUsageResponse struct {
  49. Current ProjectUsage `json:"current"`
  50. Limit ProjectUsage `json:"limit"`
  51. // Whether the usage is exceeded
  52. IsExceeded bool `json:"exceeded"`
  53. // When the usage has been exceeded since, if IsExceeded
  54. ExceededSince *time.Time `json:"exceeded_since,omitempty"`
  55. }