Skip to content

Commit

Permalink
Add additional checking for required parameters
Browse files Browse the repository at this point in the history
This allows us to quickly show an error instead of trying the request (and failing).
  • Loading branch information
Piccirello committed Jul 9, 2020
1 parent 5c51d71 commit ba96035
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/cmd/enclave_configs_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var configsLogsGetCmd = &cobra.Command{
if len(args) > 0 {
log = args[0]
}
utils.RequireValue("log", log)

configLog, err := http.GetConfigLog(localConfig.APIHost.Value, utils.GetBool(localConfig.VerifyTLS.Value, true), localConfig.Token.Value, localConfig.EnclaveProject.Value, localConfig.EnclaveConfig.Value, log)
if !err.IsNil() {
Expand Down Expand Up @@ -88,6 +89,7 @@ var configsLogsRollbackCmd = &cobra.Command{
if len(args) > 0 {
log = args[0]
}
utils.RequireValue("log", log)

configLog, err := http.RollbackConfigLog(localConfig.APIHost.Value, utils.GetBool(localConfig.VerifyTLS.Value, true), localConfig.Token.Value, localConfig.EnclaveProject.Value, localConfig.EnclaveConfig.Value, log)
if !err.IsNil() {
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/enclave_configs_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var configsTokensGetCmd = &cobra.Command{
if len(args) > 0 {
slug = args[0]
}
utils.RequireValue("slug", slug)

tokens, err := http.GetConfigServiceTokens(localConfig.APIHost.Value, utils.GetBool(localConfig.VerifyTLS.Value, true), localConfig.Token.Value, localConfig.EnclaveProject.Value, localConfig.EnclaveConfig.Value)
if !err.IsNil() {
Expand Down Expand Up @@ -97,6 +98,7 @@ var configsTokensCreateCmd = &cobra.Command{
if len(args) > 0 {
name = args[0]
}
utils.RequireValue("name", name)

configToken, err := http.CreateConfigServiceToken(localConfig.APIHost.Value, utils.GetBool(localConfig.VerifyTLS.Value, true), localConfig.Token.Value, localConfig.EnclaveProject.Value, localConfig.EnclaveConfig.Value, name)
if !err.IsNil() {
Expand Down Expand Up @@ -125,6 +127,7 @@ var configsTokensRevokeCmd = &cobra.Command{
if len(args) > 0 {
slug = args[0]
}
utils.RequireValue("slug", slug)

err := http.DeleteConfigServiceToken(localConfig.APIHost.Value, utils.GetBool(localConfig.VerifyTLS.Value, true), localConfig.Token.Value, localConfig.EnclaveProject.Value, localConfig.EnclaveConfig.Value, slug)
if !err.IsNil() {
Expand Down

0 comments on commit ba96035

Please sign in to comment.