use of org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingResponse 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.GetServiceInstanceBindingResponse in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerResponseCodeTest method getServiceBindingWithMissingServiceInstanceGivesExpectedStatus.
@Test
void getServiceBindingWithMissingServiceInstanceGivesExpectedStatus() {
given(bindingService.getServiceInstanceBinding(any(GetServiceInstanceBindingRequest.class))).willThrow(new ServiceInstanceDoesNotExistException("nonexistent-service-id"));
ResponseEntity<GetServiceInstanceBindingResponse> responseEntity = controller.getServiceInstanceBinding(pathVariables, "nonexistent-service-id", "nonexistent-binding-id", null, null, null, null, null).block();
assertThat(responseEntity).isNotNull();
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}
use of org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingResponse in project spring-cloud-open-service-broker by spring-cloud.
the class ExampleServiceBindingService method getServiceInstanceBinding.
@Override
public Mono<GetServiceInstanceBindingResponse> getServiceInstanceBinding(GetServiceInstanceBindingRequest request) {
String serviceInstanceId = request.getServiceInstanceId();
String bindingId = request.getBindingId();
//
// retrieve the details of the specified service binding
//
String url = new String();
String bindingUsername = new String();
String bindingPassword = new String();
GetServiceInstanceBindingResponse response = GetServiceInstanceAppBindingResponse.builder().credentials("username", bindingUsername).credentials("password", bindingPassword).credentials("url", url).build();
return Mono.just(response);
}
use of org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingResponse in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerResponseCodeTest method getServiceBindingWithResponseGivesExpectedStatus2.
@Test
void getServiceBindingWithResponseGivesExpectedStatus2() {
GetServiceInstanceBindingResponse response = GetServiceInstanceAppBindingResponse.builder().build();
validateGetServiceBindingResponseStatus(response, HttpStatus.OK);
}
use of org.springframework.cloud.servicebroker.model.binding.GetServiceInstanceBindingResponse in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerResponseCodeTest method getServiceBindingWithMissingBindingGivesExpectedStatus.
@Test
void getServiceBindingWithMissingBindingGivesExpectedStatus() {
given(bindingService.getServiceInstanceBinding(any(GetServiceInstanceBindingRequest.class))).willThrow(new ServiceInstanceBindingDoesNotExistException("binding-id"));
ResponseEntity<GetServiceInstanceBindingResponse> responseEntity = controller.getServiceInstanceBinding(pathVariables, null, null, null, null, null, null, null).block();
assertThat(responseEntity).isNotNull();
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}
Aggregations