core

package
v3.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

LimesUnits is a slice of units that Limes understands. Note: the units in this slice **must** be in ascending order.

Functions

This section is empty.

Types

type CSVRecordFormat

type CSVRecordFormat int

CSVRecordFormat type defines the style of CSV records.

const (
	CSVRecordFormatDefault CSVRecordFormat = iota
	CSVRecordFormatLong
	CSVRecordFormatNames
)

Different types of CSVRecordFormat.

type CSVRecords

type CSVRecords [][]string

CSVRecords is exactly that.

func RenderReports

func RenderReports(opts *OutputOpts, rL ...LimesReportRenderer) CSVRecords

RenderReports renders multiple reports and returns the aggregate CSVRecords.

Note: if multiple LimesReportRenderer are given then they must have the same underlying type.

func (CSVRecords) Write

func (d CSVRecords) Write(w io.Writer) error

Write writes CSVRecords to w.

Note: the method takes an io.Writer because it is used in unit tests.

func (CSVRecords) WriteAsTable

func (d CSVRecords) WriteAsTable()

WriteAsTable writes CSVRecords to os.Stdout in table format.

type ClusterRatesReport added in v3.2.0

type ClusterRatesReport struct {
	*limesrates.ClusterReport
}

ClusterRatesReport is a wrapper for limesrates.ClusterReport.

type ClusterReport

type ClusterReport struct {
	*limesresources.ClusterReport
}

ClusterReport is a wrapper for limesresources.ClusterReport.

type DomainReport

type DomainReport struct {
	*limesresources.DomainReport
}

DomainReport is a wrapper for limesresources.DomainReport.

type LimesReportRenderer

type LimesReportRenderer interface {
	// contains filtered or unexported methods
}

LimesReportRenderer is implemented by data types that can render a Limes API report into CSVRecords.

func LimesDomainsToReportRenderer

func LimesDomainsToReportRenderer(in []limesresources.DomainReport) []LimesReportRenderer

LimesDomainsToReportRenderer wraps the given limesresources.DomainReport in a DomainReport and returns a []LimesReportRenderer.

func LimesProjectRatesToReportRenderer added in v3.0.3

func LimesProjectRatesToReportRenderer(
	in []limesrates.ProjectReport,
	domainID, domainName string,
	hasRatesOnly bool,
) []LimesReportRenderer

LimesProjectRatesToReportRenderer wraps the given limesrates.ProjectReport in a ProjectRatesReport and returns a []LimesReportRenderer.

func LimesProjectResourcesToReportRenderer added in v3.0.3

func LimesProjectResourcesToReportRenderer(
	in []limesresources.ProjectReport,
	domainID, domainName string,
	hasRatesOnly bool,
) []LimesReportRenderer

LimesProjectResourcesToReportRenderer wraps the given limesresources.ProjectReport in a ProjectResourcesReport and returns a []LimesReportRenderer.

type OutputFormat

type OutputFormat string

OutputFormat that the app can print data in.

const (
	OutputFormatTable OutputFormat = "table"
	OutputFormatCSV   OutputFormat = "csv"
	OutputFormatJSON  OutputFormat = "json"
)

Different types of OutputFormat.

func (*OutputFormat) Set added in v3.1.0

func (f *OutputFormat) Set(v string) error

Set implements the pflag.Value interface.

func (*OutputFormat) String added in v3.1.0

func (f *OutputFormat) String() string

String implements the pflag.Value interface.

func (*OutputFormat) Type added in v3.1.0

func (f *OutputFormat) Type() string

Type implements the pflag.Value interface.

type OutputOpts

type OutputOpts struct {
	Fmt       OutputFormat
	CSVRecFmt CSVRecordFormat
	Humanize  bool
}

type ProjectRatesReport added in v3.0.3

type ProjectRatesReport struct {
	*limesrates.ProjectReport

	DomainID   string
	DomainName string
}

ProjectRatesReport is a wrapper for limesrates.ProjectReport.

type ProjectResourcesReport added in v3.0.3

type ProjectResourcesReport struct {
	*limesresources.ProjectReport

	DomainID   string
	DomainName string
}

ProjectResourcesReport is a wrapper for limesresources.ProjectReport.

Jump to

Keyboard shortcuts

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