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

项目:aws-ant-tasks    文件:DeployAppToBeanstalkTests.java   
@After
public void tearDown() throws InterruptedException {
    bcClient.terminateEnvironment(new TerminateEnvironmentRequest()
            .withEnvironmentName(TEST_ENVIRONMENTNAME));
    AWSTestUtils.waitForEnvironmentToTransitionToStateAndHealth(
            TEST_ENVIRONMENTNAME, EnvironmentStatus.Terminated, null,
            bcClient);
    bcClient.deleteApplication(new DeleteApplicationRequest(TEST_APPNAME));
    while (true) {
        DescribeApplicationsResult appResult = bcClient
                .describeApplications();
        boolean appNameFound = false;
        for (ApplicationDescription appdesc : appResult.getApplications()) {
            if (appdesc.getApplicationName().equals(TEST_APPNAME)) {
                appNameFound = true;
                break;
            }
        }
        if (!appNameFound) {
            break;
        }
    }
}
项目:jcabi-beanstalk-maven-plugin    文件:Environment.java   
/**
 * Terminate environment.
 */
public void terminate() {
    if (!this.stable()) {
        throw new DeploymentException(
            String.format(
                "env '%s' is not stable, can't terminate",
                this.eid
            )
        );
    }
    if (!this.terminated()) {
        final TerminateEnvironmentResult res =
            this.client.terminateEnvironment(
                new TerminateEnvironmentRequest()
                    .withEnvironmentId(this.eid)
                    .withTerminateResources(true)
            );
        Logger.info(
            this,
            "Environment '%s/%s/%s' is terminated (label:'%s', status:%s)",
            res.getApplicationName(), res.getEnvironmentName(),
            res.getEnvironmentId(),
            res.getVersionLabel(), res.getStatus()
        );
    }
}
项目:aws-ant-tasks    文件:TerminateBeanstalkEnvironmentTask.java   
public void execute() {
    System.out
            .println("Terminating environment " + environmentName + "...");
    checkParams();
    AWSElasticBeanstalkClient bcClient = getOrCreateClient(AWSElasticBeanstalkClient.class);
    try {
        bcClient.terminateEnvironment(new TerminateEnvironmentRequest()
                .withEnvironmentName(environmentName));
    } catch (Exception e) {
        throw new BuildException("Could not terminate environment "
                + e.getMessage(), e);
    }
    System.out
            .println("The request to terminate the environment has been submitted.");
}
项目:cloudml    文件:BeanstalkConnector.java   
public void terminateEnvironment(String envName) {
    TerminateEnvironmentRequest tr = new TerminateEnvironmentRequest();
    tr.setEnvironmentName(envName);
    beanstalkClient.terminateEnvironment(tr);
}
项目: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()
    );
}