steampipeconfig

package
v0.9.0-dev.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: AGPL-3.0 Imports: 30 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 GetModFileExtensions added in v0.4.0

func GetModFileExtensions() []string

GetModFileExtensions :: return list of all file extensions we care about this will be the mod data extension, plus any registered extensions registered in fileToResourceMap

func GetPluginPath

func GetPluginPath(remoteSchema string) (string, error)

func HandleGrpcError

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

func LoadMod added in v0.4.0

func LoadMod(modPath string, opts *parse.ParseModOptions) (mod *modconfig.Mod, err error)

LoadMod parses all hcl files in modPath and returns a single mod if CreatePseudoResources flag is set, construct hcl resources for files with specific extensions NOTE: it is an error if there is more than 1 mod defined, however zero mods is acceptable - a default mod will be created assuming there are any resource files

func LoadModDependencies added in v0.4.0

func LoadModDependencies(m *modconfig.Mod, modsFolder string, modMap modconfig.ModMap, deep bool) error

if deep is false only load single level of dependencies - if true load full tree (tbd if this is needed)

func LoadModResourceNames added in v0.8.0

func LoadModResourceNames(modPath string, opts *parse.ParseModOptions) (resources *modconfig.WorkspaceResources, err error)

LoadModResourceNames parses all hcl files in modPath and returns the names of all resources

func LoadVariables added in v0.8.0

func LoadVariables(workspacePath string, opts *parse.ParseModOptions) (variables map[string]*modconfig.Variable, err error)

func PluginFQNToSchemaName

func PluginFQNToSchemaName(pluginFQN string) string

schemas in postgres are limited to 63 chars - the name 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 ConnectionDataMap) error

Types

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
}

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

func (ConnectionData) Equals added in v0.4.0

func (p ConnectionData) Equals(other *ConnectionData) bool

type ConnectionDataMap added in v0.9.0

type ConnectionDataMap map[string]*ConnectionData

func GetConnectionState

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

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

func (ConnectionDataMap) Equals added in v0.9.0

func (m ConnectionDataMap) Equals(other ConnectionDataMap) bool

type ConnectionMap

type ConnectionMap map[string]*modconfig.Connection

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         ConnectionDataMap
	Delete         ConnectionDataMap
	MissingPlugins []string
	// the connections which will exist after the update
	RequiredConnections ConnectionDataMap
}

func GetConnectionsToUpdate

func GetConnectionsToUpdate(schemas []string, connectionConfig ConnectionMap) (*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 ConnectionMap

	// Steampipe options
	DefaultConnectionOptions *options.Connection
	DatabaseOptions          *options.Database
	TerminalOptions          *options.Terminal
	GeneralOptions           *options.General
	// contains filtered or unexported fields
}

SteampipeConfig is a struct to hold Connection map and Steampipe options

var Config *SteampipeConfig

func LoadConnectionConfig added in v0.9.0

func LoadConnectionConfig() (*SteampipeConfig, error)

LoadConnectionConfig loads the conneciton config but not the workspace options options

func LoadSteampipeConfig added in v0.4.0

func LoadSteampipeConfig(workspacePath string, commandName string) (*SteampipeConfig, error)

LoadSteampipeConfig loads the HCL connection config and workspace options

func NewSteampipeConfig added in v0.9.0

func NewSteampipeConfig(commandName string) *SteampipeConfig

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)

func (*SteampipeConfig) String added in v0.4.0

func (c *SteampipeConfig) String() string

func (*SteampipeConfig) Validate added in v0.7.0

func (c *SteampipeConfig) Validate() error

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