summaryrefslogtreecommitdiffstats
path: root/client/go/cmd/auth.go
blob: 68d7fa00fdf2bed48878db0a62e650920ec39e52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cmd

import (
	"fmt"

	"github.com/spf13/cobra"
	"github.com/vespa-engine/vespa/client/go/vespa"
)

func init() {
	if vespa.Auth0AccessTokenEnabled() {
		rootCmd.AddCommand(authCmd)
		rootCmd.AddCommand(deprecatedCertCmd)
		rootCmd.AddCommand(deprecatedApiKeyCmd)
		authCmd.AddCommand(certCmd)
		authCmd.AddCommand(apiKeyCmd)
		authCmd.AddCommand(loginCmd)
		authCmd.AddCommand(logoutCmd)
	} else {
		rootCmd.AddCommand(certCmd)
		rootCmd.AddCommand(apiKeyCmd)
	}
}

var authCmd = &cobra.Command{
	Use:               "auth",
	Short:             "Manage Vespa Cloud credentials",
	Long:              `Manage Vespa Cloud credentials.`,
	DisableAutoGenTag: true,
	SilenceUsage:      false,
	Args:              cobra.MinimumNArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {
		return fmt.Errorf("invalid command: %s", args[0])
	},
}