aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/cmd/api_key.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/go/cmd/api_key.go')
-rw-r--r--client/go/cmd/api_key.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/client/go/cmd/api_key.go b/client/go/cmd/api_key.go
index 9832f04e3f0..f6113adf5d6 100644
--- a/client/go/cmd/api_key.go
+++ b/client/go/cmd/api_key.go
@@ -16,15 +16,24 @@ import (
var overwriteKey bool
func init() {
- rootCmd.AddCommand(apiKeyCmd)
apiKeyCmd.Flags().BoolVarP(&overwriteKey, "force", "f", false, "Force overwrite of existing API key")
apiKeyCmd.MarkPersistentFlagRequired(applicationFlag)
}
+var example string
+
+func apiKeyExample() string {
+ if vespa.Auth0AccessTokenEnabled() {
+ return "$ vespa auth api-key -a my-tenant.my-app.my-instance"
+ } else {
+ return "$ vespa api-key -a my-tenant.my-app.my-instance"
+ }
+}
+
var apiKeyCmd = &cobra.Command{
Use: "api-key",
Short: "Create a new user API key for authentication with Vespa Cloud",
- Example: "$ vespa api-key -a my-tenant.my-app.my-instance",
+ Example: apiKeyExample(),
DisableAutoGenTag: true,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {