use of org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingController method getServiceInstanceBinding.
@GetMapping(value = { "/{platformInstanceId}/v2/service_instances/{instanceId}/service_bindings/{bindingId}", "/v2/service_instances/{instanceId}/service_bindings/{bindingId}" })
public ResponseEntity<GetServiceInstanceBindingResponse> getServiceInstanceBinding(@PathVariable Map<String, String> pathVariables, @PathVariable(INSTANCE_ID_PATH_VARIABLE) String serviceInstanceId, @PathVariable(BINDING_ID_PATH_VARIABLE) String bindingId, @RequestHeader(value = API_INFO_LOCATION_HEADER, required = false) String apiInfoLocation, @RequestHeader(value = ORIGINATING_IDENTITY_HEADER, required = false) String originatingIdentityString) {
GetServiceInstanceBindingRequest request = GetServiceInstanceBindingRequest.builder().serviceInstanceId(serviceInstanceId).bindingId(bindingId).platformInstanceId(pathVariables.get(PLATFORM_INSTANCE_ID_VARIABLE)).apiInfoLocation(apiInfoLocation).originatingIdentity(parseOriginatingIdentity(originatingIdentityString)).build();
LOGGER.debug("Getting a service instance binding: request={}", request);
GetServiceInstanceBindingResponse response = serviceInstanceBindingService.getServiceInstanceBinding(request);
LOGGER.debug("Getting a service instance binding succeeded: bindingId={}", bindingId);
return new ResponseEntity<>(response, HttpStatus.OK);
}
use of org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerRequestTest method getServiceBindingParametersAreMappedToRequest.
@Test
public void getServiceBindingParametersAreMappedToRequest() {
GetServiceInstanceBindingRequest expectedRequest = GetServiceInstanceBindingRequest.builder().serviceInstanceId("service-instance-id").bindingId("binding-id").platformInstanceId("platform-instance-id").apiInfoLocation("api-info-location").originatingIdentity(identityContext).build();
ServiceInstanceBindingController controller = createControllerUnderTest(expectedRequest);
controller.getServiceInstanceBinding(pathVariables, "service-instance-id", "binding-id", "api-info-location", encodeOriginatingIdentity(identityContext));
}
use of org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method getBindingToRouteSucceeds.
@Test
public void getBindingToRouteSucceeds() throws Exception {
setupServiceInstanceBindingService(GetServiceInstanceRouteBindingResponse.builder().build());
mockMvc.perform(get(buildCreateUrl(PLATFORM_INSTANCE_ID)).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk());
GetServiceInstanceBindingRequest actualRequest = verifyGetBinding();
assertHeaderValuesSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method getBindingToAppSucceeds.
@Test
public void getBindingToAppSucceeds() throws Exception {
setupServiceInstanceBindingService(GetServiceInstanceAppBindingResponse.builder().build());
mockMvc.perform(get(buildCreateUrl(PLATFORM_INSTANCE_ID)).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk());
GetServiceInstanceBindingRequest actualRequest = verifyGetBinding();
assertHeaderValuesSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method getBindingToRouteSucceeds.
@Test
public void getBindingToRouteSucceeds() throws Exception {
setupServiceInstanceBindingService(GetServiceInstanceRouteBindingResponse.builder().build());
client.get().uri(buildCreateUrl(PLATFORM_INSTANCE_ID)).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk();
GetServiceInstanceBindingRequest actualRequest = verifyGetBinding();
assertHeaderValuesSet(actualRequest);
}
Aggregations