private static Mono<PrivateDomainResource> getPrivateDomain( CloudFoundryClient cloudFoundryClient, String domain) { return requestListPrivateDomains(cloudFoundryClient, domain) .single() .otherwise( NoSuchElementException.class, t -> ExceptionUtils.illegalArgument("Private domain %s does not exist", domain)); }
private static Mono<OrganizationResource> getOrganization( CloudFoundryClient cloudFoundryClient, String organization) { return requestOrganizations(cloudFoundryClient, organization) .single() .otherwise( NoSuchElementException.class, t -> ExceptionUtils.illegalArgument("Organization %s does not exist", organization)); }
@Override public Mono<Boolean> exists(RouteExistsRequest request) { return get( request, Boolean.class, function( (builder, validRequest) -> builder.pathSegment( "v2", "routes", "reserved", "domain", validRequest.getDomainId(), "host", validRequest.getHost()))) .defaultIfEmpty(true) .otherwise(ExceptionUtils.replace(CF_NOT_FOUND, () -> Mono.just(false))); }