Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.

Commit b3b33d7

Browse files
committed
Add retrieval of app features
JIRA:LMCROSSITXSADEPLOY-3111
1 parent 792a3d1 commit b3b33d7

File tree

5 files changed

+107
-90
lines changed

5 files changed

+107
-90
lines changed

src/main/java/com/sap/cloudfoundry/client/facade/CloudControllerClient.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import java.util.Set;
99
import java.util.UUID;
1010

11-
import org.cloudfoundry.client.v3.Metadata;
12-
1311
import com.sap.cloudfoundry.client.facade.domain.CloudApplication;
1412
import com.sap.cloudfoundry.client.facade.domain.CloudAsyncJob;
1513
import com.sap.cloudfoundry.client.facade.domain.CloudBuild;
@@ -34,10 +32,10 @@
3432
import com.sap.cloudfoundry.client.facade.domain.Upload;
3533
import com.sap.cloudfoundry.client.facade.domain.UserRole;
3634
import com.sap.cloudfoundry.client.facade.dto.ApplicationToCreateDto;
35+
import org.cloudfoundry.client.v3.Metadata;
3736

3837
/**
3938
* The interface defining operations making up the Cloud Foundry Java client's API.
40-
*
4139
*/
4240
public interface CloudControllerClient {
4341

@@ -104,15 +102,13 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,
104102
String createServiceBroker(CloudServiceBroker serviceBroker);
105103

106104
/**
107-
*
108105
* @param keyModel service-key cloud object
109106
* @param serviceInstanceName name of related service instance
110107
* @return the service-key object populated with new guid
111108
*/
112109
CloudServiceKey createAndFetchServiceKey(CloudServiceKey keyModel, String serviceInstanceName);
113110

114111
/**
115-
*
116112
* @param keyModel service-key cloud object
117113
* @param serviceInstanceName name of related service instance
118114
* @return job id for async polling if present
@@ -121,7 +117,7 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,
121117

122118
/**
123119
* Create a service key.
124-
*
120+
*
125121
* @param serviceInstanceName name of service instance
126122
* @param serviceKeyName name of service-key
127123
* @param parameters parameters of service-key
@@ -171,7 +167,6 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,
171167
void deleteServiceInstance(String serviceInstance);
172168

173169
/**
174-
*
175170
* @param serviceInstance {@link CloudServiceInstance}
176171
*/
177172
void deleteServiceInstance(CloudServiceInstance serviceInstance);
@@ -194,7 +189,7 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,
194189

195190
/**
196191
* Delete a service binding.
197-
*
192+
*
198193
* @param serviceInstanceName name of service instance
199194
* @param serviceKeyName name of service key
200195
* @return job id for async polling if present
@@ -203,7 +198,7 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,
203198

204199
/**
205200
* Delete a service binding.
206-
*
201+
*
207202
* @param bindingGuid The GUID of the binding
208203
* @param serviceBindingOperationCallback callback used for error handling
209204
* @return job id for async polling if present
@@ -287,6 +282,8 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,
287282

288283
boolean getApplicationSshEnabled(UUID applicationGuid);
289284

285+
Map<String, Boolean> getApplicationFeatures(UUID applicationGuid);
286+
290287
/**
291288
* Get all applications in the currently targeted space. This method has EXTREMELY poor performance for spaces with a lot of
292289
* applications.
@@ -364,7 +361,7 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,
364361

365362
/**
366363
* Get the GUID of a service instance.
367-
*
364+
*
368365
* @param serviceInstanceName the name of the service instance
369366
* @return the service instance GUID
370367
*/
@@ -447,7 +444,7 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,
447444

448445
/**
449446
* Get all user-provided service instance parameters
450-
*
447+
*
451448
* @param guid The service instance guid
452449
* @return user-provided service instance parameters in key-value pairs
453450
*/
@@ -670,7 +667,7 @@ CloudPackage asyncUploadApplicationWithExponentialBackoff(String applicationName
670667

671668
/**
672669
* Get the list of one-off tasks currently known for the given application.
673-
*
670+
*
674671
* @param applicationName the application to look for tasks
675672
* @return the list of known tasks
676673
* @throws UnsupportedOperationException if the targeted controller does not support tasks
@@ -679,7 +676,7 @@ CloudPackage asyncUploadApplicationWithExponentialBackoff(String applicationName
679676

680677
/**
681678
* Run a one-off task on an application.
682-
*
679+
*
683680
* @param applicationName the application to run the task on
684681
* @param task the task to run
685682
* @return the ran task
@@ -689,7 +686,7 @@ CloudPackage asyncUploadApplicationWithExponentialBackoff(String applicationName
689686

690687
/**
691688
* Cancel the given task.
692-
*
689+
*
693690
* @param taskGuid the GUID of the task to cancel
694691
* @return the cancelled task
695692
*/

src/main/java/com/sap/cloudfoundry/client/facade/CloudControllerClientImpl.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
import java.util.UUID;
1111
import java.util.function.Supplier;
1212

13-
import org.cloudfoundry.AbstractCloudFoundryException;
14-
import org.cloudfoundry.client.v3.Metadata;
15-
import org.springframework.http.HttpStatus;
16-
import org.springframework.util.Assert;
17-
1813
import com.sap.cloudfoundry.client.facade.domain.CloudApplication;
1914
import com.sap.cloudfoundry.client.facade.domain.CloudAsyncJob;
2015
import com.sap.cloudfoundry.client.facade.domain.CloudBuild;
@@ -42,10 +37,13 @@
4237
import com.sap.cloudfoundry.client.facade.rest.CloudControllerRestClient;
4338
import com.sap.cloudfoundry.client.facade.rest.CloudControllerRestClientFactory;
4439
import com.sap.cloudfoundry.client.facade.rest.ImmutableCloudControllerRestClientFactory;
40+
import org.cloudfoundry.AbstractCloudFoundryException;
41+
import org.cloudfoundry.client.v3.Metadata;
42+
import org.springframework.http.HttpStatus;
43+
import org.springframework.util.Assert;
4544

4645
/**
4746
* A Java client to exercise the Cloud Foundry API.
48-
*
4947
*/
5048
public class CloudControllerClientImpl implements CloudControllerClient {
5149

@@ -61,7 +59,8 @@ public CloudControllerClientImpl(URL controllerUrl, CloudCredentials credentials
6159
public CloudControllerClientImpl(URL controllerUrl, CloudCredentials credentials, CloudSpace target, boolean trustSelfSignedCerts) {
6260
Assert.notNull(controllerUrl, "URL for cloud controller cannot be null");
6361
CloudControllerRestClientFactory restClientFactory = ImmutableCloudControllerRestClientFactory.builder()
64-
.shouldTrustSelfSignedCertificates(trustSelfSignedCerts)
62+
.shouldTrustSelfSignedCertificates(
63+
trustSelfSignedCerts)
6564
.build();
6665
this.delegate = restClientFactory.createClient(controllerUrl, credentials, target);
6766
}
@@ -264,6 +263,11 @@ public boolean getApplicationSshEnabled(UUID applicationGuid) {
264263
return handleExceptions(() -> delegate.getApplicationSshEnabled(applicationGuid));
265264
}
266265

266+
@Override
267+
public Map<String, Boolean> getApplicationFeatures(UUID applicationGuid) {
268+
return handleExceptions(() -> delegate.getApplicationFeatures(applicationGuid));
269+
}
270+
267271
@Override
268272
public List<CloudApplication> getApplications() {
269273
return handleExceptions(() -> delegate.getApplications());

src/main/java/com/sap/cloudfoundry/client/facade/domain/Staging.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.sap.cloudfoundry.client.facade.domain;
22

33
import java.util.List;
4+
import java.util.Map;
45

56
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
67
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -55,6 +56,9 @@ public interface Staging {
5556
@Nullable
5657
Boolean isSshEnabled();
5758

59+
@SkipNulls
60+
Map<String, Boolean> getAppFeatures();
61+
5862
/**
5963
* @return the stack to use when staging the application, or null to use the default stack
6064
*/

src/main/java/com/sap/cloudfoundry/client/facade/rest/CloudControllerRestClient.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
import java.util.Set;
99
import java.util.UUID;
1010

11-
import com.sap.cloudfoundry.client.facade.dto.ApplicationToCreateDto;
12-
import org.cloudfoundry.client.v3.Metadata;
13-
1411
import com.sap.cloudfoundry.client.facade.UploadStatusCallback;
1512
import com.sap.cloudfoundry.client.facade.domain.CloudApplication;
1613
import com.sap.cloudfoundry.client.facade.domain.CloudAsyncJob;
@@ -35,10 +32,11 @@
3532
import com.sap.cloudfoundry.client.facade.domain.Staging;
3633
import com.sap.cloudfoundry.client.facade.domain.Upload;
3734
import com.sap.cloudfoundry.client.facade.domain.UserRole;
35+
import com.sap.cloudfoundry.client.facade.dto.ApplicationToCreateDto;
36+
import org.cloudfoundry.client.v3.Metadata;
3837

3938
/**
4039
* Interface defining operations available for the cloud controller REST client implementations
41-
*
4240
*/
4341
public interface CloudControllerRestClient {
4442

@@ -50,7 +48,8 @@ public interface CloudControllerRestClient {
5048

5149
Optional<String> bindServiceInstance(String bindingName, String applicationName, String serviceInstanceName);
5250

53-
Optional<String> bindServiceInstance(String bindingName, String applicationName, String serviceInstanceName, Map<String, Object> parameters);
51+
Optional<String> bindServiceInstance(String bindingName, String applicationName, String serviceInstanceName,
52+
Map<String, Object> parameters);
5453

5554
void createApplication(ApplicationToCreateDto applicationToCreateDto);
5655

@@ -110,6 +109,8 @@ public interface CloudControllerRestClient {
110109

111110
boolean getApplicationSshEnabled(UUID applicationGuid);
112111

112+
Map<String, Boolean> getApplicationFeatures(UUID applicationGuid);
113+
113114
List<CloudApplication> getApplications();
114115

115116
CloudDomain getDefaultDomain();

0 commit comments

Comments
 (0)