-
Notifications
You must be signed in to change notification settings - Fork 71
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
Return statusOK when resource exists #77
Conversation
We have created an issue in Pivotal Tracker to manage this: https://www.pivotaltracker.com/story/show/168191701 The labels on this github issue will be updated when the story is started. |
Thanks so much, @ataleksandrov! We should be able to review this week and get back to you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 👍
domain/service_broker.go
Outdated
@@ -169,6 +170,7 @@ type UnbindSpec struct { | |||
|
|||
type Binding struct { | |||
IsAsync bool `json:"is_async"` | |||
AlreadyExists bool `json:"-"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why this json:"-"
annotation rather than json:"already_exists"
? cc @FelisiaM
@@ -87,6 +87,16 @@ func (h APIHandler) Bind(w http.ResponseWriter, req *http.Request) { | |||
return | |||
} | |||
|
|||
if binding.AlreadyExists { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We think it makes more sense to check if the instance already exists before checking if the response is async. Whether the response is async or synchronous, we want to return 200 if the instance already exists.
There would need to be a new test to be sure that if the broker response is asyn and says that the binding already exists that the returned response is 200.
handlers/provision.go
Outdated
} | ||
|
||
var statusCode int | ||
if provisionResponse.AlreadyExists { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We think it makes more sense to check if the instance already exists before checking if the response is async. Whether the response is async or synchronous, we want to return 200 if the instance already exists.
There would need to be a new test to be sure that if the broker response is asyn and says that the instance already exists that the returned response is 200.
@FelisiaM and I took a look and left a few questions/comments as single-line comments in files. Let us know if you have questions. Thanks! |
Looks good @ataleksandrov, thanks! |
I have the same use case as in issue.
Added:
Pull request: