Skip to content

Commit

Permalink
[scd] oir upsert: fail early with Bad request if both a subscription …
Browse files Browse the repository at this point in the history
…ID and implicit request are specified
  • Loading branch information
Shastick committed Sep 2, 2024
1 parent 02f8ac9 commit d33de8b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/scd/operational_intents_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,17 @@ 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 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

0 comments on commit d33de8b

Please sign in to comment.