Documentation ¶
Index ¶
- Variables
- func BuildValidationWarningString(failures []*ValidationFailure) string
- func GetModFileExtensions() []string
- func GetVariableValues(ctx context.Context, parseCtx *parse.ModParseContext, ...) (*modconfig.ModVariableMap, error)
- func IsCloudWorkspaceIdentifier(name string) bool
- func LoadMod(modPath string, parseCtx *parse.ModParseContext) (mod *modconfig.Mod, err error)
- func LoadModResourceNames(modPath string, parseCtx *parse.ModParseContext) (resources *modconfig.WorkspaceResources, err error)
- func LoadVariableDefinitions(variablePath string, parseCtx *parse.ModParseContext) (*modconfig.ModVariableMap, error)
- func NewConnectionUpdates(schemaNames []string, forceUpdateConnectionNames ...string) (*ConnectionUpdates, *RefreshConnectionResult)
- func ValidatePlugins(updates ConnectionDataMap, plugins map[string]*ConnectionPlugin) ([]*ValidationFailure, ConnectionDataMap, map[string]*ConnectionPlugin)
- type ActorMetadata
- type CloudMetadata
- type ConnectionData
- type ConnectionDataMap
- type ConnectionPlugin
- type ConnectionPluginData
- type ConnectionSchemaMap
- type ConnectionUpdates
- type IdentityMetadata
- type PreparedStatementFailure
- type RefreshConnectionResult
- type SteampipeConfig
- func (c *SteampipeConfig) ConfigMap() map[string]interface{}
- func (c *SteampipeConfig) ConnectionList() []*modconfig.Connection
- func (c *SteampipeConfig) ConnectionNames() []string
- func (c *SteampipeConfig) ConnectionsForPlugin(pluginLongName string, pluginVersion *version.Version) []*modconfig.Connection
- func (c *SteampipeConfig) GetConnectionOptions(connectionName string) *options.Connection
- func (c *SteampipeConfig) SetOptions(opts options.Options)
- func (c *SteampipeConfig) String() string
- func (c *SteampipeConfig) Validate() error
- type ValidationFailure
- type WorkspaceMetadata
- type WorkspaceProfileLoader
Constants ¶
This section is empty.
Variables ¶
var ConnectionDataStructVersion int64 = 20211125
ConnectionDataStructVersion is used to force refreshing connections If we need to force a connection refresh (for example if any of the underlying schema generation code changes), updating this version will force all connections to refresh, as the deserialized data will have an old version
var GlobalWorkspaceProfile *modconfig.WorkspaceProfile
Functions ¶
func BuildValidationWarningString ¶
func BuildValidationWarningString(failures []*ValidationFailure) string
func GetModFileExtensions ¶
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 GetVariableValues ¶
func GetVariableValues(ctx context.Context, parseCtx *parse.ModParseContext, variableMap *modconfig.ModVariableMap, validate bool) (*modconfig.ModVariableMap, error)
func IsCloudWorkspaceIdentifier ¶ added in v0.17.0
IsCloudWorkspaceIdentifier returns whether name is a cloud workspace identifier of the form: {identity_handle}/{workspace_handle},
func LoadMod ¶
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 LoadModResourceNames ¶
func LoadModResourceNames(modPath string, parseCtx *parse.ModParseContext) (resources *modconfig.WorkspaceResources, err error)
LoadModResourceNames parses all hcl files in modPath and returns the names of all resources
func LoadVariableDefinitions ¶
func LoadVariableDefinitions(variablePath string, parseCtx *parse.ModParseContext) (*modconfig.ModVariableMap, error)
func NewConnectionUpdates ¶
func NewConnectionUpdates(schemaNames []string, forceUpdateConnectionNames ...string) (*ConnectionUpdates, *RefreshConnectionResult)
NewConnectionUpdates returns updates to be made to the database to sync with connection config
func ValidatePlugins ¶
func ValidatePlugins(updates ConnectionDataMap, plugins map[string]*ConnectionPlugin) ([]*ValidationFailure, ConnectionDataMap, map[string]*ConnectionPlugin)
Types ¶
type ActorMetadata ¶
type CloudMetadata ¶
type CloudMetadata struct { Actor *ActorMetadata `json:"actor,omitempty"` Identity *IdentityMetadata `json:"identity,omitempty"` WorkspaceDatabase *WorkspaceMetadata `json:"workspace,omitempty"` ConnectionString string `json:"-"` }
type ConnectionData ¶
type ConnectionData struct { StructVersion int64 `json:"struct_version,omitempty"` // the fully qualified name of the plugin Plugin string `json:"plugin,omitempty"` // the underlying connection object Connection *modconfig.Connection `json:"connection,omitempty"` // schema mode - static or dynamic SchemaMode string `json:"schema_mode,omitempty"` // the hash of the connection schema SchemaHash string `json:"schema_hash,omitempty"` // the creation time of the plugin file (only used for local plugins) ModTime time.Time `json:"mod_time"` // legacy properties included for backwards compatibility with v0.13 LegacyPlugin string `json:"Plugin,omitempty"` LegacyConnection *modconfig.Connection `json:"Connection,omitempty"` LegacySchemaMode string `json:"SchemaMode,omitempty"` LegacySchemaHash string `json:"SchemaHash,omitempty"` LegacyModTime time.Time `json:"ModTime,omitempty"` }
ConnectionData is a struct containing all details for a connection - the plugin name and checksum, the connection config and options json tags needed as this is stored in the connection state file
func NewConnectionData ¶
func NewConnectionData(remoteSchema string, connection *modconfig.Connection, creationTime time.Time) *ConnectionData
func (*ConnectionData) Equals ¶
func (d *ConnectionData) Equals(other *ConnectionData) bool
func (*ConnectionData) IsValid ¶
func (d *ConnectionData) IsValid() bool
IsValid checks whether the struct was correctly deserialized, by checking if the StructVersion is populated
func (*ConnectionData) MaintainLegacy ¶
func (d *ConnectionData) MaintainLegacy()
MaintainLegacy keeps the values of the legacy properties intact while refreshing connections
func (*ConnectionData) MigrateLegacy ¶
func (d *ConnectionData) MigrateLegacy()
MigrateLegacy migrates the legacy properties into new properties
type ConnectionDataMap ¶
type ConnectionDataMap map[string]*ConnectionData
func GetConnectionState ¶
func GetConnectionState(schemaNames []string) (state ConnectionDataMap, stateModified bool, err error)
GetConnectionState loads the connection state file, and remove any connections which do not exist in the db
func NewConnectionDataMap ¶
func NewConnectionDataMap(connectionMap map[string]*modconfig.Connection) (ConnectionDataMap, map[string][]modconfig.Connection, error)
NewConnectionDataMap populates a map of connection data for all connections in connectionMap
func (ConnectionDataMap) Connections ¶
func (m ConnectionDataMap) Connections() []*modconfig.Connection
func (ConnectionDataMap) Equals ¶
func (m ConnectionDataMap) Equals(other ConnectionDataMap) bool
func (ConnectionDataMap) IsValid ¶
func (m ConnectionDataMap) IsValid() bool
IsValid checks whether the struct was correctly deserialized, by checking if the ConnectionData StructVersion is populated
func (ConnectionDataMap) MigrateFrom ¶
func (m ConnectionDataMap) MigrateFrom() migrate.Migrateable
func (ConnectionDataMap) Save ¶
func (m ConnectionDataMap) Save() error
type ConnectionPlugin ¶
type ConnectionPlugin struct { // map of connection data (name, config, options) // keyed by connection name ConnectionMap map[string]*ConnectionPluginData PluginName string PluginClient *sdkgrpc.PluginClient SupportedOperations *proto.SupportedOperations }
ConnectionPlugin is a structure representing an instance of a plugin for non-legacy plugins, each plugin instance supportds multiple connections the config, options and schema for each connection is stored in ConnectionMap
func NewConnectionPlugin ¶ added in v0.16.0
func NewConnectionPlugin(pluginName string, pluginClient *sdkgrpc.PluginClient, supportedOperations *proto.SupportedOperations) *ConnectionPlugin
func (ConnectionPlugin) GetSchema ¶ added in v0.19.0
func (p ConnectionPlugin) GetSchema(connectionName string) (*sdkproto.Schema, error)
GetSchema returns the cached schema if it is static, or if it is dynamic, refetch it
func (ConnectionPlugin) IncludesConnection ¶ added in v0.16.0
func (p ConnectionPlugin) IncludesConnection(name string) bool
type ConnectionPluginData ¶ added in v0.16.0
type ConnectionSchemaMap ¶
ConnectionSchemaMap is a map of connection to all connections with the same schema
func NewConnectionSchemaMap ¶
func NewConnectionSchemaMap() (ConnectionSchemaMap, error)
NewConnectionSchemaMap creates a ConnectionSchemaMap for all configured connections it uses the current connection state to determine if a connection has a dynamic schema (NOTE: this will no work for newly added plugins which will not have a state yet - which is why CreateConnectionPlugins loads the schemas for each new plugin and calls NewConnectionSchemaMapForConnections directly, passing the schema modes)
func NewConnectionSchemaMapForConnections ¶
func NewConnectionSchemaMapForConnections(connections []*modconfig.Connection, schemaModeMap map[string]string, connectionState ConnectionDataMap) ConnectionSchemaMap
func (ConnectionSchemaMap) UniqueSchemas ¶
func (c ConnectionSchemaMap) UniqueSchemas() []string
UniqueSchemas returns the unique schemas for all loaded connections
type ConnectionUpdates ¶
type ConnectionUpdates struct { Update ConnectionDataMap Delete ConnectionDataMap MissingPlugins map[string][]modconfig.Connection // the connections which will exist after the update RequiredConnectionState ConnectionDataMap // connection plugins required to perform the updates ConnectionPlugins map[string]*ConnectionPlugin ConnectionStateModified bool // contains filtered or unexported fields }
func (*ConnectionUpdates) HasUpdates ¶
func (u *ConnectionUpdates) HasUpdates() bool
func (*ConnectionUpdates) String ¶ added in v0.17.0
func (u *ConnectionUpdates) String() string
type IdentityMetadata ¶
type PreparedStatementFailure ¶ added in v0.17.0
type PreparedStatementFailure struct { Query modconfig.QueryProvider Error error }
func (*PreparedStatementFailure) String ¶ added in v0.17.0
func (f *PreparedStatementFailure) String() string
type RefreshConnectionResult ¶
type RefreshConnectionResult struct { UpdatedConnections bool Warnings []string Error error Updates *ConnectionUpdates }
RefreshConnectionResult is a structure used to contain the result of either a RefreshConnections or a NewLocalClient operation
func CreateConnectionPlugins ¶
func CreateConnectionPlugins(connectionsToCreate []*modconfig.Connection) (requestedConnectionPluginMap map[string]*ConnectionPlugin, res *RefreshConnectionResult)
CreateConnectionPlugins instantiates plugins for specified connections, and fetches schemas
func (*RefreshConnectionResult) AddWarning ¶
func (r *RefreshConnectionResult) AddWarning(warning string)
func (*RefreshConnectionResult) Merge ¶
func (r *RefreshConnectionResult) Merge(other *RefreshConnectionResult)
func (*RefreshConnectionResult) ShowWarnings ¶
func (r *RefreshConnectionResult) ShowWarnings()
func (*RefreshConnectionResult) String ¶ added in v0.17.0
func (r *RefreshConnectionResult) String() string
type SteampipeConfig ¶
type SteampipeConfig struct { // map of connection name to partially parsed connection config Connections map[string]*modconfig.Connection // 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 GlobalConfig *SteampipeConfig
func LoadConnectionConfig ¶
func LoadConnectionConfig() (*SteampipeConfig, error)
LoadConnectionConfig loads the connection config but not the workspace options this is called by the fdw
func LoadSteampipeConfig ¶
func LoadSteampipeConfig(modLocation string, commandName string) (*SteampipeConfig, error)
LoadSteampipeConfig loads the HCL connection config and workspace options
func NewSteampipeConfig ¶
func NewSteampipeConfig(commandName string) *SteampipeConfig
func (*SteampipeConfig) ConfigMap ¶
func (c *SteampipeConfig) ConfigMap() map[string]interface{}
ConfigMap creates a config map to pass to viper
func (*SteampipeConfig) ConnectionList ¶
func (c *SteampipeConfig) ConnectionList() []*modconfig.Connection
func (*SteampipeConfig) ConnectionNames ¶
func (c *SteampipeConfig) ConnectionNames() []string
ConnectionNames returns a flat list of connection names
func (*SteampipeConfig) ConnectionsForPlugin ¶
func (c *SteampipeConfig) ConnectionsForPlugin(pluginLongName string, pluginVersion *version.Version) []*modconfig.Connection
func (*SteampipeConfig) GetConnectionOptions ¶
func (c *SteampipeConfig) GetConnectionOptions(connectionName string) *options.Connection
func (*SteampipeConfig) SetOptions ¶
func (c *SteampipeConfig) SetOptions(opts options.Options)
func (*SteampipeConfig) String ¶
func (c *SteampipeConfig) String() string
func (*SteampipeConfig) Validate ¶
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
type WorkspaceMetadata ¶
type WorkspaceProfileLoader ¶ added in v0.17.0
type WorkspaceProfileLoader struct { DefaultProfile *modconfig.WorkspaceProfile ConfiguredProfile *modconfig.WorkspaceProfile // contains filtered or unexported fields }
func NewWorkspaceProfileLoader ¶ added in v0.17.0
func NewWorkspaceProfileLoader(workspaceProfilePath string) (*WorkspaceProfileLoader, error)
func (*WorkspaceProfileLoader) GetActiveWorkspaceProfile ¶ added in v0.17.0
func (l *WorkspaceProfileLoader) GetActiveWorkspaceProfile() *modconfig.WorkspaceProfile
Source Files ¶
- cloud_metadata.go
- cloud_workspace.go
- connection_data.go
- connection_data_map.go
- connection_plugin.go
- connection_schemas.go
- connection_state.go
- connection_updates.go
- connection_validation.go
- load_config.go
- load_mod.go
- load_mod_variables.go
- prepared_sattement_failure.go
- refresh_connections_result.go
- steampipeconfig.go
- workspace_profile_loader.go