2023-05-24 12:45:19 +00:00
|
|
|
package bundle
|
|
|
|
|
2024-03-25 14:18:47 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/databricks/cli/libs/diag"
|
|
|
|
)
|
2023-05-24 12:45:19 +00:00
|
|
|
|
|
|
|
type seqMutator struct {
|
|
|
|
mutators []Mutator
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *seqMutator) Name() string {
|
|
|
|
return "seq"
|
|
|
|
}
|
|
|
|
|
2024-03-25 14:18:47 +00:00
|
|
|
func (s *seqMutator) Apply(ctx context.Context, b *Bundle) diag.Diagnostics {
|
|
|
|
var diags diag.Diagnostics
|
2023-05-24 12:45:19 +00:00
|
|
|
for _, m := range s.mutators {
|
2024-03-25 14:18:47 +00:00
|
|
|
diags = diags.Extend(Apply(ctx, b, m))
|
|
|
|
if diags.HasError() {
|
|
|
|
break
|
2023-05-24 12:45:19 +00:00
|
|
|
}
|
|
|
|
}
|
2024-03-25 14:18:47 +00:00
|
|
|
return diags
|
2023-05-24 12:45:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func Seq(ms ...Mutator) Mutator {
|
|
|
|
return &seqMutator{mutators: ms}
|
|
|
|
}
|