aws: document ValidateRegion better
This commit is contained in:
parent
6af621c37a
commit
ce8532e94b
|
@ -19,8 +19,10 @@ func listEC2Regions(ec2conn ec2iface.EC2API) ([]string, error) {
|
|||
return regions, nil
|
||||
}
|
||||
|
||||
// ValidateRegion returns true if the supplied region is a valid AWS
|
||||
// region and false if it's not.
|
||||
// ValidateRegion returns an nil if the regions are valid
|
||||
// and exists; otherwise an error.
|
||||
// ValidateRegion calls ec2conn.DescribeRegions to get the list of
|
||||
// regions available to this account.
|
||||
func (c *AccessConfig) ValidateRegion(regions ...string) error {
|
||||
ec2conn, err := c.NewEC2Connection()
|
||||
if err != nil {
|
||||
|
@ -50,7 +52,7 @@ func (c *AccessConfig) ValidateRegion(regions ...string) error {
|
|||
}
|
||||
|
||||
if len(invalidRegions) > 0 {
|
||||
return fmt.Errorf("Invalid region(s): %v", invalidRegions)
|
||||
return fmt.Errorf("Invalid region(s): %v, available regions: %v", invalidRegions, validRegions)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue