Documentation
¶
Index ¶
- Constants
- func BuildValidationWarningString(failures []*ValidationFailure) string
- func GetModFileExtensions() []string
- func GetPluginPath(remoteSchema string) (string, error)
- func HandleGrpcError(err error, connection, call string) error
- func LoadMod(modPath string, opts *LoadModOptions) (mod *modconfig.Mod, err error)
- func LoadModDependencies(m *modconfig.Mod, modsFolder string, modMap modconfig.ModMap, deep bool) error
- func PluginFQNToSchemaName(pluginFQN string) string
- func SaveConnectionState(state ConnectionMap) error
- func ValidatePlugins(updates ConnectionMap, plugins []*ConnectionPlugin) ([]*ValidationFailure, ConnectionMap, []*ConnectionPlugin)
- type Connection
- type ConnectionData
- type ConnectionMap
- type ConnectionPlugin
- type ConnectionPluginInput
- type ConnectionUpdates
- type LoadModFlag
- type LoadModOptions
- type SteampipeConfig
- type ValidationFailure
Constants ¶
const CacheEnabledEnvVar = "STEAMPIPE_CACHE"
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 HandleGrpcError ¶
func LoadMod ¶ added in v0.4.0
func LoadMod(modPath string, opts *LoadModOptions) (mod *modconfig.Mod, err error)
LoadMod :: parse all hcl files in modPath and return 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 PluginFQNToSchemaName ¶
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 ConnectionMap) error
func ValidatePlugins ¶
func ValidatePlugins(updates ConnectionMap, plugins []*ConnectionPlugin) ([]*ValidationFailure, ConnectionMap, []*ConnectionPlugin)
Types ¶
type Connection ¶
type Connection struct {
// connection name
Name string
// Name of plugin
Plugin string
// unparsed HCL of plugin specific connection config
Config string
// options
Options *options.Connection
}
Connection :: structure representing the partially parsed connection.
func (*Connection) String ¶ added in v0.4.0
func (c *Connection) String() string
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
func (ConnectionData) Equals ¶ added in v0.4.0
func (p ConnectionData) Equals(other *ConnectionData) bool
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
func (ConnectionMap) Equals ¶ added in v0.4.0
func (m ConnectionMap) Equals(other ConnectionMap) bool
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 LoadModFlag ¶ added in v0.4.0
type LoadModFlag uint32
Op describes a set of file operations.
const ( CreateDefaultMod LoadModFlag = 1 << iota CreatePseudoResources )
type LoadModOptions ¶ added in v0.4.0
type LoadModOptions struct {
Flags LoadModFlag
Exclude []string
}
func (*LoadModOptions) CreateDefaultMod ¶ added in v0.4.0
func (o *LoadModOptions) CreateDefaultMod() bool
func (*LoadModOptions) CreatePseudoResources ¶ added in v0.4.0
func (o *LoadModOptions) CreatePseudoResources() bool
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
TerminalOptions *options.Terminal
GeneralOptions *options.General
}
SteampipeConfig :: Connection map and Steampipe settings
var Config *SteampipeConfig
func LoadSteampipeConfig ¶ added in v0.4.0
func LoadSteampipeConfig(workspacePath string) (*SteampipeConfig, error)
LoadSteampipeConfig :: 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)
func (*SteampipeConfig) String ¶ added in v0.4.0
func (c *SteampipeConfig) String() string
type ValidationFailure ¶
type ValidationFailure struct {
Plugin string
ConnectionName string
Message string
ShouldDropIfExists bool
}
func (ValidationFailure) String ¶
func (v ValidationFailure) String() string