certmanager updates
This commit is contained in:
@@ -39,6 +39,11 @@ const (
|
||||
unrevokeServicePairCmd = "unrevokeServicePair"
|
||||
listServicePairsCmd = "listServicePairs"
|
||||
getServicePairCmd = "getServicePair"
|
||||
|
||||
createAccountCmd = "createAccount"
|
||||
updateAccountCmd = "updateAccount"
|
||||
deleteAccountCmd = "revokeAccount"
|
||||
listAccountsCmd = "listAccounts"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -70,6 +75,13 @@ type Util struct {
|
||||
serviceCommonName string
|
||||
serviceID int64
|
||||
serviceName string
|
||||
|
||||
accountID int64
|
||||
username string
|
||||
password string
|
||||
disable bool
|
||||
newUsername string
|
||||
newPassword string
|
||||
}
|
||||
|
||||
func NewUtil() *Util {
|
||||
@@ -114,17 +126,23 @@ func (util *Util) GetOpt() error {
|
||||
fmt.Printf("Usage: %s [option] command [command option]\n", exeName)
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("Command list: help, %s\n", getStatusCmd)
|
||||
fmt.Printf("Command list: %s, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
|
||||
fmt.Printf("Command list: %s, %s, %s, %s, %s, %s\n",
|
||||
createIssuerPairCmd,
|
||||
importIssuerPairCmd,
|
||||
revokeIssuerPairCmd,
|
||||
unrevokeIssuerPairCmd,
|
||||
listIssuerPairsCmd,
|
||||
getIssuerCertificateCmd,
|
||||
getIssuerCertificateCmd)
|
||||
fmt.Printf("Command list: %s, %s, %s, %s\n",
|
||||
createServicePairCmd,
|
||||
revokeServicePairCmd,
|
||||
listServicePairsCmd,
|
||||
getServicePairCmd)
|
||||
fmt.Printf("Command list: %s, %s, %s, %s\n",
|
||||
createAccountCmd,
|
||||
deleteAccountCmd,
|
||||
listAccountsCmd,
|
||||
updateAccountCmd)
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("Global options:\n")
|
||||
flag.PrintDefaults()
|
||||
@@ -342,6 +360,76 @@ func (util *Util) GetOpt() error {
|
||||
}
|
||||
flagSet.Parse(subArgs)
|
||||
util.subCmd = subCmd
|
||||
|
||||
case createAccountCmd:
|
||||
flagSet := flag.NewFlagSet(createAccountCmd, flag.ExitOnError)
|
||||
|
||||
flagSet.StringVar(&util.username, "username", util.username, "user name")
|
||||
flagSet.StringVar(&util.password, "password", util.password, "user password")
|
||||
|
||||
flagSet.Usage = func() {
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("Usage: %s [global options] %s [command options]\n", exeName, subCmd)
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("The command options: none\n")
|
||||
flagSet.PrintDefaults()
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
flagSet.Parse(subArgs)
|
||||
util.subCmd = subCmd
|
||||
|
||||
case deleteAccountCmd:
|
||||
flagSet := flag.NewFlagSet(deleteAccountCmd, flag.ExitOnError)
|
||||
|
||||
flagSet.StringVar(&util.username, "username", util.username, "user name")
|
||||
flagSet.Int64Var(&util.accountID, "accountId", util.accountID, "account ID")
|
||||
|
||||
flagSet.Usage = func() {
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("Usage: %s [global options] %s [command options]\n", exeName, subCmd)
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("The command options: none\n")
|
||||
flagSet.PrintDefaults()
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
flagSet.Parse(subArgs)
|
||||
util.subCmd = subCmd
|
||||
|
||||
case listAccountsCmd:
|
||||
flagSet := flag.NewFlagSet(listAccountsCmd, flag.ExitOnError)
|
||||
|
||||
flagSet.Usage = func() {
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("Usage: %s [global options] %s [command options]\n", exeName, subCmd)
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("The command options: none\n")
|
||||
flagSet.PrintDefaults()
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
flagSet.Parse(subArgs)
|
||||
util.subCmd = subCmd
|
||||
|
||||
case updateAccountCmd:
|
||||
flagSet := flag.NewFlagSet(updateAccountCmd, flag.ExitOnError)
|
||||
|
||||
flagSet.StringVar(&util.username, "username", util.username, "user name")
|
||||
flagSet.Int64Var(&util.accountID, "accountId", util.accountID, "account ID")
|
||||
|
||||
flagSet.StringVar(&util.newUsername, "username", util.newUsername, "new user name")
|
||||
flagSet.StringVar(&util.newPassword, "password", util.newPassword, "new user password")
|
||||
flagSet.BoolVar(&util.disable, "disable", util.disable, "disable account")
|
||||
|
||||
flagSet.Usage = func() {
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("Usage: %s [global options] %s [command options]\n", exeName, subCmd)
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("The command options: none\n")
|
||||
flagSet.PrintDefaults()
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
flagSet.Parse(subArgs)
|
||||
util.subCmd = subCmd
|
||||
|
||||
default:
|
||||
help()
|
||||
return errors.New("Unknown command")
|
||||
@@ -392,6 +480,16 @@ func (util *Util) Exec() error {
|
||||
res, err = util.ListServicePairs(ctx)
|
||||
case getServicePairCmd:
|
||||
res, err = util.GetServicePair(ctx)
|
||||
|
||||
case createAccountCmd:
|
||||
res, err = util.CreateAccount(ctx)
|
||||
case updateAccountCmd:
|
||||
res, err = util.UpdateAccount(ctx)
|
||||
case listAccountsCmd:
|
||||
res, err = util.ListAccounts(ctx)
|
||||
case deleteAccountCmd:
|
||||
res, err = util.DeleteAccount(ctx)
|
||||
|
||||
default:
|
||||
err = errors.New("Unknown cli command")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user