func()

in image/resources/netapp-exports/config.go [104:136]


func (s *NetAppServer) validate() error {
	if s.Host == "" {
		return errors.New("host not set")
	}

	if s.URL == "" {
		return errors.New("API URL not set")
	}

	if s.User == "" {
		return errors.New("username not set")
	}

	if s.Password == "" && s.SecurePassword == nil {
		return errors.New("no password provided")
	}

	if s.Password != "" && s.SecurePassword != nil {
		return errors.New("only one password source permitted")
	}

	if s.SecurePassword != nil {
		s.SecurePassword.validate()
	}

	// Ensure TLS always has a value, this simplifies the code later by
	// removing repeated nil checks.
	if s.TLS == nil {
		s.TLS = &TLSConfig{}
	}

	return nil
}