()
| 46 | } |
| 47 | |
| 48 | func (f *Function) Validate() error { |
| 49 | if f.Name == "" { |
| 50 | return errors.New("function name shouldn't be empty") |
| 51 | } |
| 52 | if strings.Contains(f.Name, "/") { |
| 53 | return errors.New("name should not contain '/'") |
| 54 | } |
| 55 | if strings.Contains(f.Namespace, "/") { |
| 56 | return errors.New("namespace should not contain '/'") |
| 57 | } |
| 58 | if len(f.Sources) == 0 { |
| 59 | return errors.New("sources should be configured") |
| 60 | } |
| 61 | if f.Replicas <= 0 { |
| 62 | return errors.New("replicas should be greater than 0") |
| 63 | } |
| 64 | return nil |
| 65 | } |
no outgoing calls
no test coverage detected