cost

package
v0.0.0-...-1dd8909 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MonthlyForService

func MonthlyForService(ctx context.Context, teamSlug slug.Slug, environmentName, workloadName, service string) (float32, error)

func NewLoaderContext

func NewLoaderContext(ctx context.Context, dbConn *pgxpool.Pool, opts ...Option) context.Context

Types

type BigQueryDatasetCost

type BigQueryDatasetCost struct {
	Sum float64 `json:"sum"`
}

type Client

type Client interface {
	DailyForWorkload(ctx context.Context, teamSlug slug.Slug, environmentName, workloadName string, fromDate, toDate time.Time) (*WorkloadCostPeriod, error)
	MonthlyForWorkload(ctx context.Context, teamSlug slug.Slug, environmentName, workloadName string) (*WorkloadCostPeriod, error)
	DailyForTeamEnvironment(ctx context.Context, teamSlug slug.Slug, environmentName string, fromDate, toDate time.Time) (*TeamEnvironmentCostPeriod, error)
	DailyForTeam(ctx context.Context, teamSlug slug.Slug, fromDate, toDate time.Time, filter *TeamCostDailyFilter) (*TeamCostPeriod, error)
	MonthlySummaryForTeam(ctx context.Context, teamSlug slug.Slug) (*TeamCostMonthlySummary, error)
	MonthlyForService(ctx context.Context, teamSlug slug.Slug, environmentName, workloadName, service string) (float32, error)
}

type FakeClient

type FakeClient struct {
	// contains filtered or unexported fields
}

func NewFakeClient

func NewFakeClient() *FakeClient

func (*FakeClient) DailyForTeam

func (c *FakeClient) DailyForTeam(_ context.Context, teamSlug slug.Slug, fromDate, toDate time.Time, filter *TeamCostDailyFilter) (*TeamCostPeriod, error)

func (*FakeClient) DailyForTeamEnvironment

func (c *FakeClient) DailyForTeamEnvironment(ctx context.Context, teamSlug slug.Slug, environmentName string, fromDate, toDate time.Time) (*TeamEnvironmentCostPeriod, error)

func (*FakeClient) DailyForWorkload

func (c *FakeClient) DailyForWorkload(_ context.Context, teamSlug slug.Slug, environmentName, workloadName string, fromDate, toDate time.Time) (*WorkloadCostPeriod, error)

func (*FakeClient) MonthlyForService

func (c *FakeClient) MonthlyForService(_ context.Context, teamSlug slug.Slug, environmentName, workloadName, service string) (float32, error)

func (*FakeClient) MonthlyForWorkload

func (c *FakeClient) MonthlyForWorkload(_ context.Context, teamSlug slug.Slug, environmentName, workloadName string) (*WorkloadCostPeriod, error)

func (*FakeClient) MonthlySummaryForTeam

func (c *FakeClient) MonthlySummaryForTeam(_ context.Context, teamSlug slug.Slug) (*TeamCostMonthlySummary, error)

type OpenSearchCost

type OpenSearchCost struct {
	Sum float64 `json:"sum"`
}

type Option

type Option func(l *loaders)

func WithClient

func WithClient(client Client) Option

type RedisInstanceCost

type RedisInstanceCost struct {
	Sum float64 `json:"sum"`
}

type SQLInstanceCost

type SQLInstanceCost struct {
	Sum float64 `json:"sum"`
}

type ServiceCostSample

type ServiceCostSample struct {
	Service string  `json:"service"`
	Cost    float64 `json:"cost"`
}

type ServiceCostSeries

type ServiceCostSeries struct {
	Date     scalar.Date          `json:"date"`
	Services []*ServiceCostSample `json:"services"`
}

func (*ServiceCostSeries) Sum

func (w *ServiceCostSeries) Sum() float64

type TeamCost

type TeamCost struct {
	TeamSlug slug.Slug `json:"-"`
}

type TeamCostDailyFilter

type TeamCostDailyFilter struct {
	// Services to include in the summary.
	Services []string `json:"services,omitempty"`
}

func (*TeamCostDailyFilter) Validate

func (i *TeamCostDailyFilter) Validate(ctx context.Context) error

type TeamCostMonthlySample

type TeamCostMonthlySample struct {
	Date scalar.Date `json:"date"`
	Cost float64     `json:"cost"`
}

type TeamCostMonthlySummary

type TeamCostMonthlySummary struct {
	Series []*TeamCostMonthlySample `json:"series"`
}

func MonthlySummaryForTeam

func MonthlySummaryForTeam(ctx context.Context, teamSlug slug.Slug) (*TeamCostMonthlySummary, error)

func (*TeamCostMonthlySummary) Sum

type TeamCostPeriod

type TeamCostPeriod struct {
	Series []*ServiceCostSeries `json:"series"`
}

func DailyForTeam

func DailyForTeam(ctx context.Context, teamSlug slug.Slug, fromDate, toDate time.Time, filter *TeamCostDailyFilter) (*TeamCostPeriod, error)

func (*TeamCostPeriod) Sum

func (w *TeamCostPeriod) Sum() float64

type TeamEnvironmentCost

type TeamEnvironmentCost struct {
	TeamSlug        slug.Slug `json:"-"`
	EnvironmentName string    `json:"-"`
}

type TeamEnvironmentCostPeriod

type TeamEnvironmentCostPeriod struct {
	Series []*WorkloadCostSeries `json:"series"`
}

func DailyForTeamEnvironment

func DailyForTeamEnvironment(ctx context.Context, teamSlug slug.Slug, environmentName string, fromDate, toDate time.Time) (*TeamEnvironmentCostPeriod, error)

func (*TeamEnvironmentCostPeriod) Sum

type WorkloadCost

type WorkloadCost struct {
	EnvironmentName string    `json:"-"`
	WorkloadName    string    `json:"-"`
	TeamSlug        slug.Slug `json:"-"`
}

type WorkloadCostPeriod

type WorkloadCostPeriod struct {
	Series []*ServiceCostSeries `json:"series"`
}

func DailyForWorkload

func DailyForWorkload(ctx context.Context, teamSlug slug.Slug, environmentName, workloadName string, fromDate, toDate time.Time) (*WorkloadCostPeriod, error)

func MonthlyForWorkload

func MonthlyForWorkload(ctx context.Context, teamSlug slug.Slug, environmentName, workloadName string) (*WorkloadCostPeriod, error)

func (*WorkloadCostPeriod) Sum

func (w *WorkloadCostPeriod) Sum() float64

type WorkloadCostSample

type WorkloadCostSample struct {
	Cost            float64   `json:"cost"`
	WorkloadName    string    `json:"workloadName"`
	TeamSlug        slug.Slug `json:"-"`
	EnvironmentName string    `json:"-"`
}

type WorkloadCostSeries

type WorkloadCostSeries struct {
	Date      scalar.Date           `json:"date"`
	Workloads []*WorkloadCostSample `json:"workloads"`
}

func (*WorkloadCostSeries) Sum

func (w *WorkloadCostSeries) Sum() float64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL