mirror of
https://github.com/safedep/vet.git
synced 2025-12-10 12:07:30 -06:00
Remove auth trial command for cloud commands
This commit is contained in:
parent
debe15e572
commit
c0e915cfaa
32
auth.go
32
auth.go
@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
@ -16,7 +15,6 @@ import (
|
||||
var (
|
||||
authInsightApiBaseUrl string
|
||||
authControlPlaneApiBaseUrl string
|
||||
authTrialEmail string
|
||||
authCommunity bool
|
||||
)
|
||||
|
||||
@ -34,7 +32,6 @@ func newAuthCommand() *cobra.Command {
|
||||
|
||||
cmd.AddCommand(configureAuthCommand())
|
||||
cmd.AddCommand(verifyAuthCommand())
|
||||
cmd.AddCommand(trialsRegisterCommand())
|
||||
|
||||
return cmd
|
||||
}
|
||||
@ -101,32 +98,3 @@ func verifyAuthCommand() *cobra.Command {
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func trialsRegisterCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "trial",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
client := auth.NewTrialRegistrationClient(auth.TrialConfig{
|
||||
Email: authTrialEmail,
|
||||
ControlPlaneApiUrl: authControlPlaneApiBaseUrl,
|
||||
})
|
||||
|
||||
res, err := client.Execute()
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Printf("Trial registration successful with Id:%s\n", res.Id)
|
||||
fmt.Printf("Check your email (%s) for API key and usage instructions\n", authTrialEmail)
|
||||
fmt.Printf("The trial API key will expire on %s\n", res.ExpiresAt.String())
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&authTrialEmail, "email", "", "",
|
||||
"Email address to use for sending trial API key")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@ -23,6 +23,10 @@ func Verify(config *VerifyConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if ApiKey() == "" {
|
||||
return fmt.Errorf("API key is not set")
|
||||
}
|
||||
|
||||
logger.Infof("Verifying auth token using Control Plane: %s", config.ControlPlaneApiUrl)
|
||||
|
||||
client, err := cpv1.NewClientWithResponses(config.ControlPlaneApiUrl)
|
||||
|
||||
@ -155,6 +155,7 @@ func NewSyncReporter(config SyncReporterConfig) (Reporter, error) {
|
||||
logger.Debugf("Report Sync: Creating tool session for project: %s, version: %s",
|
||||
config.ProjectName, config.ProjectVersion)
|
||||
|
||||
// Refactor this into a common session creator function
|
||||
toolServiceClient := controltowerv1grpc.NewToolServiceClient(config.ClientConnection)
|
||||
toolSessionRes, err := toolServiceClient.CreateToolSession(context.Background(),
|
||||
&controltowerv1.CreateToolSessionRequest{
|
||||
@ -205,6 +206,7 @@ func (s *syncReporter) AddManifest(manifest *models.PackageManifest) {
|
||||
logger.Debugf("Report Sync: Creating tool session for project: %s, version: %s",
|
||||
projectName, projectVersion)
|
||||
|
||||
// Refactor this into a common session creator function
|
||||
toolServiceClient := controltowerv1grpc.NewToolServiceClient(s.client)
|
||||
toolSessionRes, err := toolServiceClient.CreateToolSession(context.Background(),
|
||||
&controltowerv1.CreateToolSessionRequest{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user