forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subcommand.go
36 lines (26 loc) · 1.01 KB
/
subcommand.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
package sa
import (
"io"
"github.com/spf13/cobra"
cmdutil "github.com/openshift/origin/pkg/cmd/util"
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
)
const ServiceAccountsRecommendedName = "serviceaccounts"
const (
serviceAccountsShort = `Manage service accounts in your project.`
serviceAccountsLong = `
Manage service accounts in your project.
Service accounts allow system components to access the API.`
)
func NewCmdServiceAccounts(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
cmds := &cobra.Command{
Use: name,
Short: serviceAccountsShort,
Long: serviceAccountsLong,
Aliases: []string{"sa"},
Run: cmdutil.DefaultSubCommandRun(out),
}
cmds.AddCommand(NewCommandGetServiceAccountToken(GetServiceAccountTokenRecommendedName, fullName+" "+GetServiceAccountTokenRecommendedName, f, out))
cmds.AddCommand(NewCommandNewServiceAccountToken(NewServiceAccountTokenRecommendedName, fullName+" "+NewServiceAccountTokenRecommendedName, f, out))
return cmds
}