2
0

usage.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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: 40,
  22. ResourceMemory: 80000,
  23. Clusters: 1,
  24. Users: 20,
  25. }
  26. var TeamPlan = ProjectUsage{
  27. ResourceCPU: 20,
  28. ResourceMemory: 40000,
  29. Clusters: 3,
  30. Users: 3,
  31. }
  32. var GrowthPlan = ProjectUsage{
  33. ResourceCPU: 80,
  34. ResourceMemory: 160000,
  35. Clusters: 0,
  36. Users: 5,
  37. }
  38. // all unlimited
  39. var EnterprisePlan = ProjectUsage{
  40. ResourceCPU: 0,
  41. ResourceMemory: 0,
  42. Clusters: 0,
  43. Users: 0,
  44. }
  45. type GetProjectUsageResponse struct {
  46. Current ProjectUsage `json:"current"`
  47. Limit ProjectUsage `json:"limit"`
  48. // Whether the usage is exceeded
  49. IsExceeded bool `json:"exceeded"`
  50. // When the usage has been exceeded since, if IsExceeded
  51. ExceededSince *time.Time `json:"exceeded_since,omitempty"`
  52. }