Fix validate for region.
* survey.Required already ensures at least one selection.
This commit is contained in:
parent
6b8e6fc2c2
commit
6c3e3ad912
@ -176,18 +176,6 @@ func validateAlias(val interface{}) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateRegions(val interface{}) error {
|
|
||||||
if regions, ok := val.([]string); ok {
|
|
||||||
if len(regions) < 1 {
|
|
||||||
return errors.New("need at least one region")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return fmt.Errorf("expected type []string got %v", reflect.TypeOf(val).Name())
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func certificateAuthorityQuestions(config *SSHrimp) []*survey.Question {
|
func certificateAuthorityQuestions(config *SSHrimp) []*survey.Question {
|
||||||
defaultAccountID := ""
|
defaultAccountID := ""
|
||||||
if config.CertificateAuthority.AccountID > 0 {
|
if config.CertificateAuthority.AccountID > 0 {
|
||||||
@ -217,10 +205,7 @@ func certificateAuthorityQuestions(config *SSHrimp) []*survey.Question {
|
|||||||
Options: supportedAwsRegions,
|
Options: supportedAwsRegions,
|
||||||
PageSize: 10,
|
PageSize: 10,
|
||||||
},
|
},
|
||||||
Validate: survey.ComposeValidators(
|
Validate: survey.Required,
|
||||||
survey.Required,
|
|
||||||
validateRegions,
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "FunctionName",
|
Name: "FunctionName",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user