Example usage for com.amazonaws.services.elasticbeanstalk.model CreateEnvironmentRequest setCNAMEPrefix

List of usage examples for com.amazonaws.services.elasticbeanstalk.model CreateEnvironmentRequest setCNAMEPrefix

Introduction

In this page you can find the example usage for com.amazonaws.services.elasticbeanstalk.model CreateEnvironmentRequest setCNAMEPrefix.

Prototype


public void setCNAMEPrefix(String cNAMEPrefix) 

Source Link

Document

If specified, the environment attempts to use this value as the prefix for the CNAME.

Usage

From source file:br.com.ingenieux.mojo.beanstalk.cmd.env.create.CreateEnvironmentCommand.java

License:Apache License

@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());/*from   w  ww  . ja  va2s .com*/

    request.setOptionSettings(Arrays.asList(context.getOptionSettings()));
    request.setOptionsToRemove(Arrays.asList(context.getOptionsToRemove()));

    if ("Worker".equals(context.getEnvironmentTierName())) {
        if (contextDoesNotContainsEC2Role(context)) {
            parentMojo.getLog().warn(
                    "It is meaningless to launch a worker without an IAM Role. If you set in templateName, thats fine, but here's a warning for you");
        }
        ;
        context.setEnvironmentTierType(StringUtils.defaultString(context.getEnvironmentTierType(), "SQS/HTTP"));
        request.setCNAMEPrefix(null);
        request.setTier(new EnvironmentTier().withName(context.getEnvironmentTierName())
                .withType(context.getEnvironmentTierType()).withVersion(context.getEnvironmentTierVersion()));
    }

    if (StringUtils.isNotBlank(context.getTemplateName())) {
        request.setTemplateName(
                parentMojo.lookupTemplateName(context.getApplicationName(), context.getTemplateName()));
    } else if (StringUtils.isNotBlank(context.getSolutionStack())) {
        request.setSolutionStackName(context.getSolutionStack());
    }

    request.setVersionLabel(context.getVersionLabel());

    if (parentMojo.isVerbose()) {
        parentMojo.getLog()
                .info("Requesting createEnvironment w/ request: " + CredentialsUtil.redact("" + request));
    }

    return service.createEnvironment(request);
}

From source file:org.cloudml.connectors.BeanstalkConnector.java

License:Open Source License

public void createEnvironment(String applicationName, String domainName, String envName, String stackName) {
    CreateEnvironmentRequest cr = new CreateEnvironmentRequest();
    cr.setApplicationName(applicationName);
    cr.setEnvironmentName(envName);//from  www  .  ja  v a  2  s. c om
    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!");
    }
}

From source file:org.cloudml.connectors.BeanstalkConnector.java

License:Open Source License

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);//from w w  w  . jav a 2s  .  c om
    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;
}