9494import org .cloudfoundry .client .v2 .spaces .ListSpaceServiceInstancesRequest ;
9595import org .cloudfoundry .client .v2 .spaces .SpaceApplicationSummary ;
9696import org .cloudfoundry .client .v2 .spaces .SpaceResource ;
97- import org .cloudfoundry .client .v2 .stacks .GetStackRequest ;
98- import org .cloudfoundry .client .v2 .stacks .GetStackResponse ;
99- import org .cloudfoundry .client .v2 .stacks .ListStacksRequest ;
100- import org .cloudfoundry .client .v2 .stacks .StackResource ;
10197import org .cloudfoundry .client .v3 .BuildpackData ;
10298import org .cloudfoundry .client .v3 .Lifecycle ;
10399import org .cloudfoundry .client .v3 .Relationship ;
144140import org .cloudfoundry .client .v3 .processes .UpdateProcessRequest ;
145141import org .cloudfoundry .client .v3 .resourcematch .MatchedResource ;
146142import org .cloudfoundry .client .v3 .spaces .ApplyManifestRequest ;
143+ import org .cloudfoundry .client .v3 .stacks .GetStackRequest ;
144+ import org .cloudfoundry .client .v3 .stacks .GetStackResponse ;
145+ import org .cloudfoundry .client .v3 .stacks .ListStacksRequest ;
146+ import org .cloudfoundry .client .v3 .stacks .StackResource ;
147147import org .cloudfoundry .client .v3 .tasks .CancelTaskRequest ;
148148import org .cloudfoundry .client .v3 .tasks .CancelTaskResponse ;
149149import org .cloudfoundry .client .v3 .tasks .CreateTaskRequest ;
@@ -1111,7 +1111,7 @@ private Mono<ApplicationResource> getApplicationV3(String application) {
11111111 Tuple5 <
11121112 List <String >,
11131113 SummaryApplicationResponse ,
1114- GetStackResponse ,
1114+ String ,
11151115 List <InstanceDetail >,
11161116 List <String >>>
11171117 getAuxiliaryContent (AbstractApplicationResource applicationResource ) {
@@ -1130,7 +1130,7 @@ private Mono<ApplicationResource> getApplicationV3(String application) {
11301130 Mono .zip (
11311131 getApplicationBuildpacks (applicationId ),
11321132 Mono .just (summaryApplicationResponse ),
1133- requestStack (stackId ),
1133+ getStackName (stackId ),
11341134 toInstanceDetailList (
11351135 applicationInstancesResponse ,
11361136 applicationStatisticsResponse ),
@@ -1376,18 +1376,20 @@ private Mono<String> getSpaceOrganizationId(String spaceId) {
13761376 .map (response -> ResourceUtils .getEntity (response ).getOrganizationId ());
13771377 }
13781378
1379- private Mono <String > getStackId (String stack ) {
1380- return requestStacks (stack )
1381- .map (ResourceUtils ::getId )
1379+ private Mono <String > getStackId (String stackName ) {
1380+ return requestStacks (stackName )
1381+ .map (StackResource ::getId )
13821382 .single ()
13831383 .onErrorResume (
13841384 NoSuchElementException .class ,
1385- t -> ExceptionUtils .illegalArgument ("Stack %s does not exist" , stack ));
1385+ t -> ExceptionUtils .illegalArgument ("Stack %s does not exist" , stackName ));
13861386 }
13871387
13881388 private Mono <String > getStackName (String stackId ) {
1389- return requestStack (stackId )
1390- .map (getStackResponse -> getStackResponse .getEntity ().getName ());
1389+ return this .cloudFoundryClient
1390+ .stacksV3 ()
1391+ .get (GetStackRequest .builder ().stackId (stackId ).build ())
1392+ .map (GetStackResponse ::getName );
13911393 }
13921394
13931395 private Mono <String > getTaskId (String applicationId , Integer sequenceId ) {
@@ -2042,17 +2044,11 @@ private Mono<GetSpaceSummaryResponse> requestSpaceSummary() {
20422044 .getSummary (GetSpaceSummaryRequest .builder ().spaceId (this .spaceId ).build ());
20432045 }
20442046
2045- private Mono <GetStackResponse > requestStack (String stackId ) {
2046- return this .cloudFoundryClient
2047- .stacks ()
2048- .get (GetStackRequest .builder ().stackId (stackId ).build ());
2049- }
2050-
20512047 private Flux <StackResource > requestStacks (String stack ) {
2052- return PaginationUtils .requestClientV2Resources (
2048+ return PaginationUtils .requestClientV3Resources (
20532049 page ->
20542050 this .cloudFoundryClient
2055- .stacks ()
2051+ .stacksV3 ()
20562052 .list (ListStacksRequest .builder ().page (page ).name (stack ).build ()));
20572053 }
20582054
@@ -2305,7 +2301,7 @@ private Mono<AbstractApplicationResource> stopApplicationIfNotStopped(
23052301 private static ApplicationDetail toApplicationDetail (
23062302 List <String > buildpacks ,
23072303 SummaryApplicationResponse summaryApplicationResponse ,
2308- GetStackResponse getStackResponse ,
2304+ String stackName ,
23092305 List <InstanceDetail > instanceDetails ,
23102306 List <String > urls ) {
23112307 if (buildpacks .size () == 0 ) {
@@ -2324,7 +2320,7 @@ private static ApplicationDetail toApplicationDetail(
23242320 .name (summaryApplicationResponse .getName ())
23252321 .requestedState (summaryApplicationResponse .getState ())
23262322 .runningInstances (summaryApplicationResponse .getRunningInstances ())
2327- .stack (getStackResponse . getEntity (). getName () )
2323+ .stack (stackName )
23282324 .urls (urls )
23292325 .build ();
23302326 }
0 commit comments