com.amazonaws.services.ec2.model.InstanceStateChange Java Examples

The following examples show how to use com.amazonaws.services.ec2.model.InstanceStateChange. 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: InstanceStateChangeTerminateConverter.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected InstanceStateChange convertObject(TerminatingInstanceDescription from) {
    InstanceStateChange to = new InstanceStateChange();

    to.setInstanceId(from.getInstanceId());

    InstanceState previousState = new InstanceState();
    previousState.setCode(from.getPreviousStateCode());
    previousState.setName(from.getPreviousState());
    to.setPreviousState(previousState);

    InstanceState currentState = new InstanceState();
    currentState.setCode(from.getShutdownStateCode());
    currentState.setName(from.getShutdownState());
    to.setCurrentState(currentState);

    return to;
}
 
Example #2
Source File: VmManagerTest.java    From SeleniumGridScaler with GNU General Public License v2.0 6 votes vote down vote up
@Test
// Test terminating instances works correctly
public void testTerminateInstance() {
    MockAmazonEc2Client client = new MockAmazonEc2Client(null);
    String instanceId="foo";
    TerminateInstancesResult terminateInstancesResult = new TerminateInstancesResult();
    client.setTerminateInstancesResult(terminateInstancesResult);
    InstanceStateChange stateChange = new InstanceStateChange();
    stateChange.withInstanceId(instanceId);
    stateChange.setCurrentState(new InstanceState().withCode(32));
    terminateInstancesResult.setTerminatingInstances(Arrays.asList(stateChange));
    Properties properties = new Properties();
    String region = "east";
    MockManageVm manageEC2 = new MockManageVm(client,properties,region);

    boolean success = manageEC2.terminateInstance(instanceId);
    TerminateInstancesRequest request = client.getTerminateInstancesRequest();
    Assert.assertEquals("Instance id size should match", 1, request.getInstanceIds().size());
    Assert.assertEquals("Instance ids should match", instanceId, request.getInstanceIds().get(0));
    Assert.assertTrue("Termination call should have been successful", success);
}
 
Example #3
Source File: VmManagerTest.java    From SeleniumGridScaler with GNU General Public License v2.0 6 votes vote down vote up
@Test
// Tests terminating an invalid instance is handled correctly
public void testTerminateInstanceInvalidRunningCode() {
    MockAmazonEc2Client client = new MockAmazonEc2Client(null);
    String instanceId="foo";
    TerminateInstancesResult terminateInstancesResult = new TerminateInstancesResult();
    client.setTerminateInstancesResult(terminateInstancesResult);
    InstanceStateChange stateChange = new InstanceStateChange();
    stateChange.withInstanceId(instanceId);
    stateChange.setCurrentState(new InstanceState().withCode(8));
    terminateInstancesResult.setTerminatingInstances(Arrays.asList(stateChange));
    Properties properties = new Properties();
    String region = "east";
    MockManageVm manageEC2 = new MockManageVm(client,properties,region);

    boolean success = manageEC2.terminateInstance(instanceId);
    TerminateInstancesRequest request = client.getTerminateInstancesRequest();
    Assert.assertEquals("Instance id size should match", 1, request.getInstanceIds().size());
    Assert.assertEquals("Instance ids should match", instanceId, request.getInstanceIds().get(0));
    Assert.assertFalse("Termination call should have not been successful", success);
}
 
Example #4
Source File: VmManagerTest.java    From SeleniumGridScaler with GNU General Public License v2.0 6 votes vote down vote up
@Test
// Test terminating a valid but not matching instances is handled correctly
public void testTerminateInstanceNoMatchingInstance() {
    MockAmazonEc2Client client = new MockAmazonEc2Client(null);
    String instanceId="foo";
    TerminateInstancesResult terminateInstancesResult = new TerminateInstancesResult();
    client.setTerminateInstancesResult(terminateInstancesResult);
    InstanceStateChange stateChange = new InstanceStateChange();
    stateChange.withInstanceId("notMatching");
    stateChange.setCurrentState(new InstanceState().withCode(8));
    terminateInstancesResult.setTerminatingInstances(Arrays.asList(stateChange));
    Properties properties = new Properties();
    String region = "east";
    MockManageVm manageEC2 = new MockManageVm(client,properties,region);

    boolean success = manageEC2.terminateInstance(instanceId);
    TerminateInstancesRequest request = client.getTerminateInstancesRequest();
    Assert.assertEquals("Instance id size should match", 1, request.getInstanceIds().size());
    Assert.assertEquals("Instance ids should match", instanceId, request.getInstanceIds().get(0));
    Assert.assertFalse("Termination call should have not been successful", success);
}
 
Example #5
Source File: StartInstancesExample.java    From aws-mock with MIT License 6 votes vote down vote up
/**
 * Start specified instances (power-on the instances).
 *
 * @param instanceIDs
 *            IDs of the instances start
 * @return a list of state changes for the instances
 */
public static List<InstanceStateChange> startInstances(final List<String> instanceIDs) {
    // pass any credentials as aws-mock does not authenticate them at all
    AWSCredentials credentials = new BasicAWSCredentials("foo", "bar");
    AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials);

    // the mock endpoint for ec2 which runs on your computer
    String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/";
    amazonEC2Client.setEndpoint(ec2Endpoint);

    // send the start request with args as instance IDs to start existing instances
    StartInstancesRequest request = new StartInstancesRequest();
    request.withInstanceIds(instanceIDs);
    StartInstancesResult result = amazonEC2Client.startInstances(request);

    return result.getStartingInstances();
}
 
Example #6
Source File: StartInstancesExample.java    From aws-mock with MIT License 6 votes vote down vote up
/**
 * Main method for command line use.
 *
 * @param args
 *            parameters from command line - IDs of the instances to start
 */
public static void main(final String[] args) {

    List<InstanceStateChange> iscs = startInstances(Arrays.asList(args));

    if (null != iscs && iscs.size() > 0) {
        System.out.println("Instance state changes: ");
        for (InstanceStateChange isc : iscs) {
            System.out.println(isc.getInstanceId() + ": " + isc.getPreviousState().getName() + " -> "
                    + isc.getCurrentState().getName());
        }
    } else {
        System.out.println("Nothing happened! Make sure you input the right instance IDs.");
        System.out.println("usage: java StartInstancesExample <instanceID-1> [instanceID-2] [instanceID-3] ...");
    }

}
 
Example #7
Source File: TerminateInstancesExample.java    From aws-mock with MIT License 6 votes vote down vote up
/**
 * Terminate specified instances (power-on the instances).
 *
 * @param instanceIDs
 *            IDs of the instances to terminate
 * @return a list of state changes for the instances
 */
public static List<InstanceStateChange> terminateInstances(final List<String> instanceIDs) {
    // pass any credentials as aws-mock does not authenticate them at all
    AWSCredentials credentials = new BasicAWSCredentials("foo", "bar");
    AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials);

    // the mock endpoint for ec2 which runs on your computer
    String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/";
    amazonEC2Client.setEndpoint(ec2Endpoint);

    // send the terminate request with args as instance IDs
    TerminateInstancesRequest request = new TerminateInstancesRequest();
    request.withInstanceIds(instanceIDs);
    TerminateInstancesResult result = amazonEC2Client.terminateInstances(request);

    return result.getTerminatingInstances();
}
 
Example #8
Source File: TerminateInstancesExample.java    From aws-mock with MIT License 6 votes vote down vote up
/**
 * Main method for command line use.
 *
 * @param args
 *            parameters from command line - IDs of the instances to terminate
 */
public static void main(final String[] args) {

    List<InstanceStateChange> iscs = terminateInstances(Arrays.asList(args));

    if (null != iscs && iscs.size() > 0) {
        System.out.println("Instance state changes: ");
        for (InstanceStateChange isc : iscs) {
            System.out.println(isc.getInstanceId() + ": " + isc.getPreviousState().getName() + " -> "
                    + isc.getCurrentState().getName());
        }
    } else {
        System.out.println("Nothing happened! Make sure you input the right instance IDs.");
        System.out
                .println("usage: java TerminateInstancesExample <instanceID-1> [instanceID-2] [instanceID-3] ...");
    }

}
 
Example #9
Source File: StopInstancesExample.java    From aws-mock with MIT License 6 votes vote down vote up
/**
 * Stop specified instances (power-on the instances).
 *
 * @param instanceIDs
 *            IDs of the instances to stop
 * @return a list of state changes for the instances
 */
public static List<InstanceStateChange> stopInstances(final List<String> instanceIDs) {
    // pass any credentials as aws-mock does not authenticate them at all
    AWSCredentials credentials = new BasicAWSCredentials("foo", "bar");
    AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials);

    // the mock endpoint for ec2 which runs on your computer
    String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/";
    amazonEC2Client.setEndpoint(ec2Endpoint);

    // send the stop request with args as instance IDs to stop running instances
    StopInstancesRequest request = new StopInstancesRequest();
    request.withInstanceIds(instanceIDs);
    StopInstancesResult result = amazonEC2Client.stopInstances(request);

    return result.getStoppingInstances();
}
 
Example #10
Source File: StopInstancesExample.java    From aws-mock with MIT License 6 votes vote down vote up
/**
 * Main method for command line use.
 *
 * @param args
 *            parameters from command line - IDs of the instances to stop
 */
public static void main(final String[] args) {

    List<InstanceStateChange> iscs = stopInstances(Arrays.asList(args));

    if (null != iscs && iscs.size() > 0) {
        System.out.println("Instance state changes: ");
        for (InstanceStateChange isc : iscs) {
            System.out.println(isc.getInstanceId() + ": " + isc.getPreviousState().getName() + " -> "
                    + isc.getCurrentState().getName());
        }
    } else {
        System.out.println("Nothing happened! Make sure you input the right instance IDs.");
        System.out.println("usage: java StopInstancesExample <instanceID-1> [instanceID-2] [instanceID-3] ...");
    }

}
 
Example #11
Source File: AwsInstanceProcess.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
public void start(AwsProcessClient awsProcessClient, Long instanceNo) {
    AwsInstance awsInstance = awsInstanceDao.read(instanceNo);
    String instanceId = awsInstance.getInstanceId();

    // イベントログ出力
    Instance instance = instanceDao.read(instanceNo);
    processLogger.debug(null, instance, "AwsInstanceStart",
            new Object[] { awsProcessClient.getPlatform().getPlatformName(), instanceId });

    // インスタンスの起動
    StartInstancesRequest request = new StartInstancesRequest();
    request.withInstanceIds(instanceId);
    StartInstancesResult result = awsProcessClient.getEc2Client().startInstances(request);
    List<InstanceStateChange> startingInstances = result.getStartingInstances();

    // API実行結果チェック
    if (startingInstances.size() == 0) {
        // インスタンス起動失敗時
        throw new AutoException("EPROCESS-000125", instanceId);

    } else if (startingInstances.size() > 1) {
        // 複数のインスタンスが起動した場合
        AutoException exception = new AutoException("EPROCESS-000127", instanceId);
        exception.addDetailInfo("result=" + startingInstances);
        throw exception;
    }

    // ログ出力
    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100111", instanceId));
    }

    // データベース更新
    awsInstance.setStatus(startingInstances.get(0).getCurrentState().getName());
    awsInstanceDao.update(awsInstance);
}
 
Example #12
Source File: BaseTest.java    From aws-mock with MIT License 5 votes vote down vote up
/**
 * Terminate instances.
 *
 * @param instanceIds
 *            instances' IDs
 * @return list of instances change
 */
protected final List<InstanceStateChange> terminateInstances(
        final Collection<String> instanceIds) {
    log.info("Terminate instances:" + toString(instanceIds));
    TerminateInstancesRequest request = new TerminateInstancesRequest();
    request.setInstanceIds(instanceIds);
    TerminateInstancesResult result = amazonEC2Client
            .terminateInstances(request);
    return result.getTerminatingInstances();
}
 
Example #13
Source File: BaseTest.java    From aws-mock with MIT License 5 votes vote down vote up
/**
 * Stop instances.
 *
 * @param instanceIds
 *            instances' IDs
 * @return list of instances change
 */
protected final List<InstanceStateChange> stopInstances(
        final Collection<String> instanceIds) {
    log.info("Stop instances:" + toString(instanceIds));
    StopInstancesRequest request = new StopInstancesRequest();
    request.setInstanceIds(instanceIds);
    StopInstancesResult result = amazonEC2Client.stopInstances(request);
    return result.getStoppingInstances();
}
 
Example #14
Source File: BaseTest.java    From aws-mock with MIT License 5 votes vote down vote up
/**
 * Start instances.
 *
 * @param instanceIds
 *            instances' IDs
 * @return list of instances change
 */
protected final List<InstanceStateChange> startInstances(
        final Collection<String> instanceIds) {
    log.info("Start instances:" + toString(instanceIds));

    StartInstancesRequest request = new StartInstancesRequest();
    request.setInstanceIds(instanceIds);
    StartInstancesResult result = amazonEC2Client.startInstances(request);
    return result.getStartingInstances();
}
 
Example #15
Source File: Ec2EndpointTest.java    From aws-mock with MIT License 5 votes vote down vote up
/**
 * Test one instance by run->stop->start->terminate.
 */
@Test(timeout = TIMEOUT_LEVEL2)
public final void sequenceRunStopStartTerminateTest() {
    log.info("Start simple run->stop->start->terminate test");
    // run
    List<Instance> instances = runInstances(
            AbstractMockEc2Instance.InstanceType.M1_SMALL, 1, 1);
    Assert.assertTrue("fail to start instances", instances.size() == 1);

    // wait for running
    waitForState(instances.get(0).getInstanceId(),
            AbstractMockEc2Instance.InstanceState.RUNNING);

    // stop
    List<InstanceStateChange> stateChanges = stopInstances(instances);
    Assert.assertTrue("fail to stop instances", stateChanges.size() == 1);

    // wait for stopped
    waitForState(instances.get(0).getInstanceId(),
            AbstractMockEc2Instance.InstanceState.STOPPED);

    // re-start
    stateChanges = startInstances(instances);
    Assert.assertTrue("fail to re-start instances",
            stateChanges.size() == 1);

    // wait for running
    waitForState(instances.get(0).getInstanceId(),
            AbstractMockEc2Instance.InstanceState.RUNNING);

    // terminate
    stateChanges = terminateInstances(instances);
    Assert.assertTrue("fail to terminate instances",
            stateChanges.size() == 1);

    // wait for terminated
    waitForState(instances.get(0).getInstanceId(),
            AbstractMockEc2Instance.InstanceState.TERMINATED);
}
 
Example #16
Source File: Ec2EndpointTest.java    From aws-mock with MIT License 5 votes vote down vote up
/**
    * Test one instance by run->stop.
    */
   @Test(timeout = TIMEOUT_LEVEL1)
   public final void sequenceRunStopTest() {

context = this;

       log.info("Start simple run -> stop test");

       // run
       List<Instance> instances = runInstances(
               AbstractMockEc2Instance.InstanceType.M1_SMALL, 1, 1);
       Assert.assertTrue("fail to start instances", instances.size() == 1);

       instances = describeInstances(instances);
       Assert.assertTrue("fail to describe instances", instances.size() == 1);
       Assert.assertEquals("pending", instances.get(0).getState().getName());

       // wait for running
       waitForState(instances.get(0).getInstanceId(),
               AbstractMockEc2Instance.InstanceState.RUNNING);

       // stop
       List<InstanceStateChange> stateChanges = stopInstances(instances);
       Assert.assertTrue("fail to stop instances", stateChanges.size() == 1);
       Assert.assertEquals("stopping", stateChanges.get(0).getCurrentState()
               .getName());

       // wait for stopped
       waitForState(instances.get(0).getInstanceId(),
               AbstractMockEc2Instance.InstanceState.STOPPED);
   }
 
Example #17
Source File: AwsVmManager.java    From SeleniumGridScaler with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Terminates the specified instance.
 *
 * @param  instanceId  Id of the instance to terminate
 */
public boolean terminateInstance(final String instanceId) {
    TerminateInstancesRequest terminateRequest = new TerminateInstancesRequest();
    terminateRequest.withInstanceIds(instanceId);

    if(client == null){
        throw new RuntimeException("The client is not initialized");
    }
    TerminateInstancesResult result = client.terminateInstances(terminateRequest);
    List<InstanceStateChange> stateChanges = result.getTerminatingInstances();
    boolean terminatedInstance = false;
    for (InstanceStateChange stateChange : stateChanges) {
        if (instanceId.equals(stateChange.getInstanceId())) {
            terminatedInstance = true;

            InstanceState currentState = stateChange.getCurrentState();
            if (currentState.getCode() != 32 && currentState.getCode() != 48) {
                log.error(String.format(
                        "Machine state for id %s should be terminated (48) or shutting down (32) but was %s instead",
                        instanceId, currentState.getCode()));
                return false;
            }
        }
    }

    if (!terminatedInstance) {
        log.error("Matching terminated instance was not found for instance " + instanceId);
        return false;
    }

    return true;
}
 
Example #18
Source File: AwsInstanceProcess.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
public void terminate(AwsProcessClient awsProcessClient, Long instanceNo) {
    AwsInstance awsInstance = awsInstanceDao.read(instanceNo);
    String instanceId = awsInstance.getInstanceId();

    // イベントログ出力
    Instance instance = instanceDao.read(instanceNo);
    processLogger.debug(null, instance, "AwsInstanceDelete",
            new Object[] { awsProcessClient.getPlatform().getPlatformName(), instanceId });

    // インスタンスの削除
    TerminateInstancesRequest request = new TerminateInstancesRequest();
    request.withInstanceIds(instanceId);
    TerminateInstancesResult result = awsProcessClient.getEc2Client().terminateInstances(request);
    List<InstanceStateChange> terminatingInstances = result.getTerminatingInstances();

    // API実行結果チェック
    if (terminatingInstances.size() == 0) {
        // インスタンス削除失敗時
        throw new AutoException("EPROCESS-000107", instanceId);

    } else if (terminatingInstances.size() > 1) {
        // 複数のインスタンスが削除された場合
        AutoException exception = new AutoException("EPROCESS-000108", instanceId);
        exception.addDetailInfo("result=" + terminatingInstances);
        throw exception;
    }

    // ログ出力
    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100117", instanceId));
    }

    // データベース更新
    awsInstance.setStatus(terminatingInstances.get(0).getCurrentState().getName());
    awsInstanceDao.update(awsInstance);
}
 
Example #19
Source File: AwsInstanceProcess.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
public void stop(AwsProcessClient awsProcessClient, Long instanceNo) {
    AwsInstance awsInstance = awsInstanceDao.read(instanceNo);
    String instanceId = awsInstance.getInstanceId();

    // イベントログ出力
    Instance instance = instanceDao.read(instanceNo);
    processLogger.debug(null, instance, "AwsInstanceStop",
            new Object[] { awsProcessClient.getPlatform().getPlatformName(), instanceId });

    // インスタンスの停止
    StopInstancesRequest request = new StopInstancesRequest();
    request.withInstanceIds(instanceId);
    StopInstancesResult result = awsProcessClient.getEc2Client().stopInstances(request);
    List<InstanceStateChange> stoppingInstances = result.getStoppingInstances();

    // API実行結果チェック
    if (stoppingInstances.size() == 0) {
        // インスタンス停止失敗時
        throw new AutoException("EPROCESS-000128", instanceId);

    } else if (stoppingInstances.size() > 1) {
        // 複数のインスタンスが停止した場合
        AutoException exception = new AutoException("EPROCESS-000130", instanceId);
        exception.addDetailInfo("result=" + stoppingInstances);
        throw exception;
    }

    // ログ出力
    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100113", instanceId));
    }

    // データベース更新
    awsInstance.setStatus(stoppingInstances.get(0).getCurrentState().getName());
    awsInstanceDao.update(awsInstance);
}
 
Example #20
Source File: Ec2EndpointTest.java    From aws-mock with MIT License 4 votes vote down vote up
/**
     * Test one instance by run->terminate->start. A terminated instance can not start.
     */
    @Test
    public final void sequenceRunTerminateStartTest() {
        log.info("Start simple run->terminate->start test");
        // run
        List<Instance> instances = runInstances(
                AbstractMockEc2Instance.InstanceType.M1_SMALL, 1, 1);
        Assert.assertTrue("fail to start instances", instances.size() == 1);

        // wait for running
        waitForState(instances.get(0).getInstanceId(),
                AbstractMockEc2Instance.InstanceState.RUNNING);

        // terminate
        List<InstanceStateChange> stateChanges = terminateInstances(instances);
        Assert.assertTrue("fail to terminate instances",
                stateChanges.size() == 1);

        // Commenting  the test as we cannot recover the terminated instances
/*        // wait for terminated
        waitForState(instances.get(0).getInstanceId(),
                AbstractMockEc2Instance.InstanceState.TERMINATED);

        // start, instance's state should remain terminated.
        stateChanges = startInstances(instances);
        Assert.assertTrue("fail to call start instances",
                stateChanges.size() == 1);

        // wait 10 seconds
        waitForState(instances.get(0).getInstanceId(),
                AbstractMockEc2Instance.InstanceState.RUNNING, TEN_SECONDS);

        instances = describeInstances(instances);
        Assert.assertTrue("number of instances should be 1",
                instances.size() == 1);
        Assert.assertTrue(
                "instance's state should be terminated",
                instances
                        .get(0)
                        .getState()
                        .getName()
                        .equals(AbstractMockEc2Instance.InstanceState.TERMINATED
                                .getName()));*/
    }
 
Example #21
Source File: Ec2EndpointTest.java    From aws-mock with MIT License 4 votes vote down vote up
/**
 * Test describing instances with states filter.
 */
@Test(timeout = TIMEOUT_LEVEL2)
public final void describeInstancesWithStatesFilterTest() {
    log.info("Start describing instances with states filter test");

    final int totalCount = 5;
    final int nonTerminatedCount = 3;
    final int terminateFromIndex = 1;
    final int terminateToIndex = 3;
    // run
    List<Instance> instances = runInstances(
            AbstractMockEc2Instance.InstanceType.M1_SMALL, totalCount, totalCount);
    Assert.assertTrue("fail to start instances", instances.size() == totalCount);

    // wait for running
    for (Instance i : instances) {
        waitForState(i.getInstanceId(),
                AbstractMockEc2Instance.InstanceState.RUNNING);
    }

    // stop the first instance
    List<InstanceStateChange> stateChanges = stopInstances(instances.subList(0, 1));
    Assert.assertTrue("fail to stop instances", stateChanges.size() == 1);

    // wait for stopped
    waitForState(instances.get(0).getInstanceId(),
            AbstractMockEc2Instance.InstanceState.STOPPED);

    // terminate the second and third instance
    stateChanges = terminateInstances(instances.subList(terminateFromIndex, terminateToIndex));
    Assert.assertTrue("fail to terminate instances", stateChanges.size() == 2);

    // wait for terminated
    waitForState(instances.get(1).getInstanceId(),
            AbstractMockEc2Instance.InstanceState.TERMINATED);
    waitForState(instances.get(2).getInstanceId(),
            AbstractMockEc2Instance.InstanceState.TERMINATED);

    // get non terminated instances
    instances = describeNonTerminatedInstances(instances);

    Assert.assertTrue("number of non terminated instances should be 3",
            instances.size() == nonTerminatedCount);
}
 
Example #22
Source File: BaseTest.java    From aws-mock with MIT License 2 votes vote down vote up
/**
 * Start instances.
 *
 * @param instances
 *            list of instances
 * @return list of instances change
 */
protected final List<InstanceStateChange> startInstances(
        final List<Instance> instances) {
    return startInstances(getInstanceIds(instances));
}
 
Example #23
Source File: BaseTest.java    From aws-mock with MIT License 2 votes vote down vote up
/**
 * Stop instances.
 *
 * @param instances
 *            list of instances
 * @return list of instances change
 */
protected final List<InstanceStateChange> stopInstances(
        final List<Instance> instances) {
    return stopInstances(getInstanceIds(instances));
}
 
Example #24
Source File: BaseTest.java    From aws-mock with MIT License 2 votes vote down vote up
/**
 * Terminate instances.
 *
 * @param instances
 *            list of instances
 * @return list of instances change
 */
protected final List<InstanceStateChange> terminateInstances(
        final List<Instance> instances) {
    return terminateInstances(getInstanceIds(instances));
}