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.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.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.

1.4. Example Implementation

The following example shows an implementation of a service binding:

Unresolved directive in service-bindings.adoc - include::{examples-dir}/ExampleServiceBindingService.java[]