From a971274cce474806b9fc415ce990055e67cfb94e Mon Sep 17 00:00:00 2001 From: Suyash Upadhyay Date: Thu, 5 Jan 2023 14:40:25 +0530 Subject: [PATCH] Modified getOrganizationId() & getSpaceId() as per V3 --- .../_DefaultCloudFoundryOperations.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cloudfoundry-operations/src/main/java/org/cloudfoundry/operations/_DefaultCloudFoundryOperations.java b/cloudfoundry-operations/src/main/java/org/cloudfoundry/operations/_DefaultCloudFoundryOperations.java index 35d76a3fb0..299b4bf5e4 100644 --- a/cloudfoundry-operations/src/main/java/org/cloudfoundry/operations/_DefaultCloudFoundryOperations.java +++ b/cloudfoundry-operations/src/main/java/org/cloudfoundry/operations/_DefaultCloudFoundryOperations.java @@ -18,10 +18,10 @@ import org.cloudfoundry.Nullable; import org.cloudfoundry.client.CloudFoundryClient; -import org.cloudfoundry.client.v2.organizations.ListOrganizationsRequest; -import org.cloudfoundry.client.v2.organizations.OrganizationResource; -import org.cloudfoundry.client.v2.spaces.ListSpacesRequest; -import org.cloudfoundry.client.v2.spaces.SpaceResource; +import org.cloudfoundry.client.v3.organizations.ListOrganizationsRequest; +import org.cloudfoundry.client.v3.organizations.OrganizationResource; +import org.cloudfoundry.client.v3.spaces.ListSpacesRequest; +import org.cloudfoundry.client.v3.spaces.SpaceResource; import org.cloudfoundry.doppler.DopplerClient; import org.cloudfoundry.networking.NetworkingClient; import org.cloudfoundry.operations.advanced.Advanced; @@ -56,7 +56,6 @@ import org.cloudfoundry.uaa.UaaClient; import org.cloudfoundry.util.ExceptionUtils; import org.cloudfoundry.util.PaginationUtils; -import org.cloudfoundry.util.ResourceUtils; import org.immutables.value.Value; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -211,7 +210,7 @@ Mono getOrganizationId() { if (hasText(organization)) { Mono cached = getOrganization(getCloudFoundryClientPublisher(), organization) - .map(ResourceUtils::getId); + .map(OrganizationResource::getId); return getCacheDuration() .map(cached::cache) @@ -247,7 +246,7 @@ Mono getSpaceId() { if (hasText(getSpace())) { Mono cached = getOrganizationId() .flatMap(organizationId -> getSpace(getCloudFoundryClientPublisher(), organizationId, space)) - .map(ResourceUtils::getId); + .map(SpaceResource::getId); return getCacheDuration() .map(cached::cache) @@ -308,7 +307,7 @@ private static boolean hasText(CharSequence str) { private static Flux requestOrganizations(Mono cloudFoundryClientPublisher, String organization) { return cloudFoundryClientPublisher .flatMapMany(cloudFoundryClient -> PaginationUtils - .requestClientV2Resources(page -> cloudFoundryClient.organizations() + .requestClientV3Resources(page -> cloudFoundryClient.organizationsV3() .list(ListOrganizationsRequest.builder() .name(organization) .page(page) @@ -318,7 +317,7 @@ private static Flux requestOrganizations(Mono requestSpaces(Mono cloudFoundryClientPublisher, String organizationId, String space) { return cloudFoundryClientPublisher .flatMapMany(cloudFoundryClient -> PaginationUtils - .requestClientV2Resources(page -> cloudFoundryClient.spaces() + .requestClientV3Resources(page -> cloudFoundryClient.spacesV3() .list(ListSpacesRequest.builder() .organizationId(organizationId) .name(space)