2026-05-23 09:18:02 +08:00
|
|
|
package access
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type closurePlan struct {
|
2026-05-23 17:06:52 +08:00
|
|
|
effectiveProbeAPIKey string
|
|
|
|
|
effectiveProbeKeySource string
|
2026-05-23 09:18:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Service) prepareClosurePlan(ctx context.Context, req ClosureRequest) (closurePlan, error) {
|
2026-05-23 17:06:52 +08:00
|
|
|
requestedProbeAPIKey := strings.TrimSpace(req.ProbeAPIKey)
|
|
|
|
|
plan := closurePlan{
|
|
|
|
|
effectiveProbeAPIKey: requestedProbeAPIKey,
|
|
|
|
|
}
|
|
|
|
|
if requestedProbeAPIKey != "" {
|
|
|
|
|
plan.effectiveProbeKeySource = ProbeKeySourceRequestedProbeAPIKey
|
|
|
|
|
}
|
2026-05-23 09:18:02 +08:00
|
|
|
if strings.TrimSpace(req.Mode) != ModeSubscription {
|
|
|
|
|
return plan, nil
|
|
|
|
|
}
|
|
|
|
|
return s.prepareSubscriptionPlan(ctx, req, plan)
|
|
|
|
|
}
|