1234567891011121314151617181920212223242526272829 |
- package storage
- import "git.linuxforward.com/byom/byom-golang-lib/pkg/errors"
- // Config holds the storage configuration
- type Config struct {
- Endpoint string `yaml:"endpoint"`
- AccessKeyID string `yaml:"access_key_id"`
- SecretAccessKey string `yaml:"secret_access_key"`
- UseSSL bool `yaml:"use_ssl"`
- BucketName string `yaml:"bucket_name"`
- }
- // Validate implements the config.Validator interface
- func (c *Config) Validate() error {
- if c.Endpoint == "" {
- return errors.NewConfigError("storage.endpoint", errors.ErrInvalidInput)
- }
- if c.AccessKeyID == "" {
- return errors.NewConfigError("storage.access_key_id", errors.ErrInvalidInput)
- }
- if c.SecretAccessKey == "" {
- return errors.NewConfigError("storage.secret_access_key", errors.ErrInvalidInput)
- }
- if c.BucketName == "" {
- return errors.NewConfigError("storage.bucket_name", errors.ErrInvalidInput)
- }
- return nil
- }
|