Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ private static Mono<String> updateServiceInstanceByName(CloudFoundryClient cloud
.build())
.map(serviceInstances -> serviceInstances.getResources().get(0))
.flatMap(serviceInstance -> updateServiceInstanceById(cloudFoundryClient, serviceInstance.getId()))
.flatMap(serviceInstance -> waitForCompletionOnUpdate(cloudFoundryClient, serviceInstance, serviceInstanceName));
.map(response -> response.getJobId().get())
.flatMap(jobId -> JobUtils.waitForCompletion(cloudFoundryClient, Duration.ofMinutes(5), jobId))
.then(getServiceInstanceIdByName(cloudFoundryClient, serviceInstanceName));
}

private static Mono<UpdateServiceInstanceResponse> updateServiceInstanceById(CloudFoundryClient cloudFoundryClient, String serviceInstanceId) {
Expand All @@ -287,26 +289,14 @@ private static Mono<UpdateServiceInstanceResponse> updateServiceInstanceById(Clo
.build());
}


private static Mono<String> waitForCompletionOnUpdate(CloudFoundryClient cloudFoundryClient, UpdateServiceInstanceResponse updateServiceInstanceResponse, String serviceInstanceName) {
if (updateServiceInstanceResponse.getJobId().isPresent()) {
JobUtils.waitForCompletion(cloudFoundryClient, Duration.ofMinutes(1), updateServiceInstanceResponse.getJobId().get());
}
return getServiceInstanceIdByName(cloudFoundryClient, serviceInstanceName);
}

private static Mono<String> createManagedServiceInstanceId(CloudFoundryClient cloudFoundryClient, Mono<String> serviceBrokerId, String serviceInstanceName, String serviceName, String spaceId) {
return serviceBrokerId
.flatMap(brokerId -> getPlanId(cloudFoundryClient, brokerId, serviceName))
.flatMap(planId -> requestCreateServiceInstance(cloudFoundryClient, planId, serviceInstanceName, spaceId))
.flatMap(serviceInstance -> waitForCompletionOnCreate(cloudFoundryClient, serviceInstance, serviceInstanceName));
}

private static Mono<String> waitForCompletionOnCreate(CloudFoundryClient cloudFoundryClient, CreateServiceInstanceResponse createServiceInstanceResponse, String serviceInstanceName) {
if (createServiceInstanceResponse.getJobId().isPresent()) {
JobUtils.waitForCompletion(cloudFoundryClient, Duration.ofMinutes(1), createServiceInstanceResponse.getJobId().get());
}
return getServiceInstanceIdByName(cloudFoundryClient, serviceInstanceName);
.map(response -> response.getJobId()
.get())
.flatMap(jobId -> JobUtils.waitForCompletion(cloudFoundryClient, Duration.ofMinutes(5), jobId))
.then(getServiceInstanceIdByName(cloudFoundryClient, serviceInstanceName));
}

private static Mono<String> getServiceInstanceIdByName(CloudFoundryClient cloudFoundryClient, String serviceInstanceName) {
Expand Down