eventio

package
v0.95.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillableEvent

type BillableEvent struct {
	EventGUID           string `json:"event_guid"`
	EventStart          string `json:"event_start"`
	EventStop           string `json:"event_stop"`
	ResourceGUID        string `json:"resource_guid"`
	ResourceName        string `json:"resource_name"`
	ResourceType        string `json:"resource_type"`
	OrgGUID             string `json:"org_guid"`
	OrgName             string `json:"org_name"`
	SpaceGUID           string `json:"space_guid"`
	SpaceName           string `json:"space_name"`
	PlanGUID            string `json:"plan_guid"`
	PlanName            string `json:"plan_name"`
	QuotaDefinitionGUID string `json:"quota_definition_guid"`
	NumberOfNodes       int64  `json:"number_of_nodes"`
	MemoryInMB          int64  `json:"memory_in_mb"`
	StorageInMB         int64  `json:"storage_in_mb"`
	Price               Price  `json:"price"`
}

func (*BillableEvent) Scan

func (e *BillableEvent) Scan(src interface{}) error

type BillableEventConsolidator added in v0.43.0

type BillableEventConsolidator interface {
	ConsolidateAll() error
	ConsolidateFullMonths(startAt string, endAt string) error
	Consolidate(filter EventFilter) error
}

type BillableEventForecaster

type BillableEventForecaster interface {
	ForecastBillableEventRows(ctx context.Context, events []UsageEvent, filter EventFilter) (BillableEventRows, error)
	ForecastBillableEvents(events []UsageEvent, filter EventFilter) ([]BillableEvent, error)
}

type BillableEventReader

type BillableEventReader interface {
	GetBillableEventRows(ctx context.Context, filter EventFilter) (BillableEventRows, error)
	GetBillableEvents(filter EventFilter) ([]BillableEvent, error)
}

type BillableEventRows

type BillableEventRows interface {
	Next() bool
	Close() error
	Err() error
	EventJSON() ([]byte, error)
	Event() (*BillableEvent, error)
}

type ConsolidatedBillableEventReader added in v0.43.0

type ConsolidatedBillableEventReader interface {
	GetConsolidatedBillableEventRows(ctx context.Context, filter EventFilter) (BillableEventRows, error)
	GetConsolidatedBillableEvents(filter EventFilter) ([]BillableEvent, error)
	IsRangeConsolidated(filter EventFilter) (bool, error)
}

type CurrencyRate added in v0.24.0

type CurrencyRate struct {
	Code      string  `json:"code"`
	ValidFrom string  `json:"valid_from"`
	Rate      float64 `json:"rate"`
}

type CurrencyRateReader added in v0.57.0

type CurrencyRateReader interface {
	GetCurrencyRates(filter TimeRangeFilter) ([]CurrencyRate, error)
}

type EventFetcher

type EventFetcher interface {
	FetchEvents(ctx context.Context, lastKnownEvent *RawEvent) ([]RawEvent, error)
	Kind() string
}

type EventFilter

type EventFilter struct {
	RangeStart string
	RangeStop  string
	OrgGUIDs   []string
}

func (*EventFilter) SplitByMonth added in v0.43.0

func (filter *EventFilter) SplitByMonth() ([]EventFilter, error)

func (*EventFilter) TruncateMonth added in v0.43.0

func (filter *EventFilter) TruncateMonth() (EventFilter, error)

func (*EventFilter) Validate

func (filter *EventFilter) Validate() error

type Price

type Price struct {
	IncVAT  string           `json:"inc_vat"`
	ExVAT   string           `json:"ex_vat"`
	Details []PriceComponent `json:"details"`
}

type PriceComponent

type PriceComponent struct {
	Name         string `json:"name"`
	PlanName     string `json:"plan_name"`
	Start        string `json:"start"`
	Stop         string `json:"stop"`
	VatRate      string `json:"vat_rate"`
	VatCode      string `json:"vat_code"`
	CurrencyCode string `json:"currency_code"`
	IncVAT       string `json:"inc_vat"`
	ExVAT        string `json:"ex_vat"`
}

type PricingPlan added in v0.24.0

type PricingPlan struct {
	Name          string                 `json:"name"`
	PlanGUID      string                 `json:"plan_guid"`
	ValidFrom     string                 `json:"valid_from"`
	Components    []PricingPlanComponent `json:"components"`
	MemoryInMB    uint                   `json:"memory_in_mb"`
	StorageInMB   uint                   `json:"storage_in_mb"`
	NumberOfNodes uint                   `json:"number_of_nodes"`
}

type PricingPlanComponent added in v0.24.0

type PricingPlanComponent struct {
	Name         string `json:"name"`
	Formula      string `json:"formula"`
	VATCode      string `json:"vat_code"`
	CurrencyCode string `json:"currency_code"`
}

type PricingPlanReader added in v0.24.0

type PricingPlanReader interface {
	GetPricingPlans(filter TimeRangeFilter) ([]PricingPlan, error)
}

type RawEvent

type RawEvent struct {
	GUID       string          `json:"guid"`
	Kind       string          `json:"kind"`
	RawMessage json.RawMessage `json:"raw_message"`
	CreatedAt  time.Time       `json:"created_at"`
}

func (*RawEvent) Validate

func (e *RawEvent) Validate() error

type RawEventFilter

type RawEventFilter struct {
	Reverse bool
	Limit   int
	Kind    string
}

type RawEventReader

type RawEventReader interface {
	GetEvents(filter RawEventFilter) ([]RawEvent, error)
}

type RawEventWriter

type RawEventWriter interface {
	StoreEvents(events []RawEvent) error
}

type TimeRangeFilter added in v0.57.0

type TimeRangeFilter struct {
	RangeStart string
	RangeStop  string
}

func (*TimeRangeFilter) Validate added in v0.57.0

func (filter *TimeRangeFilter) Validate() error

type TotalCost added in v0.65.0

type TotalCost struct {
	PlanGUID string  `json:"plan_guid"`
	Cost     float32 `json:"cost"`
}

type TotalCostReader added in v0.65.0

type TotalCostReader interface {
	GetTotalCost() ([]TotalCost, error)
}

type UsageEvent

type UsageEvent struct {
	EventGUID     string `json:"event_guid"`
	EventStart    string `json:"event_start"`
	EventStop     string `json:"event_stop"`
	ResourceGUID  string `json:"resource_guid"`
	ResourceName  string `json:"resource_name"`
	ResourceType  string `json:"resource_type"`
	OrgGUID       string `json:"org_guid"`
	OrgName       string `json:"org_name"`
	SpaceGUID     string `json:"space_guid"`
	SpaceName     string `json:"space_name"`
	PlanGUID      string `json:"plan_guid"`
	PlanName      string `json:"plan_name"`
	ServiceGUID   string `json:"service_guid"`
	ServiceName   string `json:"service_name"`
	NumberOfNodes int64  `json:"number_of_nodes"`
	MemoryInMB    int64  `json:"memory_in_mb"`
	StorageInMB   int64  `json:"storage_in_mb"`
}

type UsageEventReader

type UsageEventReader interface {
	GetUsageEventRows(filter EventFilter) (UsageEventRows, error)
	GetUsageEvents(filter EventFilter) ([]UsageEvent, error)
}

type UsageEventRows

type UsageEventRows interface {
	Next() bool
	Close() error
	Err() error
	EventJSON() ([]byte, error)
	Event() (*UsageEvent, error)
}

type VATRate added in v0.24.0

type VATRate struct {
	Code      string  `json:"code"`
	ValidFrom string  `json:"valid_from"`
	Rate      float64 `json:"rate"`
}

type VATRateReader added in v0.57.0

type VATRateReader interface {
	GetVATRates(filter TimeRangeFilter) ([]VATRate, error)
}

Jump to

Keyboard shortcuts

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