/** * @deprecated use {@link #applicationDeployArchive(String, String, String, File, File, String, boolean, * UploadProgress)} */ @Deprecated public ApplicationDeployArchiveResponse applicationDeployArchive( String appId, String environment, String description, String earFile, String srcFile, String archiveType, boolean deltaDeploy, UploadProgress progress) throws Exception { return applicationDeployArchive(appId, environment, description, asFile(earFile), asFile(srcFile), archiveType, deltaDeploy, progress); }
public CBUser addUser(CBUser user) throws IOException { return root.addUserToAccount(this, user); }
public ApplicationCheckSumsResponse applicationCheckSums(String appId) throws Exception { return applicationCheckSums(appId, true); }
/** * @deprecated use {@link #applicationDeployEar(String, String, String, java.io.File, java.io.File, UploadProgress)} */ @Deprecated public ApplicationDeployArchiveResponse applicationDeployEar( String appId, String environment, String description, String earFile, String srcFile, UploadProgress progress) throws Exception { return applicationDeployEar(appId, environment, description, asFile(earFile), asFile(srcFile), progress); }
/** * @deprecated use {@link #applicationDeployWar(String, String, String, File, File, UploadProgress)} */ @Deprecated public ApplicationDeployArchiveResponse applicationDeployWar( String appId, String environment, String description, String warFile, String srcFile, UploadProgress progress) throws Exception { return applicationDeployWar(appId, environment, description, asFile(warFile), asFile(srcFile), progress); }
trace("Get existing checksums"); ApplicationCheckSumsResponse applicationCheckSumsResponse = applicationCheckSums(args.appId, false); if (logger.isLoggable(Level.FINER)) { for (Map.Entry<String, Long> entry : applicationCheckSumsResponse.getCheckSums().entrySet()) { trace("No existing checksums, upload full archive"); } else { trace("Creating Delta archive for: " + archiveFile); archiveFile = ArchiveUtils.createDeltaWarFile(applicationCheckSumsResponse.getCheckSums(), archiveFile, archiveFile.getParent()); trace("Get existing jar hashes"); ApplicationJarHashesResponse applicationJarHashesResponse = applicationJarHashes(args.appId, JarUtils.getJarHashes(archiveFile)); if (applicationJarHashesResponse.getJarHash().size() == 0) { trace("No existing jars"); } else { trace("Creating Delta2 archive for: " + archiveFile); File archiveFile2 = JarUtils.createDeltaWarFile(applicationJarHashesResponse.getJarHash(), archiveFile, archiveFile.getParent()); trace("Uploading delta archive: " + archiveFile); params.put("parameters", createParameter(args.parameters)); params.put("variables", createParameter(args.variables)); String url = getApiUrl("application.deployArchive").toString(); params.put("action", "application.deployArchive"); String response = executeUpload(url, params, fileParams, args.progress);
/** * Sends a request in JSON and expects a JSON response back. * * @param urlTail The end point to hit. Appended to {@link #base}. Shouldn't start with '/' * @param headers HTTP headers * @param params * Form parameters */ /*package*/ HttpReply formUrlEncoded(String urlTail, Map<String, String> headers, Map<String,List<String>> params) throws IOException { String urlString = absolutize(urlTail); trace("API call: " + urlString); PostMethod httpMethod = new PostMethod(urlString); httpMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); for (Entry<String, List<String>> e : params.entrySet()) { for (String v : e.getValue()) { httpMethod.addParameter(e.getKey(),v); } } return executeRequest(httpMethod,headers); }
public ServiceResourceInfo serviceResourceUpdate(String service, String resourceId, Map<String, String> settings) throws Exception { Map<String, String> params = new HashMap<String, String>(); params.put("service", service); params.put("resource_id", resourceId); params.put("settings", createParameter(settings)); ServiceResourceResponse apiResponse = (ServiceResourceResponse) apiCall("service.resource.update", settings, params); return apiResponse.getResource(); }
String operation = getRequiredOption("operation", options); BeesClient client = new BeesClient(getRequiredOption("url", options), getRequiredOption("username", options), getRequiredOption( "password", options), "0.1", "1.0"); subArgs[i] = args[argIndex++]; client.main(subArgs);
/** * @since 1.1.4 */ public ApplicationDeployArchiveResponse applicationDeployEar( String appId, String environment, String description, File earFile, File srcFile, UploadProgress progress) throws Exception { String archiveType = "ear"; return applicationDeployArchive(appId, environment, description, earFile, srcFile, archiveType, false, progress); }
public String createEnvironmentWithWar(String applicationName, String domainName, String envName, String stackName, int minRam, String warFile, String versionLabel) { String tmp2=""; if(stackName == null || stackName.length()==0){ try { tmp2 = Adapter.uploadAndDeployToEnv(platform, warFile, credentials.getPublicKey(), credentials.getPrivateKey(), credentials.getAccountName(), applicationName, versionLabel, "", "", "", "", "", "deployed by cloudml" ); journal.log(Level.INFO, ">> Created application:" + tmp2); } catch (Cloud4SoaException ex) { Logger.getLogger(Cloud4soaConnector.class.getName()).log(Level.SEVERE, null, ex); } catch (java.lang.NoSuchFieldError ex){ Logger.getLogger(Cloud4soaConnector.class.getName()).log(Level.SEVERE, "The war is deployed, but due to the version conflict of cloudbees, no response is printed"); } } else{ BeesClient client = new BeesClient("https://api.cloudbees.com/api", provider.getCredentials().getLogin(), provider.getCredentials().getPassword(), "xml", "1.0"); Map<String,String> params = new HashMap<String, String>(); params.put("containerType", stackName); try { ApplicationDeployArchiveResponse deployArchiveResponse = client.applicationDeployArchive(this.credentials.getAccountName() + "/" + applicationName, envName, "deployed by cloudml", warFile, warFile, "war", false, params, null); tmp2=deployArchiveResponse.getUrl(); } catch (Exception ex) { Logger.getLogger(Cloud4soaConnector.class.getName()).log(Level.SEVERE, null, ex); } } return tmp2; }
/** * Creates a new {@link BeesClient} that uses the access token encapsulated in this {@link OauthToken} */ public BeesClient createClient() { BeesClientConfiguration config = new BeesClientConfiguration(); config.setOAuthToken(accessToken); return new BeesClient(config); }
public void restartApp(String appId){ try { BeesClient client = new BeesClient("https://api.cloudbees.com/api", provider.getCredentials().getLogin(), provider.getCredentials().getPassword(), "xml", "1.0"); client.applicationRestart("mod4cloud/" + appId); } catch (Exception e) { journal.log(Level.SEVERE, e.getMessage()); } }
OauthClient oauthClient = new BeesClient(oauthConfig.getClientId(), oauthConfig.getClientSecret()).getOauthClient();
public void bindDbToApp(String appId, String dbId, String alias){ try { //Thread.sleep(60000); BeesClient client = new BeesClient("https://api.cloudbees.com/api", provider.getCredentials().getLogin(), provider.getCredentials().getPassword(), "xml", "1.0"); ServiceResourceBindResponse srbr=client.resourceBind("cb-app", "mod4cloud/"+appId, "cb-db", "mod4cloud/"+dbId, alias, Collections.EMPTY_MAP); Logger.getLogger(Cloud4soaConnector.class.getName()).log(Level.INFO, srbr.getMessage()); restartApp(appId); } catch (Exception ex) { Logger.getLogger(Cloud4soaConnector.class.getName()).log(Level.SEVERE, null, ex); } }
@Override public void configAppParameters(String applicationName, Map<String,String> params) { if("cloudbees".equals(provider.getName().toLowerCase())){ try{ BeesClient client = new BeesClient("https://api.cloudbees.com/api", provider.getCredentials().getLogin(), provider.getCredentials().getPassword(), "xml", "1.0"); client.applicationConfigUpdate(this.credentials.getAccountName()+"/"+applicationName, params); } catch(Exception ex){ Logger.getLogger(Cloud4soaConnector.class.getName()).log(Level.SEVERE, "failed to set up scale", ex); } } }
/** * @since 1.1.4 */ public ApplicationDeployArchiveResponse applicationDeployWar( String appId, String environment, String description, File warFile, File srcFile, UploadProgress progress) throws Exception { return applicationDeployWar(appId, environment, description, warFile, srcFile, true, progress); }
/** * Returns all the applications in all the account sthat you belong to. * <p/> * Short-hand for {@code applicationList(null)}. */ public ApplicationListResponse applicationList() throws Exception { return applicationList(null); }
/** * @deprecated */ public ApplicationJarHashesResponse applicationJarCrcs(String appId, Map<String, String> hashes) throws Exception { return applicationJarHashes(appId, hashes); }
trace("Get existing checksums"); ApplicationCheckSumsResponse applicationCheckSumsResponse = applicationCheckSums(args.appId, false); if (logger.isLoggable(Level.FINER)) { for (Map.Entry<String, Long> entry : applicationCheckSumsResponse.getCheckSums().entrySet()) { trace("No existing checksums, upload full archive"); } else { trace("Creating Delta archive for: " + archiveFile); archiveFile = ArchiveUtils.createDeltaWarFile(applicationCheckSumsResponse.getCheckSums(), archiveFile, archiveFile.getParent()); trace("Get existing jar hashes"); ApplicationJarHashesResponse applicationJarHashesResponse = applicationJarHashes(args.appId, JarUtils.getJarHashes(archiveFile)); if (applicationJarHashesResponse.getJarHash().size() == 0) { trace("No existing jars"); } else { trace("Creating Delta2 archive for: " + archiveFile); File archiveFile2 = JarUtils.createDeltaWarFile(applicationJarHashesResponse.getJarHash(), archiveFile, archiveFile.getParent()); trace("Uploading delta archive: " + archiveFile); params.put("parameters", createParameter(args.parameters)); params.put("variables", createParameter(args.variables)); String url = getApiUrl("application.deployArchive").toString(); params.put("action", "application.deployArchive"); String response = executeUpload(url, params, fileParams, args.progress);