mirror of https://github.com/databricks/cli.git
31 lines
552 B
Go
31 lines
552 B
Go
package bundle
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/databricks/cli/libs/diag"
|
|
)
|
|
|
|
type DeferredMutator struct {
|
|
mutator Mutator
|
|
finally Mutator
|
|
}
|
|
|
|
func (d *DeferredMutator) Name() string {
|
|
return "deferred"
|
|
}
|
|
|
|
func Defer(mutator, finally Mutator) Mutator {
|
|
return &DeferredMutator{
|
|
mutator: mutator,
|
|
finally: finally,
|
|
}
|
|
}
|
|
|
|
func (d *DeferredMutator) Apply(ctx context.Context, b *Bundle) diag.Diagnostics {
|
|
var diags diag.Diagnostics
|
|
diags = diags.Extend(Apply(ctx, b, d.mutator))
|
|
diags = diags.Extend(Apply(ctx, b, d.finally))
|
|
return diags
|
|
}
|