Skip to content

Commit

Permalink
fix: error message used by CR Authenticator (#126)
Browse files Browse the repository at this point in the history
This commit changes the error message used by the
ComputeResourceAuthenticator to report a validation
error when neither of the `IAMProfileName` or `IAMProfileID`
properties are specified by the user.
The error message is now:
`At least one of IAMProfileName or IAMProfileID must be specified.`
  • Loading branch information
padamstx authored Jul 27, 2021
1 parent fb19fe9 commit 3632ce6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions v5/core/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const (
ERRORMSG_PROP_MISSING = "The %s property is required but was not specified."
ERRORMSG_PROP_INVALID = "The %s property is invalid. Please remove any surrounding {, }, or \" characters."
ERRORMSG_EXCLUSIVE_PROPS_ERROR = "Exactly one of %s or %s must be specified."
ERRORMSG_ATLEAST_ONE_PROP_ERROR = "At least one of %s or %s must be specified."
ERRORMSG_NO_AUTHENTICATOR = "Authentication information was not properly configured."
ERRORMSG_AUTHTYPE_UNKNOWN = "Unrecognized authentication type: %s"
ERRORMSG_PROPS_MAP_NIL = "The 'properties' map cannot be nil."
Expand Down
2 changes: 1 addition & 1 deletion v5/core/cr_authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (authenticator *ComputeResourceAuthenticator) Validate() error {

// Check to make sure that one of IAMProfileName or IAMProfileID are specified.
if authenticator.IAMProfileName == "" && authenticator.IAMProfileID == "" {
return fmt.Errorf(ERRORMSG_EXCLUSIVE_PROPS_ERROR, "IAMProfileName", "IAMProfileID")
return fmt.Errorf(ERRORMSG_ATLEAST_ONE_PROP_ERROR, "IAMProfileName", "IAMProfileID")
}

// Validate ClientId and ClientSecret. They must both be specified togther or neither should be specified.
Expand Down

0 comments on commit 3632ce6

Please sign in to comment.