fix: make instance ID required field

This commit is contained in:
garethgeorge
2024-07-01 21:05:50 -07:00
parent 90e0656fc4
commit 7c8ded2fcc
5 changed files with 42 additions and 59 deletions

View File

@@ -6,7 +6,6 @@ import (
v1 "github.com/garethgeorge/backrest/gen/go/v1"
"github.com/garethgeorge/backrest/pkg/restic"
"go.uber.org/zap"
)
// ValidateOperation verifies critical properties of the operation proto.
@@ -24,7 +23,7 @@ func ValidateOperation(op *v1.Operation) error {
return errors.New("operation.plan_id is required")
}
if op.InstanceId == "" {
zap.L().Warn("operation.instance_id should typically be set")
return errors.New("operation.instance_id is required")
}
if op.SnapshotId != "" {
if err := restic.ValidateSnapshotId(op.SnapshotId); err != nil {