printer

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OutputDir = "./output"
)

Functions

func ConvertServiceMapToArray added in v0.3.11

func ConvertServiceMapToArray(s map[int]Service,
	granularity string) [][]string

func ConvertServiceSliceToArray added in v0.3.11

func ConvertServiceSliceToArray(s []Service, granularity string) [][]string

func ConvertServiceToSlice added in v0.3.0

func ConvertServiceToSlice(s Service, granularity string) [][]string

func ConvertToChartInputType added in v0.3.11

func ConvertToChartInputType(r CostAndUsageOutputType,
	s []Service) chart.InputType

func ConvertToFloat

func ConvertToFloat(amount string) float64

func CostAndUsageToCSV added in v0.3.0

func CostAndUsageToCSV(sortFn func(r map[int]Service) []Service,
	r CostAndUsageOutputType) error

func CostAndUsageToChart added in v0.3.0

func CostAndUsageToChart(sortFn func(r map[int]Service) []Service,
	r CostAndUsageOutputType) error

func CostAndUsageToOpenAI added in v0.3.11

func CostAndUsageToOpenAI(sortFn func(r map[int]Service) []Service,
	r CostAndUsageOutputType) error

func CostAndUsageToStdout added in v0.3.0

func CostAndUsageToStdout(sortFn func(r map[int]Service) []Service,
	r CostAndUsageOutputType)

func CreateSubTitle added in v0.3.0

func CreateSubTitle(granularity string, start string, end string) string

func CreateTable added in v0.3.0

func CreateTable(header table.Row) table.Writer

func ForecastToRows added in v0.3.0

func ForecastToRows(r ForecastPrintData) []table.Row

func ForecastToStdout added in v0.3.0

func ForecastToStdout(r ForecastPrintData,
	dimensions []string)

func MaxRows added in v0.4.4

func MaxRows(rows [][]string, maxRows int) int

func ResultsToServicesMap added in v0.3.0

func ResultsToServicesMap(res []types.ResultByTime) map[int]Service

func ReturnIfPresent

func ReturnIfPresent(s []string) string

func SortFunction added in v0.3.9

func SortFunction(sortBy string) func(r map[int]Service) []Service

Types

type ChartData added in v0.3.0

type ChartData struct {
	StartDate      string
	EndDate        string
	Granularity    string
	DimensionOrTag string
	Title          string
	SubTitle       string
	NumericValues  float64
}

type ChartPrinter added in v0.3.0

type ChartPrinter struct {
	Variant string
}

func (*ChartPrinter) Print added in v0.3.0

func (p *ChartPrinter) Print(f interface{}, c interface{}) error

type CostAndUsage added in v0.3.0

type CostAndUsage struct {
	Rows  []table.Row
	Total string
}

func CostUsageToRows added in v0.3.0

func CostUsageToRows(s []Service, granularity string) CostAndUsage

type CostAndUsageOutputType added in v0.3.0

type CostAndUsageOutputType struct {
	Services     map[int]Service
	Granularity  string
	Start        string
	End          string
	Dimensions   []string
	Tags         []string
	SortBy       string
	OpenAIAPIKey string
}

type CostAndUsageReport

type CostAndUsageReport struct {
	Services    map[int]Service
	Start       string
	End         string
	Granularity string
	Dimensions  []string
	Tags        []string
}

func (CostAndUsageReport) Equals

func (CostAndUsageReport) Len

func (c CostAndUsageReport) Len() int

func (CostAndUsageReport) Less

func (c CostAndUsageReport) Less(i, j int) bool

func (CostAndUsageReport) Swap

func (c CostAndUsageReport) Swap(i, j int)

type CsvPrinter added in v0.3.0

type CsvPrinter struct {
	Variant string
}

func (*CsvPrinter) Print added in v0.3.0

func (p *CsvPrinter) Print(f interface{}, c interface{}) error

type Error added in v0.3.11

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

func (Error) Error added in v0.3.11

func (e Error) Error() string

type ForecastPrintData added in v0.2.0

type ForecastPrintData struct {
	Forecast *costexplorer.GetCostForecastOutput
	Filters  []string
}

type FormatError added in v0.3.11

type FormatError struct {
	Msg string
}

func (FormatError) Error added in v0.3.11

func (e FormatError) Error() string

type Metrics

type Metrics struct {
	Name          string
	Amount        string
	NumericAmount float64
	Unit          string
	UsageQuantity float64
}

func MetricsToService added in v0.3.0

func MetricsToService(m map[string]types.MetricValue) []Metrics

func (Metrics) Equals

func (m Metrics) Equals(m2 Metrics) bool

type OpenAIPrinter added in v0.3.11

type OpenAIPrinter struct {
	Variant string
}

func (*OpenAIPrinter) Print added in v0.3.11

func (p *OpenAIPrinter) Print(f interface{}, c interface{}) error

type PrintWriterType added in v0.3.0

type PrintWriterType int
const (
	Stdout PrintWriterType = iota
	CSV
	Chart
	OpenAPI
)

func ToPrintWriterType added in v0.3.0

func ToPrintWriterType(s string) PrintWriterType

type Printer added in v0.3.0

type Printer interface {
	Print(interface{}, interface{}) error
}

func PrintFactory added in v0.3.0

func PrintFactory(printType PrintWriterType, variant string) Printer

type Service

type Service struct {
	Keys    []string
	Name    string
	Metrics []Metrics
	Start   string
	End     string
}

func SortServicesByMetricAmount

func SortServicesByMetricAmount(r map[int]Service) []Service

func SortServicesByStartDate added in v0.3.9

func SortServicesByStartDate(r map[int]Service) []Service

func (Service) Equals

func (s Service) Equals(s2 Service) bool

func (Service) Less

func (s Service) Less(i, j int) bool

type SortBy added in v0.3.9

type SortBy int
const (
	Amount SortBy = iota
	Date
)

type StdoutPrinter added in v0.3.0

type StdoutPrinter struct {
	Variant string
}

func (*StdoutPrinter) Print added in v0.3.0

func (p *StdoutPrinter) Print(f interface{}, c interface{}) error

Directories

Path Synopsis
writers
csv

Jump to

Keyboard shortcuts

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