Documentation ¶
Overview ¶
Package constants contains constant values that are used throughout Steampipe
Index ¶
Constants ¶
const ( ClientConnectionAppNamePrefix = "steampipe_client" ServiceConnectionAppNamePrefix = "steampipe_service" ClientSystemConnectionAppNamePrefix = "steampipe_client_system" )
const ( CmdNameQuery = "query" CmdNameCheck = "check" CmdNameDashboard = "dashboard" )
const ( ConfigKeyInteractive = "interactive" ConfigKeyActiveCommand = "cmd" ConfigKeyActiveCommandArgs = "cmd_args" ConfigInteractiveVariables = "interactive_var" ConfigKeyIsTerminalTTY = "is_terminal" ConfigKeyServerSearchPath = "server-search-path" ConfigKeyServerSearchPathPrefix = "server-search-path-prefix" ConfigKeyBypassHomeDirModfileWarning = "bypass-home-dir-modfile-warning" )
viper config keys
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 )
const ( ControlOk = "ok" ControlAlarm = "alarm" ControlSkip = "skip" ControlInfo = "info" ControlError = "error" )
const ( DashboardServerDefaultPort = 9194 DashboardAssetsImageRefFormat = "us-docker.pkg.dev/steampipe/steampipe/assets:%s" )
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 // MaxBackups is the maximum number of backups that will be retained MaxBackups = 100 )
Client constants
const ( DatabaseDefaultListenAddresses = "localhost" DatabaseDefaultPort = 9193 DatabaseDefaultCheckQueryTimeout = 240 DatabaseSuperUser = "root" DatabaseUser = "steampipe" DatabaseName = "steampipe" DatabaseUsersRole = "steampipe_users" DefaultMaxConnections = 10 )
const ( DatabaseVersion = "14.2.0" FdwVersion = "1.12.0-rc.1" // PostgresImageRef is the OCI Image ref for the database binaries PostgresImageRef = "ghcr.io/turbot/steampipe/db:14.2.0" PostgresImageDigest = "sha256:1972eee02bbd3bf52f8cce30a5109ab017f310a85d45a31ddd1623f1dfe455fa" FdwImageRef = "ghcr.io/turbot/steampipe/fdw:" + FdwVersion FdwBinaryFileName = "steampipe_postgres_fdw.so" )
constants for installing db and fdw images
const ( // legacy schema names // these are schema names which were used previously // but are not relevant anymore and need to be dropped LegacyInternalSchema = "internal" // InternalSchema is the schema container for all steampipe helper functions, and connection state table // also used to send commands to the FDW InternalSchema = "steampipe_internal" // ServerSettingsTable is the table used to store steampipe service configuration ServerSettingsTable = "steampipe_server_settings" // RateLimiterDefinitionTable is the table used to store rate limiters defined in the config RateLimiterDefinitionTable = "steampipe_plugin_limiter" // PluginInstanceTable is the table used to store plugin configs PluginInstanceTable = "steampipe_plugin" PluginColumnTable = "steampipe_plugin_column" // LegacyConnectionStateTable is the table used to store steampipe connection state LegacyConnectionStateTable = "steampipe_connection_state" ConnectionTable = "steampipe_connection" ConnectionStatePending = "pending" ConnectionStatePendingIncomplete = "incomplete" ConnectionStateReady = "ready" ConnectionStateUpdating = "updating" ConnectionStateDeleting = "deleting" ConnectionStateDisabled = "disabled" ConnectionStateError = "error" // foreign tables in internal schema ForeignTableScanMetadataSummary = "steampipe_scan_metadata_summary" ForeignTableScanMetadata = "steampipe_scan_metadata" ForeignTableSettings = "steampipe_settings" ForeignTableSettingsKeyColumn = "name" ForeignTableSettingsValueColumn = "value" ForeignTableSettingsCacheKey = "cache" ForeignTableSettingsCacheTtlKey = "cache_ttl" ForeignTableSettingsCacheClearTimeKey = "cache_clear_time" FunctionCacheSet = "meta_cache" FunctionConnectionCacheClear = "meta_connection_cache_clear" FunctionCacheSetTtl = "meta_cache_ttl" // legacy LegacyCommandSchema = "steampipe_command" LegacyCommandTableCache = "cache" LegacyCommandTableCacheOperationColumn = "operation" LegacyCommandCacheOn = "cache_on" LegacyCommandCacheOff = "cache_off" LegacyCommandCacheClear = "cache_clear" LegacyCommandTableScanMetadata = "scan_metadata" )
schema names
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" IntrospectionTableDashboardGraph = "steampipe_dashboard_graph" 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
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" )
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
const ( EnvUpdateCheck = "STEAMPIPE_UPDATE_CHECK" EnvInstallDir = "STEAMPIPE_INSTALL_DIR" EnvInstallDatabase = "STEAMPIPE_INITDB_DATABASE_NAME" EnvServicePassword = "STEAMPIPE_DATABASE_PASSWORD" EnvMaxParallel = "STEAMPIPE_MAX_PARALLEL" EnvDatabaseStartTimeout = "STEAMPIPE_DATABASE_START_TIMEOUT" EnvDatabaseSSLPassword = "STEAMPIPE_DATABASE_SSL_PASSWORD" EnvDashboardStartTimeout = "STEAMPIPE_DASHBOARD_START_TIMEOUT" EnvSnapshotLocation = "STEAMPIPE_SNAPSHOT_LOCATION" EnvWorkspaceDatabase = "STEAMPIPE_WORKSPACE_DATABASE" EnvWorkspaceProfile = "STEAMPIPE_WORKSPACE" EnvPipesHost = "PIPES_HOST" EnvPipesToken = "PIPES_TOKEN" EnvDisplayWidth = "STEAMPIPE_DISPLAY_WIDTH" EnvCacheEnabled = "STEAMPIPE_CACHE" EnvCacheTTL = "STEAMPIPE_CACHE_TTL" EnvCacheMaxTTL = "STEAMPIPE_CACHE_MAX_TTL" EnvCacheMaxSize = "STEAMPIPE_CACHE_MAX_SIZE_MB" EnvQueryTimeout = "STEAMPIPE_QUERY_TIMEOUT" EnvConnectionWatcher = "STEAMPIPE_CONNECTION_WATCHER" EnvWorkspaceChDir = "STEAMPIPE_WORKSPACE_CHDIR" EnvModLocation = "STEAMPIPE_MOD_LOCATION" EnvTelemetry = "STEAMPIPE_TELEMETRY" EnvWorkspaceProfileLocation = "STEAMPIPE_WORKSPACE_PROFILES_LOCATION" // EnvInputVarPrefix is the prefix for environment variables that represent values for input variables. EnvInputVarPrefix = "SP_VAR_" // EnvConfigDump is an undocumented variable is subject to change in the future EnvConfigDump = "STEAMPIPE_CONFIG_DUMP" EnvMemoryMaxMb = "STEAMPIPE_MEMORY_MAX_MB" EnvMemoryMaxMbPlugin = "STEAMPIPE_PLUGIN_MEMORY_MAX_MB" EnvPluginStartTimeout = "STEAMPIPE_PLUGIN_START_TIMEOUT" )
Environment Variables
const ( ExitCodeSuccessful = 0 ExitCodeControlsAlarm = 1 // check - no runtime errors, 1 or more control alarms, no control errors ExitCodeControlsError = 2 // check - no runtime errors, 1 or more control errors ExitCodePluginLoadingError = 11 // plugin - loading error ExitCodePluginListFailure = 12 // plugin - listing failed ExitCodePluginNotFound = 13 // plugin - not found ExitCodePluginInstallFailure = 14 // plugin - install failed ExitCodeSnapshotCreationFailed = 21 // snapshot - creation failed ExitCodeSnapshotUploadFailed = 22 // snapshot - upload failed ExitCodeServiceSetupFailure = 31 // service - setup failed ExitCodeServiceStartupFailure = 32 // service - start failed ExitCodeServiceStopFailure = 33 // service - stop failed ExitCodeQueryExecutionFailed = 41 // query - 1 or more queries failed - change in behavior(previously the exitCode used to be the number of queries that failed) ExitCodeLoginCloudConnectionFailed = 51 // login - connecting to cloud failed ExitCodeModInitFailed = 61 // mod - init failed ExitCodeModInstallFailed = 62 // mod - install failed ExitCodeInvalidExecutionEnvironment = 249 // common - when steampipe is run in an unsupported environment ExitCodeInitializationFailed = 250 // common - initialization failed ExitCodeNoModFile = 252 // common - no mod file ExitCodeFileSystemAccessFailure = 253 // common - file system access failed ExitCodeInsufficientOrWrongInputs = 254 // common - runtime error(insufficient or wrong input) ExitCodeUnknownErrorPanic = 255 // common - runtime error(unknown panic) )
const ( ConfigExtension = ".spc" SnapshotExtension = ".sps" TokenExtension = ".tptt" LegacyTokenExtension = ".sptt" )
const ( HistoryFile = "history.json" // File to store historical data HistorySize = 500 // Number of historical records to store )
Constants for History
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 CmdCacheTtl = ".cache_ttl" // set cache ttl CmdAutoComplete = ".autocomplete" // enable or disable auto complete )
const ( OutputFormatCSV = "csv" OutputFormatJSON = "json" OutputFormatTable = "table" OutputFormatLine = "line" OutputFormatNone = "none" OutputFormatText = "text" OutputFormatBrief = "brief" OutputFormatSnapshot = "snapshot" OutputFormatSnapshotShort = "sps" )
const ( ServerCertKey = "server.key" RootCertKey = "root.key" ServerCert = "server.crt" RootCert = "root.crt" SslConfDir = "/etc/ssl" )
constants for ssl key and certificate
const ( TelemetryNone = "none" TelemetryInfo = "info" )
constants for telemetry config flag
const ( DefaultPipesHost = "pipes.turbot.com" LegacyDefaultPipesHost = "cloud.steampipe.io" DefaultWorkspaceDatabase = "local" )
const ( // The BaseImageRef is the common prefix for all turbot managed steampipe images // Embedded PG: ghcr.io/turbot/steampipe/db // FDW: ghcr.io/turbot/steampipe/fdw // Plugins: ghcr.io/turbot/steampipe/plugins/turbot/plugin BaseImageRef = "ghcr.io/turbot/steampipe" )
const DefaultConnectionConfigContent = `` /* 1512-byte string literal not displayed */
DefaultConnectionConfigContent is the content of the sample connection config file(default.spc.sample), that is created if it does not exist
const DefaultMaxCacheSizeMb = 16384
const DefaultWorkspaceContent = `` /* 1147-byte string literal not displayed */
DefaultWorkspaceContent is the content of the sample workspaces config file(workspaces.spc.sample), that is created if it does not exist
const OutputFormatSpSnapshotShort = "sps"
steampipe snapshot
const (
PostgresNotificationChannel = "steampipe_notification"
)
const PostgresqlConfContent = `` /* 810-byte string literal not displayed */
const ReservedConnectionNamePrefix = "steampipe_"
const (
RuntimeParamsKeyApplicationName = "application_name"
)
const SteampipeConfContent = `` /* 1556-byte string literal not displayed */
const SteampipeHubOCIBase = "hub.steampipe.io/"
Variables ¶
var ( DashboardStartTimeout = 30 * time.Second DBStartTimeout = 30 * time.Second DBConnectionRetryBackoff = 200 * time.Millisecond DBRecoveryTimeout = 24 * time.Hour DBRecoveryRetryBackoff = 200 * time.Millisecond ServicePingInterval = 50 * time.Millisecond PluginStartTimeout = 30 * time.Second )
var ArgAutoComplete = ArgFromMetaquery(CmdAutoComplete)
var ArgHeader = ArgFromMetaquery(CmdHeaders)
var ArgMultiLine = ArgFromMetaquery(CmdMulti)
var ArgOutput = ArgFromMetaquery(CmdOutput)
var ArgSeparator = ArgFromMetaquery(CmdSeparator)
var AutoVariablesExtensions = []string{".auto.spvars"}
var CheckOutputModeIds = map[CheckOutputMode][]string{ CheckOutputModeText: {constants.OutputFormatText}, CheckOutputModeBrief: {constants.OutputFormatBrief}, CheckOutputModeCsv: {constants.OutputFormatCSV}, CheckOutputModeHTML: {constants.OutputFormatHTML}, CheckOutputModeJSON: {constants.OutputFormatJSON}, CheckOutputModeMd: {constants.OutputFormatMD}, CheckOutputModeSnapshot: {constants.OutputFormatSnapshot}, CheckOutputModeSnapshotShort: {OutputFormatSpSnapshotShort}, CheckOutputModeNone: {constants.OutputFormatNone}, }
var CheckTimingModeIds = map[CheckTimingMode][]string{ CheckTimingModeOff: {constants.ArgOff}, CheckTimingModeOn: {constants.ArgOn}, }
var CheckTimingValueLookup = map[string]struct{}{ constants.ArgOff: {}, constants.ArgOn: {}, }
var ConnectionStates = []string{ LegacyConnectionStateTable, ConnectionStatePending, ConnectionStateReady, ConnectionStateUpdating, ConnectionStateDeleting, ConnectionStateError, }
ConnectionStates is a handy array of all states
var (
DashboardAssetsImageRef = fmt.Sprintf(DashboardAssetsImageRefFormat, version.VersionString)
)
var DashboardListenAddresses = []string{"localhost", "127.0.0.1"}
DashboardListenAddresses is an arrays is listen addresses which Steampipe accepts
var MinimalPgHbaContent string = `
hostssl all root samehost trust
host all root samehost trust
`
var ModDataExtensions = []string{".sp"}
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)
var QueryOutputModeIds = map[QueryOutputMode][]string{ QueryOutputModeCsv: {constants.OutputFormatCSV}, QueryOutputModeJson: {constants.OutputFormatJSON}, QueryOutputModeLine: {constants.OutputFormatLine}, QueryOutputModeSnapshot: {constants.OutputFormatSnapshot}, QueryOutputModeSnapshotShort: {OutputFormatSpSnapshotShort}, QueryOutputModeTable: {constants.OutputFormatTable}, }
var QueryTimingModeIds = map[QueryTimingMode][]string{ QueryTimingModeOff: {constants.ArgOff}, QueryTimingModeOn: {constants.ArgOn}, QueryTimingModeVerbose: {constants.ArgVerbose}, QueryTimingModeTrue: {"true"}, QueryTimingModeFalse: {"false"}, }
var QueryTimingValueLookup = map[string]struct{}{ constants.ArgOff: {}, constants.ArgOn: {}, constants.ArgVerbose: {}, "true": {}, "false": {}, }
var ReservedConnectionNames = []string{
"public",
}
var TelemetryLevels = []string{TelemetryNone, TelemetryInfo}
var VariablesExtensions = []string{".spvars"}
Functions ¶
func ArgFromMetaquery ¶
ArgFromMetaquery converts a metaquery of form '.header' into the config argument used to set the mode, i.e. 'header'
func FlagValues ¶ added in v0.23.0
func FlagValues[T comparable](mappings map[T][]string) []string
Types ¶
type CheckOutputMode ¶ added in v0.23.0
type CheckOutputMode enumflag.Flag
const ( CheckOutputModeText CheckOutputMode = iota CheckOutputModeBrief CheckOutputMode = iota CheckOutputModeCsv CheckOutputModeHTML CheckOutputModeJSON CheckOutputModeMd CheckOutputModeSnapshot CheckOutputModeSnapshotShort CheckOutputModeNone )
type CheckTimingMode ¶ added in v0.23.0
type CheckTimingMode enumflag.Flag
const ( CheckTimingModeOff CheckTimingMode = iota CheckTimingModeOn )
type Invoker ¶
type Invoker string
Invoker is a pseudoEnum for the command/operation which starts the service
type QueryOutputMode ¶ added in v0.23.0
type QueryOutputMode enumflag.Flag
const ( QueryOutputModeCsv QueryOutputMode = iota QueryOutputModeJson QueryOutputModeLine QueryOutputModeSnapshot QueryOutputModeSnapshotShort QueryOutputModeTable )
type QueryTimingMode ¶ added in v0.23.0
type QueryTimingMode enumflag.Flag
const ( QueryTimingModeOff QueryTimingMode = iota QueryTimingModeOn QueryTimingModeVerbose // support legacy values QueryTimingModeTrue QueryTimingModeFalse )
Source Files ¶
- app.go
- args.go
- cache.go
- cmd_name.go
- config_keys.go
- control_execute.go
- control_status.go
- dashboard.go
- db.go
- default_options.go
- default_workspaces.go
- display.go
- doc.go
- duration.go
- env.go
- exit_codes.go
- extensions.go
- flags.go
- history.go
- image.go
- metaquery_commands.go
- notifications.go
- oci.go
- output_format.go
- pg_hba.go
- postgresql_conf.go
- ssl.go
- telemetry.go
- workspace_profile.go