-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Supports private issue https://github.com/orange-cloudfoundry/paas-templates/issues/1360
Async service binding is now available in cf java client in https://github.com/cloudfoundry/cf-java-client/releases/tag/v5.9.0.RELEASE thanks to cloudfoundry/cf-java-client#1158
http://v3-apidocs.cloudfoundry.org/version/3.203.0/index.html#asynchronous-operations
Unlike V2, clients cannot opt-in for asynchronous responses from endpoints. Instead, endpoints that require asynchronous processing will return 202 Accepted with a Location header pointing to the job resource to poll. Endpoints that do not require asynchronous processing will respond synchronously.
For clients that want to report the outcome of an asynchronous operation, poll the job in the Location header until its state is no longer PROCESSING. If the job’s state is FAILED, the errors field will contain any errors that occurred during the operation.
Service related endpoints such as service instance, service credential binding and service route binding may create jobs that transition to state POLLING after PROCESSING. This state reflects the polling of the last operation from the service broker. For clients that want to report the outcome of this asynchronous operation, poll the job in the Location header until its state is no longer POLLING.
Protocol mapping outline
https://github.com/cloudfoundry/servicebroker/blob/master/spec.md#request-creating-a-service-binding
https://github.com/cloudfoundry/servicebroker/blob/master/spec.md#polling-last-operation-for-service-bindings
https://github.com/cloudfoundry/servicebroker/blob/master/spec.md#fetching-a-service-binding
http://v3-apidocs.cloudfoundry.org/version/3.203.0/index.html#create-a-service-credential-binding
http://v3-apidocs.cloudfoundry.org/version/3.203.0/index.html#get-a-job
http://v3-apidocs.cloudfoundry.org/version/3.203.0/index.html#get-a-service-credential-binding-details
sequenceDiagram
actor osb-client
actor osb-cmdb-broker
actor cf
osb-client ->>+ osb-cmdb-broker: PUT /v2/service_instances/:instance_id/service_bindings/:binding_id
osb-cmdb-broker ->>+ cf: POST /POST /v2/service_bindings<br>name=:binding_id,accepts_incomplete=false
note right of osb-cmdb-broker: return sync credentials if supported
cf ->> osb-cmdb-broker: HTTP/1.1 201 created<br>credentials
osb-cmdb-broker ->> osb-client: returns 201 Created, response contains credentials
cf ->>- osb-cmdb-broker: HTTP/1.1 4xx Async not supported
note right of osb-cmdb-broker: continue with new async request if sync not supported
osb-cmdb-broker ->>+ cf: POST /v3/service_credential_bindings<br>name=:binding_id
cf ->>- osb-cmdb-broker: HTTP/1.1 202 Accepted, <br/>Location:https://api.../v3/jobs/job-id
osb-cmdb-broker ->>- osb-client: returns 202 Accepted, body{operation} with operation holding jobid
osb-client ->>+ osb-cmdb-broker: GET /v2/service_instances/:instance_id/service_bindings/:binding_id/last_operation<br/>with body{operation}
osb-cmdb-broker ->>+ cf: GET /v3/jobs/:guid
cf ->>- osb-cmdb-broker: return state
osb-cmdb-broker ->>- osb-client: If COMPLETE then return {state": "succeeded"}<br/>If not, return {state": "in progress"}
osb-client ->>+ osb-cmdb-broker: GET /v2/service_instances/:instance_id/service_bindings/:binding_id
osb-cmdb-broker ->>+ cf: GET /v3/service_credential_bindings?service_instance_names=:instance_id <br> & names=:binding_id & type=key
cf ->>- osb-cmdb-broker: 200 OK <br/>resources json, with binding guid
osb-cmdb-broker ->>+ cf: GET /v3/service_credential_bindings/:guid/details
cf ->>- osb-cmdb-broker: 200 OK <br/>credentials json
osb-cmdb-broker ->>- osb-client: 200 OK <br/> credentials json