/** * Constructs a new CreateEnvironmentRequest object. Callers should use the setter or fluent setter (with...) * methods to initialize any additional object members. * * @param applicationName * The name of the application that contains the version to be deployed.</p> * <p> * If no application is found with this name, <code>CreateEnvironment</code> returns an * <code>InvalidParameterValue</code> error. * @param environmentName * A unique name for the deployment environment. Used in the application URL. * </p> * <p> * Constraint: Must be from 4 to 40 characters in length. The name can contain only letters, numbers, and * hyphens. It cannot start or end with a hyphen. This name must be unique within a region in your account. * If the specified name already exists in the region, AWS Elastic Beanstalk returns an * <code>InvalidParameterValue</code> error. * </p> * <p> * Default: If the CNAME parameter is not specified, the environment name becomes part of the CNAME, and * therefore part of the visible URL for your application. */ public CreateEnvironmentRequest(String applicationName, String environmentName) { setApplicationName(applicationName); setEnvironmentName(environmentName); }
/** * <p> * The name of the application version to deploy. * </p> * <p> * If the specified application has no associated application versions, AWS Elastic Beanstalk * <code>UpdateEnvironment</code> returns an <code>InvalidParameterValue</code> error. * </p> * <p> * Default: If not specified, AWS Elastic Beanstalk attempts to launch the sample application in the container. * </p> * * @param versionLabel * The name of the application version to deploy.</p> * <p> * If the specified application has no associated application versions, AWS Elastic Beanstalk * <code>UpdateEnvironment</code> returns an <code>InvalidParameterValue</code> error. * </p> * <p> * Default: If not specified, AWS Elastic Beanstalk attempts to launch the sample application in the * container. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateEnvironmentRequest withVersionLabel(String versionLabel) { setVersionLabel(versionLabel); return this; }
/** * <p> * If specified, the environment attempts to use this value as the prefix for the CNAME. If not specified, the CNAME * is generated automatically by appending a random alphanumeric string to the environment name. * </p> * * @param cNAMEPrefix * If specified, the environment attempts to use this value as the prefix for the CNAME. If not specified, * the CNAME is generated automatically by appending a random alphanumeric string to the environment name. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateEnvironmentRequest withCNAMEPrefix(String cNAMEPrefix) { setCNAMEPrefix(cNAMEPrefix); return this; }
@Override protected CreateEnvironmentResult executeInternal(CreateEnvironmentContext context) throws Exception { CreateEnvironmentRequest request = new CreateEnvironmentRequest(); request.setApplicationName(context.getApplicationName()); request.setCNAMEPrefix(parentMojo.ensureSuffixStripped(context.getCnamePrefix())); request.setDescription(context.getApplicationDescription()); request.setEnvironmentName(context.getEnvironmentName()); request.setTags(context.getTags()); request.setOptionSettings(Arrays.asList(context.getOptionSettings())); request.setOptionsToRemove(Arrays.asList(context.getOptionsToRemove())); request.setCNAMEPrefix(null); request.setTier( new EnvironmentTier() .withName(context.getEnvironmentTierName()) request.setTemplateName(parentMojo.lookupTemplateName(context.getApplicationName(), context.getTemplateName())); } else if (StringUtils.isNotBlank(context.getSolutionStack())) { request.setSolutionStackName(context.getSolutionStack()); request.setVersionLabel(context.getVersionLabel());
public void createEnvironment(String applicationName, String domainName, String envName, String stackName) { CreateEnvironmentRequest cr = new CreateEnvironmentRequest(); cr.setApplicationName(applicationName); cr.setEnvironmentName(envName); String stack = findSolutionStack(stackName); if (!stack.equals("")) { cr.setSolutionStackName(stack); CheckDNSAvailabilityResult r = checkDNS(domainName); if (r.isAvailable()) { cr.setCNAMEPrefix(domainName); CreateEnvironmentResult res = beanstalkClient.createEnvironment(cr); journal.log(Level.INFO, ">> Status of the environment creation: " + res.toString()); } else { journal.log(Level.INFO, ">> Status of the environment creation: Domain Name already existing"); } } else { journal.log(Level.INFO, ">> Status of the environment creation: This type of stack does not exist!"); } }
private void deployNewVersion(String versionLabel, String environmentName, String applicationName, String templateName) { log.info("Describe environments to check if environment exists"); ArrayList<String> environmentNames = new ArrayList<String>(); environmentNames.add(environmentName); DescribeEnvironmentsRequest describeEnvironmentsRequest = new DescribeEnvironmentsRequest(); describeEnvironmentsRequest.setEnvironmentNames(environmentNames); DescribeEnvironmentsResult describeEnvironmentsResult = elasticBeanstalk.describeEnvironments(describeEnvironmentsRequest); if (describeEnvironmentsResult.getEnvironments().size() == 0) { log.info("Create environment with uploaded application version"); CreateEnvironmentRequest createEnvironmentRequest = new CreateEnvironmentRequest(); createEnvironmentRequest.setApplicationName(applicationName); createEnvironmentRequest.setEnvironmentName(environmentName); createEnvironmentRequest.setTemplateName(templateName); createEnvironmentRequest.setVersionLabel(versionLabel); CreateEnvironmentResult createEnvironmentResult = elasticBeanstalk.createEnvironment(createEnvironmentRequest); log.info("Created environment {}", createEnvironmentResult); } else { log.info("Update environment with uploaded application version"); UpdateEnvironmentRequest updateEnvironmentRequest = new UpdateEnvironmentRequest(); updateEnvironmentRequest.setEnvironmentName(environmentName); updateEnvironmentRequest.setVersionLabel(versionLabel); UpdateEnvironmentResult updateEnvironmentResult = elasticBeanstalk.updateEnvironment(updateEnvironmentRequest); log.info("Updated environment {}", updateEnvironmentResult); } }
public void execute() { checkParams(); AWSElasticBeanstalkClient client = getOrCreateClient(AWSElasticBeanstalkClient.class); CreateEnvironmentRequest eRequest = new CreateEnvironmentRequest( applicationName, environmentName) .withDescription(environmentDescription) .withVersionLabel(versionLabel) .withSolutionStackName(solutionStackName); if (!(tierName == null || tierType == null || tierVersion == null)) { eRequest.setTier(new EnvironmentTier().withName(tierName) .withType(tierType).withVersion(tierVersion)); + " was not available"); eRequest.setCNAMEPrefix(cnamePrefix); eRequest.setOptionSettings(optionSettings);
private String createEnvironment(String versionLabel, String versionDescription, String templateName, List<String> environmentNames) throws InvalidDeploymentTypeException { log("Creating environment based on application %s @ %s from version %s and configuration template %s", c.config.getApplicationName(), StringUtils.join(environmentNames, "/"), versionLabel, templateName); String newEnvironmentName = environmentNames.get(0); for (String environmentName : environmentNames) { try { lookupEnvironmentIds(Collections.singletonList(environmentName)); } catch (InvalidEnvironmentsSizeException e) { newEnvironmentName = environmentName; break; } } CreateEnvironmentRequest request = new CreateEnvironmentRequest() .withEnvironmentName(newEnvironmentName).withVersionLabel(versionLabel) .withDescription(versionDescription).withApplicationName(c.config.getApplicationName()) .withTemplateName(templateName); return getAwseb().createEnvironment(request).getEnvironmentId(); }
CreateEnvironmentRequest req = new CreateEnvironmentRequest() .withApplicationName(appName) .withEnvironmentName(envName) .withDescription(envDesc) .withTemplateName(templateName) .withVersionLabel(versionLabel); req.withTier(tier.toEnvironmentTier()); if (tier == Tier.WebServer) { req.withCNAMEPrefix(cnamePrefix); req.withTags(ebTags);
/** * <p> * The name of the application that contains the version to be deployed. * </p> * <p> * If no application is found with this name, <code>CreateEnvironment</code> returns an * <code>InvalidParameterValue</code> error. * </p> * * @param applicationName * The name of the application that contains the version to be deployed.</p> * <p> * If no application is found with this name, <code>CreateEnvironment</code> returns an * <code>InvalidParameterValue</code> error. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateEnvironmentRequest withApplicationName(String applicationName) { setApplicationName(applicationName); return this; }
setEnvironmentName(environmentName); return this;
/** * <p> * If specified, AWS Elastic Beanstalk sets the specified configuration options to the requested value in the * configuration set for the new environment. These override the values obtained from the solution stack or the * configuration template. * </p> * * @param optionSettings * If specified, AWS Elastic Beanstalk sets the specified configuration options to the requested value in the * configuration set for the new environment. These override the values obtained from the solution stack or * the configuration template. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateEnvironmentRequest withOptionSettings(java.util.Collection<ConfigurationOptionSetting> optionSettings) { setOptionSettings(optionSettings); return this; }
/** * <p> * The name of the configuration template to use in deployment. If no configuration template is found with this * name, AWS Elastic Beanstalk returns an <code>InvalidParameterValue</code> error. * </p> * * @param templateName * The name of the configuration template to use in deployment. If no configuration template is found with * this name, AWS Elastic Beanstalk returns an <code>InvalidParameterValue</code> error. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateEnvironmentRequest withTemplateName(String templateName) { setTemplateName(templateName); return this; }
/** * <p> * This specifies the tier to use for creating this environment. * </p> * * @param tier * This specifies the tier to use for creating this environment. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateEnvironmentRequest withTier(EnvironmentTier tier) { setTier(tier); return this; }
/** * <p> * This is an alternative to specifying a template name. If specified, AWS Elastic Beanstalk sets the configuration * values to the default values associated with the specified solution stack. * </p> * <p> * For a list of current solution stacks, see <a * href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html">Elastic Beanstalk Supported * Platforms</a>. * </p> * * @param solutionStackName * This is an alternative to specifying a template name. If specified, AWS Elastic Beanstalk sets the * configuration values to the default values associated with the specified solution stack.</p> * <p> * For a list of current solution stacks, see <a * href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html">Elastic Beanstalk * Supported Platforms</a>. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateEnvironmentRequest withSolutionStackName(String solutionStackName) { setSolutionStackName(solutionStackName); return this; }
public String createEnvironmentWithWar(String applicationName, String domainName, String envName, String stackName, int minRam, String warFile, String versionLabel) { String endPoint=""; prepareWar(new File(warFile), versionLabel, applicationName); CreateEnvironmentRequest cr = new CreateEnvironmentRequest(); cr.setApplicationName(applicationName); cr.setEnvironmentName(envName); cr.setVersionLabel(versionLabel); String stack = findSolutionStack(stackName); if (!stack.equals("")) { cr.setSolutionStackName(stack); CheckDNSAvailabilityResult r = checkDNS(domainName); if (r.isAvailable()) { cr.setCNAMEPrefix(domainName); CreateEnvironmentResult res = beanstalkClient.createEnvironment(cr); endPoint=res.getEndpointURL(); journal.log(Level.INFO, ">> Status of the environment creation: " + res.toString()); } else { journal.log(Level.INFO, ">> Status of the environment creation: Domain Name already existing"); } } else { journal.log(Level.INFO, ">> Status of the environment creation: This type of stack does not exist!"); } return endPoint; }
private void deployNewVersion(String versionLabel, String environmentName, String applicationName, String templateName) { log.info("Describe environments to check if environment exists"); ArrayList<String> environmentNames = new ArrayList<String>(); environmentNames.add(environmentName); DescribeEnvironmentsRequest describeEnvironmentsRequest = new DescribeEnvironmentsRequest(); describeEnvironmentsRequest.setEnvironmentNames(environmentNames); DescribeEnvironmentsResult describeEnvironmentsResult = elasticBeanstalk.describeEnvironments(describeEnvironmentsRequest); if (describeEnvironmentsResult.getEnvironments().size() == 0) { log.info("Create environment with uploaded application version"); CreateEnvironmentRequest createEnvironmentRequest = new CreateEnvironmentRequest(); createEnvironmentRequest.setApplicationName(applicationName); createEnvironmentRequest.setEnvironmentName(environmentName); createEnvironmentRequest.setTemplateName(templateName); createEnvironmentRequest.setVersionLabel(versionLabel); CreateEnvironmentResult createEnvironmentResult = elasticBeanstalk.createEnvironment(createEnvironmentRequest); log.info("Created environment {}", createEnvironmentResult); } else { log.info("Update environment with uploaded application version"); UpdateEnvironmentRequest updateEnvironmentRequest = new UpdateEnvironmentRequest(); updateEnvironmentRequest.setEnvironmentName(environmentName); updateEnvironmentRequest.setVersionLabel(versionLabel); UpdateEnvironmentResult updateEnvironmentResult = elasticBeanstalk.updateEnvironment(updateEnvironmentRequest); log.info("Updated environment {}", updateEnvironmentResult); } }
/** * <p> * The name of the application that contains the version to be deployed. * </p> * <p> * If no application is found with this name, <code>CreateEnvironment</code> returns an * <code>InvalidParameterValue</code> error. * </p> * * @param applicationName * The name of the application that contains the version to be deployed.</p> * <p> * If no application is found with this name, <code>CreateEnvironment</code> returns an * <code>InvalidParameterValue</code> error. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateEnvironmentRequest withApplicationName(String applicationName) { setApplicationName(applicationName); return this; }
setEnvironmentName(environmentName); return this;
/** * <p> * If specified, AWS Elastic Beanstalk sets the specified configuration options to the requested value in the * configuration set for the new environment. These override the values obtained from the solution stack or the * configuration template. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setOptionSettings(java.util.Collection)} or {@link #withOptionSettings(java.util.Collection)} if you want * to override the existing values. * </p> * * @param optionSettings * If specified, AWS Elastic Beanstalk sets the specified configuration options to the requested value in the * configuration set for the new environment. These override the values obtained from the solution stack or * the configuration template. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateEnvironmentRequest withOptionSettings(ConfigurationOptionSetting... optionSettings) { if (this.optionSettings == null) { setOptionSettings(new com.amazonaws.internal.SdkInternalList<ConfigurationOptionSetting>(optionSettings.length)); } for (ConfigurationOptionSetting ele : optionSettings) { this.optionSettings.add(ele); } return this; }