export

package
v1.0.0-alpha.24 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package export writes a rows file in the import format of another cost tool: FOCUS 1.4 CSV, a Vantage custom provider's CSV, Datadog's Custom Costs CSV, Harness's custom cost CSV, a Cloudability FOCUS drop, Ternary's daily FOCUS 1.2 files, or FOCUS 1.5's candidate release. Every amount leaves as the row wrote it. Nothing is converted, rounded or added up, and a tool that takes one currency refuses a row in another.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRootDir = errors.New("a Cloudability manifest names its bucket or container, so cloudability needs --root-dir")

ErrNoRootDir is a Cloudability export without the bucket its manifest names.

View Source
var ErrNoRows = errors.New("the rows file holds no rows")

ErrNoRows is a rows file that holds no row, of which no format writes a file.

Formats are the formats in the order the help names them.

Functions

This section is empty.

Types

type Export

type Export struct {
	Files []File
	// OmittedTags are the tag keys a Datadog file has no column for, because
	// a row lacks them and Datadog takes no blank cell.
	OmittedTags []string
}

Export is what a format made of a rows file.

func Write

func Write(format Format, lines io.Reader, options Options) (Export, error)

Write reads rows as JSON lines and writes them in format. A line that is not a row of the contract refuses the export, as does a row the format cannot take, and nothing is written.

type File

type File struct {
	// Name is the file's path under the directory a layout format writes,
	// and empty in a format that writes one file.
	Name string
	Body []byte
	Rows int
	// Note says what the file holds where its rows do not: what a file of no
	// rows is, or the billing period of a part.
	Note string
}

File is one file of an export and the number of rows it holds.

type Format

type Format string

Format is a value of costroid export --format.

const (
	FocusCSV     Format = "focus-csv"
	Vantage      Format = "vantage"
	Datadog      Format = "datadog"
	Harness      Format = "harness"
	Cloudability Format = "cloudability"
	Ternary      Format = "ternary"
	// Focus15CR is FOCUS 1.5's candidate release, v1.5-cr. Ratification may
	// change its content, and the format is then named focus-1.5.
	Focus15CR Format = "focus-1.5-cr"
)

The formats export writes.

func ParseFormat

func ParseFormat(name string) (Format, error)

ParseFormat reads a --format value.

func (Format) Layout

func (f Format) Layout() bool

Layout reports a format that writes a tree of named files under a directory, where the other formats write one file, or numbered parts of one.

type Options

type Options struct {
	// Now is when the export runs, which a Cloudability drop is named by.
	Now time.Time
	// RootDir is the bucket or container a Cloudability manifest names.
	RootDir string
}

Options are what a format takes besides the rows.

type RowsError

type RowsError struct {
	Format Format
	Rows   []string
	Reason string
}

RowsError refuses rows a format cannot take. It names the first 10 and counts the rest.

func (*RowsError) Error

func (e *RowsError) Error() string

Jump to

Keyboard shortcuts

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