@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateStorageLocationResult == false) return false; CreateStorageLocationResult other = (CreateStorageLocationResult) obj; if (other.getS3Bucket() == null ^ this.getS3Bucket() == null) return false; if (other.getS3Bucket() != null && other.getS3Bucket().equals(this.getS3Bucket()) == false) return false; return true; }
/** * <p> * The name of the Amazon S3 bucket created. * </p> * * @param s3Bucket * The name of the Amazon S3 bucket created. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateStorageLocationResult withS3Bucket(String s3Bucket) { setS3Bucket(s3Bucket); return this; }
public CreateStorageLocationResult unmarshall(StaxUnmarshallerContext context) throws Exception { CreateStorageLocationResult createStorageLocationResult = new CreateStorageLocationResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return createStorageLocationResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("S3Bucket", targetDepth)) { createStorageLocationResult.setS3Bucket(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return createStorageLocationResult; } } } }
public CreateStorageLocationResult unmarshall(StaxUnmarshallerContext context) throws Exception { CreateStorageLocationResult createStorageLocationResult = new CreateStorageLocationResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return createStorageLocationResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("S3Bucket", targetDepth)) { createStorageLocationResult.setS3Bucket(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return createStorageLocationResult; } } } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getS3Bucket() == null) ? 0 : getS3Bucket().hashCode()); return hashCode; }
/** * <p> * The name of the Amazon S3 bucket created. * </p> * * @param s3Bucket * The name of the Amazon S3 bucket created. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateStorageLocationResult withS3Bucket(String s3Bucket) { setS3Bucket(s3Bucket); return this; }
/** * 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()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getS3Bucket() == null) ? 0 : getS3Bucket().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateStorageLocationResult == false) return false; CreateStorageLocationResult other = (CreateStorageLocationResult) obj; if (other.getS3Bucket() == null ^ this.getS3Bucket() == null) return false; if (other.getS3Bucket() != null && other.getS3Bucket().equals(this.getS3Bucket()) == false) return false; return true; }
/** * 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()); sb.append("}"); return sb.toString(); }
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); }
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); }
@Override public void upload() throws IOException { Project project = getProject(); AwsBeanstalkPluginExtension ext = project.getExtensions().getByType(AwsBeanstalkPluginExtension.class); AWSElasticBeanstalk eb = ext.getClient(); SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd'_'HHmmss", Locale.ENGLISH); df.setTimeZone(TimeZone.getDefault()); versionLabel = String.format(Locale.ENGLISH, "%s-%s", project.getVersion().toString(), df.format(new Date())); String artifactId = project.property("artifactId").toString(); setBucketName(eb.createStorageLocation().getS3Bucket()); setKey(String.format(Locale.ENGLISH, "eb-apps/%s/%s-%s.%s", new Object[] { artifactId, artifactId, versionLabel, extension })); super.upload(); } }
s3Bucket = getService().createStorageLocation().getS3Bucket();
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()); } }
@Override protected String lookupVersionLabelForCommitId(String commitId) throws Exception { String s3Bucket = getService().createStorageLocation().getS3Bucket();
@Override public boolean perform() throws Exception { localArchive = getLocalFileObject(getRootFileObject()); log("Using archive '%s'", localArchive.getAbsolutePath()); if (isBlank(c.config.getBucketName())) { log("bucketName not set. Calling createStorageLocation"); final CreateStorageLocationResult storageLocation = getAwseb().createStorageLocation(); log("Using s3 Bucket '%s'", storageLocation.getS3Bucket()); c.config.setBucketName(storageLocation.getS3Bucket()); } setObjectKey(Utils.formatPath("%s/%s-%s.zip", c.config.getKeyPrefix(), c.config.getApplicationName(), getVersionLabel())); setS3ObjectPath("s3://" + Utils.formatPath("%s/%s", c.config.getBucketName(), getObjectKey())); log("Uploading file %s as %s", localArchive.getName(), getS3ObjectPath()); getS3().putObject(c.config.getBucketName(), getObjectKey(), localArchive); return false; }