spring-cloud-open-service-broker icon indicating copy to clipboard operation
spring-cloud-open-service-broker copied to clipboard

`ServiceInstanceBindingController.getCreateResponseCode` should fail on `response.isBindingExisted()`

Open andrejb-dev opened this issue 4 years ago • 4 comments

To generate the response in ServiceInstanceBindingController.createServiceInstanceBinding this little method is called:

https://github.com/spring-cloud/spring-cloud-open-service-broker/blob/a32b84e1836f37b74a40bf1a8262c9c924f63cb8/spring-cloud-open-service-broker-core/src/main/java/org/springframework/cloud/servicebroker/controller/ServiceInstanceBindingController.java#L144-L155

When the binding existed the method returns 200 OK. But based on OSB api spec (both v2.15 and v2.16), the response should fail with 409 Conflict

409 Conflict MUST be returned if a Service Binding with the same id, for the same Service Instance, already exists or is being created but with different parameters.

Maybe I misunderstood that or am I missing something? Thanks.

andrejb-dev avatar Mar 15 '21 16:03 andrejb-dev

Thanks for reporting! I'll review the spec and double check our tests.

royclarkson avatar Mar 16 '21 15:03 royclarkson

hmm. this is a bit ambiguous. the spec also says a 200 OK SHOULD be returned if the Service Binding already exists and the requested parameters are identical to the existing Service Binding.

royclarkson avatar Sep 29 '21 21:09 royclarkson

I see. I think the difference is in the parameters (if same 200 OK, if different 409 conflict)

andrejb-dev avatar Oct 25 '21 08:10 andrejb-dev

response.isBindingExisted() isn't adequate to support those two different scenarios. It might make sense to deprecate this property and provide an alternative method for configuring or returning the correct response code. If we do that, then it would be the responsibility of the developer to determine whether the parameters are identical or not.

royclarkson avatar Oct 29 '21 17:10 royclarkson

We already have a ServiceInstanceBindingExistsException that you can throw to return a 409, so this change isn't correct. Reopening this issue to reevaluate how to handle this.

royclarkson avatar Feb 28 '23 19:02 royclarkson