move deploy.operation package to operation

This commit is contained in:
Pasha Sviderski
2026-10-26 15:19:38 +10:00
parent c16e452439
commit e50c7a0cf6
12 changed files with 9 additions and 9 deletions
+39
View File
@@ -0,0 +1,39 @@
package operation
import (
"context"
"fmt"
"strings"
)
// SequenceOperation is a composite operation that executes a sequence of operations in order.
type SequenceOperation struct {
Operations []Operation
}
func (o *SequenceOperation) Execute(ctx context.Context, cli Client) error {
for _, op := range o.Operations {
if err := op.Execute(ctx, cli); err != nil {
return err
}
}
return nil
}
func (o *SequenceOperation) Format() string {
lines := make([]string, len(o.Operations))
for i, op := range o.Operations {
lines[i] = op.Format()
}
return strings.Join(lines, "\n")
}
func (o *SequenceOperation) String() string {
ops := make([]string, len(o.Operations))
for i, op := range o.Operations {
ops[i] = op.String()
}
return fmt.Sprintf("SequenceOperation[%s]", strings.Join(ops, ", "))
}