當前位置: 首頁>>代碼示例>>Java>>正文


Java CheckDNSAvailabilityRequest類代碼示例

本文整理匯總了Java中com.amazonaws.services.elasticbeanstalk.model.CheckDNSAvailabilityRequest的典型用法代碼示例。如果您正苦於以下問題:Java CheckDNSAvailabilityRequest類的具體用法?Java CheckDNSAvailabilityRequest怎麽用?Java CheckDNSAvailabilityRequest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CheckDNSAvailabilityRequest類屬於com.amazonaws.services.elasticbeanstalk.model包,在下文中一共展示了CheckDNSAvailabilityRequest類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import com.amazonaws.services.elasticbeanstalk.model.CheckDNSAvailabilityRequest; //導入依賴的package包/類
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);
    }

}
 
開發者ID:awslabs,項目名稱:aws-ant-tasks,代碼行數:52,代碼來源:CreateBeanstalkEnvironmentTask.java

示例2: checkDNS

import com.amazonaws.services.elasticbeanstalk.model.CheckDNSAvailabilityRequest; //導入依賴的package包/類
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;
}
 
開發者ID:SINTEF-9012,項目名稱:cloudml,代碼行數:7,代碼來源:BeanstalkConnector.java

示例3: occupied

import com.amazonaws.services.elasticbeanstalk.model.CheckDNSAvailabilityRequest; //導入依賴的package包/類
/**
 * This CNAME is occupied?
 * @param cname The CNAME to check
 * @return TRUE if it's occupied
 */
private boolean occupied(final String cname) {
    return !this.client.checkDNSAvailability(
        new CheckDNSAvailabilityRequest(cname)
    ).getAvailable();
}
 
開發者ID:jcabi,項目名稱:jcabi-beanstalk-maven-plugin,代碼行數:11,代碼來源:Application.java

示例4: createsNewEnvironment

import com.amazonaws.services.elasticbeanstalk.model.CheckDNSAvailabilityRequest; //導入依賴的package包/類
/**
 * 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()
    );
}
 
開發者ID:jcabi,項目名稱:jcabi-beanstalk-maven-plugin,代碼行數:60,代碼來源:ApplicationTest.java


注:本文中的com.amazonaws.services.elasticbeanstalk.model.CheckDNSAvailabilityRequest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。