Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.util.Set;
import java.util.UUID;

import org.cloudfoundry.client.v3.Metadata;

import com.sap.cloudfoundry.client.facade.domain.CloudApplication;
import com.sap.cloudfoundry.client.facade.domain.CloudAsyncJob;
import com.sap.cloudfoundry.client.facade.domain.CloudBuild;
Expand All @@ -34,10 +32,10 @@
import com.sap.cloudfoundry.client.facade.domain.Upload;
import com.sap.cloudfoundry.client.facade.domain.UserRole;
import com.sap.cloudfoundry.client.facade.dto.ApplicationToCreateDto;
import org.cloudfoundry.client.v3.Metadata;

/**
* The interface defining operations making up the Cloud Foundry Java client's API.
*
*/
public interface CloudControllerClient {

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

/**
*
* @param keyModel service-key cloud object
* @param serviceInstanceName name of related service instance
* @return the service-key object populated with new guid
*/
CloudServiceKey createAndFetchServiceKey(CloudServiceKey keyModel, String serviceInstanceName);

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

/**
* Create a service key.
*
*
* @param serviceInstanceName name of service instance
* @param serviceKeyName name of service-key
* @param parameters parameters of service-key
Expand Down Expand Up @@ -171,7 +167,6 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,
void deleteServiceInstance(String serviceInstance);

/**
*
* @param serviceInstance {@link CloudServiceInstance}
*/
void deleteServiceInstance(CloudServiceInstance serviceInstance);
Expand All @@ -194,7 +189,7 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,

/**
* Delete a service binding.
*
*
* @param serviceInstanceName name of service instance
* @param serviceKeyName name of service key
* @return job id for async polling if present
Expand All @@ -203,7 +198,7 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,

/**
* Delete a service binding.
*
*
* @param bindingGuid The GUID of the binding
* @param serviceBindingOperationCallback callback used for error handling
* @return job id for async polling if present
Expand Down Expand Up @@ -287,6 +282,8 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,

boolean getApplicationSshEnabled(UUID applicationGuid);

Map<String, Boolean> getApplicationFeatures(UUID applicationGuid);

/**
* Get all applications in the currently targeted space. This method has EXTREMELY poor performance for spaces with a lot of
* applications.
Expand Down Expand Up @@ -364,7 +361,7 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,

/**
* Get the GUID of a service instance.
*
*
* @param serviceInstanceName the name of the service instance
* @return the service instance GUID
*/
Expand Down Expand Up @@ -447,7 +444,7 @@ Optional<String> bindServiceInstance(String bindingName, String applicationName,

/**
* Get all user-provided service instance parameters
*
*
* @param guid The service instance guid
* @return user-provided service instance parameters in key-value pairs
*/
Expand Down Expand Up @@ -670,7 +667,7 @@ CloudPackage asyncUploadApplicationWithExponentialBackoff(String applicationName

/**
* Get the list of one-off tasks currently known for the given application.
*
*
* @param applicationName the application to look for tasks
* @return the list of known tasks
* @throws UnsupportedOperationException if the targeted controller does not support tasks
Expand All @@ -679,7 +676,7 @@ CloudPackage asyncUploadApplicationWithExponentialBackoff(String applicationName

/**
* Run a one-off task on an application.
*
*
* @param applicationName the application to run the task on
* @param task the task to run
* @return the ran task
Expand All @@ -689,7 +686,7 @@ CloudPackage asyncUploadApplicationWithExponentialBackoff(String applicationName

/**
* Cancel the given task.
*
*
* @param taskGuid the GUID of the task to cancel
* @return the cancelled task
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
import java.util.UUID;
import java.util.function.Supplier;

import org.cloudfoundry.AbstractCloudFoundryException;
import org.cloudfoundry.client.v3.Metadata;
import org.springframework.http.HttpStatus;
import org.springframework.util.Assert;

import com.sap.cloudfoundry.client.facade.domain.CloudApplication;
import com.sap.cloudfoundry.client.facade.domain.CloudAsyncJob;
import com.sap.cloudfoundry.client.facade.domain.CloudBuild;
Expand Down Expand Up @@ -42,10 +37,13 @@
import com.sap.cloudfoundry.client.facade.rest.CloudControllerRestClient;
import com.sap.cloudfoundry.client.facade.rest.CloudControllerRestClientFactory;
import com.sap.cloudfoundry.client.facade.rest.ImmutableCloudControllerRestClientFactory;
import org.cloudfoundry.AbstractCloudFoundryException;
import org.cloudfoundry.client.v3.Metadata;
import org.springframework.http.HttpStatus;
import org.springframework.util.Assert;

/**
* A Java client to exercise the Cloud Foundry API.
*
*/
public class CloudControllerClientImpl implements CloudControllerClient {

Expand All @@ -61,7 +59,8 @@ public CloudControllerClientImpl(URL controllerUrl, CloudCredentials credentials
public CloudControllerClientImpl(URL controllerUrl, CloudCredentials credentials, CloudSpace target, boolean trustSelfSignedCerts) {
Assert.notNull(controllerUrl, "URL for cloud controller cannot be null");
CloudControllerRestClientFactory restClientFactory = ImmutableCloudControllerRestClientFactory.builder()
.shouldTrustSelfSignedCertificates(trustSelfSignedCerts)
.shouldTrustSelfSignedCertificates(
trustSelfSignedCerts)
.build();
this.delegate = restClientFactory.createClient(controllerUrl, credentials, target);
}
Expand Down Expand Up @@ -264,6 +263,11 @@ public boolean getApplicationSshEnabled(UUID applicationGuid) {
return handleExceptions(() -> delegate.getApplicationSshEnabled(applicationGuid));
}

@Override
public Map<String, Boolean> getApplicationFeatures(UUID applicationGuid) {
return handleExceptions(() -> delegate.getApplicationFeatures(applicationGuid));
}

@Override
public List<CloudApplication> getApplications() {
return handleExceptions(() -> delegate.getApplications());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sap.cloudfoundry.client.facade.domain;

import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
Expand Down Expand Up @@ -55,6 +56,15 @@ public interface Staging {
@Nullable
Boolean isSshEnabled();

/**
* Retrieves the application features map. The map contains feature names as keys and their enabled/disabled state as Boolean values.
* This allows specifying which features should be enabled or disabled for the application during staging.
*
* @return a map of application features and their enabled/disabled state
*/
@SkipNulls
Map<String, Boolean> getAppFeatures();

/**
* @return the stack to use when staging the application, or null to use the default stack
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import java.util.Set;
import java.util.UUID;

import com.sap.cloudfoundry.client.facade.dto.ApplicationToCreateDto;
import org.cloudfoundry.client.v3.Metadata;

import com.sap.cloudfoundry.client.facade.UploadStatusCallback;
import com.sap.cloudfoundry.client.facade.domain.CloudApplication;
import com.sap.cloudfoundry.client.facade.domain.CloudAsyncJob;
Expand All @@ -35,10 +32,11 @@
import com.sap.cloudfoundry.client.facade.domain.Staging;
import com.sap.cloudfoundry.client.facade.domain.Upload;
import com.sap.cloudfoundry.client.facade.domain.UserRole;
import com.sap.cloudfoundry.client.facade.dto.ApplicationToCreateDto;
import org.cloudfoundry.client.v3.Metadata;

/**
* Interface defining operations available for the cloud controller REST client implementations
*
*/
public interface CloudControllerRestClient {

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

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

Optional<String> bindServiceInstance(String bindingName, String applicationName, String serviceInstanceName, Map<String, Object> parameters);
Optional<String> bindServiceInstance(String bindingName, String applicationName, String serviceInstanceName,
Map<String, Object> parameters);

void createApplication(ApplicationToCreateDto applicationToCreateDto);

Expand Down Expand Up @@ -110,6 +109,8 @@ public interface CloudControllerRestClient {

boolean getApplicationSshEnabled(UUID applicationGuid);

Map<String, Boolean> getApplicationFeatures(UUID applicationGuid);

List<CloudApplication> getApplications();

CloudDomain getDefaultDomain();
Expand Down
Loading