constants

package
v0.14.0-alpha.20 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package constants contains constant values that are used throughout Steampipe

Index

Constants

View Source
const (
	ArgHelp              = "help"
	ArgVersion           = "version"
	ArgForce             = "force"
	ArgAll               = "all"
	ArgTimer             = "timing"
	ArgOn                = "on"
	ArgOff               = "off"
	ArgClear             = "clear"
	ArgDatabasePort      = "database-port"
	ArgListenAddress     = "database-listen"
	ArgServicePassword   = "database-password"
	ArgDashboard         = "dashboard"
	ArgDashboardListen   = "dashboard-listen"
	ArgDashboardPort     = "dashboard-port"
	ArgForeground        = "foreground"
	ArgInvoker           = "invoker"
	ArgUpdateCheck       = "update-check"
	ArgTelemetry         = "telemetry"
	ArgInstallDir        = "install-dir"
	ArgWorkspace         = "workspace"
	ArgWorkspaceChDir    = "workspace-chdir"
	ArgWorkspaceDatabase = "workspace-database"
	ArgSchemaComments    = "schema-comments"
	ArgCloudHost         = "cloud-host"
	ArgCloudToken        = "cloud-token"
	ArgSearchPath        = "search-path"
	ArgSearchPathPrefix  = "search-path-prefix"
	ArgWatch             = "watch"
	ArgTheme             = "theme"
	ArgProgress          = "progress"
	ArgExport            = "export"
	ArgMaxParallel       = "max-parallel"
	ArgDryRun            = "dry-run"
	ArgWhere             = "where"
	ArgTag               = "tag"
	ArgVariable          = "var"
	ArgVarFile           = "var-file"
	ArgConnectionString  = "connection-string"
	ArgCheckDisplayWidth = "check-display-width"
	ArgPrune             = "prune"
	ArgModInstall        = "mod-install"
	ArgServiceMode       = "service-mode"
	ArgBrowser           = "browser"
	ArgInput             = "input"
)

Argument name constants

View Source
const (
	// ConfigKeyDatabaseSearchPath is used to store the search path set in the database config in viper
	// the viper value will be set via via a call to getScopedKey in steampipeconfig/steampipeconfig.go
	ConfigKeyDatabaseSearchPath = "database.search-path"
	ConfigKeyInteractive        = "interactive"
	ConfigKeyActiveCommand      = "cmd"
	ConfigKeyActiveCommandArgs  = "cmd_args"
	ConfigInteractiveVariables  = "interactive_var"
	ConfigKeyIsTerminalTTY      = "is_terminal"
)

viper config keys

View Source
const (
	// ControlQueryCancellationTimeoutSecs is maximum number of seconds to wait for control queries to finish cancelling
	ControlQueryCancellationTimeoutSecs = 30
	// MaxControlRunAttempts determines how many time should a cotnrol run should be retried
	// in the case of a GRPC connectivity error
	MaxControlRunAttempts = 2
)
View Source
const (
	ControlOk    = "ok"
	ControlAlarm = "alarm"
	ControlSkip  = "skip"
	ControlInfo  = "info"
	ControlError = "error"
)
View Source
const (
	DashboardServerDefaultPort    = 9194
	DashboardAssetsImageRefFormat = "us-docker.pkg.dev/steampipe/steampipe/assets:%s"
)
View Source
const (
	DatabaseDefaultPort   = 9193
	DatabaseSuperUser     = "root"
	DatabaseUser          = "steampipe"
	DatabaseName          = "steampipe"
	DatabaseUsersRole     = "steampipe_users"
	DefaultMaxConnections = 5
)
View Source
const (
	DatabaseVersion = "14.2.0"
	FdwVersion      = "1.0.0-rc.2"

	// PostgresImageRef is the OCI Image ref for the databse binaries
	PostgresImageRef = "us-docker.pkg.dev/steampipe/steampipe/db:14.2.0-dev.5" // + DatabaseVersion
	FdwImageRef      = "us-docker.pkg.dev/steampipe/steampipe/fdw:" + FdwVersion
)

constants for installing db and fdw images

View Source
const (
	// FunctionSchema is the schema container for all steampipe helper functions
	FunctionSchema = "internal"

	// CommandSchema is the schema which is used to send commands to the FDW
	CommandSchema               = "steampipe_command"
	CacheCommandTable           = "cache"
	CacheCommandOperationColumn = "operation"
	CommandCacheOn              = "cache_on"
	CommandCacheOff             = "cache_off"
	CommandCacheClear           = "cache_clear"
)

schema names

View Source
const (
	IntrospectionTableQuery              = "steampipe_query"
	IntrospectionTableControl            = "steampipe_control"
	IntrospectionTableBenchmark          = "steampipe_benchmark"
	IntrospectionTableMod                = "steampipe_mod"
	IntrospectionTableDashboard          = "steampipe_dashboard"
	IntrospectionTableDashboardContainer = "steampipe_dashboard_container"
	IntrospectionTableDashboardCard      = "steampipe_dashboard_card"
	IntrospectionTableDashboardChart     = "steampipe_dashboard_chart"
	IntrospectionTableDashboardFlow      = "steampipe_dashboard_flow"
	IntrospectionTableDashboardHierarchy = "steampipe_dashboard_hierarchy"
	IntrospectionTableDashboardImage     = "steampipe_dashboard_image"
	IntrospectionTableDashboardInput     = "steampipe_dashboard_input"
	IntrospectionTableDashboardTable     = "steampipe_dashboard_table"
	IntrospectionTableDashboardText      = "steampipe_dashboard_text"
	IntrospectionTableVariable           = "steampipe_variable"
	IntrospectionTableReference          = "steampipe_reference"
)

introspection table names

View Source
const (
	// InvokerService is set when invoked by `service start`
	InvokerService Invoker = "service"
	// InvokerQuery is set when invoked by query command
	InvokerQuery = "query"
	// InvokerCheck is set when invoked by check command
	InvokerCheck = "check"
	// InvokerPlugin is set when invoked by a plugin command
	InvokerPlugin = "plugin"
	// InvokerDashboard is set when invoked by dashboard command
	InvokerDashboard = "dashboard"
	// InvokerConnectionWatcher is set when invoked by the connection watcher process
	InvokerConnectionWatcher = "connection-watcher"
)
View Source
const (
	// SpinnerShowTimeout is the duration after which spinner should be shown
	SpinnerShowTimeout = 1 * time.Second

	MaxColumnWidth = 1024

	// NullString is the string which is displayed for null column values
	NullString = "<null>"
)

Display constants

View Source
const (
	EnvUpdateCheck     = "STEAMPIPE_UPDATE_CHECK"
	EnvInstallDir      = "STEAMPIPE_INSTALL_DIR"
	EnvInstallDatabase = "STEAMPIPE_INITDB_DATABASE_NAME"
	EnvServicePassword = "STEAMPIPE_DATABASE_PASSWORD"
	EnvMaxParallel     = "STEAMPIPE_MAX_PARALLEL"

	EnvWorkspaceDatabase = "STEAMPIPE_WORKSPACE_DATABASE"
	EnvCloudHost         = "STEAMPIPE_CLOUD_HOST"
	EnvCloudToken        = "STEAMPIPE_CLOUD_TOKEN"

	EnvCheckDisplayWidth = "STEAMPIPE_CHECK_DISPLAY_WIDTH"
	EnvCacheEnabled      = "STEAMPIPE_CACHE"
	EnvCacheTTL          = "STEAMPIPE_CACHE_TTL"
	EnvConnectionWatcher = "STEAMPIPE_CONNECTION_WATCHER"
	EnvWorkspaceChDir    = "STEAMPIPE_WORKSPACE_CHDIR"

	// EnvInputVarPrefix is the prefix for environment variables that represent values for input variables.
	EnvInputVarPrefix = "SP_VAR_"

	EnvTelemetry = "STEAMPIPE_TELEMETRY"
)

Environment Variables

View Source
const (
	ExitCodeSuccessful                   = 0
	ExitCodeUnknownErrorPanic            = 1
	ExitCodeInsufficientOrWrongArguments = 2
	ExitCodeLoadingError                 = 3
	ExitCodePluginListFailure            = 4
	ExitCodeNoModFile                    = 15
	ExitCodeBindPortUnavailable          = 31
)
View Source
const (
	PluginExtension        = ".plugin"
	ConfigExtension        = ".spc"
	SqlExtension           = ".sql"
	MarkdownExtension      = ".md"
	ModDataExtension       = ".sp"
	VariablesExtension     = ".spvars"
	AutoVariablesExtension = ".auto.spvars"
	JsonExtension          = ".json"
	CsvExtension           = ".csv"
)
View Source
const (
	HistoryFile = "history.json" // File to store historical data
	HistorySize = 500            // Number of historical records to store
)

Constants for History

View Source
const (
	CmdTableList        = ".tables"             // List all tables
	CmdOutput           = ".output"             // Set output mode
	CmdTiming           = ".timing"             // Toggle query timer
	CmdHeaders          = ".header"             // Toggle headers output
	CmdSeparator        = ".separator"          // Set the column separator
	CmdExit             = ".exit"               // Exit the interactive prompt
	CmdQuit             = ".quit"               // Alias for .exit
	CmdInspect          = ".inspect"            // inspect
	CmdConnections      = ".connections"        // list all connections
	CmdMulti            = ".multi"              // toggle multi line query
	CmdClear            = ".clear"              // clear the console
	CmdHelp             = ".help"               // list all meta commands
	CmdSearchPath       = ".search_path"        // Set or show search-path
	CmdSearchPathPrefix = ".search_path_prefix" // set search path prefix
	CmdCache            = ".cache"              // cache control
)
View Source
const (
	// query output format
	OutputFormatCSV   = "csv"
	OutputFormatJSON  = "json"
	OutputFormatTable = "table"
	OutputFormatLine  = "line"

	// check output format
	CheckOutputFormatNone     = "none"
	CheckOutputFormatText     = "text"
	CheckOutputFormatBrief    = "brief"
	CheckOutputFormatCSV      = "csv"
	CheckOutputFormatJSON     = "json"
	CheckOutputFormatHTML     = "html"
	CheckOutputFormatMarkdown = "md"
	CheckOutputFormatNUnit3   = "nunit3"
	CheckOutputFormatAsffJson = "json-asff"
)
View Source
const (
	ArchAMD64 = "amd64"
	ArchARM64 = "arm64"
	OSLinux   = "linux"
	OSDarwin  = "darwin"
)
View Source
const (
	PluginAlreadyInstalled       = "Already installed"
	PluginLatestAlreadyInstalled = "Latest already installed"
	PluginNotInstalled           = "Not installed"
	PluginNotFound               = "Not found"
)
View Source
const (
	ServerCertKey = "server.key"
	RootCertKey   = "root.key"
	ServerCert    = "server.crt"
	RootCert      = "root.crt"
	SslConfDir    = "/etc/ssl"
)

constants for ssl key and certificate

View Source
const (
	TelemetryNone = "none"
	TelemetryInfo = "info"
)

constants for telemetry config flag

View Source
const (
	AppName = "steampipe"
)
View Source
const DefaultConnectionConfigContent = `` /* 918-byte string literal not displayed */

DefaultConnectionConfigContent is the content of the default connection config file, default.spc, that is created if it does not exist

View Source
const EEXISTS = "EEXISTS"

EEXISTS is the universal error string to denote that a resource already exists

View Source
const ENOTEXISTS = "ENOTEXISTS"

ENOTEXISTS is the universal error string to denote that a resource does not exists

View Source
const (
	// MaxParallelClientInits is the number of clients to initialize in parallel
	// if we start initializing all clients together, it leads to bad performance on all
	MaxParallelClientInits = 3
)

dbClient constants

View Source
const MaxPreparedStatementNameLength = 63
View Source
const PostgresqlConfContent = `` /* 572-byte string literal not displayed */
View Source
const PreparedStatementCardSuffix = "_cd"
View Source
const PreparedStatementChartSuffix = "_ch"
View Source
const PreparedStatementControlSuffix = "_c"
View Source
const PreparedStatementFlowSuffix = "_f"
View Source
const PreparedStatementHierarchySuffix = "_h"
View Source
const PreparedStatementImageSuffix = "_im"
View Source
const PreparedStatementInputSuffix = "_ip"
View Source
const PreparedStatementQuerySuffix = "_q"
View Source
const PreparedStatementTableSuffix = "_t"
View Source
const SteampipeConfContent = `` /* 1582-byte string literal not displayed */

Variables

View Source
var (
	// OptLeftArrowASCIICode ::
	OptLeftArrowASCIICode = []byte{0x1b, 0x62}
	// OptRightArrowASCIICode ::
	OptRightArrowASCIICode = []byte{0x1b, 0x66}
	// AltLeftArrowASCIICode ::
	AltLeftArrowASCIICode = []byte{0x1b, 0x1b, 0x5B, 0x44}
	// AltRightArrowASCIICode ::
	AltRightArrowASCIICode = []byte{0x1b, 0x1b, 0x5B, 0x43}
)
View Source
var (
	ServiceStartTimeout = 5 * time.Second
	ServicePingInterval = 50 * time.Millisecond
)
View Source
var ArgMultiLine = ArgFromMetaquery(CmdMulti)
View Source
var Black = aurora.Black
View Source
var Blink = aurora.Blink
View Source
var Blue = aurora.Blue
View Source
var Bold = aurora.Bold
View Source
var BrightBlack = aurora.BrightBlack
View Source
var BrightBlue = aurora.BrightBlue
View Source
var BrightCyan = aurora.BrightCyan
View Source
var BrightGreen = aurora.BrightGreen
View Source
var BrightMagenta = aurora.BrightMagenta
View Source
var BrightRed = aurora.BrightRed
View Source
var BrightWhite = aurora.BrightWhite
View Source
var BrightYellow = aurora.BrightYellow
View Source
var Colors = map[string]func(arg interface{}) aurora.Value{
	"bold":       Bold,
	"italic":     Italic,
	"underline":  Underline,
	"slow-blink": SlowBlink,

	"black":   Black,
	"red":     Red,
	"green":   Green,
	"yellow":  Yellow,
	"blue":    Blue,
	"magenta": Magenta,
	"cyan":    Cyan,
	"white":   White,

	"bold-black":   BoldBlack,
	"bold-red":     BoldRed,
	"bold-green":   BoldGreen,
	"bold-yellow":  BoldYellow,
	"bold-blue":    BoldBlue,
	"bold-magenta": BoldMagenta,
	"bold-cyan":    BoldCyan,
	"bold-white":   BoldWhite,

	"bright-black":   BrightBlack,
	"bright-red":     BrightRed,
	"bright-green":   BrightGreen,
	"bright-yellow":  BrightYellow,
	"bright-blue":    BrightBlue,
	"bright-magenta": BrightMagenta,
	"bright-cyan":    BrightCyan,
	"bright-white":   BrightWhite,

	"bold-bright-black":   BoldBrightBlack,
	"bold-bright-red":     BoldBrightRed,
	"bold-bright-green":   BoldBrightGreen,
	"bold-bright-yellow":  BoldBrightYellow,
	"bold-bright-blue":    BoldBrightBlue,
	"bold-bright-magenta": BoldBrightMagenta,
	"bold-bright-cyan":    BoldBrightCyan,
	"bold-bright-white":   BoldBrightWhite,

	"gray1": Gray1,
	"gray2": Gray2,
	"gray3": Gray3,
	"gray4": Gray4,
	"gray5": Gray5,
}

Colors is a map of string to aurora colour value

View Source
var ConnectionConfigExtensions = append(YamlExtensions, ConfigExtension, JsonExtension)
View Source
var Cyan = aurora.Cyan
View Source
var DatabaseListenAddresses = []string{"localhost", "127.0.0.1"}

DatabaseListenAddresses is an arrays is listen addresses which Steampipe accepts

View Source
var Functions = []schema.SQLFunc{
	{
		Name:     "glob",
		Params:   map[string]string{"input_glob": "text"},
		Returns:  "text",
		Language: "plpgsql",
		Body: `
declare
	output_pattern text;
begin
	output_pattern = replace(input_glob, '*', '%');
	output_pattern = replace(output_pattern, '?', '_');
	return output_pattern;
end;
`,
	},
}

Functions :: a list of SQLFunc objects that are installed in the db 'internal' schema startup

View Source
var Green = aurora.Green
View Source
var Italic = aurora.Italic
View Source
var Magenta = aurora.Magenta
View Source
var MinimalPgHbaContent string = `
hostssl all root samehost trust
host all root samehost trust
`
View Source
var PgHbaTemplate string = `` /* 1099-byte string literal not displayed */

PgHbaTemplate is to be formatted with two variables:

  • databaseName
  • username

Example:

fmt.Sprintf(template, datName, username)
View Source
var Red = aurora.Red
View Source
var ReservedConnectionNames = []string{
	"public",
	FunctionSchema,
}
View Source
var SlowBlink = aurora.SlowBlink
View Source
var TelemetryLevels = []string{TelemetryNone, TelemetryInfo}
View Source
var Underline = aurora.Underline
View Source
var White = aurora.White
View Source
var YamlExtensions = []string{".yml", ".yaml"}
View Source
var Yellow = aurora.Yellow

Functions

func ArgFromMetaquery added in v0.1.1

func ArgFromMetaquery(cmd string) string

ArgFromMetaquery converts a metaquery of form '.header' into the config argument used to set the mode, i.e. 'header'

func BoldBlack added in v0.5.0

func BoldBlack(arg interface{}) aurora.Value

func BoldBlue added in v0.5.0

func BoldBlue(arg interface{}) aurora.Value

func BoldBrightBlack added in v0.5.0

func BoldBrightBlack(arg interface{}) aurora.Value

func BoldBrightBlue added in v0.5.0

func BoldBrightBlue(arg interface{}) aurora.Value

func BoldBrightCyan added in v0.5.0

func BoldBrightCyan(arg interface{}) aurora.Value

func BoldBrightGreen added in v0.5.0

func BoldBrightGreen(arg interface{}) aurora.Value

func BoldBrightMagenta added in v0.5.0

func BoldBrightMagenta(arg interface{}) aurora.Value

func BoldBrightRed added in v0.5.0

func BoldBrightRed(arg interface{}) aurora.Value

func BoldBrightWhite added in v0.5.0

func BoldBrightWhite(arg interface{}) aurora.Value

func BoldBrightYellow added in v0.5.0

func BoldBrightYellow(arg interface{}) aurora.Value

func BoldCyan added in v0.5.0

func BoldCyan(arg interface{}) aurora.Value

func BoldGreen added in v0.5.0

func BoldGreen(arg interface{}) aurora.Value

func BoldMagenta added in v0.5.0

func BoldMagenta(arg interface{}) aurora.Value

func BoldRed added in v0.5.0

func BoldRed(arg interface{}) aurora.Value

func BoldWhite added in v0.5.0

func BoldWhite(arg interface{}) aurora.Value

func BoldYellow added in v0.5.0

func BoldYellow(arg interface{}) aurora.Value

func BoolToEnableDisable added in v0.1.1

func BoolToEnableDisable(val bool) string

BoolToEnableDisable converts a boolean value onto the string "enable" or "disable"

func BoolToOnOff added in v0.1.1

func BoolToOnOff(val bool) string

BoolToOnOff converts a boolean value onto the string "on" or "off"

func Gray1 added in v0.5.0

func Gray1(arg interface{}) aurora.Value

func Gray2 added in v0.5.0

func Gray2(arg interface{}) aurora.Value

func Gray3 added in v0.5.0

func Gray3(arg interface{}) aurora.Value

func Gray4 added in v0.5.0

func Gray4(arg interface{}) aurora.Value

func Gray5 added in v0.5.0

func Gray5(arg interface{}) aurora.Value

func IsYamlExtension added in v0.9.0

func IsYamlExtension(ext string) bool

Types

type Invoker added in v0.8.0

type Invoker string

Invoker is a pseudoEnum for the command/operation which starts the service

func (Invoker) IsValid added in v0.8.0

func (i Invoker) IsValid() error

IsValid is a validator for Invoker known values

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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