public class BeesClient
extends com.cloudbees.api.BeesClientBase
| Modifier and Type | Class and Description |
|---|---|
static class |
BeesClient.UsageError |
| Constructor and Description |
|---|
BeesClient(com.cloudbees.api.BeesClientConfiguration beesClientConfiguration) |
BeesClient(String apikey,
String secret)
Creates a client that talks to the CloudBees production API endpoint
To obtain your API key an the secret, visit https://grandcentral.cloudbees.com/user/keys
If you have reigstered an OAuth application and talking to CloudBees as that OAuth
application (for example to validate OAuth tokens you received from your users via browser),
then you can specify that OAuth client ID and the secret.
|
BeesClient(String server,
String apikey,
String secret) |
BeesClient(String server,
String apikey,
String secret,
String format,
String version) |
public BeesClient(com.cloudbees.api.BeesClientConfiguration beesClientConfiguration)
public BeesClient(String apikey, String secret)
public OauthClient getOauthClient()
This method does not involve any remote call.
public OauthClient getOauthClient(String gcUrl)
gcUrl - If null defaults to https://grandcentral.cloudbees.compublic CBUser createUser(CBUser user) throws IOException
IOExceptionpublic CBUser updateUser(String id, CBUser user) throws IOException
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.IOExceptionpublic void deleteUser(String id) throws IOException
IOExceptionpublic CBUser addUserToAccount(CBAccount account, CBUser user) throws IOException
IOExceptionprotected <T> T jsonPOJORequest(String apiTail, Object request, Class<T> type, String method) throws IOException
apiTail - The end point to hit. Appended to base. Shouldn't start with '/'request - JSON-bound POJO object that represents the request payload, or null if none.type - JSON-bound POJO class to unmarshal the response into.method - HTTP method name like GET or POST.IOException - If the communication fails.public HttpReply jsonRequest(String urlTail, String method, Map<String,String> headers, String jsonContent) throws IOException
urlTail - The end point to hit. Appended to base. Shouldn't start with '/'method - HTTP method name like GET or POST.headers - jsonContent - The json request payload, or null if none. @throws IOException If the communication fails.IOExceptionpublic CBAccount getAccount(String name) throws IOException
IOExceptionpublic CBUser getUser(String id) throws IOException
IOExceptionpublic CBUser getSelfUser() throws IOException
IOExceptionpublic CBUser getUserByFingerprint(String sshPublicKeyFingerprint) throws IOException
sshPublicKeyFingerprint - Fingerprint formatted as "12:34:56:..:aa:bb:cc" (case insensitive)IOExceptionpublic SayHelloResponse sayHello(String message) throws Exception
Exceptionpublic ApplicationGetSourceUrlResponse applicationGetSourceUrl(String appId) throws Exception
Exceptionpublic ApplicationDeleteResponse applicationDelete(String appId) throws Exception
Exceptionpublic ApplicationRestartResponse applicationRestart(String appId) throws Exception
Exceptionpublic ApplicationStatusResponse applicationStart(String appId) throws Exception
Exceptionpublic ApplicationStatusResponse applicationStop(String appId) throws Exception
Exceptionpublic ApplicationStatusResponse applicationHibernate(String appId) throws Exception
Exceptionpublic ApplicationListResponse applicationList() throws Exception
applicationList(null).Exceptionpublic ApplicationListResponse applicationList(String account) throws Exception
account - if null, returns all the applications from all the accounts that you belong to.Exceptionpublic ApplicationInfo applicationInfo(String appId) throws Exception
Exceptionpublic ApplicationSetMetaResponse applicationSetMeta(String appId, Map<String,String> metaAttrs) throws Exception
Exceptionpublic ApplicationJarHashesResponse applicationJarCrcs(String appId, Map<String,String> hashes) throws Exception
Exceptionpublic ApplicationJarHashesResponse applicationJarHashes(String appId, Map<String,String> hashes) throws Exception
Exception@Deprecated public ApplicationDeployArchiveResponse applicationDeployEar(String appId, String environment, String description, String earFile, String srcFile, com.cloudbees.api.UploadProgress progress) throws Exception
applicationDeployEar(String, String, String, java.io.File, java.io.File, UploadProgress)Exceptionpublic ApplicationDeployArchiveResponse applicationDeployEar(String appId, String environment, String description, File earFile, File srcFile, com.cloudbees.api.UploadProgress progress) throws Exception
Exception@Deprecated public ApplicationDeployArchiveResponse applicationDeployWar(String appId, String environment, String description, String warFile, String srcFile, com.cloudbees.api.UploadProgress progress) throws Exception
Exceptionpublic ApplicationDeployArchiveResponse applicationDeployWar(String appId, String environment, String description, File warFile, File srcFile, com.cloudbees.api.UploadProgress progress) throws Exception
Exception@Deprecated public ApplicationDeployArchiveResponse applicationDeployWar(String appId, String environment, String description, String warFile, String srcFile, boolean deltaDeploy, com.cloudbees.api.UploadProgress progress) throws Exception
Exceptionpublic ApplicationDeployArchiveResponse applicationDeployWar(String appId, String environment, String description, File warFile, File srcFile, boolean deltaDeploy, com.cloudbees.api.UploadProgress progress) throws Exception
Exception@Deprecated public ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, String earFile, String srcFile, String archiveType, com.cloudbees.api.UploadProgress progress) throws Exception
applicationDeployArchive(String, String, String, File, File, String, UploadProgress)Exceptionpublic ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, File earFile, File srcFile, String archiveType, com.cloudbees.api.UploadProgress progress) throws Exception
Exception@Deprecated public ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, String earFile, String srcFile, String archiveType, boolean deltaDeploy, com.cloudbees.api.UploadProgress progress) throws Exception
applicationDeployArchive(String, String, String, File, File, String, boolean,
UploadProgress)Exceptionpublic ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, File earFile, File srcFile, String archiveType, boolean deltaDeploy, com.cloudbees.api.UploadProgress progress) throws Exception
Exception@Deprecated public ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, String earFile, String srcFile, String archiveType, boolean deltaDeploy, Map<String,String> parameters, com.cloudbees.api.UploadProgress progress) throws Exception
applicationDeployArchive(String, String, String, File, File, String, boolean, Map,
UploadProgress)Exceptionpublic ApplicationDeployArchiveResponse applicationDeployArchive(String appId, String environment, String description, File earFile, File srcFile, String archiveType, boolean deltaDeploy, Map<String,String> parameters, com.cloudbees.api.UploadProgress progress) throws Exception
Exceptionpublic ApplicationDeployArchiveResponse applicationDeployArchive(ApplicationDeployArgs args) throws Exception
Exceptionpublic ApplicationCheckSumsResponse applicationCheckSums(String appId) throws Exception
Exceptionpublic ApplicationCheckSumsResponse applicationCheckSums(String appId, boolean traceResponse) throws Exception
Exceptionpublic ApplicationScaleResponse applicationScale(String appId, int unit) throws Exception
Exceptionpublic DatabaseCreateResponse databaseCreate(String domain, String dbId, String username, String password) throws Exception
Exceptionpublic DatabaseCreateResponse databaseCreate(String domain, String dbId, String username, String password, String plan) throws Exception
Exceptionpublic DatabaseDeleteResponse databaseDelete(String dbId) throws Exception
Exceptionpublic DatabaseInfo databaseInfo(String dbId, boolean fetchPassword) throws Exception
Exceptionpublic DatabaseListResponse databaseList() throws Exception
databaseList(null).Exceptionpublic DatabaseListResponse databaseList(String account) throws Exception
account - if null, returns all the databases from all the accounts that you belong to.Exceptionpublic DatabaseSetPasswordResponse databaseSetPassword(String dbId, String password) throws Exception
dbId - The database IDpassword - The database passwordExceptionpublic DatabaseInfo databaseUpdate(String dbID, Map<String,String> parameters) throws Exception
Exceptionpublic DatabaseSnapshotListResponse databaseSnapshotList(String dbId) throws Exception
Exceptionpublic DatabaseSnapshotDeleteResponse databaseSnapshotDelete(String dbId, String snapshotId) throws Exception
Exceptionpublic DatabaseSnapshotDeployResponse databaseSnapshotDeploy(String dbId, String snapshotId) throws Exception
Exceptionpublic DatabaseSnapshotInfo databaseSnapshotCreate(String dbId, String snapshotTitle) throws Exception
Exceptionpublic DatabaseBackupListResponse databaseBackupList(String dbId) throws Exception
Exceptionpublic DatabaseBackupResponse databaseBackupCreate(String dbId) throws Exception
Exceptionpublic DatabaseBackupResponse databaseBackupRestore(String dbId, String backupId) throws Exception
Exceptionpublic DatabaseBackupResponse databaseBackupDelete(String dbId, String backupId) throws Exception
Exceptionpublic DatabaseClusterListResponse databaseClusterList(String account) throws Exception
Exceptionpublic AccountKeysResponse accountKeys(String domain, String user, String password) throws Exception
Exceptionpublic AccountListResponse accountList() throws Exception
Exceptionpublic ApplicationConfiguration getApplicationConfiguration(String warFilePath, String account, String[] environments) throws Exception
Exceptionpublic ConfigurationParametersUpdateResponse configurationParametersUpdate(String resourceId, String configType, File resourceFile) throws Exception
Exceptionpublic ConfigurationParametersUpdateResponse configurationParametersUpdate(String resourceId, String configType, ConfigParameters model) throws Exception
Exceptionpublic ConfigurationParametersDeleteResponse configurationParametersDelete(String resourceId, String configType) throws Exception
Exceptionpublic ConfigurationParametersResponse configurationParameters(String resourceId, String configType) throws Exception
Exceptionpublic ConfigParameters configurationParametersAsObject(String resourceId, String configType) throws Exception
configurationParameters(String, String) and obtains the result as a data-bound object.Exceptionpublic ServiceListResponse serviceList(String account) throws Exception
Exceptionpublic ServiceSubscriptionInfo serviceSubscribe(String service, String plan, String account, Map<String,String> settings) throws Exception
Exceptionpublic ServiceSubscriptionDeleteResponse serviceUnSubscribe(String service, String subscriptionId) throws Exception
Exceptionpublic ServiceSubscriptionDeleteResponse serviceUnSubscribe(String service, String subscriptionId, Map<String,String> settings) throws Exception
Exceptionpublic ServiceSubscriptionInfo serviceSubscriptionUpdate(String service, String plan, String subscriptionId, Map<String,String> settings) throws Exception
Exceptionpublic ServiceSubscriptionInfo serviceSubscriptionInfo(String service, String subscriptionId) throws Exception
Exceptionpublic ServiceSubscriptionListResponse serviceSubscriptionList(String account) throws Exception
Exceptionpublic ServiceResourceInfo serviceResourceInfo(String service, String resourceId) throws Exception
Exceptionpublic ServiceResourceListResponse serviceResourceList(String service, String account, String resourceType) throws Exception
Exceptionpublic ServiceResourceBindingListResponse resourceBindingList(String service, String resourceId) throws Exception
Exceptionpublic ServiceResourceBindingListResponse resourceBindingList(String service, String resourceId, boolean bidirectional) throws Exception
Exceptionpublic AccountRegionListResponse accountRegionList(String account, String service) throws Exception
Exceptionpublic ApplicationInstanceListResponse applicationInstanceList(String appId) throws Exception
Exceptionpublic ApplicationInstanceStatusResponse applicationInstanceReplace(String instanceId) throws Exception
Exceptionpublic ApplicationInstanceStatusResponse applicationInstanceRestart(String instanceId) throws Exception
Exceptionpublic ApplicationInstanceStatusResponse applicationInstanceDelete(String instanceId) throws Exception
Exceptionpublic ApplicationInstanceInfo applicationInstanceTagsUpdate(String instanceId, Map<String,String> tags, boolean replace) throws Exception
Exceptionpublic ApplicationInstanceInfo applicationInstanceInfo(String instanceId) throws Exception
Exceptionpublic ApplicationInstanceInvokeResponse applicationInstanceInvoke(String instanceId, String invoke, Map<String,String> parameters) throws Exception
Exceptionpublic void applicationInstanceTailLog(String instanceId, String logName, OutputStream out) throws Exception
Exceptionpublic ApplicationSnapshotListResponse applicationSnapshotList(String appId) throws Exception
Exceptionpublic ApplicationSnapshotStatusResponse applicationSnapshotDelete(String snapshotId) throws Exception
Exceptionpublic ApplicationSnapshotInfo applicationSnapshotInfo(String snapshotId) throws Exception
Exceptionpublic ApplicationSnapshotStatusResponse applicationSnapshotUpdate(String snapshotId, Map<String,String> parameters) throws Exception
Exceptionpublic ApplicationStatusResponse applicationProxyUpdate(String appId, Map<String,String> parameters) throws Exception
Exceptionpublic ApplicationConfigUpdateResponse applicationConfigUpdate(String appId, Map<String,String> parameters) throws Exception
Exceptionpublic ServiceResourceBindResponse resourceBind(String fromService, String fromResourceId, String toService, String toResourceId, String alias, Map<String,String> settings) throws Exception
Exceptionpublic ServiceResourceUnBindResponse resourceUnBind(String service, String resourceId, String alias) throws Exception
Exceptionpublic ServiceResourceInfo serviceResourceCreate(String service, String account, String resourceType, String resourceName, Map<String,String> settings) throws Exception
Exceptionpublic ServiceResourceInfo serviceResourceUpdate(String service, String resourceId, Map<String,String> settings) throws Exception
Exceptionpublic ServiceResourceDeleteResponse serviceResourceDelete(String service, String resourceId) throws Exception
Exceptionpublic ApplicationCreateResponse applicationCreate(String appId, Map<String,String> parameters) throws Exception
Exceptionpublic ServerPoolInfo serverPoolCreate(String account, String poolName, Map<String,String> parameters) throws Exception
Exceptionpublic ServerPoolInfo serverPoolInfo(String poolId) throws Exception
Exceptionpublic ServerPoolInfo serverPoolInfo(String poolId, boolean withApplications) throws Exception
Exceptionpublic ServerPoolListResponse serverPoolList(String account) throws Exception
Exceptionpublic ServerPoolDeleteResponse serverPoolDelete(String poolId) throws Exception
Exceptionpublic ServerInfo serverCreate(String poolId, Map<String,String> parameters) throws Exception
Exceptionpublic ServerRestoreResponse serverRestore(String serverId) throws Exception
Exceptionpublic ServerInfo serverInfo(String serverId) throws Exception
Exceptionpublic ServerStatusResponse serverStop(String serverId) throws Exception
Exceptionpublic ServerStatusResponse serverDelete(String serverId) throws Exception
Exceptionpublic ServerStatusResponse serverDeactivate(String serverId) throws Exception
Exceptionpublic ServiceSubscriptionInvokeInfo serviceSubscriptionInvoke(String service, String subscriptionId, String invoke, Map<String,String> parameters) throws Exception
Exceptionpublic ServiceResourceInvokeInfo serviceResourceInvoke(String service, String resourceId, String invoke, Map<String,String> parameters) throws Exception
Exceptionpublic ApplicationCreateResponse applicationCreate(String appId, Map<String,String> parameters, Map<String,String> appParameters, Map<String,String> appVariables) throws Exception
Exceptionpublic List<ResourceSettings> applicationResources(String appId, String resourceType, String configType, String environment) throws Exception
Exceptionpublic String executeRequest(String url) throws Exception
executeRequest in class com.cloudbees.api.BeesClientBaseExceptionprotected String executeUpload(String uploadURL, Map<String,String> params, Map<String,File> files, com.cloudbees.api.UploadProgress writeListener) throws Exception
executeUpload in class com.cloudbees.api.BeesClientBaseExceptionprotected static ApplicationConfiguration getAppConfig(File deployZip, String[] environments, String[] implicitEnvironments) throws IOException
IOExceptionpublic void tailLog(String appId, String logName, OutputStream out) throws Exception
Exceptionprotected Object apiCall(String apiMethod, Map<String,String> settings, Map<String,String> params) throws Exception
Exceptionpublic String call(String action, Map<String,String> params) throws Exception
Exceptionprotected com.thoughtworks.xstream.XStream getXStream()
throws Exception
ExceptionCopyright © 2011-2015. All Rights Reserved.