/** * <p> * Describes this version. * </p> * * @param description * Describes this version. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateApplicationVersionRequest withDescription(String description) { setDescription(description); return this; }
setSourceBundle(sourceBundle); return this;
/** * <p> * Set to <code>true</code> to create an application with the specified name if it doesn't already exist. * </p> * * @param autoCreateApplication * Set to <code>true</code> to create an application with the specified name if it doesn't already exist. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateApplicationVersionRequest withAutoCreateApplication(Boolean autoCreateApplication) { setAutoCreateApplication(autoCreateApplication); return this; }
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()); } }
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(); }
private ApplicationVersionDescription createApplicationVersion(S3Location bundle, String applicationName, String versionLabel) { log.info("Create application version {} with for application {}", versionLabel, applicationName); CreateApplicationVersionRequest createApplicationVersionRequest = new CreateApplicationVersionRequest(applicationName, versionLabel); createApplicationVersionRequest.setDescription(applicationName + " via Gradle deployment on " + Instant.now()); createApplicationVersionRequest.setAutoCreateApplication(true); createApplicationVersionRequest.setSourceBundle(bundle); CreateApplicationVersionResult createApplicationVersionResult = elasticBeanstalk.createApplicationVersion(createApplicationVersionRequest); log.info("Registered application version {}", createApplicationVersionResult); return createApplicationVersionResult.getApplicationVersion(); }
@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 + "'"); } }
AWSElasticBeanstalkClient client = getOrCreateClient(AWSElasticBeanstalkClient.class); CreateApplicationVersionRequest vRequest = new CreateApplicationVersionRequest( applicationName, versionLabel); vRequest.setDescription(versionDescription); String s3key = key == null ? file.getName() : key; if (file != null) { vRequest.setSourceBundle(new S3Location(bucketName, s3key)); System.out.println("Creating application version " + versionLabel + "...");
@Override public boolean perform() { log("Creating application version %s for application %s for path %s", getVersionLabel(), c.config.getApplicationName(), getS3ObjectPath()); CreateApplicationVersionRequest cavRequest = new CreateApplicationVersionRequest() .withApplicationName(c.config.getApplicationName()) .withAutoCreateApplication(true) .withSourceBundle(new S3Location(c.config.getBucketName(), getObjectKey())) .withVersionLabel(getVersionLabel()) .withDescription(getVersionDescription()); final CreateApplicationVersionResult result = getAwseb().createApplicationVersion(cavRequest); log("Created version: %s", result.getApplicationVersion().getVersionLabel()); return false; } }
private ApplicationVersionDescription createApplicationVersion(S3Location bundle, String applicationName, String versionLabel) { log.info("Create application version {} with for application {}", versionLabel, applicationName); CreateApplicationVersionRequest createApplicationVersionRequest = new CreateApplicationVersionRequest(applicationName, versionLabel); createApplicationVersionRequest.setDescription(applicationName + " via Gradle deployment on " + Instant.now()); createApplicationVersionRequest.setAutoCreateApplication(true); createApplicationVersionRequest.setSourceBundle(bundle); CreateApplicationVersionResult createApplicationVersionResult = elasticBeanstalk.createApplicationVersion(createApplicationVersionRequest); log.info("Registered application version {}", createApplicationVersionResult); return createApplicationVersionResult.getApplicationVersion(); }
@TaskAction public void createVersion() { // to enable conventionMappings feature String appName = getAppName(); String versionLabel = getVersionLabel(); AwsBeanstalkPluginExtension ext = getProject().getExtensions().getByType(AwsBeanstalkPluginExtension.class); AWSElasticBeanstalk eb = ext.getClient(); try { eb.createApplicationVersion(new CreateApplicationVersionRequest() .withApplicationName(appName) .withVersionLabel(versionLabel) .withSourceBundle(new S3Location(getBucketName(), getKey()))); getLogger().info("version " + versionLabel + " @ " + appName + " created"); } catch (AmazonServiceException e) { if (!e.getMessage().contains("already exists.")) { throw e; } getLogger().warn("version " + versionLabel + " @ " + appName + " already exists."); } } }
/** * <p> * Describes this version. * </p> * * @param description * Describes this version. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateApplicationVersionRequest withDescription(String description) { setDescription(description); return this; }
setSourceBundle(sourceBundle); return this;
/** * <p> * Set to <code>true</code> to create an application with the specified name if it doesn't already exist. * </p> * * @param autoCreateApplication * Set to <code>true</code> to create an application with the specified name if it doesn't already exist. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateApplicationVersionRequest withAutoCreateApplication(Boolean autoCreateApplication) { setAutoCreateApplication(autoCreateApplication); return this; }