| 67 | } |
| 68 | |
| 69 | func (s *Spec) Validate() error { |
| 70 | if len(s.StorageAccount) == 0 { |
| 71 | return errors.New("`storage_account` is required") |
| 72 | } |
| 73 | if len(s.Container) == 0 { |
| 74 | return errors.New("`container` is required") |
| 75 | } |
| 76 | if len(s.Path) == 0 { |
| 77 | return errors.New("`path` is required") |
| 78 | } |
| 79 | |
| 80 | if s.NoRotate && ((s.BatchSize != nil && *s.BatchSize > 0) || (s.BatchSizeBytes != nil && *s.BatchSizeBytes > 0) || (s.BatchTimeout != nil && s.BatchTimeout.Duration() > 0)) { |
| 81 | return errors.New("`no_rotate` cannot be used with non-zero `batch_size`, `batch_size_bytes` or `batch_timeout`") |
| 82 | } |
| 83 | |
| 84 | // required for s.FileSpec.Validate call |
| 85 | err := s.FileSpec.UnmarshalSpec() |
| 86 | if err != nil { |
| 87 | return err |
| 88 | } |
| 89 | s.FileSpec.SetDefaults() |
| 90 | |
| 91 | return s.FileSpec.Validate() |
| 92 | } |
| 93 | |
| 94 | func int64ptr(i int64) *int64 { |
| 95 | return &i |