diff --git a/cmd/add.go b/cmd/add.go index 601f6da..4f7b09a 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -7,7 +7,6 @@ import ( log "github.com/sirupsen/logrus" "github.com/99designs/keyring" - analytics "github.com/segmentio/analytics-go" "github.com/segmentio/aws-okta/lib" "github.com/spf13/cobra" ) @@ -44,17 +43,6 @@ func add(cmd *cobra.Command, args []string) error { log.Fatal(err) } - if analyticsEnabled && analyticsClient != nil { - analyticsClient.Enqueue(analytics.Track{ - UserId: username, - Event: "Ran Command", - Properties: analytics.NewProperties(). - Set("backend", backend). - Set("aws-okta-version", version). - Set("command", "add"), - }) - } - // Ask Okta organization details if not given in command line argument if oktaDomain == "" { organization, err = lib.Prompt("Okta organization", false) @@ -91,7 +79,7 @@ func add(cmd *cobra.Command, args []string) error { return err } } - + if oktaAccountName == "" { oktaAccountName = "okta-creds" } else { diff --git a/cmd/cred-process.go b/cmd/cred-process.go index 3b91487..2788335 100644 --- a/cmd/cred-process.go +++ b/cmd/cred-process.go @@ -7,7 +7,6 @@ import ( "time" "github.com/99designs/keyring" - analytics "github.com/segmentio/analytics-go" "github.com/segmentio/aws-okta/lib" "github.com/spf13/cobra" ) @@ -92,18 +91,6 @@ func credProcessRun(cmd *cobra.Command, args []string) error { return err } - if analyticsEnabled && analyticsClient != nil { - analyticsClient.Enqueue(analytics.Track{ - UserId: username, - Event: "Ran Command", - Properties: analytics.NewProperties(). - Set("backend", backend). - Set("aws-okta-version", version). - Set("profile", profile). - Set("command", "cred-process"), - }) - } - opts.SessionCacheSingleItem = flagSessionCacheSingleItem p, err := lib.NewProvider(kr, profile, opts) diff --git a/cmd/env.go b/cmd/env.go index f11670b..383f73c 100644 --- a/cmd/env.go +++ b/cmd/env.go @@ -8,7 +8,6 @@ import ( "github.com/99designs/keyring" "github.com/alessio/shellescape" - analytics "github.com/segmentio/analytics-go" "github.com/segmentio/aws-okta/lib" "github.com/spf13/cobra" ) @@ -80,18 +79,6 @@ func envRun(cmd *cobra.Command, args []string) error { return err } - if analyticsEnabled && analyticsClient != nil { - analyticsClient.Enqueue(analytics.Track{ - UserId: username, - Event: "Ran Command", - Properties: analytics.NewProperties(). - Set("backend", backend). - Set("aws-okta-version", version). - Set("profile", profile). - Set("command", "env"), - }) - } - opts.SessionCacheSingleItem = flagSessionCacheSingleItem p, err := lib.NewProvider(kr, profile, opts) diff --git a/cmd/exec.go b/cmd/exec.go index 3a66935..e180266 100644 --- a/cmd/exec.go +++ b/cmd/exec.go @@ -13,7 +13,6 @@ import ( "time" "github.com/99designs/keyring" - analytics "github.com/segmentio/analytics-go" "github.com/segmentio/aws-okta/lib" "github.com/spf13/cobra" ) @@ -181,18 +180,6 @@ func execRun(cmd *cobra.Command, args []string) error { return err } - if analyticsEnabled && analyticsClient != nil { - analyticsClient.Enqueue(analytics.Track{ - UserId: username, - Event: "Ran Command", - Properties: analytics.NewProperties(). - Set("backend", backend). - Set("aws-okta-version", version). - Set("profile", profile). - Set("command", "exec"), - }) - } - opts.SessionCacheSingleItem = flagSessionCacheSingleItem p, err := lib.NewProvider(kr, profile, opts) diff --git a/cmd/list.go b/cmd/list.go index 2bc5367..51742ee 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -6,7 +6,6 @@ import ( "sort" "text/tabwriter" - analytics "github.com/segmentio/analytics-go" "github.com/segmentio/aws-okta/lib" "github.com/spf13/cobra" ) @@ -68,16 +67,5 @@ func listRun(cmd *cobra.Command, args []string) error { } w.Flush() - if analyticsEnabled && analyticsClient != nil { - analyticsClient.Enqueue(analytics.Track{ - UserId: username, - Event: "Listed Profiles", - Properties: analytics.NewProperties(). - Set("backend", backend). - Set("aws-okta-version", version). - Set("profile-count", len(profiles)). - Set("command", "list"), - }) - } return nil } diff --git a/cmd/login.go b/cmd/login.go index e4f8763..5482883 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -10,7 +10,6 @@ import ( "time" "github.com/99designs/keyring" - analytics "github.com/segmentio/analytics-go" "github.com/segmentio/aws-okta/lib" "github.com/skratchdot/open-golang/open" "github.com/spf13/cobra" @@ -101,18 +100,6 @@ func loginRun(cmd *cobra.Command, args []string) error { return err } - if analyticsEnabled && analyticsClient != nil { - analyticsClient.Enqueue(analytics.Track{ - UserId: username, - Event: "Ran Command", - Properties: analytics.NewProperties(). - Set("backend", backend). - Set("aws-okta-version", version). - Set("profile", profile). - Set("command", "login"), - }) - } - opts.SessionCacheSingleItem = flagSessionCacheSingleItem p, err := lib.NewProvider(kr, profile, opts) diff --git a/cmd/root.go b/cmd/root.go index 2447160..6ed0afc 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -8,7 +8,6 @@ import ( "errors" "github.com/99designs/keyring" - analytics "github.com/segmentio/analytics-go" "github.com/segmentio/aws-okta/lib" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -35,9 +34,6 @@ var ( mfaConfig lib.MFAConfig debug bool version string - analyticsWriteKey string - analyticsEnabled bool - analyticsClient analytics.Client username string flagSessionCacheSingleItem bool ) @@ -51,15 +47,12 @@ var RootCmd = &cobra.Command{ SilenceUsage: true, SilenceErrors: true, PersistentPreRunE: prerunE, - PersistentPostRun: postrun, } // Execute adds all child commands to the root command sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute(vers string, writeKey string) { version = vers - analyticsWriteKey = writeKey - analyticsEnabled = analyticsWriteKey != "" if err := RootCmd.Execute(); err != nil { fmt.Fprintf(os.Stderr, "%s\n", err) switch err { @@ -94,28 +87,9 @@ func prerunE(cmd *cobra.Command, args []string) error { } } - if analyticsEnabled { - // set up analytics client - analyticsClient, _ = analytics.NewWithConfig(analyticsWriteKey, analytics.Config{ - BatchSize: 1, - }) - - usr := os.Getenv("USER") - analyticsClient.Enqueue(analytics.Identify{ - UserId: usr, - Traits: analytics.NewTraits(). - Set("aws-okta-version", version), - }) - } return nil } -func postrun(cmd *cobra.Command, args []string) { - if analyticsEnabled && analyticsClient != nil { - analyticsClient.Close() - } -} - func init() { backendsAvailable := []string{} for _, backendType := range keyring.AvailableBackends() { diff --git a/cmd/write-to-credentials.go b/cmd/write-to-credentials.go index 893ce46..58f9261 100644 --- a/cmd/write-to-credentials.go +++ b/cmd/write-to-credentials.go @@ -11,7 +11,6 @@ import ( "time" "github.com/99designs/keyring" - analytics "github.com/segmentio/analytics-go" "github.com/segmentio/aws-okta/lib" "github.com/spf13/cobra" ini "gopkg.in/ini.v1" @@ -92,18 +91,6 @@ func writeToCredentialsRun(cmd *cobra.Command, args []string) error { return err } - if analyticsEnabled && analyticsClient != nil { - analyticsClient.Enqueue(analytics.Track{ - UserId: username, - Event: "Ran Command", - Properties: analytics.NewProperties(). - Set("backend", backend). - Set("aws-okta-version", version). - Set("profile", profile). - Set("command", "writeToCredentials"), - }) - } - opts.SessionCacheSingleItem = flagSessionCacheSingleItem p, err := lib.NewProvider(kr, profile, opts)