List of usage examples for com.amazonaws.services.elasticbeanstalk.model ApplicationVersionDescription getSourceBundle
public S3Location getSourceBundle()
The storage location of the application version's source bundle in Amazon S3.
From source file:com.tracermedia.maven.plugins.CreateVersionMojo.java
License:Open Source License
public void execute() throws MojoExecutionException, MojoFailureException { final Date now = new Date(); if (!project.getPackaging().equalsIgnoreCase("war") && !project.getPackaging().equalsIgnoreCase("uberwar")) { throw new MojoExecutionException( "Only WAR projects can be deployed to Amazon Beanstalk. Not " + project.getPackaging()); }/*from www .ja v a 2 s . c om*/ System.out.println("Existing versions:"); for (ApplicationVersionDescription version : getVersions()) { if (version.getApplicationName().equals(applicationName)) { System.out.println(String.format("App Name: %25s, version: %20s, S3: %s/%s", version.getApplicationName(), version.getVersionLabel(), version.getSourceBundle().getS3Bucket(), version.getSourceBundle().getS3Key())); } } final Build build = project.getBuild(); // It would be much better to use project.getPackaging() instead of hardcoding "war". But // the Mojo we use to combine multiple WAR files has a package of 'uberwar'. String artifactPath = String.format("%s/%s.%s", build.getDirectory(), build.getFinalName(), "war"); // Need to push the artifact to S3. Place in the s3Bucket using the s3Key. If the key is // not specified, it is generated by using the applicationName and appending a timestamp. if (s3Key == null) { s3Key = applicationName + '-' + DF.format(now); } try { copyFileToS3(s3Bucket, s3Key, new File(artifactPath)); } catch (IOException e) { throw new MojoFailureException("Failed to copy file to Amazon S3", e); } // If a version label has not been set, we will use the applicationKey and timestamp. if (versionLabel == null) { versionLabel = applicationName + '-' + DF.format(now); } // Create the new version of the application. createApplicationVersion(applicationName, versionLabel, s3Bucket, s3Key); updateEnvironmentVersion(environmentName, versionLabel); }
From source file:com.tracermedia.maven.plugins.DisplayVersionMojo.java
License:Open Source License
public void execute() throws MojoExecutionException, MojoFailureException { System.out.println("Existing versions:"); final List<ApplicationVersionDescription> versions = getVersions(); for (ApplicationVersionDescription version : versions) { if (version.getApplicationName().equals(this.applicationName)) { System.out.println(String.format("App Name: %s, version: %s, S3: %s/%s", version.getApplicationName(), version.getVersionLabel(), version.getSourceBundle().getS3Bucket(), version.getSourceBundle().getS3Key())); }/*from www . ja va 2 s . com*/ } if (versions.size() == 0) { System.out.println("None found."); } }
From source file:com.tracermedia.maven.plugins.RestoreVersionMojo.java
License:Open Source License
public void execute() throws MojoExecutionException, MojoFailureException { final Date now = new Date(); // Version label is required if (versionLabel == null) { throw new IllegalArgumentException("VersionLabel is a required parameter for this goal."); }//from w ww .jav a 2 s.c o m System.out.println("Existing versions:"); for (ApplicationVersionDescription version : getVersions()) { if (version.getApplicationName().equals(applicationName)) { System.out.println(String.format("App Name: %s, version: %s, S3: %s/%s", version.getApplicationName(), version.getVersionLabel(), version.getSourceBundle().getS3Bucket(), version.getSourceBundle().getS3Key())); } } // Restoring a previously uploaded version updateEnvironmentVersion(environmentName, versionLabel); }