Skip to content

Commit a971274

Browse files
committed
Modified getOrganizationId() & getSpaceId() as per V3
1 parent dcba939 commit a971274

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

cloudfoundry-operations/src/main/java/org/cloudfoundry/operations/_DefaultCloudFoundryOperations.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
import org.cloudfoundry.Nullable;
2020
import org.cloudfoundry.client.CloudFoundryClient;
21-
import org.cloudfoundry.client.v2.organizations.ListOrganizationsRequest;
22-
import org.cloudfoundry.client.v2.organizations.OrganizationResource;
23-
import org.cloudfoundry.client.v2.spaces.ListSpacesRequest;
24-
import org.cloudfoundry.client.v2.spaces.SpaceResource;
21+
import org.cloudfoundry.client.v3.organizations.ListOrganizationsRequest;
22+
import org.cloudfoundry.client.v3.organizations.OrganizationResource;
23+
import org.cloudfoundry.client.v3.spaces.ListSpacesRequest;
24+
import org.cloudfoundry.client.v3.spaces.SpaceResource;
2525
import org.cloudfoundry.doppler.DopplerClient;
2626
import org.cloudfoundry.networking.NetworkingClient;
2727
import org.cloudfoundry.operations.advanced.Advanced;
@@ -56,7 +56,6 @@
5656
import org.cloudfoundry.uaa.UaaClient;
5757
import org.cloudfoundry.util.ExceptionUtils;
5858
import org.cloudfoundry.util.PaginationUtils;
59-
import org.cloudfoundry.util.ResourceUtils;
6059
import org.immutables.value.Value;
6160
import reactor.core.publisher.Flux;
6261
import reactor.core.publisher.Mono;
@@ -211,7 +210,7 @@ Mono<String> getOrganizationId() {
211210

212211
if (hasText(organization)) {
213212
Mono<String> cached = getOrganization(getCloudFoundryClientPublisher(), organization)
214-
.map(ResourceUtils::getId);
213+
.map(OrganizationResource::getId);
215214

216215
return getCacheDuration()
217216
.map(cached::cache)
@@ -247,7 +246,7 @@ Mono<String> getSpaceId() {
247246
if (hasText(getSpace())) {
248247
Mono<String> cached = getOrganizationId()
249248
.flatMap(organizationId -> getSpace(getCloudFoundryClientPublisher(), organizationId, space))
250-
.map(ResourceUtils::getId);
249+
.map(SpaceResource::getId);
251250

252251
return getCacheDuration()
253252
.map(cached::cache)
@@ -308,7 +307,7 @@ private static boolean hasText(CharSequence str) {
308307
private static Flux<OrganizationResource> requestOrganizations(Mono<CloudFoundryClient> cloudFoundryClientPublisher, String organization) {
309308
return cloudFoundryClientPublisher
310309
.flatMapMany(cloudFoundryClient -> PaginationUtils
311-
.requestClientV2Resources(page -> cloudFoundryClient.organizations()
310+
.requestClientV3Resources(page -> cloudFoundryClient.organizationsV3()
312311
.list(ListOrganizationsRequest.builder()
313312
.name(organization)
314313
.page(page)
@@ -318,7 +317,7 @@ private static Flux<OrganizationResource> requestOrganizations(Mono<CloudFoundry
318317
private static Flux<SpaceResource> requestSpaces(Mono<CloudFoundryClient> cloudFoundryClientPublisher, String organizationId, String space) {
319318
return cloudFoundryClientPublisher
320319
.flatMapMany(cloudFoundryClient -> PaginationUtils
321-
.requestClientV2Resources(page -> cloudFoundryClient.spaces()
320+
.requestClientV3Resources(page -> cloudFoundryClient.spacesV3()
322321
.list(ListSpacesRequest.builder()
323322
.organizationId(organizationId)
324323
.name(space)

0 commit comments

Comments
 (0)