core

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 14 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 ClusterReport

type ClusterReport struct {
	*limes.ClusterReport
}

ClusterReport is a wrapper for limes.ClusterReport.

type DomainReport

type DomainReport struct {
	*limes.DomainReport
}

DomainReport is a wrapper for limes.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 []limes.DomainReport) []LimesReportRenderer

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

func LimesProjectsToReportRenderer

func LimesProjectsToReportRenderer(
	in []limes.ProjectReport,
	domainID, domainName string,
	hasRatesOnly bool,
) []LimesReportRenderer

LimesProjectsToReportRenderer wraps the given limes.ProjectReport in a ProjectReport 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.

type OutputOpts

type OutputOpts struct {
	Fmt       OutputFormat
	CSVRecFmt CSVRecordFormat
	Humanize  bool
}

type ProjectReport

type ProjectReport struct {
	*limes.ProjectReport

	HasRatesOnly bool

	DomainID   string
	DomainName string
}

ProjectReport is a wrapper for limes.ProjectReport.

Jump to

Keyboard shortcuts

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