config.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package pricingmodel
  2. import (
  3. "time"
  4. "github.com/opencost/opencost/core/pkg/util/timeutil"
  5. "github.com/opencost/opencost/pkg/env"
  6. )
  7. // PipelineConfig holds configuration for the pricing model pipeline.
  8. type PipelineConfig struct {
  9. AppName string
  10. CurrencyCode string
  11. AWSRunnerConfig AWSRunnerConfig
  12. AzureRunnerConfig AzureRunnerConfig
  13. GCPRunnerConfig GCPRunnerConfig
  14. }
  15. type AWSRunnerConfig struct {
  16. Enabled bool
  17. RefreshInterval time.Duration
  18. }
  19. type AzureRunnerConfig struct {
  20. Enabled bool
  21. RefreshInterval time.Duration
  22. }
  23. type GCPRunnerConfig struct {
  24. Enabled bool
  25. RefreshInterval time.Duration
  26. APIKey string
  27. }
  28. func DefaultPipelineConfig(appName string) PipelineConfig {
  29. return PipelineConfig{
  30. AppName: appName,
  31. CurrencyCode: "USD",
  32. AWSRunnerConfig: AWSRunnerConfig{
  33. Enabled: true,
  34. RefreshInterval: timeutil.Day,
  35. },
  36. AzureRunnerConfig: AzureRunnerConfig{
  37. Enabled: true,
  38. RefreshInterval: timeutil.Day,
  39. },
  40. GCPRunnerConfig: GCPRunnerConfig{
  41. Enabled: true,
  42. RefreshInterval: timeutil.Day,
  43. APIKey: env.GetCloudProviderAPIKey(),
  44. },
  45. }
  46. }