1. Service Bindings
Service brokers can provide information to a consumer of a service instance through a {osbspec}#binding[service binding]. Service bindings are often used to expose credentials for service instance resources to an application.
If the bindable
field is set to true
for any plan in the service catalog, the service broker must provide an implementation of the {scosb-api-services}ServiceInstanceBindingService.html[ServiceInstanceBindingService
] interface.
Otherwise, the binding methods of the service broker are not called by the platform, and a default implementation of this interface can be used.
Each method receives a single Java object parameter that contains all details of the request from the platform and returns a Java object value that provides details of the operation to the platform.
1.1. Service Binding Creation
The service broker must provide an implementation of the {scosb-api-services}ServiceInstanceBindingService.html#createServiceInstanceBinding-org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest-[createServiceInstanceBinding()].
Two types of bindings are supported:
-
App bindings can be used to provide credentials, log drains, and volume services to applications.
-
Route bindings can be used to provide routes for the platform to use when proxying requests.
The response from this method lets one of two Java object types be returned, reflecting the two types of supported bindings.
Service brokers can generate one set of credentials for all binding requests or provide unique credentials for each binding request.
1.1.1. Event Registry
Service binding creation can be further customized by utilizing events. Autowire the {scosb-api-service-events}/EventFlowRegistries.html[EventFlowRegistries] bean and retrieve the {scosb-api-service-events}/CreateServiceInstanceBindingEventFlowRegistry.html[CreateServiceInstanceBindingEventFlowRegistry] via the {scosb-api-service-events}/EventFlowRegistries.html#getCreateInstanceBindingRegistry--[getCreateInstanceBindingRegistry()] accessor. Use the {scosb-api-service-events}/EventFlowRegistry.html#addInitializationFlow-I-[addInitializationFlow()], {scosb-api-service-events}/EventFlowRegistry.html#addCompletionFlow-C-[addCompletionFlow()] or {scosb-api-service-events}/EventFlowRegistry.html#addErrorFlow-E-[addErrorFlow()] methods to register custom reactive flows for execution during the various stages of creating a service binding.
1.2. Service Binding Deletion
The service broker must provide an implementation of the {scosb-api-services}ServiceInstanceBindingService.html#deleteServiceInstanceBinding-org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest-[deleteServiceInstanceBinding()].
Any credentials provisioned in the create operation should be deprovisioned by the delete operation.
1.2.1. Event Registry
Service binding deletion can be further customized by utilizing events. Autowire the {scosb-api-service-events}/EventFlowRegistries.html[EventFlowRegistries] bean and retrieve the {scosb-api-service-events}/DeleteServiceInstanceBindingEventFlowRegistry.html[DeleteServiceInstanceBindingEventFlowRegistry] via the {scosb-api-service-events}/EventFlowRegistries.html#getDeleteInstanceBindingRegistry--[getDeleteInstanceBindingRegistry()] accessor. Use the {scosb-api-service-events}/EventFlowRegistry.html#addInitializationFlow-I-[addInitializationFlow()], {scosb-api-service-events}/EventFlowRegistry.html#addCompletionFlow-C-[addCompletionFlow()] or {scosb-api-service-events}/EventFlowRegistry.html#addErrorFlow-E-[addErrorFlow()] methods to register custom reactive flows for execution during the various stages of deleting a service binding.
1.3. Service Binding Retrieval
If the bindings_retrievable
field is set to true
in the services catalog, the service catalog must provide an implementation of the {scosb-api-services}ServiceInstanceBindingService.html#getServiceInstanceBinding-org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingRequest-[getServiceInstanceBinding()].
Otherwise, this method is never called by the platform, and the default implementation in the interface can be used.
Service brokers are responsible for maintaining any service binding state necessary to support the retrieval operation.