@Override
  public void deploy(File appWarFile) {

    log.info("Finding S3 bucket to upload WAR");

    String bucketName = elasticBeanstalk.createStorageLocation().getS3Bucket();

    String s3key = uniqueTempWarFileName(appWarFile);
    uploadToS3(appWarFile, bucketName, s3key);

    String versionLabel = getVersionLabel(appWarFile);

    log.info("Create application version with uploaded application");

    CreateApplicationVersionRequest cavr = new CreateApplicationVersionRequest();
    cavr.setApplicationName(applicationName);
    cavr.setVersionLabel(versionLabel);
    cavr.setDescription(getDescription());
    cavr.setAutoCreateApplication(true);
    cavr.setSourceBundle(new S3Location(bucketName, s3key));

    CreateApplicationVersionResult result;
    result = elasticBeanstalk.createApplicationVersion(cavr);

    log.info("Created application version {}", result);

    log.info("Updating environment with uploaded application version");

    UpdateEnvironmentRequest uer;
    uer = new UpdateEnvironmentRequest();

    uer.setEnvironmentName(environmentName);
    uer.setVersionLabel(versionLabel);

    UpdateEnvironmentResult result2;
    result2 = elasticBeanstalk.updateEnvironment(uer);

    log.info("Updated environment {}", result2);
  }
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof CreateApplicationVersionRequest == false) return false;
    CreateApplicationVersionRequest other = (CreateApplicationVersionRequest) obj;

    if (other.getApplicationName() == null ^ this.getApplicationName() == null) return false;
    if (other.getApplicationName() != null
        && other.getApplicationName().equals(this.getApplicationName()) == false) return false;
    if (other.getVersionLabel() == null ^ this.getVersionLabel() == null) return false;
    if (other.getVersionLabel() != null
        && other.getVersionLabel().equals(this.getVersionLabel()) == false) return false;
    if (other.getDescription() == null ^ this.getDescription() == null) return false;
    if (other.getDescription() != null
        && other.getDescription().equals(this.getDescription()) == false) return false;
    if (other.getSourceBundle() == null ^ this.getSourceBundle() == null) return false;
    if (other.getSourceBundle() != null
        && other.getSourceBundle().equals(this.getSourceBundle()) == false) return false;
    if (other.isAutoCreateApplication() == null ^ this.isAutoCreateApplication() == null)
      return false;
    if (other.isAutoCreateApplication() != null
        && other.isAutoCreateApplication().equals(this.isAutoCreateApplication()) == false)
      return false;
    return true;
  }