org.cloudfoundry.client.lib
Interface CloudFoundryOperations

All Known Implementing Classes:
CloudFoundryClient

public interface CloudFoundryOperations

The interface defining operations making up the Cloud Foundry Java client's API.

Author:
Ramnivas Laddad, A.B.Srinivasan, Jennifer Hickey, Dave Syer, Thomas Risberg

Method Summary
 void addDomain(String domainName)
          Add a private domain in the current organization.
 void addRoute(String host, String domainName)
          Register a new route to the a domain.
 void bindService(String appName, String serviceName)
          Associate (provision) a service with an application.
 void createApplication(String appName, Staging staging, Integer disk, Integer memory, List<String> uris, List<String> serviceNames)
          Create application.
 void createApplication(String appName, Staging staging, Integer memory, List<String> uris, List<String> serviceNames)
          Create application.
 void createService(CloudService service)
          Create a service.
 void createUserProvidedService(CloudService service, Map<String,Object> credentials)
          Create a user-provided service.
 void debugApplication(String appName, CloudApplication.DebugMode mode)
          Debug application.
 void deleteAllApplications()
          Delete all applications.
 void deleteAllServices()
          Delete all services.
 void deleteApplication(String appName)
          Delete application.
 void deleteDomain(String domainName)
          Delete a private domain in the current organization.
 void deleteRoute(String host, String domainName)
          Delete a registered route from the space of the current session.
 void deleteService(String service)
          Delete cloud service.
 CloudApplication getApplication(String appName)
          Get cloud application with the specified name.
 InstancesInfo getApplicationInstances(CloudApplication app)
          Get application instances info for application.
 InstancesInfo getApplicationInstances(String appName)
          Get application instances info for application.
 List<CloudApplication> getApplications()
          Get all cloud applications.
 ApplicationStats getApplicationStats(String appName)
          Get application stats for the app with the specified name.
 URL getCloudControllerUrl()
          Get the URL used for the cloud controller.
 CloudInfo getCloudInfo()
          Get CloudInfo for the current cloud.
 CrashesInfo getCrashes(String appName)
          Get crashes info for application.
 Map<String,String> getCrashLogs(String appName)
          Get logs from most recent crash of the deployed application.
 List<CloudDomain> getDomains()
          Get list of all domain shared and private domains.
 List<CloudDomain> getDomainsForOrg()
          Get list of all domain registered for the current organization.
 String getFile(String appName, int instanceIndex, String filePath)
          Get file from the deployed application.
 String getFile(String appName, int instanceIndex, String filePath, int startPosition)
          Get a the content, starting at a specific position, of a file from the deployed application.
 String getFile(String appName, int instanceIndex, String filePath, int startPosition, int endPosition)
          Get a range of content of a file from the deployed application.
 String getFileTail(String appName, int instanceIndex, String filePath, int length)
          Get a the last bytes, with length as specified, of content of a file from the deployed application.
 Map<String,String> getLogs(String appName)
          Get logs from the deployed application.
 List<CloudOrganization> getOrganizations()
          Get list of CloudOrganizations for the current cloud.
 List<CloudDomain> getPrivateDomains()
          Get list of all private domains.
 List<CloudRoute> getRoutes(String domainName)
          Get the info for all routes for a domain.
 CloudService getService(String service)
          Get cloud service.
 List<CloudServiceOffering> getServiceOfferings()
          Get all service offerings.
 List<CloudService> getServices()
          Get list of cloud services.
 List<CloudDomain> getSharedDomains()
          Get list of all shared domains.
 List<CloudSpace> getSpaces()
          Get list of CloudSpaces for the current cloud.
 CloudStack getStack(String name)
          Get a stack by name.
 List<CloudStack> getStacks()
          Get the list of stacks available for staging applications.
 String getStagingLogs(StartingInfo info, int offset)
          Get the staging log while an application is starting.
 org.springframework.security.oauth2.common.OAuth2AccessToken login()
          Login using the credentials already set for the client.
 void logout()
          Logout closing the current session.
 void register(String email, String password)
          Register new user account with the provided credentials.
 void registerRestLogListener(RestLogCallback callBack)
          Register a new RestLogCallback
 void removeDomain(String domainName)
          Deprecated. alias for deleteDomain(java.lang.String)
 void rename(String appName, String newName)
          Rename an application.
 StartingInfo restartApplication(String appName)
          Restart application.
 void setResponseErrorHandler(org.springframework.web.client.ResponseErrorHandler errorHandler)
          Override the default REST response error handler with a custom error handler.
 StartingInfo startApplication(String appName)
          Start application.
 void stopApplication(String appName)
          Stop application.
 void unbindService(String appName, String serviceName)
          Un-associate (unprovision) a service from an application.
 void unregister()
          Unregister and log out the currently logged in user
 void unRegisterRestLogListener(RestLogCallback callBack)
          Un-register a RestLogCallback
 void updateApplicationDiskQuota(String appName, int disk)
          Update application disk quota.
 void updateApplicationEnv(String appName, List<String> env)
          Update application env using a list of strings each with one environment setting.
 void updateApplicationEnv(String appName, Map<String,String> env)
          Update application env using a map where the key specifies the name of the environment variable and the value the value of the environment variable..
 void updateApplicationInstances(String appName, int instances)
          Update application instances.
 void updateApplicationMemory(String appName, int memory)
          Update application memory.
 void updateApplicationServices(String appName, List<String> services)
          Update application services.
 void updateApplicationStaging(String appName, Staging staging)
          Update application staging information.
 void updateApplicationUris(String appName, List<String> uris)
          Update application URIs.
 void updatePassword(CloudCredentials credentials, String newPassword)
          Update the password for the logged in user using the username/old_password provided in the credentials.
 void updatePassword(String newPassword)
          Update the password for the logged in user.
 void uploadApplication(String appName, ApplicationArchive archive)
          Upload an application to cloud foundry.
 void uploadApplication(String appName, ApplicationArchive archive, UploadStatusCallback callback)
          Upload an application to cloud foundry.
 void uploadApplication(String appName, File file)
          Upload an application to cloud foundry.
 void uploadApplication(String appName, File file, UploadStatusCallback callback)
          Upload an application to cloud foundry.
 void uploadApplication(String appName, String file)
          Upload an application.
 

Method Detail

setResponseErrorHandler

void setResponseErrorHandler(org.springframework.web.client.ResponseErrorHandler errorHandler)
Override the default REST response error handler with a custom error handler.

Parameters:
errorHandler -

getCloudControllerUrl

URL getCloudControllerUrl()
Get the URL used for the cloud controller.

Returns:
the cloud controller URL

getCloudInfo

CloudInfo getCloudInfo()
Get CloudInfo for the current cloud.

Returns:
CloudInfo object containing the cloud info

getSpaces

List<CloudSpace> getSpaces()
Get list of CloudSpaces for the current cloud.

Returns:
List of CloudSpace objects containing the space info

getOrganizations

List<CloudOrganization> getOrganizations()
Get list of CloudOrganizations for the current cloud.

Returns:
List of CloudOrganizations objects containing the organization info

register

void register(String email,
              String password)
Register new user account with the provided credentials.

Parameters:
email - the email account
password - the password

updatePassword

void updatePassword(String newPassword)
Update the password for the logged in user.

Parameters:
newPassword - the new password

updatePassword

void updatePassword(CloudCredentials credentials,
                    String newPassword)
Update the password for the logged in user using the username/old_password provided in the credentials.

Parameters:
credentials - current credentials
newPassword - the new password

unregister

void unregister()
Unregister and log out the currently logged in user


login

org.springframework.security.oauth2.common.OAuth2AccessToken login()
Login using the credentials already set for the client.

Returns:
authentication token

logout

void logout()
Logout closing the current session.


getApplications

List<CloudApplication> getApplications()
Get all cloud applications.

Returns:
list of cloud applications

getApplication

CloudApplication getApplication(String appName)
Get cloud application with the specified name.

Parameters:
appName - name of the app
Returns:
the cloud application

getApplicationStats

ApplicationStats getApplicationStats(String appName)
Get application stats for the app with the specified name.

Parameters:
appName - name of the app
Returns:
the cloud application stats

createApplication

void createApplication(String appName,
                       Staging staging,
                       Integer memory,
                       List<String> uris,
                       List<String> serviceNames)
Create application.

Parameters:
appName - application name
staging - staging info
memory - memory to use in MB
uris - list of URIs for the app
serviceNames - list of service names to bind to app

createApplication

void createApplication(String appName,
                       Staging staging,
                       Integer disk,
                       Integer memory,
                       List<String> uris,
                       List<String> serviceNames)
Create application.

Parameters:
appName - application name
staging - staging info
disk - disk quota to use in MB
memory - memory to use in MB
uris - list of URIs for the app
serviceNames - list of service names to bind to app

createService

void createService(CloudService service)
Create a service.

Parameters:
service - cloud service info

createUserProvidedService

void createUserProvidedService(CloudService service,
                               Map<String,Object> credentials)
Create a user-provided service.

Parameters:
service - cloud service info
credentials - the user-provided service credentials

uploadApplication

void uploadApplication(String appName,
                       String file)
                       throws IOException
Upload an application.

Parameters:
appName - application name
file - path to the application archive or folder
Throws:
IOException

uploadApplication

void uploadApplication(String appName,
                       File file)
                       throws IOException
Upload an application to cloud foundry.

Parameters:
appName - the application name
file - the application archive or folder
Throws:
IOException

uploadApplication

void uploadApplication(String appName,
                       File file,
                       UploadStatusCallback callback)
                       throws IOException
Upload an application to cloud foundry.

Parameters:
appName - the application name
file - the application archive
callback - a callback interface used to provide progress information or null
Throws:
IOException

uploadApplication

void uploadApplication(String appName,
                       ApplicationArchive archive)
                       throws IOException
Upload an application to cloud foundry.

Parameters:
appName - the application name
archive - the application archive
Throws:
IOException

uploadApplication

void uploadApplication(String appName,
                       ApplicationArchive archive,
                       UploadStatusCallback callback)
                       throws IOException
Upload an application to cloud foundry.

Parameters:
appName - the application name
archive - the application archive
callback - a callback interface used to provide progress information or null
Throws:
IOException

startApplication

StartingInfo startApplication(String appName)
Start application. May return starting info if the response obtained after the start request contains headers. If the response does not contain headers, null is returned instead.

Parameters:
appName - name of application
Returns:
Starting info containing response headers, if headers are present in the response. If there are no headers, return null.

debugApplication

void debugApplication(String appName,
                      CloudApplication.DebugMode mode)
Debug application.

Parameters:
appName - name of application
mode - debug mode info

stopApplication

void stopApplication(String appName)
Stop application.

Parameters:
appName - name of application

restartApplication

StartingInfo restartApplication(String appName)
Restart application.

Parameters:
appName - name of application

deleteApplication

void deleteApplication(String appName)
Delete application.

Parameters:
appName - name of application

deleteAllApplications

void deleteAllApplications()
Delete all applications.


deleteAllServices

void deleteAllServices()
Delete all services.


updateApplicationDiskQuota

void updateApplicationDiskQuota(String appName,
                                int disk)
Update application disk quota.

Parameters:
appName - name of application
disk - new disk setting in MB

updateApplicationMemory

void updateApplicationMemory(String appName,
                             int memory)
Update application memory.

Parameters:
appName - name of application
memory - new memory setting in MB

updateApplicationInstances

void updateApplicationInstances(String appName,
                                int instances)
Update application instances.

Parameters:
appName - name of application
instances - number of instances to use

updateApplicationServices

void updateApplicationServices(String appName,
                               List<String> services)
Update application services.

Parameters:
appName - name of appplication
services - list of services that should be bound to app

updateApplicationStaging

void updateApplicationStaging(String appName,
                              Staging staging)
Update application staging information.

Parameters:
appName - name of appplication
staging - staging information for the app

updateApplicationUris

void updateApplicationUris(String appName,
                           List<String> uris)
Update application URIs.

Parameters:
appName - name of application
uris - list of URIs the app should use

updateApplicationEnv

void updateApplicationEnv(String appName,
                          Map<String,String> env)
Update application env using a map where the key specifies the name of the environment variable and the value the value of the environment variable..

Parameters:
appName - name of application
env - map of environment settings

updateApplicationEnv

void updateApplicationEnv(String appName,
                          List<String> env)
Update application env using a list of strings each with one environment setting.

Parameters:
appName - name of application
env - list of environment settings

getLogs

Map<String,String> getLogs(String appName)
Get logs from the deployed application. The logs will be returned in a Map keyed by the path of the log file (logs/stderr.log, logs/stdout.log).

Parameters:
appName - name of the application
Returns:
a Map containing the logs. The logs will be returned with the path to the log file used as the key and the full content of the log file will be returned as a String value for the corresponding key.

getCrashLogs

Map<String,String> getCrashLogs(String appName)
Get logs from most recent crash of the deployed application. The logs will be returned in a Map keyed by the path of the log file (logs/stderr.log, logs/stdout.log).

Parameters:
appName - name of the application
Returns:
a Map containing the logs. The logs will be returned with the path to the log file used as the key and the full content of the log file will be returned as a String value for the corresponding key.

getStagingLogs

String getStagingLogs(StartingInfo info,
                      int offset)
Get the staging log while an application is starting. A null value indicates that no further checks for staging logs should occur as staging logs are no longer available.

Parameters:
info - starting information containing staging log file URL. Obtained after starting an application.
offset - starting position from where content should be retrieved.
Returns:
portion of the staging log content starting from the offset. It may contain multiple lines. Returns null if no further content is available.

getStacks

List<CloudStack> getStacks()
Get the list of stacks available for staging applications.

Returns:
the list of available stacks

getStack

CloudStack getStack(String name)
Get a stack by name.

Parameters:
name - the name of the stack to get
Returns:
the stack, or null if not found

getFile

String getFile(String appName,
               int instanceIndex,
               String filePath)
Get file from the deployed application.

Parameters:
appName - name of the application
instanceIndex - instance index
filePath - path to the file
Returns:
the contents of the file

getFile

String getFile(String appName,
               int instanceIndex,
               String filePath,
               int startPosition)
Get a the content, starting at a specific position, of a file from the deployed application.

Parameters:
appName - name of the application
instanceIndex - instance index
filePath - path to the file
startPosition - the starting position of the file contents (inclusive)
Returns:
the contents of the file

getFile

String getFile(String appName,
               int instanceIndex,
               String filePath,
               int startPosition,
               int endPosition)
Get a range of content of a file from the deployed application. The range begins at the specified startPosition and extends to the character at endPosition - 1.

Parameters:
appName - name of the application
instanceIndex - instance index
filePath - path to the file
startPosition - the starting position of the file contents (inclusive)
endPosition - the ending position of the file contents (exclusive)
Returns:
the contents of the file

getFileTail

String getFileTail(String appName,
                   int instanceIndex,
                   String filePath,
                   int length)
Get a the last bytes, with length as specified, of content of a file from the deployed application.

Parameters:
appName - name of the application
instanceIndex - instance index
filePath - path to the file
length - the length of the file contents to retrieve
Returns:
the contents of the file

getServices

List<CloudService> getServices()
Get list of cloud services.

Returns:
list of cloud services

getService

CloudService getService(String service)
Get cloud service.

Parameters:
service - name of service
Returns:
the cloud service info

deleteService

void deleteService(String service)
Delete cloud service.

Parameters:
service - name of service

getServiceOfferings

List<CloudServiceOffering> getServiceOfferings()
Get all service offerings.

Returns:
list of service offerings

bindService

void bindService(String appName,
                 String serviceName)
Associate (provision) a service with an application.

Parameters:
appName - the application name
serviceName - the service name

unbindService

void unbindService(String appName,
                   String serviceName)
Un-associate (unprovision) a service from an application.

Parameters:
appName - the application name
serviceName - the service name

getApplicationInstances

InstancesInfo getApplicationInstances(String appName)
Get application instances info for application.

Parameters:
appName - name of application.
Returns:
instances info

getApplicationInstances

InstancesInfo getApplicationInstances(CloudApplication app)
Get application instances info for application.

Parameters:
app - the application.
Returns:
instances info

getCrashes

CrashesInfo getCrashes(String appName)
Get crashes info for application.

Parameters:
appName - name of application
Returns:
crashes info

rename

void rename(String appName,
            String newName)
Rename an application.

Parameters:
appName - the current name
newName - the new name

getDomainsForOrg

List<CloudDomain> getDomainsForOrg()
Get list of all domain registered for the current organization.

Returns:
list of domains

getPrivateDomains

List<CloudDomain> getPrivateDomains()
Get list of all private domains.

Returns:
list of private domains

getSharedDomains

List<CloudDomain> getSharedDomains()
Get list of all shared domains.

Returns:
list of shared domains

getDomains

List<CloudDomain> getDomains()
Get list of all domain shared and private domains.

Returns:
list of domains

addDomain

void addDomain(String domainName)
Add a private domain in the current organization.

Parameters:
domainName - the domain to add

removeDomain

void removeDomain(String domainName)
Deprecated. alias for deleteDomain(java.lang.String)

Delete a private domain in the current organization.

Parameters:
domainName - the domain to remove

deleteDomain

void deleteDomain(String domainName)
Delete a private domain in the current organization.

Parameters:
domainName - the domain to delete

getRoutes

List<CloudRoute> getRoutes(String domainName)
Get the info for all routes for a domain.

Parameters:
domainName - the domain the routes belong to
Returns:
list of routes

addRoute

void addRoute(String host,
              String domainName)
Register a new route to the a domain.

Parameters:
host - the host of the route to register
domainName - the domain of the route to register

deleteRoute

void deleteRoute(String host,
                 String domainName)
Delete a registered route from the space of the current session.

Parameters:
host - the host of the route to delete
domainName - the domain of the route to delete

registerRestLogListener

void registerRestLogListener(RestLogCallback callBack)
Register a new RestLogCallback

Parameters:
callBack - the callback to be registered

unRegisterRestLogListener

void unRegisterRestLogListener(RestLogCallback callBack)
Un-register a RestLogCallback

Parameters:
callBack - the callback to be un-registered


Copyright © 2014. All rights reserved.