package hostops import ( "context" "github.com/carlosframework/platform/internal/hostclaim" "github.com/carlosframework/platform/internal/park" "github.com/carlosframework/platform/internal/termfence" ) // MoveFenceRegions preserves the verifier's roster/enrollment checks, then // projects only its region binding into the move's engine vocabulary. // Signed fence bytes and the cloud region are never edited. type MoveFenceRegions struct { Authority hostclaim.FenceAuthority HomeRegion string } func (a MoveFenceRegions) ValidateFence(ctx context.Context, f termfence.Record) (hostclaim.FenceBinding, error) { if a.Authority == nil { return hostclaim.FenceBinding{}, hostclaim.ErrFence } binding, err := a.Authority.ValidateFence(ctx, f) if err != nil { return hostclaim.FenceBinding{}, err } if binding.Region == "" || (a.HomeRegion != "" && (a.HomeRegion != binding.FleetHomeRegion || park.PlacementRegion(a.HomeRegion) != a.HomeRegion)) { return hostclaim.FenceBinding{}, hostclaim.ErrFence } binding.Region = park.PlacementRegion(park.HomePlacementCode(a.HomeRegion, binding.Region)) if binding.Region == "" { return hostclaim.FenceBinding{}, hostclaim.ErrFence } return binding, nil }