Documentation
¶
Index ¶
- func DefaultValueFormatter(value uint64) string
- type CSVRecordFormat
- type CSVRecords
- type ClusterRatesReport
- type ClusterReport
- type DomainReport
- type LimesReportRenderer
- func LimesDomainsToReportRenderer(in []limesresources.DomainReport) []LimesReportRenderer
- func LimesProjectRatesToReportRenderer(in []limesrates.ProjectReport, domainID, domainName string, hasRatesOnly bool) []LimesReportRenderer
- func LimesProjectResourcesToReportRenderer(in []limesresources.ProjectReport, domainID, domainName string, ...) []LimesReportRenderer
- type OutputFormat
- type OutputOpts
- type ProjectRatesReport
- type ProjectResourcesReport
- type ValueFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultValueFormatter ¶ added in v3.11.0
DefaultValueFormatter is a ValueFormatter that does not perform unit conversion.
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
}
OutputOpts contains all relevant settings how to format an output of a command.
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.
type ValueFormatter ¶ added in v3.11.0
ValueFormatter is the interface for a function that renders integer values into their output representation in CSV. This may involve a conversion between units, based on the unit that was chosen for the respective CSV row during humanization.
func PickHumanizedValueFormatter ¶ added in v3.11.0
PickHumanizedValueFormatter takes several values that are to be interpreted in the given unit, and chooses the best unit to format them in for human-readable values.
For example, `PickHumanizedValueFormatter([2048 4096], UnitBytes)` returns UnitKibibytes and a formatter that renders 2048 as 2 and 4096 as 4.