price

package
v0.0.0-...-d8fd49e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPricesInto

func ExtractPricesInto(r pagination.Page, v interface{}) error

func List

List returns a Pager which allows you to iterate over a collection of price.

Types

type ListOpts

type ListOpts struct {
	OnlyActive bool      `q:"onlyActive"`
	MetricType string    `q:"METRIC_TYPE"`
	Region     string    `q:"-"`
	From       time.Time `q:"-"`
	To         time.Time `q:"-"`
}

ListOpts is a structure that holds options for listing prices.

func (ListOpts) ToPriceListQuery

func (opts ListOpts) ToPriceListQuery() (string, error)

ToPriceListQuery formats a ListOpts into a query string.

type Price

type Price struct {
	SendCC              int       `json:"SEND_CC"`
	CostElement         int       `json:"COST_ELEMENT"`
	PriceLoc            float64   `json:"PRICE_LOC,string"`
	PriceSec            float64   `json:"PRICE_SEC,string"`
	ValidForProjectType string    `json:"VALID_FOR_PROJECT_TYPE"`
	ObjectType          string    `json:"OBJECT_TYPE"`
	MetricType          string    `json:"METRIC_TYPE"`
	Region              string    `json:"REGION"`
	ValidFrom           time.Time `json:"-"`
	ValidTo             time.Time `json:"-"`
}

Price represents a Billing Price.

func ExtractPrices

func ExtractPrices(r pagination.Page) ([]Price, error)

ExtractPrices accepts a Page struct, specifically a PricePage struct, and extracts the elements into a slice of Price structs. In other words, a generic collection is mapped into a relevant slice.

func (*Price) MarshalJSON

func (r *Price) MarshalJSON() ([]byte, error)

func (*Price) UnmarshalJSON

func (r *Price) UnmarshalJSON(b []byte) error

type PricePage

type PricePage struct {
	pagination.SinglePageBase
}

PricePage is the page returned by a pager when traversing over a collection of price.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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