Files
sub2api-cn-relay-manager/internal/access/planner.go

26 lines
607 B
Go
Raw Normal View History

package access
import (
"context"
"strings"
)
type closurePlan struct {
effectiveProbeAPIKey string
effectiveProbeKeySource string
}
func (s *Service) prepareClosurePlan(ctx context.Context, req ClosureRequest) (closurePlan, error) {
requestedProbeAPIKey := strings.TrimSpace(req.ProbeAPIKey)
plan := closurePlan{
effectiveProbeAPIKey: requestedProbeAPIKey,
}
if requestedProbeAPIKey != "" {
plan.effectiveProbeKeySource = ProbeKeySourceRequestedProbeAPIKey
}
if strings.TrimSpace(req.Mode) != ModeSubscription {
return plan, nil
}
return s.prepareSubscriptionPlan(ctx, req, plan)
}