forked from cloudfoundry-community/pe-rds-broker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
31 lines (25 loc) · 795 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package rdsbroker
import (
"errors"
"fmt"
)
type Config struct {
Region string `json:"region"`
DBPrefix string `json:"db_prefix"`
AllowUserProvisionParameters bool `json:"allow_user_provision_parameters"`
AllowUserUpdateParameters bool `json:"allow_user_update_parameters"`
AllowUserBindParameters bool `json:"allow_user_bind_parameters"`
Catalog Catalog `json:"catalog"`
}
func (c Config) Validate() error {
if c.Region == "" {
return errors.New("Must provide a non-empty Region")
}
if c.DBPrefix == "" {
return errors.New("Must provide a non-empty DBPrefix")
}
if err := c.Catalog.Validate(); err != nil {
return fmt.Errorf("Validating Catalog configuration: %s", err)
}
return nil
}