mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-19 18:12:43 -05:00
tidy
This commit is contained in:
@@ -2,11 +2,11 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/steampipe/pkg/cmdconfig"
|
||||
)
|
||||
|
||||
|
||||
28
cmd/query.go
28
cmd/query.go
@@ -11,10 +11,8 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
"github.com/thediveo/enumflag/v2"
|
||||
"github.com/turbot/go-kit/helpers"
|
||||
"github.com/turbot/pipe-fittings/cloud"
|
||||
pconstants "github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/pipe-fittings/contexthelpers"
|
||||
"github.com/turbot/pipe-fittings/steampipeconfig"
|
||||
"github.com/turbot/pipe-fittings/utils"
|
||||
"github.com/turbot/steampipe-plugin-sdk/v5/sperr"
|
||||
"github.com/turbot/steampipe/pkg/cmdconfig"
|
||||
@@ -195,29 +193,3 @@ func getPipedStdinData() string {
|
||||
}
|
||||
return stdinData
|
||||
}
|
||||
|
||||
func publishSnapshotIfNeeded(ctx context.Context, snapshot *steampipeconfig.SteampipeSnapshot) error {
|
||||
shouldShare := viper.GetBool(pconstants.ArgShare)
|
||||
shouldUpload := viper.GetBool(pconstants.ArgSnapshot)
|
||||
|
||||
if !(shouldShare || shouldUpload) {
|
||||
return nil
|
||||
}
|
||||
|
||||
message, err := cloud.PublishSnapshot(ctx, snapshot, shouldShare)
|
||||
if err != nil {
|
||||
// reword "402 Payment Required" error
|
||||
return handlePublishSnapshotError(err)
|
||||
}
|
||||
if viper.GetBool(pconstants.ArgProgress) {
|
||||
fmt.Println(message)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func handlePublishSnapshotError(err error) error {
|
||||
if err.Error() == "402 Payment Required" {
|
||||
return fmt.Errorf("maximum number of snapshots reached")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package cmd
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"os"
|
||||
|
||||
"github.com/mattn/go-isatty"
|
||||
@@ -11,6 +10,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
filehelpers "github.com/turbot/go-kit/files"
|
||||
"github.com/turbot/pipe-fittings/app_specific"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/pipe-fittings/utils"
|
||||
"github.com/turbot/steampipe/pkg/error_helpers"
|
||||
"github.com/turbot/steampipe/pkg/statushooks"
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
|
||||
var exitCode int
|
||||
|
||||
// rootCmd represents the base command when called without any subcommands
|
||||
// rootCmd represents the base command when called without any subcommands
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "steampipe [--version] [--help] COMMAND [args]",
|
||||
|
||||
@@ -23,36 +23,3 @@ func (p PluginMap) ToPluginLimiterMap() PluginLimiterMap {
|
||||
}
|
||||
return limiterPluginMap
|
||||
}
|
||||
|
||||
//func (p PluginMap) Diff(otherMap PluginMap) (added, deleted, changed map[string][]*plugin.Plugin) {
|
||||
// // results are maps of connections keyed by plugin instance
|
||||
// added = make(map[string][]*plugin.Plugin)
|
||||
// deleted = make(map[string][]*plugin.Plugin)
|
||||
// changed = make(map[string][]*plugin.Plugin)
|
||||
//
|
||||
// for name, plugin := range p {
|
||||
// if otherConnection, ok := otherMap[name]; !ok {
|
||||
// deleted[plugin.Instance] = append(deleted[plugin.Instance], plugin)
|
||||
// } else {
|
||||
// // check for changes
|
||||
//
|
||||
// // special case - if the plugin has changed, treat this as a deletion and a re-add
|
||||
// if plugin.Instance != otherConnection.Plugin {
|
||||
// added[otherConnection.Plugin] = append(added[otherConnection.Plugin], otherConnection)
|
||||
// deleted[plugin.Instance] = append(deleted[plugin.Instance], plugin)
|
||||
// } else {
|
||||
// if !plugin.Equals(otherConnection) {
|
||||
// changed[plugin.Instance] = append(changed[plugin.Instance], otherConnection)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for otherName, otherConnection := range otherMap {
|
||||
// if _, ok := p[otherName]; !ok {
|
||||
// added[otherConnection.Plugin] = append(added[otherConnection.Plugin], otherConnection)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return
|
||||
//}
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
"github.com/turbot/go-kit/helpers"
|
||||
pconstants "github.com/turbot/pipe-fittings/constants"
|
||||
error_helpers2 "github.com/turbot/pipe-fittings/error_helpers"
|
||||
perror_helpers "github.com/turbot/pipe-fittings/error_helpers"
|
||||
"github.com/turbot/pipe-fittings/utils"
|
||||
"github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto"
|
||||
"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
|
||||
@@ -227,7 +227,7 @@ func (s *refreshConnectionState) updateRateLimiterDefinitions(ctx context.Contex
|
||||
if len(updatedPluginLimiters) > 0 {
|
||||
err := s.pluginManager.HandlePluginLimiterChanges(updatedPluginLimiters)
|
||||
if err != nil {
|
||||
s.pluginManager.SendPostgresErrorsAndWarningsNotification(ctx, error_helpers2.NewErrorsAndWarning(err))
|
||||
s.pluginManager.SendPostgresErrorsAndWarningsNotification(ctx, perror_helpers.NewErrorsAndWarning(err))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -3,13 +3,13 @@ package db_client
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/turbot/go-kit/helpers"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/steampipe/pkg/db/db_common"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package db_client
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"time"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/steampipe/pkg/db/db_common"
|
||||
)
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ package db_common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/pipe-fittings/error_helpers"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/pipe-fittings/error_helpers"
|
||||
)
|
||||
|
||||
func ValidateClientCacheSettings(c Client) error_helpers.ErrorAndWarnings {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package db_common
|
||||
|
||||
import (
|
||||
"github.com/turbot/pipe-fittings/utils"
|
||||
"golang.org/x/exp/maps"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/turbot/pipe-fittings/utils"
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
func NewSchemaMetadata() *SchemaMetadata {
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"crypto/x509/pkix"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"log"
|
||||
"math/big"
|
||||
"os"
|
||||
@@ -17,6 +16,7 @@ import (
|
||||
|
||||
"github.com/spf13/viper"
|
||||
filehelpers "github.com/turbot/go-kit/files"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/pipe-fittings/utils"
|
||||
"github.com/turbot/steampipe-plugin-sdk/v5/sperr"
|
||||
"github.com/turbot/steampipe/pkg/db/sslio"
|
||||
|
||||
@@ -105,7 +105,7 @@ func (c *InteractiveClient) initialiseSchemaAndTableSuggestions(connectionStateM
|
||||
}
|
||||
|
||||
func (c *InteractiveClient) initialiseQuerySuggestions() {
|
||||
// TODO #KAI add sql files???
|
||||
// TODO add sql files???
|
||||
}
|
||||
|
||||
func sanitiseTableName(strToEscape string) string {
|
||||
|
||||
@@ -3,10 +3,11 @@ package metaquery
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/pipe-fittings/querydisplay"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/pipe-fittings/querydisplay"
|
||||
)
|
||||
|
||||
// inspect
|
||||
|
||||
@@ -2,6 +2,7 @@ package ociinstaller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/turbot/pipe-fittings/ociinstaller"
|
||||
"github.com/turbot/steampipe/pkg/constants"
|
||||
|
||||
@@ -2,6 +2,7 @@ package ociinstaller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/turbot/pipe-fittings/ociinstaller"
|
||||
"github.com/turbot/steampipe/pkg/constants"
|
||||
|
||||
@@ -2,9 +2,9 @@ package ociinstaller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"runtime"
|
||||
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/pipe-fittings/ociinstaller"
|
||||
"github.com/turbot/pipe-fittings/utils"
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@ package plugin
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/turbot/pipe-fittings/ociinstaller"
|
||||
"github.com/turbot/pipe-fittings/plugin"
|
||||
"github.com/turbot/pipe-fittings/versionfile"
|
||||
|
||||
@@ -2,7 +2,6 @@ package pluginmanager
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"io"
|
||||
"log"
|
||||
"os/exec"
|
||||
@@ -11,6 +10,7 @@ import (
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"github.com/turbot/pipe-fittings/app_specific"
|
||||
"github.com/turbot/pipe-fittings/constants"
|
||||
"github.com/turbot/steampipe-plugin-sdk/v5/logging"
|
||||
"github.com/turbot/steampipe-plugin-sdk/v5/sperr"
|
||||
"github.com/turbot/steampipe/pkg/pluginmanager_service/grpc"
|
||||
|
||||
@@ -2,10 +2,11 @@ package pluginmanager_service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"github.com/turbot/pipe-fittings/error_helpers"
|
||||
"github.com/turbot/steampipe/pkg/db/db_local"
|
||||
"github.com/turbot/steampipe/pkg/steampipeconfig"
|
||||
"log"
|
||||
)
|
||||
|
||||
func (m *PluginManager) SendPostgresSchemaNotification(ctx context.Context) error {
|
||||
|
||||
@@ -2,6 +2,7 @@ package pluginmanager_service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/turbot/pipe-fittings/plugin"
|
||||
"github.com/turbot/steampipe/pkg/connection"
|
||||
"github.com/turbot/steampipe/pkg/db/db_local"
|
||||
|
||||
@@ -3,11 +3,10 @@ package pluginmanager_service
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/error_helpers"
|
||||
|
||||
"log"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/turbot/pipe-fittings/error_helpers"
|
||||
"github.com/turbot/pipe-fittings/ociinstaller"
|
||||
"github.com/turbot/pipe-fittings/plugin"
|
||||
sdkgrpc "github.com/turbot/steampipe-plugin-sdk/v5/grpc"
|
||||
|
||||
@@ -184,10 +184,6 @@ func loadSteampipeConfig(ctx context.Context, modLocation string, commandName st
|
||||
errorsAndWarnings.AddWarning(ew.Warnings...)
|
||||
}
|
||||
|
||||
// now set default options on all connections without options set
|
||||
// this is needed as the connection config is also loaded by the FDW which has no access to viper
|
||||
steampipeConfig.setDefaultConnectionOptions()
|
||||
|
||||
// now validate the config
|
||||
warnings, errors := steampipeConfig.Validate()
|
||||
logValidationResult(warnings, errors)
|
||||
|
||||
@@ -121,12 +121,6 @@ func (c *SteampipeConfig) SetOptions(opts poptions.Options) (errorsAndWarnings e
|
||||
var defaultCacheEnabled = true
|
||||
var defaultTTL = 300
|
||||
|
||||
// if default connection options have been set, assign them to any connection which do not define specific options
|
||||
func (c *SteampipeConfig) setDefaultConnectionOptions() {
|
||||
// precedence for the default is (high to low):
|
||||
// env var
|
||||
// base default
|
||||
}
|
||||
func (c *SteampipeConfig) String() string {
|
||||
var connectionStrings []string
|
||||
for _, c := range c.Connections {
|
||||
|
||||
@@ -6,10 +6,9 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/turbot/pipe-fittings/plugin"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/turbot/go-kit/files"
|
||||
"github.com/turbot/pipe-fittings/plugin"
|
||||
"github.com/turbot/pipe-fittings/utils"
|
||||
"github.com/turbot/steampipe/pkg/error_helpers"
|
||||
"github.com/turbot/steampipe/pkg/filepaths"
|
||||
|
||||
@@ -3,8 +3,6 @@ package task
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/turbot/pipe-fittings/plugin"
|
||||
"github.com/turbot/steampipe/pkg/steampipeconfig"
|
||||
"log"
|
||||
"os"
|
||||
"sync"
|
||||
@@ -12,11 +10,13 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/turbot/go-kit/files"
|
||||
"github.com/turbot/pipe-fittings/plugin"
|
||||
"github.com/turbot/pipe-fittings/utils"
|
||||
"github.com/turbot/steampipe/pkg/db/db_local"
|
||||
"github.com/turbot/steampipe/pkg/error_helpers"
|
||||
"github.com/turbot/steampipe/pkg/filepaths"
|
||||
"github.com/turbot/steampipe/pkg/installationstate"
|
||||
"github.com/turbot/steampipe/pkg/steampipeconfig"
|
||||
)
|
||||
|
||||
const minimumDurationBetweenChecks = 24 * time.Hour
|
||||
|
||||
Reference in New Issue
Block a user