/** * 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); }
/** * 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 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); } } }
new BeesClient(getRequiredOption("url", options), getRequiredOption("username", options), getRequiredOption( "password", options), "0.1", "1.0");
new BeesClient(getRequiredOption("url", options), getRequiredOption("username", options), getRequiredOption( "password", options), "0.1", "1.0");
/** * Creates a new {@link BeesClient} that uses the access token encapsulated in this {@link OauthToken}. * * @param current * The configuration parameter to inherit from. This method does not mutate this object. */ public BeesClient createClient(BeesClientConfiguration current) { // TODO: there should be a copy constructor BeesClientConfiguration config = new BeesClientConfiguration(current.getServerApiUrl()); config.setOAuthToken(accessToken); return new BeesClient(config); }
/** * Creates a new {@link BeesClient} that uses the access token encapsulated in this {@link OauthToken}. * * @param current * The configuration parameter to inherit from. This method does not mutate this object. */ public BeesClient createClient(BeesClientConfiguration current) { // TODO: there should be a copy constructor BeesClientConfiguration config = new BeesClientConfiguration(current.getServerApiUrl()); 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()); } }
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; }
OauthClient oauthClient = new BeesClient(oauthConfig.getClientId(), oauthConfig.getClientSecret()).getOauthClient();