commands

package
v0.0.0-...-9994f1b Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Package commands contains the implementation of commands for the fleetcost command line tool.

Index

Constants

This section is empty.

Variables

View Source
var BatchCreateCICommand *subcommands.Command = &subcommands.Command{
	UsageLine: "batch-create-ci -csv ...",
	ShortDesc: "batch create models from a CSV",
	LongDesc:  "batch create models from a CSV",
	CommandRun: func() subcommands.CommandRun {
		c := &batchCreateCICommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		c.Flags.StringVar(&c.path, "path", "", "path to cost indicators")
		return c
	},
}
View Source
var CreateCostIndicatorCommand *subcommands.Command = &subcommands.Command{
	UsageLine: "create-ci [options...]",
	ShortDesc: "create a cost indicator",
	LongDesc:  "Create a cost indicator",
	CommandRun: func() subcommands.CommandRun {
		c := &createCostIndicatorCommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		c.Flags.StringVar(&c.name, "name", "", "name of cost indicator")
		c.Flags.Func("type", "name of cost indicator", makeTypeRecorder(&c.typ))
		c.Flags.StringVar(&c.primary, "primary", "", "primary")
		c.Flags.StringVar(&c.secondary, "secondary", "", "secondary")
		c.Flags.StringVar(&c.tertiary, "tertiary", "", "tertiary")
		c.Flags.Func("cost", "cost", makeMoneyRecorder(&c.cost))
		c.Flags.Func("cadence", "cost-cadence", makeCostCadenceRecorder(&c.costCadence))
		c.Flags.Float64Var(&c.burnoutRate, "burnout", 0, "device burnout rate")
		c.Flags.Func("location", "where the device is located", makeLocationRecorder(&c.location))
		c.Flags.Float64Var(&c.amortizationInYears, "am", 0, "amortization time in years")
		c.Flags.StringVar(&c.urls, "urls", "", `a ;-delimited list of URLs`)
		return c
	},
}
View Source
var DeleteCostIndicatorCommand *subcommands.Command = &subcommands.Command{
	UsageLine: "delete-ci [options...]",
	ShortDesc: "delete a cost indicator",
	LongDesc:  "Delete a cost indicator",
	CommandRun: func() subcommands.CommandRun {
		c := &deleteCostIndicatorCommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		c.Flags.StringVar(&c.primary, "primary", "", "the board of the indicator to delete")
		c.Flags.StringVar(&c.secondary, "secondary", "", "the model of the indicator to delete")
		c.Flags.StringVar(&c.tertiary, "tertiary", "", "the sku of the indicator to delete")
		c.Flags.Func("location", "the location of the thing to delete", makeLocationRecorder(&c.location))
		c.Flags.Func("type", "the type of the thing to delete", makeTypeRecorder(&c.typ))
		return c
	},
}

DeleteCostIndicatorCommand deletes a cost indicator.

View Source
var GetCostIndicatorCommand *subcommands.Command = &subcommands.Command{
	UsageLine: "get-ci [options...]",
	ShortDesc: "get a cost indicator",
	LongDesc:  "Get a cost indicator",
	CommandRun: func() subcommands.CommandRun {
		c := &getCostIndicatorCommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		c.Flags.StringVar(&c.primary, "primary", "", "primary")
		c.Flags.StringVar(&c.secondary, "secondary", "", "secondary")
		c.Flags.StringVar(&c.tertiary, "tertiary", "", "tertiary")
		c.Flags.Func("location", "where the device is located", makeLocationRecorder(&c.location))
		c.Flags.Func("type", "name of cost indicator", makeTypeRecorder(&c.typ))
		return c
	},
}
View Source
var GetCostResultCommand *subcommands.Command = &subcommands.Command{
	UsageLine: "get-cost [options...]",
	ShortDesc: "Get cost result of a particular DUT",
	LongDesc:  "Get cost result of a particular DUT",
	CommandRun: func() subcommands.CommandRun {
		c := &getCostResultCommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		c.Flags.StringVar(&c.name, "name", "", "hostname of a DUT. If hints are provided, then we want the cost of a hypothetical DUT and the hostname should not be provided.")
		c.Flags.BoolVar(&c.lax, "lax", false, "whether to forgive missing cost entries")
		c.Flags.StringVar(&c.hints, "hints", "", "if provided, do not talk to UFS and instead use hints to generate the cost estimate. Comma-delimited.")
		c.Flags.BoolVar(&c.forceUpdate, "forceupdate", false, "if provided, force update the cache entry (false by default)")
		return c
	},
}

GetCostResultCommand pings UFS via the fleet cost service.

View Source
var PersistToBigqueryCommand *subcommands.Command = &subcommands.Command{
	UsageLine: "persist-to-bigquery [options...]",
	ShortDesc: "Persist to bigquery",
	LongDesc:  "Persist to bigquery",
	CommandRun: func() subcommands.CommandRun {
		c := &persistToBigqueryCommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		c.Flags.BoolVar(&c.readonly, "readonly", true, "use readonly")
		return c
	},
}

PersistToBigqueryCommand persists to BigQuery.

View Source
var PingCommand *subcommands.Command = &subcommands.Command{
	UsageLine: "ping [options...]",
	ShortDesc: "ping a fleet cost instance",
	LongDesc:  "Ping a fleet cost instance",
	CommandRun: func() subcommands.CommandRun {
		c := &pingCommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		return c
	},
}

PingCommand pings the service.

View Source
var PingUFSCommand *subcommands.Command = &subcommands.Command{
	UsageLine: "pingufs [options...]",
	ShortDesc: "ping ufs via a fleet cost instance",
	LongDesc:  "Ping ufs via a fleet cost instance",
	CommandRun: func() subcommands.CommandRun {
		c := &pingUFSCommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		return c
	},
}

PingUFSCommand pings UFS via the fleet cost service.

View Source
var RepopulateCacheCommand *subcommands.Command = &subcommands.Command{
	UsageLine: "repopulate-cache [options...]",
	ShortDesc: "Repopulate the cache",
	LongDesc:  "Repopulate the cache",
	CommandRun: func() subcommands.CommandRun {
		c := &repopulateCacheCommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		c.Flags.BoolVar(&c.forgiveMissingEntries, "forgive", false, "forgive missing entries")
		return c
	},
}

RepopulateCacheCommand repopulates the cache.

View Source
var UpdateCostIndicatorCommand *subcommands.Command = &subcommands.Command{
	UsageLine: "update-ci [options...]",
	ShortDesc: "update a cost indicator",
	LongDesc:  "Update a cost indicator",
	CommandRun: func() subcommands.CommandRun {
		c := &updateCostIndicatorCommand{}
		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
		c.authFlags.RegisterIDTokenFlags(&c.Flags)
		c.commonFlags.Register(&c.Flags)
		c.Flags.StringVar(&c.name, "name", "", "name of cost indicator")
		c.Flags.Func("type", "name of cost indicator", makeTypeRecorder(&c.typ))
		c.Flags.StringVar(&c.primary, "primary", "", "primary")
		c.Flags.StringVar(&c.secondary, "secondary", "", "secondary")
		c.Flags.StringVar(&c.tertiary, "tertiary", "", "tertiary")
		c.Flags.Func("cost", "cost", makeMoneyRecorder(&c.cost))
		c.Flags.Func("cadence", "cost-cadence", makeCostCadenceRecorder(&c.costCadence))
		c.Flags.Float64Var(&c.burnoutRate, "burnout", 0, "device burnout rate")
		c.Flags.Func("location", "where the device is located", makeLocationRecorder(&c.location))
		c.Flags.Float64Var(&c.amortizationInYears, "am", 0, "amortization time in years")
		return c
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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