Package com.amazon.ec2

Examples of com.amazon.ec2.RunningInstancesSetType


        EC2ReleaseAddress ec2Request = new EC2ReleaseAddress();
        if (ec2Request != null) {
            ec2Request.setPublicIp(publicIp);
        }

        ReleaseAddressResponse EC2Response = EC2SoapServiceImpl.toReleaseAddressResponse(engine.releaseAddress(ec2Request));

        serializeResponse(response, EC2Response);
    }
View Full Code Here


        EC2ImageLaunchPermission launchPermission = new EC2ImageLaunchPermission();
        launchPermission.setLaunchPermOp(EC2ImageLaunchPermission.Operation.reset);
        ec2request.addLaunchPermission(launchPermission);

        // -> execute the request
        ResetImageAttributeResponse EC2response = EC2SoapServiceImpl.toResetImageAttributeResponse(
                ServiceProvider.getInstance().getEC2Engine().modifyImageAttribute( ec2request ));
        serializeResponse(response, EC2response);
    }
View Full Code Here

        EC2ImageLaunchPermission launchPermission = new EC2ImageLaunchPermission();
        launchPermission.setLaunchPermOp(EC2ImageLaunchPermission.Operation.reset);
        ec2request.addLaunchPermission(launchPermission);

        // -> execute the request
        ResetImageAttributeResponse EC2response =
            EC2SoapServiceImpl.toResetImageAttributeResponse(ServiceProvider.getInstance().getEC2Engine().modifyImageAttribute(ec2request));
        serializeResponse(response, EC2response);
    }
View Full Code Here

        if (1 == nCount) {
            throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - IpPermissions");
        }

        // -> execute the request
        RevokeSecurityGroupIngressResponse EC2response = EC2SoapServiceImpl.toRevokeSecurityGroupIngressResponse(
                ServiceProvider.getInstance().getEC2Engine().revokeSecurityGroup( EC2request ));
        serializeResponse(response, EC2response);
    }
View Full Code Here

            }
        }

        // -> execute the request
        EC2Engine engine = ServiceProvider.getInstance().getEC2Engine();
        RunInstancesResponse EC2response = EC2SoapServiceImpl.toRunInstancesResponse( engine.runInstances( EC2request ), engine);
        serializeResponse(response, EC2response);
    }
View Full Code Here

                    param4.addItem(param5);
                }
            }
            param3.setGroupSet(param4);

            RunningInstancesSetType param6 = new RunningInstancesSetType();
            RunningInstancesItemType param7 = new RunningInstancesItemType();

            param7.setInstanceId(inst.getId());
            param7.setImageId(inst.getTemplateId());

            InstanceStateType param8 = new InstanceStateType();
            param8.setCode(toAmazonCode(inst.getState()));
            param8.setName(toAmazonStateName(inst.getState()));
            param7.setInstanceState(param8);

            param7.setPrivateDnsName("");
            param7.setDnsName("");
            param7.setReason("");
            param7.setKeyName(inst.getKeyPairName());
            param7.setAmiLaunchIndex(null);
            param7.setInstanceType(inst.getServiceOffering());

            ProductCodesSetType param9 = new ProductCodesSetType();
            ProductCodesSetItemType param10 = new ProductCodesSetItemType();
            param10.setProductCode("");
            param10.setType("");
            param9.addItem(param10);
            param7.setProductCodes(param9);

            Calendar cal = inst.getCreated();
            if (null == cal) {
                cal = Calendar.getInstance();
//                 cal.set( 1970, 1, 1 );
            }
            param7.setLaunchTime(cal);

            PlacementResponseType param11 = new PlacementResponseType();
            param11.setAvailabilityZone(inst.getZoneName());
            param11.setGroupName("");
            param7.setPlacement(param11);
            param7.setKernelId("");
            param7.setRamdiskId("");
            param7.setPlatform("");

            InstanceMonitoringStateType param12 = new InstanceMonitoringStateType();
            param12.setState("");
            param7.setMonitoring(param12);
            param7.setSubnetId("");
            param7.setVpcId("");
//            String ipAddr = inst.getPrivateIpAddress();
//            param7.setPrivateIpAddress((null != ipAddr ? ipAddr : ""));
            param7.setPrivateIpAddress(inst.getPrivateIpAddress());
            param7.setIpAddress(inst.getIpAddress());

            StateReasonType param13 = new StateReasonType();
            param13.setCode("");
            param13.setMessage("");
            param7.setStateReason(param13);
            param7.setArchitecture("");
            param7.setRootDeviceType("");
            String devicePath = engine.cloudDeviceIdToDevicePath(inst.getHypervisor(), inst.getRootDeviceId());
            param7.setRootDeviceName(devicePath);

            GroupSetType param14 = new GroupSetType();
            GroupItemType param15 = new GroupItemType(); // VPC security group
            param15.setGroupName("");
            param15.setGroupName("");
            param14.addItem(param15);
            param7.setGroupSet(param14);

            param7.setInstanceLifecycle("");
            param7.setSpotInstanceRequestId("");
            param7.setHypervisor(inst.getHypervisor());

            EC2TagKeyValue[] tags = inst.getResourceTags();
            param7.setTagSet(setResourceTags(tags));

            param6.addItem(param7);
            param3.setInstancesSet(param6);
            param2.addItem(param3);
        }
        param1.setReservationSet(param2);
        param1.setRequestId(UUID.randomUUID().toString());
View Full Code Here

        RunInstancesResponse response = new RunInstancesResponse();
        RunInstancesResponseType param1 = new RunInstancesResponseType();

        param1.setReservationId("");

        RunningInstancesSetType param6 = new RunningInstancesSetType();
        EC2Instance[] instances = engineResponse.getInstanceSet();
        for (EC2Instance inst : instances) {
            RunningInstancesItemType param7 = new RunningInstancesItemType();
            param7.setInstanceId(inst.getId());
            param7.setImageId(inst.getTemplateId());

            String accountName = inst.getAccountName();
            String domainId = inst.getDomainId();
            String ownerId = domainId + ":" + accountName;

            param1.setOwnerId(ownerId);

            EC2SecurityGroup[] groups = inst.getGroupSet();
            GroupSetType param2 = new GroupSetType();
            if (null == groups || 0 == groups.length) {
                GroupItemType param3 = new GroupItemType();
                param3.setGroupId("");
                param2.addItem(param3);
            } else {
                for (EC2SecurityGroup group : groups) {
                    GroupItemType param3 = new GroupItemType();
                    param3.setGroupId(group.getId());
                    param2.addItem(param3);
                }
            }
            param1.setGroupSet(param2);

            InstanceStateType param8 = new InstanceStateType();
            param8.setCode(toAmazonCode(inst.getState()));
            param8.setName(toAmazonStateName(inst.getState()));
            param7.setInstanceState(param8);

            param7.setPrivateDnsName("");
            param7.setDnsName("");
            param7.setReason("");
            param7.setKeyName(inst.getKeyPairName());
            param7.setAmiLaunchIndex(null);

            ProductCodesSetType param9 = new ProductCodesSetType();
            ProductCodesSetItemType param10 = new ProductCodesSetItemType();
            param10.setProductCode("");
            param10.setType("");
            param9.addItem(param10);
            param7.setProductCodes(param9);

            param7.setInstanceType(inst.getServiceOffering());
            // -> CloudStack seems to have issues with timestamp formats so just in case
            Calendar cal = inst.getCreated();
            if (null == cal) {
                cal = Calendar.getInstance();
                cal.set(1970, 1, 1);
            }
            param7.setLaunchTime(cal);

            PlacementResponseType param11 = new PlacementResponseType();
            param11.setAvailabilityZone(inst.getZoneName());
            param7.setPlacement(param11);

            param7.setKernelId("");
            param7.setRamdiskId("");
            param7.setPlatform("");

            InstanceMonitoringStateType param12 = new InstanceMonitoringStateType();
            param12.setState("");
            param7.setMonitoring(param12);
            param7.setSubnetId("");
            param7.setVpcId("");
            String ipAddr = inst.getPrivateIpAddress();
            param7.setPrivateIpAddress((null != ipAddr ? ipAddr : ""));
            param7.setIpAddress(inst.getIpAddress());

            StateReasonType param13 = new StateReasonType();
            param13.setCode("");
            param13.setMessage("");
            param7.setStateReason(param13);
            param7.setArchitecture("");
            param7.setRootDeviceType("");
            param7.setRootDeviceName("");

            param7.setInstanceLifecycle("");
            param7.setSpotInstanceRequestId("");
            param7.setVirtualizationType("");
            param7.setClientToken("");

            ResourceTagSetType param18 = new ResourceTagSetType();
            ResourceTagSetItemType param19 = new ResourceTagSetItemType();
            param19.setKey("");
            param19.setValue("");
            param18.addItem(param19);
            param7.setTagSet(param18);

            GroupSetType param14 = new GroupSetType();
            GroupItemType param15 = new GroupItemType();
            param15.setGroupId("");
            param15.setGroupName("");
            param14.addItem(param15);
            param7.setGroupSet(param14);

            String hypervisor = inst.getHypervisor();
            param7.setHypervisor((null != hypervisor ? hypervisor : ""));
            param6.addItem(param7);
        }
        param1.setInstancesSet(param6);
        param1.setRequesterId("");

        param1.setRequestId(UUID.randomUUID().toString());
View Full Code Here

        if (0 == count) {
            throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
        }

        // -> execute the request
        StartInstancesResponse EC2response = EC2SoapServiceImpl.toStartInstancesResponse( ServiceProvider.getInstance().getEC2Engine().startInstances(EC2request));
        serializeResponse(response, EC2response);
    }
View Full Code Here

        if ( force != null) {
            EC2request.setForce( Boolean.parseBoolean(force[0]));
        }

        // -> execute the request
        StopInstancesResponse EC2response = EC2SoapServiceImpl.toStopInstancesResponse( ServiceProvider.getInstance().getEC2Engine().stopInstances( EC2request ));
        serializeResponse(response, EC2response);
    }
View Full Code Here

            throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
        }

        // -> execute the request
        EC2request.setDestroyInstances( true );
        TerminateInstancesResponse EC2response = EC2SoapServiceImpl.toTermInstancesResponse( ServiceProvider.getInstance().getEC2Engine().stopInstances( EC2request ));
        serializeResponse(response, EC2response);
    }
View Full Code Here

TOP

Related Classes of com.amazon.ec2.RunningInstancesSetType

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.