Package com.amazon.ec2

Examples of com.amazon.ec2.SecurityGroupItemType


        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

        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

        DescribeSecurityGroupsResponseType param1 = new DescribeSecurityGroupsResponseType();
        SecurityGroupSetType param2 = new SecurityGroupSetType();

        EC2SecurityGroup[] groups = engineResponse.getGroupSet();
        for (EC2SecurityGroup group : groups) {
            SecurityGroupItemType param3 = new SecurityGroupItemType();
            String accountName = group.getAccountName();
            String domainId = group.getDomainId();
            String ownerId = domainId + ":" + accountName;

            param3.setOwnerId(ownerId);
            param3.setGroupName(group.getName());
            String desc = group.getDescription();
            param3.setGroupDescription((null != desc ? desc : ""));
            param3.setGroupId(group.getId());
            param3.setVpcId("");

            IpPermissionSetType param4 = new IpPermissionSetType();
            EC2IpPermission[] perms = group.getIpPermissionSet();
            for (EC2IpPermission perm : perms) {
                // TODO: Fix kludges like this...
                if (perm == null)
                    continue;
                IpPermissionType param5 = new IpPermissionType();
                param5.setIpProtocol(perm.getProtocol());
                if (perm.getProtocol().equalsIgnoreCase("icmp")) {
                    param5.setFromPort(Integer.parseInt(perm.getIcmpType()));
                    param5.setToPort(Integer.parseInt(perm.getIcmpCode()));
                } else {
                    param5.setFromPort(perm.getFromPort());
                    param5.setToPort(perm.getToPort());
                }

                // -> user groups
                EC2SecurityGroup[] userSet = perm.getUserSet();
                if (null == userSet || 0 == userSet.length) {
                    UserIdGroupPairSetType param8 = new UserIdGroupPairSetType();
                    param5.setGroups(param8);
                } else {
                    for (EC2SecurityGroup secGroup : userSet) {
                        UserIdGroupPairSetType param8 = new UserIdGroupPairSetType();
                        UserIdGroupPairType param9 = new UserIdGroupPairType();
                        param9.setUserId(secGroup.getAccount());
                        param9.setGroupName(secGroup.getName());
                        param8.addItem(param9);
                        param5.setGroups(param8);
                    }
                }

                // -> or CIDR list
                String[] rangeSet = perm.getIpRangeSet();
                if (null == rangeSet || 0 == rangeSet.length) {
                    IpRangeSetType param6 = new IpRangeSetType();
                    param5.setIpRanges(param6);
                } else {
                    for (String range : rangeSet) {
                        // TODO: This needs further attention...
                        IpRangeSetType param6 = new IpRangeSetType();
                        if (range != null) {
                            IpRangeItemType param7 = new IpRangeItemType();
                            param7.setCidrIp(range);
                            param6.addItem(param7);
                        }
                        param5.setIpRanges(param6);
                    }
                }
                param4.addItem(param5);
            }
            param3.setIpPermissions(param4);
            EC2TagKeyValue[] tags = group.getResourceTags();
            param3.setTagSet(setResourceTags(tags));
            param2.addItem(param3);
        }
        param1.setSecurityGroupInfo(param2);
        param1.setRequestId(UUID.randomUUID().toString());
        response.setDescribeSecurityGroupsResponse(param1);
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.SecurityGroupItemType

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.