@Override public boolean perform() throws Exception { List<String> environmentIds = Lists.newArrayList(getEnvironmentId().split(",")); for (ListIterator<String> i = environmentIds.listIterator(); i.hasNext(); ) { String element = i.next(); UpdateEnvironmentRequest req = new UpdateEnvironmentRequest(). withEnvironmentId(element). withVersionLabel(getVersionLabel()). withDescription(getVersionDescription()); log("Updating environmentId '%s' with Version Label set to '%s'", element, getVersionLabel()); getAwseb().updateEnvironment(req); } return false; }
private void updateEnvironment(String applicationName, String environmentName, AWSElasticBeanstalk eb, String versionLabel) { log.info("requesting update of environment to new version label"); UpdateEnvironmentRequest request = new UpdateEnvironmentRequest().withApplicationName(applicationName) .withEnvironmentName(environmentName).withVersionLabel(versionLabel); eb.updateEnvironment(request); log.info("requested"); }
private void updateEnv() { log("'%s': Attempt %d/%d", envd.getEnvironmentName(), nAttempt, MAX_ATTEMPTS); UpdateEnvironmentRequest uavReq = new UpdateEnvironmentRequest().withEnvironmentId(environmentId).withVersionLabel(versionLabel); isUpdated = true; try { awseb.updateEnvironment(uavReq); isReady(); nAttempt = 0; } catch (Exception e) { log("'%s': Problem:", envd.getEnvironmentName()); e.printStackTrace(listener.getLogger()); if (e.getMessage().contains("No Application Version named")) { isComplete = true; } if (nAttempt++ > MAX_ATTEMPTS) { log("'%s': Unable to update environment!", envd.getEnvironmentName()); isComplete = true; } } }
public void uploadWar(String warFile, String versionLabel, String applicationName, String envName, int timeout) { prepareWar(new File(warFile), versionLabel, applicationName); journal.log(Level.INFO, ">> Uploading War file!"); while(timeout-- > 0){ System.out.print("-"); try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(BeanstalkConnector.class.getName()).log(Level.SEVERE, null, ex); } try{ UpdateEnvironmentResult updateEnvironment = beanstalkClient.updateEnvironment(new UpdateEnvironmentRequest() .withEnvironmentName(envName) .withVersionLabel(versionLabel)); journal.log(Level.INFO, ">> War uploaded!"); break; } catch(com.amazonaws.AmazonServiceException e){ } } }
/** * Update this environment with a new version. * @param version The version to update to */ public void update(final Version version) { final UpdateEnvironmentResult res = this.client.updateEnvironment( new UpdateEnvironmentRequest() .withEnvironmentId(this.eid) .withVersionLabel(version.label()) ); Logger.info( this, "Environment '%s' updated to '%s'", res.getEnvironmentId(), res.getVersionLabel() ); }