Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scd] oir upsert: check uss base URL and if both subscription ID and implicit request are specified #1097

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pkg/scd/operational_intents_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,18 @@ func validateAndReturnUpsertParams(
}
}

if params.NewSubscription != nil {
// The spec states that NewSubscription.UssBaseUrl is required and an empty value
// makes no sense, so we will fail if an implicit subscription is requested but the base url is empty
if params.NewSubscription.UssBaseUrl == "" {
return nil, stacktrace.NewError("Missing required USS base url for new subscription (in parameters for implicit subscription)")
}
// If an implicit subscription is requested, the Subscription ID cannot be present.
if params.SubscriptionId != nil {
return nil, stacktrace.NewError("Cannot provide both a Subscription ID and request an implicit subscription")
}
}

// Check if a subscription is required for this request:
// OIRs in an accepted state do not need a subscription.
if valid.state.RequiresSubscription() &&
Expand Down
Loading