Java 类com.amazonaws.services.elasticbeanstalk.model.CheckDNSAvailabilityResult 实例源码

项目:cloudml    文件:BeanstalkConnector.java   
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!");
    }
}
项目:cloudml    文件:BeanstalkConnector.java   
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;
}
项目:aws-ant-tasks    文件:CreateBeanstalkEnvironmentTask.java   
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);
    }

}
项目:cloudml    文件:BeanstalkConnector.java   
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;
}
项目:jcabi-beanstalk-maven-plugin    文件:ApplicationTest.java   
/**
 * Application can create a new environment.
 * @throws Exception If something is wrong
 */
@Test
public void createsNewEnvironment() throws Exception {
    final String name = "some-app-name";
    final String template = "some-template";
    final Version version = Mockito.mock(Version.class);
    final AWSElasticBeanstalk ebt = Mockito.mock(AWSElasticBeanstalk.class);
    Mockito.doReturn(
        new CheckDNSAvailabilityResult().withAvailable(true)
    ).when(ebt)
        .checkDNSAvailability(
            Mockito.any(CheckDNSAvailabilityRequest.class)
        );
    Mockito.doReturn(
        new CreateEnvironmentResult()
            .withApplicationName(name)
            .withEnvironmentId("f4g5h6j7")
            .withEnvironmentName(name)
    ).when(ebt)
        .createEnvironment(
            Mockito.any(CreateEnvironmentRequest.class)
        );
    Mockito.doReturn(
        new DescribeConfigurationSettingsResult().withConfigurationSettings(
            new ArrayList<ConfigurationSettingsDescription>(0)
        )
    ).when(ebt)
        .describeConfigurationSettings(
            Mockito.any(DescribeConfigurationSettingsRequest.class)
        );
    Mockito.doReturn(
        new DescribeEnvironmentsResult().withEnvironments(
            Arrays.asList(
                new EnvironmentDescription()
                    .withCNAME("")
                    .withEnvironmentName("some-env")
                    .withEnvironmentId("a1b2c3d4")
                    .withStatus("Ready")
            )
        )
    ).when(ebt)
        .describeEnvironments(
            Mockito.any(DescribeEnvironmentsRequest.class)
        );
    Mockito.doReturn(new TerminateEnvironmentResult())
        .when(ebt)
        .terminateEnvironment(
            Mockito.any(TerminateEnvironmentRequest.class)
        );
    final Application app = new Application(ebt, name);
    app.clean(false);
    MatcherAssert.assertThat(
        app.candidate(version, template),
        Matchers.notNullValue()
    );
}