public S3Location unmarshall(StaxUnmarshallerContext context) throws Exception { S3Location s3Location = new S3Location(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return s3Location; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("S3Bucket", targetDepth)) { s3Location.setS3Bucket(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("S3Key", targetDepth)) { s3Location.setS3Key(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return s3Location; } } } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getS3Bucket() == null) ? 0 : getS3Bucket().hashCode()); hashCode = prime * hashCode + ((getS3Key() == null) ? 0 : getS3Key().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPlatformName() == null) ? 0 : getPlatformName().hashCode()); hashCode = prime * hashCode + ((getPlatformVersion() == null) ? 0 : getPlatformVersion().hashCode()); hashCode = prime * hashCode + ((getPlatformDefinitionBundle() == null) ? 0 : getPlatformDefinitionBundle().hashCode()); hashCode = prime * hashCode + ((getEnvironmentName() == null) ? 0 : getEnvironmentName().hashCode()); hashCode = prime * hashCode + ((getOptionSettings() == null) ? 0 : getOptionSettings().hashCode()); return hashCode; }
private S3Location uploadCodeBundle(File warFile) { if (!warFile.exists()) throw new RuntimeException("war-file " + warFile + " does not exist."); log.info("Uploading {} to Amazon S3", warFile); String bucketName = elasticBeanstalk.createStorageLocation().getS3Bucket(); String key = createS3KeyFromFileName(warFile.getName()); s3.putObject(bucketName, key, warFile); return new S3Location(bucketName, key); }
@TaskAction private void createVersion() { log.fine("Creating new application version"); AWSElasticBeanstalk client = AWSElasticBeanstalkClientBuilder.standard() .withCredentials(new DefaultAWSCredentialsProviderChain()) .withRegion(awsAppRegion) .build(); client.createApplicationVersion(new CreateApplicationVersionRequest() .withApplicationName(awsAppName) .withVersionLabel(newVersion) .withDescription("") .withSourceBundle(new S3Location() .withS3Bucket(awsAppBucket) .withS3Key(archiveName)) .withProcess(false)); log.fine("Created beanstalk application version for '" + awsAppName + "' with label '" + newVersion + "'"); } }
if (other.getPlatformDefinitionBundle() == null ^ this.getPlatformDefinitionBundle() == null) return false; if (other.getPlatformDefinitionBundle() != null && other.getPlatformDefinitionBundle().equals(this.getPlatformDefinitionBundle()) == false) return false; if (other.getEnvironmentName() == null ^ this.getEnvironmentName() == null)
private S3Location uploadCodeBundle(File warFile) { if (!warFile.exists()) throw new RuntimeException("war-file " + warFile + " does not exist."); log.info("Uploading {} to Amazon S3", warFile); String bucketName = elasticBeanstalk.createStorageLocation().getS3Bucket(); String key = createS3KeyFromFileName(warFile.getName()); s3.putObject(bucketName, key, warFile); return new S3Location(bucketName, key); }
if (other.getSourceBundle() == null ^ this.getSourceBundle() == null) return false; if (other.getSourceBundle() != null && other.getSourceBundle().equals(this.getSourceBundle()) == false) return false; if (other.getDateCreated() == null ^ this.getDateCreated() == null)
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()); } }
public S3Location unmarshall(StaxUnmarshallerContext context) throws Exception { S3Location s3Location = new S3Location(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return s3Location; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("S3Bucket", targetDepth)) { s3Location.setS3Bucket(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("S3Key", targetDepth)) { s3Location.setS3Key(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return s3Location; } } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof S3Location == false) return false; S3Location other = (S3Location) obj; if (other.getS3Bucket() == null ^ this.getS3Bucket() == null) return false; if (other.getS3Bucket() != null && other.getS3Bucket().equals(this.getS3Bucket()) == false) return false; if (other.getS3Key() == null ^ this.getS3Key() == null) return false; if (other.getS3Key() != null && other.getS3Key().equals(this.getS3Key()) == false) return false; return true; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getApplicationVersionArn() == null) ? 0 : getApplicationVersionArn().hashCode()); hashCode = prime * hashCode + ((getApplicationName() == null) ? 0 : getApplicationName().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getVersionLabel() == null) ? 0 : getVersionLabel().hashCode()); hashCode = prime * hashCode + ((getSourceBuildInformation() == null) ? 0 : getSourceBuildInformation().hashCode()); hashCode = prime * hashCode + ((getBuildArn() == null) ? 0 : getBuildArn().hashCode()); hashCode = prime * hashCode + ((getSourceBundle() == null) ? 0 : getSourceBundle().hashCode()); hashCode = prime * hashCode + ((getDateCreated() == null) ? 0 : getDateCreated().hashCode()); hashCode = prime * hashCode + ((getDateUpdated() == null) ? 0 : getDateUpdated().hashCode()); hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); return hashCode; }
if (other.getSourceBundle() == null ^ this.getSourceBundle() == null) return false; if (other.getSourceBundle() != null && other.getSourceBundle().equals(this.getSourceBundle()) == false) return false; if (other.getBuildConfiguration() == null ^ this.getBuildConfiguration() == null)
vRequest.setSourceBundle(new S3Location(bucketName, s3key)); System.out.println("Creating application version " + versionLabel + "...");
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getS3Bucket() != null) sb.append("S3Bucket: ").append(getS3Bucket()).append(","); if (getS3Key() != null) sb.append("S3Key: ").append(getS3Key()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getApplicationName() == null) ? 0 : getApplicationName().hashCode()); hashCode = prime * hashCode + ((getVersionLabel() == null) ? 0 : getVersionLabel().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getSourceBuildInformation() == null) ? 0 : getSourceBuildInformation().hashCode()); hashCode = prime * hashCode + ((getSourceBundle() == null) ? 0 : getSourceBundle().hashCode()); hashCode = prime * hashCode + ((getBuildConfiguration() == null) ? 0 : getBuildConfiguration().hashCode()); hashCode = prime * hashCode + ((getAutoCreateApplication() == null) ? 0 : getAutoCreateApplication().hashCode()); hashCode = prime * hashCode + ((getProcess() == null) ? 0 : getProcess().hashCode()); return hashCode; }
if (other.getPlatformDefinitionBundle() == null ^ this.getPlatformDefinitionBundle() == null) return false; if (other.getPlatformDefinitionBundle() != null && other.getPlatformDefinitionBundle().equals(this.getPlatformDefinitionBundle()) == false) return false; if (other.getEnvironmentName() == null ^ this.getEnvironmentName() == null)
protected Object executeInternal() throws MojoExecutionException { if (skipExisting) { if (versionLabelExists()) { getLog().info("VersionLabel " + versionLabel + " already exists. Skipping creation of new application-version"); return null; } } CreateApplicationVersionRequest request = new CreateApplicationVersionRequest(); request.setApplicationName(applicationName); request.setDescription(versionDescription); request.setAutoCreateApplication(autoCreateApplication); if (StringUtils.isNotBlank(s3Bucket) && StringUtils.isNotBlank(s3Key)) { request.setSourceBundle(new S3Location(s3Bucket, s3Key)); } request.setDescription(versionDescription); request.setVersionLabel(versionLabel); CreateApplicationVersionResult result = getService().createApplicationVersion(request); return result.getApplicationVersion(); }
if (platformDefinitionBundle != null) { if (platformDefinitionBundle.getS3Bucket() != null) { request.addParameter("PlatformDefinitionBundle.S3Bucket", StringUtils.fromString(platformDefinitionBundle.getS3Bucket())); if (platformDefinitionBundle.getS3Key() != null) { request.addParameter("PlatformDefinitionBundle.S3Key", StringUtils.fromString(platformDefinitionBundle.getS3Key()));
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPlatformName() == null) ? 0 : getPlatformName().hashCode()); hashCode = prime * hashCode + ((getPlatformVersion() == null) ? 0 : getPlatformVersion().hashCode()); hashCode = prime * hashCode + ((getPlatformDefinitionBundle() == null) ? 0 : getPlatformDefinitionBundle().hashCode()); hashCode = prime * hashCode + ((getEnvironmentName() == null) ? 0 : getEnvironmentName().hashCode()); hashCode = prime * hashCode + ((getOptionSettings() == null) ? 0 : getOptionSettings().hashCode()); return hashCode; }