com.amazonaws.services.elasticbeanstalk.model.CreateApplicationVersionRequest Java Examples

The following examples show how to use com.amazonaws.services.elasticbeanstalk.model.CreateApplicationVersionRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BeanstalkConnector.java    From cloudml with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void prepareWar(File warFile, String versionLabel, String applicationName) {
    AmazonS3 s3 = new AmazonS3Client(awsCredentials);
    String bucketName = beanstalkClient.createStorageLocation().getS3Bucket();
    String key;
    try {
        key = URLEncoder.encode(warFile.getName() + "-" + versionLabel, "UTF-8");
        s3.putObject(bucketName, key, warFile);
        beanstalkClient.createApplicationVersion(new CreateApplicationVersionRequest()
                .withApplicationName(applicationName).withAutoCreateApplication(true)
                .withVersionLabel(versionLabel)
                .withSourceBundle(new S3Location(bucketName, key)));
    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        journal.log(Level.SEVERE, e.getMessage());
    }
}