com.cloudbees.api
Class BeesClient

java.lang.Object
  extended by com.cloudbees.api.BeesClientBase
      extended by com.cloudbees.api.BeesClient

public class BeesClient
extends BeesClientBase

Author:
Fabian Donze, Kohsuke Kawaguchi

Nested Class Summary
static class BeesClient.UsageError
           
 
Field Summary
 
Fields inherited from class com.cloudbees.api.BeesClientBase
format
 
Constructor Summary
BeesClient(BeesClientConfiguration beesClientConfiguration)
           
BeesClient(String server, String apikey, String secret, String format, String version)
           
 
Method Summary
 AccountKeysResponse accountKeys(String domain, String user, String password)
           
 AccountListResponse accountList()
           
 CBUser addUserToAccount(CBAccount account, CBUser user)
           
 ApplicationCheckSumsResponse applicationCheckSums(String appId)
           
 ApplicationCheckSumsResponse applicationCheckSums(String appId, boolean traceResponse)
           
 ApplicationDeleteResponse applicationDelete(String appId)
           
 ApplicationDeployArchiveResponse applicationDeployArchive(ApplicationDeployArgs args)
           
 ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, File earFile, File srcFile, String archiveType, boolean deltaDeploy, Map<String,String> parameters, UploadProgress progress)
           
 ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, File earFile, File srcFile, String archiveType, boolean deltaDeploy, UploadProgress progress)
           
 ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, File earFile, File srcFile, String archiveType, UploadProgress progress)
           
 ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, String earFile, String srcFile, String archiveType, boolean deltaDeploy, Map<String,String> parameters, UploadProgress progress)
          Deprecated. use applicationDeployArchive(String, String, String, File, File, String, boolean, Map, UploadProgress)
 ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, String earFile, String srcFile, String archiveType, boolean deltaDeploy, UploadProgress progress)
          Deprecated. use applicationDeployArchive(String, String, String, File, File, String, boolean, UploadProgress)
 ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, String earFile, String srcFile, String archiveType, UploadProgress progress)
          Deprecated. use applicationDeployArchive(String, String, String, File, File, String, UploadProgress)
 ApplicationDeployArchiveResponse applicationDeployEar(String appId, String environment, String description, File earFile, File srcFile, UploadProgress progress)
           
 ApplicationDeployArchiveResponse applicationDeployEar(String appId, String environment, String description, String earFile, String srcFile, UploadProgress progress)
          Deprecated. use applicationDeployEar(String, String, String, java.io.File, java.io.File, UploadProgress)
 ApplicationDeployArchiveResponse applicationDeployWar(String appId, String environment, String description, File warFile, File srcFile, boolean deltaDeploy, UploadProgress progress)
           
 ApplicationDeployArchiveResponse applicationDeployWar(String appId, String environment, String description, File warFile, File srcFile, UploadProgress progress)
           
 ApplicationDeployArchiveResponse applicationDeployWar(String appId, String environment, String description, String warFile, String srcFile, boolean deltaDeploy, UploadProgress progress)
          Deprecated. use applicationDeployWar(String, String, String, File, File, boolean, UploadProgress)
 ApplicationDeployArchiveResponse applicationDeployWar(String appId, String environment, String description, String warFile, String srcFile, UploadProgress progress)
          Deprecated. use applicationDeployWar(String, String, String, File, File, UploadProgress)
 ApplicationGetSourceUrlResponse applicationGetSourceUrl(String appId)
           
 ApplicationInfo applicationInfo(String appId)
           
 ApplicationJarHashesResponse applicationJarCrcs(String appId, Map<String,String> hashes)
          Deprecated.  
 ApplicationJarHashesResponse applicationJarHashes(String appId, Map<String,String> hashes)
           
 ApplicationListResponse applicationList()
          Returns all the applications in all the account sthat you belong to.
 ApplicationListResponse applicationList(String account)
          Returns all the applications in the specified account.
 ApplicationRestartResponse applicationRestart(String appId)
           
 ApplicationScaleResponse applicationScale(String appId, int unit)
           
 ApplicationSetMetaResponse applicationSetMeta(String appId, Map<String,String> metaAttrs)
           
 ApplicationStatusResponse applicationStart(String appId)
           
 ApplicationStatusResponse applicationStop(String appId)
           
 String call(String action, Map<String,String> params)
           
 ConfigurationParametersResponse configurationParameters(String resourceId, String configType)
           
 ConfigurationParametersDeleteResponse configurationParametersDelete(String resourceId, String configType)
           
 ConfigurationParametersUpdateResponse configurationParametersUpdate(String resourceId, String configType, File resourceFile)
           
protected  String createParameter(Map<String,String> parameters)
           
 CBUser createUser(CBUser user)
          Creates an user, including a partial user creation.
 DatabaseCreateResponse databaseCreate(String domain, String dbId, String username, String password)
           
 DatabaseDeleteResponse databaseDelete(String dbId)
           
 DatabaseInfo databaseInfo(String dbId, boolean fetchPassword)
           
 DatabaseListResponse databaseList()
          Returns all the databases in all the account sthat you belong to.
 DatabaseListResponse databaseList(String account)
          Returns all the databases in the specified account.
 DatabaseSetPasswordResponse databaseSetPassword(String dbId, String password)
           
 DatabaseSnapshotInfo databaseSnapshotCreate(String dbId, String snapshotTitle)
           
 DatabaseSnapshotDeleteResponse databaseSnapshotDelete(String dbId, String snapshotId)
           
 DatabaseSnapshotDeployResponse databaseSnapshotDeploy(String dbId, String snapshotId)
           
 DatabaseSnapshotListResponse databaseSnapshotList(String dbId)
           
 void deleteUser(String id)
          Deletes an user.
static String encodePassword(String password, String version)
           
 CBAccount getAccount(String name)
           
protected static ApplicationConfiguration getAppConfig(File deployZip, String[] environments, String[] implicitEnvironments)
           
 ApplicationConfiguration getApplicationConfiguration(String warFilePath, String account, String[] environments)
           
 CBUser getUser(String id)
          Looks up the user by ID.
 CBUser getUserByFingerprint(String sshPublicKeyFingerprint)
          Looks up the user by the public key fingerprint
protected  com.thoughtworks.xstream.XStream getXStream()
           
 void main(String[] args)
           
 void mainCall(String[] args)
           
protected  Object readResponse(String response)
           
 SayHelloResponse sayHello(String message)
           
 ServiceListResponse serviceList(String account)
           
 ServiceResourceInfo serviceResourceInfo(String service, String resourceId)
           
 ServiceResourceListResponse serviceResourceList(String service, String account, String resourceType)
           
 ServiceSubscriptionInfo serviceSubscribe(String service, String plan, String account, Map<String,String> settings)
           
 ServiceSubscriptionInfo serviceSubscriptionInfo(String service, String subscriptionId)
           
 ServiceSubscriptionListResponse serviceSubscriptionList(String account)
           
 ServiceSubscriptionInfo serviceSubscriptionUpdate(String service, String plan, String subscriptionId, Map<String,String> settings)
           
 ServiceSubscriptionDeleteResponse serviceUnSubscribe(String service, String subscriptionId)
           
 void tailLog(String appId, String logName, OutputStream out)
           
 CBUser updateUser(String id, CBUser user)
          Updates the user record.
 
Methods inherited from class com.cloudbees.api.BeesClientBase
executeCometRequest, executeRequest, executeUpload, getApiUrl, getBeesClientConfiguration, getRequestURL, getRequestURL, getResponseString, getSignature, isVerbose, md5, processError, setVerbose, trace, traceResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeesClient

public BeesClient(BeesClientConfiguration beesClientConfiguration)

BeesClient

public BeesClient(String server,
                  String apikey,
                  String secret,
                  String format,
                  String version)
Method Detail

createUser

public CBUser createUser(CBUser user)
                  throws IOException
Creates an user, including a partial user creation.

Throws:
IOException
See Also:
API spec

updateUser

public CBUser updateUser(String id,
                         CBUser user)
                  throws IOException
Updates the user record.

Parameters:
id - The ID of the user to update. Corresponds to CBUser.id.
user - You should only set fields that you want to update, and leave everything else to null, to indicate those values should remain untouched.
Throws:
IOException

deleteUser

public void deleteUser(String id)
                throws IOException
Deletes an user.

Throws:
IOException

addUserToAccount

public CBUser addUserToAccount(CBAccount account,
                               CBUser user)
                        throws IOException
Throws:
IOException

getAccount

public CBAccount getAccount(String name)
                     throws IOException
Throws:
IOException

getUser

public CBUser getUser(String id)
               throws IOException
Looks up the user by ID.

Throws:
IOException

getUserByFingerprint

public CBUser getUserByFingerprint(String sshPublicKeyFingerprint)
                            throws IOException
Looks up the user by the public key fingerprint

Parameters:
sshPublicKeyFingerprint - Fingerprint formatted as "12:34:56:..:aa:bb:cc" (case insensitive)
Throws:
IOException

sayHello

public SayHelloResponse sayHello(String message)
                          throws Exception
Throws:
Exception

applicationGetSourceUrl

public ApplicationGetSourceUrlResponse applicationGetSourceUrl(String appId)
                                                        throws Exception
Throws:
Exception

applicationDelete

public ApplicationDeleteResponse applicationDelete(String appId)
                                            throws Exception
Throws:
Exception

applicationRestart

public ApplicationRestartResponse applicationRestart(String appId)
                                              throws Exception
Throws:
Exception

applicationStart

public ApplicationStatusResponse applicationStart(String appId)
                                           throws Exception
Throws:
Exception

applicationStop

public ApplicationStatusResponse applicationStop(String appId)
                                          throws Exception
Throws:
Exception

applicationList

public ApplicationListResponse applicationList()
                                        throws Exception
Returns all the applications in all the account sthat you belong to.

Short-hand for applicationList(null).

Throws:
Exception

applicationList

public ApplicationListResponse applicationList(String account)
                                        throws Exception
Returns all the applications in the specified account.

Parameters:
account - if null, returns all the applications from all the accounts that you belong to.
Throws:
Exception
Since:
1.1.3

applicationInfo

public ApplicationInfo applicationInfo(String appId)
                                throws Exception
Throws:
Exception

applicationSetMeta

public ApplicationSetMetaResponse applicationSetMeta(String appId,
                                                     Map<String,String> metaAttrs)
                                              throws Exception
Throws:
Exception

applicationJarCrcs

public ApplicationJarHashesResponse applicationJarCrcs(String appId,
                                                       Map<String,String> hashes)
                                                throws Exception
Deprecated. 

Throws:
Exception

applicationJarHashes

public ApplicationJarHashesResponse applicationJarHashes(String appId,
                                                         Map<String,String> hashes)
                                                  throws Exception
Throws:
Exception

applicationDeployEar

@Deprecated
public ApplicationDeployArchiveResponse applicationDeployEar(String appId,
                                                                        String environment,
                                                                        String description,
                                                                        String earFile,
                                                                        String srcFile,
                                                                        UploadProgress progress)
                                                      throws Exception
Deprecated. use applicationDeployEar(String, String, String, java.io.File, java.io.File, UploadProgress)

Throws:
Exception

applicationDeployEar

public ApplicationDeployArchiveResponse applicationDeployEar(String appId,
                                                             String environment,
                                                             String description,
                                                             File earFile,
                                                             File srcFile,
                                                             UploadProgress progress)
                                                      throws Exception
Throws:
Exception
Since:
1.1.4

applicationDeployWar

@Deprecated
public ApplicationDeployArchiveResponse applicationDeployWar(String appId,
                                                                        String environment,
                                                                        String description,
                                                                        String warFile,
                                                                        String srcFile,
                                                                        UploadProgress progress)
                                                      throws Exception
Deprecated. use applicationDeployWar(String, String, String, File, File, UploadProgress)

Throws:
Exception

applicationDeployWar

public ApplicationDeployArchiveResponse applicationDeployWar(String appId,
                                                             String environment,
                                                             String description,
                                                             File warFile,
                                                             File srcFile,
                                                             UploadProgress progress)
                                                      throws Exception
Throws:
Exception
Since:
1.1.4

applicationDeployWar

@Deprecated
public ApplicationDeployArchiveResponse applicationDeployWar(String appId,
                                                                        String environment,
                                                                        String description,
                                                                        String warFile,
                                                                        String srcFile,
                                                                        boolean deltaDeploy,
                                                                        UploadProgress progress)
                                                      throws Exception
Deprecated. use applicationDeployWar(String, String, String, File, File, boolean, UploadProgress)

Throws:
Exception

applicationDeployWar

public ApplicationDeployArchiveResponse applicationDeployWar(String appId,
                                                             String environment,
                                                             String description,
                                                             File warFile,
                                                             File srcFile,
                                                             boolean deltaDeploy,
                                                             UploadProgress progress)
                                                      throws Exception
Throws:
Exception
Since:
1.1.4

applicationDeployArchive

@Deprecated
public ApplicationDeployArchiveResponse applicationDeployArchive(String appId,
                                                                            String environment,
                                                                            String description,
                                                                            String earFile,
                                                                            String srcFile,
                                                                            String archiveType,
                                                                            UploadProgress progress)
                                                          throws Exception
Deprecated. use applicationDeployArchive(String, String, String, File, File, String, UploadProgress)

Throws:
Exception

applicationDeployArchive

public ApplicationDeployArchiveResponse applicationDeployArchive(String appId,
                                                                 String environment,
                                                                 String description,
                                                                 File earFile,
                                                                 File srcFile,
                                                                 String archiveType,
                                                                 UploadProgress progress)
                                                          throws Exception
Throws:
Exception
Since:
1.1.4

applicationDeployArchive

@Deprecated
public ApplicationDeployArchiveResponse applicationDeployArchive(String appId,
                                                                            String environment,
                                                                            String description,
                                                                            String earFile,
                                                                            String srcFile,
                                                                            String archiveType,
                                                                            boolean deltaDeploy,
                                                                            UploadProgress progress)
                                                          throws Exception
Deprecated. use applicationDeployArchive(String, String, String, File, File, String, boolean, UploadProgress)

Throws:
Exception

applicationDeployArchive

public ApplicationDeployArchiveResponse applicationDeployArchive(String appId,
                                                                 String environment,
                                                                 String description,
                                                                 File earFile,
                                                                 File srcFile,
                                                                 String archiveType,
                                                                 boolean deltaDeploy,
                                                                 UploadProgress progress)
                                                          throws Exception
Throws:
Exception
Since:
1.1.4

applicationDeployArchive

@Deprecated
public ApplicationDeployArchiveResponse applicationDeployArchive(String appId,
                                                                            String environment,
                                                                            String description,
                                                                            String earFile,
                                                                            String srcFile,
                                                                            String archiveType,
                                                                            boolean deltaDeploy,
                                                                            Map<String,String> parameters,
                                                                            UploadProgress progress)
                                                          throws Exception
Deprecated. use applicationDeployArchive(String, String, String, File, File, String, boolean, Map, UploadProgress)

Throws:
Exception

applicationDeployArchive

public ApplicationDeployArchiveResponse applicationDeployArchive(String appId,
                                                                 String environment,
                                                                 String description,
                                                                 File earFile,
                                                                 File srcFile,
                                                                 String archiveType,
                                                                 boolean deltaDeploy,
                                                                 Map<String,String> parameters,
                                                                 UploadProgress progress)
                                                          throws Exception
Throws:
Exception
Since:
1.1.4

applicationDeployArchive

public ApplicationDeployArchiveResponse applicationDeployArchive(ApplicationDeployArgs args)
                                                          throws Exception
Throws:
Exception

applicationCheckSums

public ApplicationCheckSumsResponse applicationCheckSums(String appId)
                                                  throws Exception
Throws:
Exception

applicationCheckSums

public ApplicationCheckSumsResponse applicationCheckSums(String appId,
                                                         boolean traceResponse)
                                                  throws Exception
Throws:
Exception

applicationScale

public ApplicationScaleResponse applicationScale(String appId,
                                                 int unit)
                                          throws Exception
Throws:
Exception

databaseCreate

public DatabaseCreateResponse databaseCreate(String domain,
                                             String dbId,
                                             String username,
                                             String password)
                                      throws Exception
Throws:
Exception

databaseDelete

public DatabaseDeleteResponse databaseDelete(String dbId)
                                      throws Exception
Throws:
Exception

databaseInfo

public DatabaseInfo databaseInfo(String dbId,
                                 boolean fetchPassword)
                          throws Exception
Throws:
Exception

databaseList

public DatabaseListResponse databaseList()
                                  throws Exception
Returns all the databases in all the account sthat you belong to.

Short-hand for databaseList(null).

Throws:
Exception

databaseList

public DatabaseListResponse databaseList(String account)
                                  throws Exception
Returns all the databases in the specified account.

Parameters:
account - if null, returns all the databases from all the accounts that you belong to.
Throws:
Exception
Since:
1.1.3

databaseSetPassword

public DatabaseSetPasswordResponse databaseSetPassword(String dbId,
                                                       String password)
                                                throws Exception
Throws:
Exception

databaseSnapshotList

public DatabaseSnapshotListResponse databaseSnapshotList(String dbId)
                                                  throws Exception
Throws:
Exception

databaseSnapshotDelete

public DatabaseSnapshotDeleteResponse databaseSnapshotDelete(String dbId,
                                                             String snapshotId)
                                                      throws Exception
Throws:
Exception

databaseSnapshotDeploy

public DatabaseSnapshotDeployResponse databaseSnapshotDeploy(String dbId,
                                                             String snapshotId)
                                                      throws Exception
Throws:
Exception

databaseSnapshotCreate

public DatabaseSnapshotInfo databaseSnapshotCreate(String dbId,
                                                   String snapshotTitle)
                                            throws Exception
Throws:
Exception

accountKeys

public AccountKeysResponse accountKeys(String domain,
                                       String user,
                                       String password)
                                throws Exception
Throws:
Exception

accountList

public AccountListResponse accountList()
                                throws Exception
Throws:
Exception

getApplicationConfiguration

public ApplicationConfiguration getApplicationConfiguration(String warFilePath,
                                                            String account,
                                                            String[] environments)
                                                     throws Exception
Throws:
Exception

configurationParametersUpdate

public ConfigurationParametersUpdateResponse configurationParametersUpdate(String resourceId,
                                                                           String configType,
                                                                           File resourceFile)
                                                                    throws Exception
Throws:
Exception

configurationParametersDelete

public ConfigurationParametersDeleteResponse configurationParametersDelete(String resourceId,
                                                                           String configType)
                                                                    throws Exception
Throws:
Exception

configurationParameters

public ConfigurationParametersResponse configurationParameters(String resourceId,
                                                               String configType)
                                                        throws Exception
Throws:
Exception

serviceList

public ServiceListResponse serviceList(String account)
                                throws Exception
Throws:
Exception

serviceSubscribe

public ServiceSubscriptionInfo serviceSubscribe(String service,
                                                String plan,
                                                String account,
                                                Map<String,String> settings)
                                         throws Exception
Throws:
Exception

serviceUnSubscribe

public ServiceSubscriptionDeleteResponse serviceUnSubscribe(String service,
                                                            String subscriptionId)
                                                     throws Exception
Throws:
Exception

serviceSubscriptionUpdate

public ServiceSubscriptionInfo serviceSubscriptionUpdate(String service,
                                                         String plan,
                                                         String subscriptionId,
                                                         Map<String,String> settings)
                                                  throws Exception
Throws:
Exception

serviceSubscriptionInfo

public ServiceSubscriptionInfo serviceSubscriptionInfo(String service,
                                                       String subscriptionId)
                                                throws Exception
Throws:
Exception

serviceSubscriptionList

public ServiceSubscriptionListResponse serviceSubscriptionList(String account)
                                                        throws Exception
Throws:
Exception

serviceResourceInfo

public ServiceResourceInfo serviceResourceInfo(String service,
                                               String resourceId)
                                        throws Exception
Throws:
Exception

serviceResourceList

public ServiceResourceListResponse serviceResourceList(String service,
                                                       String account,
                                                       String resourceType)
                                                throws Exception
Throws:
Exception

getAppConfig

protected static ApplicationConfiguration getAppConfig(File deployZip,
                                                       String[] environments,
                                                       String[] implicitEnvironments)
                                                throws IOException
Throws:
IOException

createParameter

protected String createParameter(Map<String,String> parameters)

tailLog

public void tailLog(String appId,
                    String logName,
                    OutputStream out)
             throws Exception
Throws:
Exception

call

public String call(String action,
                   Map<String,String> params)
            throws Exception
Throws:
Exception

getXStream

protected com.thoughtworks.xstream.XStream getXStream()
                                               throws Exception
Throws:
Exception

readResponse

protected Object readResponse(String response)
                       throws Exception
Throws:
Exception

encodePassword

public static String encodePassword(String password,
                                    String version)

mainCall

public void mainCall(String[] args)
              throws Exception
Throws:
Exception

main

public void main(String[] args)
          throws Exception
Throws:
Exception


Copyright © 2011-2012. All Rights Reserved.