com.amazonaws.services.elasticbeanstalk.model.CheckDNSAvailabilityRequest Java Examples

The following examples show how to use com.amazonaws.services.elasticbeanstalk.model.CheckDNSAvailabilityRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreateBeanstalkEnvironmentTask.java    From aws-ant-tasks with Apache License 2.0 4 votes vote down vote up
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));
    }

    if (cnamePrefix != null) {
        CheckDNSAvailabilityResult dnsResult = client
                .checkDNSAvailability(new CheckDNSAvailabilityRequest(
                        cnamePrefix));
        if (!dnsResult.isAvailable()) {
            throw new BuildException("The specified CNAME " + cnamePrefix
                    + " was not available");
        }
        eRequest.setCNAMEPrefix(cnamePrefix);
    }
    List<ConfigurationOptionSetting> optionSettings = new LinkedList<ConfigurationOptionSetting>();
    for (Setting setting : settings) {
        optionSettings.add(new ConfigurationOptionSetting(setting
                .getNamespace(), setting.getOptionName(), setting
                .getValue()));
    }
    if (optionSettings.size() > 0) {
        eRequest.setOptionSettings(optionSettings);
    }
    System.out.println("Creating environment " + environmentName + "...");
    String cNAME = "";
    try {
        CreateEnvironmentResult result = client.createEnvironment(eRequest);
        if ((cNAME = result.getCNAME()) == null) {
            System.out
                    .println("Create environment request submitted. The environment configuration does not support a CNAME.");
        } else {
            System.out
                    .println("Create environment request submitted. When the environment is finished launching, your deployment will be available at "
                            + cNAME);
        }
    } catch (Exception e) {
        throw new BuildException(
                "Exception while attempting to create environment: "
                        + e.getMessage(), e);
    }

}
 
Example #2
Source File: BeanstalkConnector.java    From cloudml with GNU Lesser General Public License v3.0 4 votes vote down vote up
public CheckDNSAvailabilityResult checkDNS(String domainName) {
    CheckDNSAvailabilityRequest cr = new CheckDNSAvailabilityRequest(domainName);
    CheckDNSAvailabilityResult res = beanstalkClient.checkDNSAvailability(cr);
    journal.log(Level.INFO, ">> Domain Name availability: " + res.toString());
    return res;
}