-
Notifications
You must be signed in to change notification settings - Fork 8
/
cmd.go
41 lines (34 loc) · 1.14 KB
/
cmd.go
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
36
37
38
39
40
41
// Copyright 2022 Namespace Labs Inc; All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
package auth
import (
"context"
"fmt"
"github.com/spf13/cobra"
"namespacelabs.dev/foundation/internal/console"
"namespacelabs.dev/foundation/internal/fnapi"
)
func NewAuthCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "auth",
Short: "Authentication related operations (e.g. login).",
}
cmd.AddCommand(NewLoginCmd())
cmd.AddCommand(NewExchangeGithubTokenCmd())
cmd.AddCommand(NewExchangeCircleCITokenCmd())
cmd.AddCommand(newExchangeAwsCognitoCmd())
cmd.AddCommand(newTrustAwsCognitoCmd())
cmd.AddCommand(NewIssueIdTokenCmd())
cmd.AddCommand(NewExchangeOIDCTokenCmd())
cmd.AddCommand(NewGenerateDevTokenCmd())
return cmd
}
func printLoginInfo(ctx context.Context, tenant *fnapi.Tenant) {
if tenant.Name != "" {
fmt.Fprintf(console.Stdout(ctx), "You are now logged into workspace %q, have a nice day.\n", tenant.Name)
}
if tenant.AppUrl != "" {
fmt.Fprintf(console.Stdout(ctx), "You can inspect your instances at %s\n", tenant.AppUrl)
}
}