java.lang.Object
org.springframework.cloud.servicebroker.controller.BaseController
Direct Known Subclasses:
CatalogController, ServiceInstanceBindingController, ServiceInstanceController

public class BaseController extends Object
Base functionality shared by controllers.
Author:
S Greenberg, Scott Frederick, Roy Clarkson
  • Field Details

  • Constructor Details

    • BaseController

      public BaseController(CatalogService catalogService)
      Construct a new BaseController.
      Parameters:
      catalogService - the catalog service
  • Method Details

    • configureCommonRequestFields

      protected reactor.core.publisher.Mono<ServiceBrokerRequest> configureCommonRequestFields(ServiceBrokerRequest request, String platformInstanceId, String apiInfoLocation, String originatingIdentityString, String requestIdentity)
      Sets common headers for the request.
      Parameters:
      request - the request in which to set the headers
      platformInstanceId - the platform instance ID
      apiInfoLocation - location of the API info endpoint of the platform instance
      originatingIdentityString - identity of the user that initiated the request from the platform
      requestIdentity - identity of the request sent from the platform
      Returns:
      the request with the applied headers
    • configureCommonRequestFields

      protected reactor.core.publisher.Mono<AsyncServiceBrokerRequest> configureCommonRequestFields(AsyncServiceBrokerRequest request, String platformInstanceId, String apiInfoLocation, String originatingIdentityString, String requestIdentity, boolean asyncAccepted)
      Sets common headers for the request.
      Parameters:
      request - the request in which to set the headers
      platformInstanceId - the platform instance ID
      apiInfoLocation - location of the API info endpoint of the platform instance
      originatingIdentityString - identity of the user that initiated the request from the platform
      requestIdentity - identity of the request sent from the platform
      asyncAccepted - does the platform accept asynchronous requests
      Returns:
      the request with the applied headers
    • getRequiredServiceDefinition

      protected reactor.core.publisher.Mono<ServiceDefinition> getRequiredServiceDefinition(String serviceDefinitionId)
      Find the Service Definition for the provided ID. Emits an error if not found.
      Parameters:
      serviceDefinitionId - the service definition ID
      Returns:
      the Service Definition
    • getServiceDefinition

      protected reactor.core.publisher.Mono<ServiceDefinition> getServiceDefinition(String serviceDefinitionId)
      Find the Service Definition for the provided ID, or empty if not found.
      Parameters:
      serviceDefinitionId - the service definition ID
      Returns:
      the Service Definition
    • getServiceDefinitionPlan

      protected reactor.core.publisher.Mono<Plan> getServiceDefinitionPlan(ServiceDefinition serviceDefinition, String planId)
      Find the Plan for the Service Definition and Plan ID, or empty if not found.
      Parameters:
      serviceDefinition - the Service Definition
      planId - the plan ID
      Returns:
      the Plan
    • getRequiredServiceDefinitionPlan

      protected reactor.core.publisher.Mono<Plan> getRequiredServiceDefinitionPlan(ServiceDefinition serviceDefinition, String planId)
      Find the Plan for the Service Definition and Plan ID. Emits an error if not found.
      Parameters:
      serviceDefinition - the Service Definition
      planId - the plan ID
      Returns:
      the Plan
    • parseOriginatingIdentity

      protected Context parseOriginatingIdentity(String originatingIdentityString)
      Populates a platform specific context from the originating identity.
      Parameters:
      originatingIdentityString - identity of the user that initiated the request from the platform
      Returns:
      the Context
    • getAsyncResponseCode

      protected HttpStatus getAsyncResponseCode(AsyncServiceBrokerResponse response)
      If an asynchronous request is received, then return HTTP 202 Accepted, otherwise HTTP 200 OK.
      Parameters:
      response - the response
      Returns:
      the HTTP status