Package io.fathom.cloud.compute.api.aws.ec2.model

Examples of io.fathom.cloud.compute.api.aws.ec2.model.Instance$StateReason


        when(execution.getVariable(ProcessVariables.INSTANCE_IDS)).thenReturn(instanceIds);

        when(client.describeInstances(Matchers.<DescribeInstancesRequest>any()))
            .thenReturn(new DescribeInstancesResult()
                .withReservations(new Reservation().withInstances(
                    new Instance().withInstanceId("i-123").withPublicDnsName("i1.amazonaws.com")
                        .withPublicIpAddress("1.2.3.4").withPrivateDnsName("i1.internal").withPrivateIpAddress("10.1.2.3"),
                    new Instance().withInstanceId("i-456").withPublicDnsName("i2.amazonaws.com")
                        .withPublicIpAddress("5.6.7.8").withPrivateDnsName("i2.internal").withPrivateIpAddress("10.4.5.6")
                )));

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);
View Full Code Here


        @SuppressWarnings("unchecked")
        List<String> instanceIds = (List<String>) collector.getVariable(ProcessVariables.INSTANCE_IDS);
        DescribeInstancesResult result = client.describeInstances(new DescribeInstancesRequest()
            .withInstanceIds(instanceIds));

        Instance instance = result.getReservations().get(0).getInstances().get(0);
        List<InstanceBlockDeviceMapping> bdm = instance.getBlockDeviceMappings();
        assertThat(bdm).hasSize(2);
        List<String> volumeIds = Lists.newArrayList();
        for (int i = 0; i < bdm.size(); i++) {
            assertThat(bdm.get(i).getDeviceName()).isEqualTo("/dev/sda" + ((i+1) * (i+1)));
            assertThat(bdm.get(i).getEbs().getDeleteOnTermination()).isTrue();
View Full Code Here

        addHandler(handlers, TerminateInstances.class);
        return handlers;
    }

    private static void addHandler(Map<String, Class<?>> handlers, Class<? extends AwsActionHandler> clazz) {
        AwsAction action = clazz.getAnnotation(AwsAction.class);
        if (action == null) {
            throw new IllegalStateException("No @Action annotation on: " + clazz);
        }
        handlers.put(action.value(), clazz);
    }
View Full Code Here

        Class<?> handlerClass = handlers.get(action);
        if (handlerClass == null) {
            throw new WebApplicationException(Status.BAD_REQUEST);
        }

        AwsActionHandler handler = (AwsActionHandler) injector.getInstance(handlerClass);

        AwsRequestContext requestContext = requestContextProvider.get();
        handler.init(requestContext, formParameters);

        return handler.go();

    }
View Full Code Here

@AwsAction("DeleteKeyPair")
public class DeleteKeyPair extends AwsActionHandler {
    @Override
    public Object go() {
        DeleteKeyPairResponse response = new DeleteKeyPairResponse();
        response.requestId = getRequestId();
        response.returnValue = true;

        return response;
    }
View Full Code Here

        // Get instances first; so we shouldn't have any instances that refer to
        // not-yet-create reservations
        List<InstanceData> instances = instanceStateStore.getInstances(getProject().getId()).list();
        List<ReservationData> reservationInfoList = instanceStateStore.getReservations(project).list();

        DescribeInstancesResponse response = new DescribeInstancesResponse();
        response.requestId = getRequestId();

        response.reservations = Lists.newArrayList();
        Map<Long, ReservationData> reservationInfoMap = Maps.newHashMap();
        for (ReservationData reservationInfo : reservationInfoList) {
View Full Code Here

            ReservationData reservationInfo = reservationInfoMap.get(reservationId);
            if (reservationInfo == null) {
                throw new IllegalStateException();
            }

            ReservationSetItem reservation = xmlReservations.get(reservationId);
            if (reservation == null) {
                reservation = new ReservationSetItem();
                xmlReservations.put(reservationId, reservation);
                response.reservations.add(reservation);

                reservation.reservationId = toEc2ReservationId(reservationInfo.getId());
                reservation.ownerId = toEc2Owner(reservationInfo.getProjectId());
View Full Code Here

@AwsAction("DescribeKeyPairs")
public class DescribeKeyPairs extends AwsActionHandler {
    @Override
    public Object go() {
        DescribeKeyPairsResponse response = new DescribeKeyPairsResponse();
        response.requestId = getRequestId();
        response.keys = Lists.newArrayList();
        Item key = new Item();
        key.keyName = "testKey";
        key.keyFingerprint = "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00";
View Full Code Here

    @Override
    public Object go() {
        DescribeKeyPairsResponse response = new DescribeKeyPairsResponse();
        response.requestId = getRequestId();
        response.keys = Lists.newArrayList();
        Item key = new Item();
        key.keyName = "testKey";
        key.keyFingerprint = "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00";
        response.keys.add(key);

        return response;
View Full Code Here

@AwsAction("DescribeRegions")
public class DescribeRegions extends AwsActionHandler {
    @Override
    public Object go() {
        DescribeRegionsResponse response = new DescribeRegionsResponse();
        response.requestId = getRequestId();
        response.regionInfo = new DescribeRegionsResponse.RegionInfo();
        response.regionInfo.regions = Lists.newArrayList();
        DescribeRegionsResponse.RegionInfo.Item region = new DescribeRegionsResponse.RegionInfo.Item();
        region.regionName = "primary";
View Full Code Here

TOP

Related Classes of io.fathom.cloud.compute.api.aws.ec2.model.Instance$StateReason

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.