billing

package
v1.0.0-beta.68 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeUsage   string = "usage"
	EventTypeStorage string = "storage"
)
View Source
const (
	TimeFormat = time.RFC3339
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Metronome

type Metronome struct {
	Config config.Metronome
	// contains filtered or unexported fields
}

func NewMetronomeProvider

func NewMetronomeProvider(config config.Metronome) (*Metronome, error)

func (*Metronome) AddDefaultPlan

func (m *Metronome) AddDefaultPlan(ctx context.Context, accountId MetronomeId) (bool, error)

func (*Metronome) AddPlan

func (m *Metronome) AddPlan(ctx context.Context, accountId MetronomeId, planId uuid.UUID) (bool, error)

func (*Metronome) CreateAccount

func (m *Metronome) CreateAccount(ctx context.Context, namespaceId string, name string) (MetronomeId, error)

func (*Metronome) PushStorageEvents

func (m *Metronome) PushStorageEvents(ctx context.Context, events []*StorageEvent) error

func (*Metronome) PushUsageEvents

func (m *Metronome) PushUsageEvents(ctx context.Context, events []*UsageEvent) error

type MetronomeError

type MetronomeError struct {
	HttpCode int
	Message  string
}

func NewMetronomeError

func NewMetronomeError(code int, message string) *MetronomeError

func (*MetronomeError) Error

func (e *MetronomeError) Error() string

type MetronomeId

type MetronomeId = uuid.UUID

type Provider

type Provider interface {
	CreateAccount(ctx context.Context, namespaceId string, name string) (MetronomeId, error)
	AddDefaultPlan(ctx context.Context, accountId MetronomeId) (bool, error)
	AddPlan(ctx context.Context, accountId MetronomeId, planId uuid.UUID) (bool, error)
	PushUsageEvents(ctx context.Context, events []*UsageEvent) error
	PushStorageEvents(ctx context.Context, events []*StorageEvent) error
}

func NewProvider

func NewProvider() Provider

type StorageEvent

type StorageEvent struct {
	biller.Event
}

type StorageEventBuilder

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

func NewStorageEventBuilder

func NewStorageEventBuilder() *StorageEventBuilder

func (*StorageEventBuilder) Build

func (sb *StorageEventBuilder) Build() *StorageEvent

func (*StorageEventBuilder) WithDatabaseBytes

func (sb *StorageEventBuilder) WithDatabaseBytes(value int64) *StorageEventBuilder

func (*StorageEventBuilder) WithIndexBytes

func (sb *StorageEventBuilder) WithIndexBytes(value int64) *StorageEventBuilder

func (*StorageEventBuilder) WithNamespaceId

func (sb *StorageEventBuilder) WithNamespaceId(id string) *StorageEventBuilder

func (*StorageEventBuilder) WithTimestamp

func (sb *StorageEventBuilder) WithTimestamp(ts time.Time) *StorageEventBuilder

func (*StorageEventBuilder) WithTransactionId

func (sb *StorageEventBuilder) WithTransactionId(id string) *StorageEventBuilder

type UsageEvent

type UsageEvent struct {
	biller.Event
}

type UsageEventBuilder

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

func NewUsageEventBuilder

func NewUsageEventBuilder() *UsageEventBuilder

func (*UsageEventBuilder) Build

func (ub *UsageEventBuilder) Build() *UsageEvent

func (*UsageEventBuilder) WithDatabaseUnits

func (ub *UsageEventBuilder) WithDatabaseUnits(value int64) *UsageEventBuilder

func (*UsageEventBuilder) WithNamespaceId

func (ub *UsageEventBuilder) WithNamespaceId(id string) *UsageEventBuilder

func (*UsageEventBuilder) WithSearchUnits

func (ub *UsageEventBuilder) WithSearchUnits(value int64) *UsageEventBuilder

func (*UsageEventBuilder) WithTimestamp

func (ub *UsageEventBuilder) WithTimestamp(ts time.Time) *UsageEventBuilder

func (*UsageEventBuilder) WithTransactionId

func (ub *UsageEventBuilder) WithTransactionId(id string) *UsageEventBuilder

type UsageReporter

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

func (*UsageReporter) Start

func (r *UsageReporter) Start()

Jump to

Keyboard shortcuts

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