steampipeconfig

package
v0.3.7-dev.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const CacheEnabledEnvVar = "STEAMPIPE_CACHE"
View Source
const CacheTTLEnvVar = "STEAMPIPE_CACHE_TTL"

Variables

This section is empty.

Functions

func BuildValidationWarningString

func BuildValidationWarningString(failures []*ValidationFailure) string

func GetPluginPath

func GetPluginPath(remoteSchema string) (string, error)

func HandleGrpcError

func HandleGrpcError(err error, connection, call string) error

func PluginFQNToSchemaName

func PluginFQNToSchemaName(pluginFQN string) string

schemas in postgres are limited to 63 chars - the FQN may be longer than this, in which case trim the length and add a hash to the end to make unique

func SaveConnectionState

func SaveConnectionState(state ConnectionMap) error

func ValidatePlugins

func ValidatePlugins(updates ConnectionMap, plugins []*ConnectionPlugin) ([]*ValidationFailure, ConnectionMap, []*ConnectionPlugin)

Types

type Connection

type Connection struct {
	// connection name
	Name string
	// FQN of plugin
	Plugin string
	// unparsed HCL of plugin specific connection config
	Config string

	// options
	Options *options.Connection
}

Connection :: structure representing the partially parsed connection.

type ConnectionData

type ConnectionData struct {
	// the fully qualified name of the plugin
	Plugin string `yaml:"plugin"`
	// the checksum of the plugin file
	CheckSum string `yaml:"checkSum"`
	// connection name
	ConnectionName string
	// connection data (unparsed)
	ConnectionConfig string
	// steampipe connection options
	ConnectionOptions *options.Connection
}

struct containing all details for a connection - the plugin name and checksum, the connection config and options

type ConnectionMap

type ConnectionMap map[string]*ConnectionData

func GetConnectionState

func GetConnectionState(schemas []string) (ConnectionMap, error)

GetConnectionState :: load connection state file, and remove any connections which do not exist in the db

type ConnectionPlugin

type ConnectionPlugin struct {
	ConnectionName    string
	ConnectionConfig  string
	ConnectionOptions *options.Connection
	PluginName        string
	Plugin            *grpc.PluginClient
	Schema            *proto.Schema
}

ConnectionPlugin :: structure representing an instance of a plugin NOTE: currently this corresponds to a single connection, i.e. we have 1 plugin instance per connection

func CreateConnectionPlugin

func CreateConnectionPlugin(input *ConnectionPluginInput) (*ConnectionPlugin, error)

CreateConnectionPlugin :: instantiate a plugin for a connection, fetch schema and send connection config

type ConnectionPluginInput

type ConnectionPluginInput struct {
	ConnectionName    string
	PluginName        string
	ConnectionConfig  string
	ConnectionOptions *options.Connection
	DisableLogger     bool
}

ConnectionPluginInput :: struct used as input to CreateConnectionPlugin - it contains all details necessary to instantiate a ConnectionPlugin

type ConnectionUpdates

type ConnectionUpdates struct {
	Update         ConnectionMap
	Delete         ConnectionMap
	MissingPlugins []string
	// the connections which will exist after the update
	RequiredConnections ConnectionMap
}

func GetConnectionsToUpdate

func GetConnectionsToUpdate(schemas []string, connectionConfig map[string]*Connection) (*ConnectionUpdates, error)

GetConnectionsToUpdate :: returns updates to be made to the database to sync with connection config

type SteampipeConfig

type SteampipeConfig struct {
	// map of connection name to partially parsed connection config
	Connections map[string]*Connection

	// Steampipe options
	DefaultConnectionOptions *options.Connection
	DatabaseOptions          *options.Database
	ConsoleOptions           *options.Terminal
	GeneralOptions           *options.General
	// array of options interfaces useful to build  ConfigMap
	Options []options.Options
}

SteampipeConfig :: Connection map and Steampipe settings

var Config *SteampipeConfig

func Load

func Load() (*SteampipeConfig, error)

Load :: load the HCL config and parse into the global Config variable

func (*SteampipeConfig) ConfigMap

func (c *SteampipeConfig) ConfigMap() map[string]interface{}

ConfigMap :: create a config map to pass to viper

func (*SteampipeConfig) GetConnectionOptions

func (c *SteampipeConfig) GetConnectionOptions(connectionName string) *options.Connection

func (*SteampipeConfig) SetOptions

func (c *SteampipeConfig) SetOptions(opts options.Options)

type ValidationFailure

type ValidationFailure struct {
	Plugin             string
	ConnectionName     string
	Message            string
	ShouldDropIfExists bool
}

func (ValidationFailure) String

func (v ValidationFailure) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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