Examples of CloudStackSecurityGroup


Examples of com.cloud.stack.models.CloudStackSecurityGroup

     * @return
     */
    public EC2SecurityGroup createSecurityGroup(String groupName, String groupDesc) {
        EC2SecurityGroup sg = new EC2SecurityGroup();
        try {
            CloudStackSecurityGroup grp = getApi().createSecurityGroup(groupName, null, groupDesc, null);
            if (grp != null && grp.getId() != null) {
              sg.setId(grp.getId());
            }
        } catch( Exception e ) {
            logger.error( "EC2 CreateSecurityGroup - ", e);
            handleException(e);
        }
View Full Code Here

Examples of com.cloud.stack.models.CloudStackSecurityGroup

                for (EC2SecurityGroup group : groups) {
                    CloudStackKeyValue pair = new CloudStackKeyValue();
                    pair.setKeyValue(group.getAccount(), group.getName());
                    secGroupList.add(pair);
                }
                CloudStackSecurityGroup resp = null;
                if (ipPerm.getProtocol().equalsIgnoreCase("icmp")) {
                    resp = getApi().authorizeSecurityGroupIngress(null, constructList(ipPerm.getIpRangeSet()), null, null,
                            ipPerm.getIcmpCode(), ipPerm.getIcmpType(), ipPerm.getProtocol(), null,
                            request.getName(), null, secGroupList);
                } else {
                    resp = getApi().authorizeSecurityGroupIngress(null, constructList(ipPerm.getIpRangeSet()), null,
                            ipPerm.getToPort().longValue(), null, null, ipPerm.getProtocol(), null, request.getName(),
                            ipPerm.getFromPort().longValue(), secGroupList);
                }
                if (resp != null ){
                    List<CloudStackIngressRule> ingressRules = resp.getIngressRules();
                    for (CloudStackIngressRule ingressRule : ingressRules)
                        if (ingressRule.getRuleId() == null) return false;
                } else {
                return false;
            }
View Full Code Here

Examples of com.cloud.stack.models.CloudStackSecurityGroup

     * @return
     */
    public EC2SecurityGroup createSecurityGroup(String groupName, String groupDesc) {
        EC2SecurityGroup sg = new EC2SecurityGroup();
        try {
            CloudStackSecurityGroup grp = getApi().createSecurityGroup(groupName, null, groupDesc, null);
            if (grp != null && grp.getId() != null) {
                sg.setId(grp.getId());
            }
        } catch (Exception e) {
            logger.error("EC2 CreateSecurityGroup - ", e);
            handleException(e);
        }
View Full Code Here

Examples of com.cloud.stack.models.CloudStackSecurityGroup

                for (EC2SecurityGroup group : groups) {
                    CloudStackKeyValue pair = new CloudStackKeyValue();
                    pair.setKeyValue(group.getAccount(), group.getName());
                    secGroupList.add(pair);
                }
                CloudStackSecurityGroup resp = null;
                if (ipPerm.getProtocol().equalsIgnoreCase("icmp")) {
                    resp =
                        getApi().authorizeSecurityGroupIngress(null, constructList(ipPerm.getIpRangeSet()), null, null, ipPerm.getIcmpCode(), ipPerm.getIcmpType(),
                            ipPerm.getProtocol(), null, request.getName(), null, secGroupList);
                } else {
                    resp =
                        getApi().authorizeSecurityGroupIngress(null, constructList(ipPerm.getIpRangeSet()), null, ipPerm.getToPort().longValue(), null, null,
                            ipPerm.getProtocol(), null, request.getName(), ipPerm.getFromPort().longValue(), secGroupList);
                }
                if (resp != null) {
                    List<CloudStackIngressRule> ingressRules = resp.getIngressRules();
                    for (CloudStackIngressRule ingressRule : ingressRules)
                        if (ingressRule.getRuleId() == null)
                            return false;
                } else {
                    return false;
View Full Code Here

Examples of com.cloud.stack.models.CloudStackSecurityGroup

   * @param groupDesc
   * @return
   */
  public Boolean createSecurityGroup(String groupName, String groupDesc) {
    try {
      CloudStackSecurityGroup grp = getApi().createSecurityGroup(groupName, null, groupDesc, null);
      if (grp != null && grp.getId() != null) {
        return true;
      }
      return false;
    } catch( Exception e ) {
      logger.error( "EC2 CreateSecurityGroup - ", e);
View Full Code Here

Examples of com.cloud.stack.models.CloudStackSecurityGroup

        vm.setName(resp.getName());
        vm.setZoneName(resp.getZoneName());
        vm.setTemplateId(resp.getTemplateId().toString());
        if (resp.getSecurityGroupList() != null && resp.getSecurityGroupList().size() > 0) {
          // TODO, we have a list of security groups, just return the first one?
          CloudStackSecurityGroup securityGroup = resp.getSecurityGroupList().get(0);
          vm.setGroup(securityGroup.getName());
        }
        vm.setState(resp.getState());
        vm.setCreated(resp.getCreated());
        vm.setIpAddress(resp.getIpAddress());
        vm.setAccountName(resp.getAccountName());
View Full Code Here

Examples of com.cloud.stack.models.CloudStackSecurityGroup

     * @param groupDesc
     * @return
     */
    public Boolean createSecurityGroup(String groupName, String groupDesc) {
        try {
            CloudStackSecurityGroup grp = getApi().createSecurityGroup(groupName, null, groupDesc, null);
            if (grp != null && grp.getId() != null) {
                return true;
            }
            return false;
        } catch( Exception e ) {
            logger.error( "EC2 CreateSecurityGroup - ", e);
View Full Code Here

Examples of com.cloud.stack.models.CloudStackSecurityGroup

                for (EC2SecurityGroup group : groups) {
                    CloudStackKeyValue pair = new CloudStackKeyValue();
                    pair.setKeyValue(group.getAccount(), group.getName());
                    secGroupList.add(pair);
                }
                CloudStackSecurityGroup resp = null;
                if (ipPerm.getProtocol().equalsIgnoreCase("icmp")) {
                    resp = getApi().authorizeSecurityGroupIngress(null, constructList(ipPerm.getIpRangeSet()), null, null,
                            ipPerm.getIcmpCode(), ipPerm.getIcmpType(), ipPerm.getProtocol(), null,
                            request.getName(), null, secGroupList);
                } else {
                    resp = getApi().authorizeSecurityGroupIngress(null, constructList(ipPerm.getIpRangeSet()), null,
                            ipPerm.getToPort().longValue(), null, null, ipPerm.getProtocol(), null, request.getName(),
                            ipPerm.getFromPort().longValue(), secGroupList);
                }
                if (resp != null ){
                    List<CloudStackIngressRule> ingressRules = resp.getIngressRules();
                    for (CloudStackIngressRule ingressRule : ingressRules)
                        if (ingressRule.getRuleId() == null) return false;
                } else {
                return false;
            }
View Full Code Here

Examples of com.cloud.stack.models.CloudStackSecurityGroup

   * @param groupDesc
   * @return
   */
  public Boolean createSecurityGroup(String groupName, String groupDesc) {
    try {
      CloudStackSecurityGroup grp = getApi().createSecurityGroup(groupName, null, groupDesc, null);
      if (grp != null && grp.getId() != null) {
        return true;
      }
      return false;
    } catch( Exception e ) {
      logger.error( "EC2 CreateSecurityGroup - ", e);
View Full Code Here

Examples of com.cloud.stack.models.CloudStackSecurityGroup

     * @return
     */
    public EC2SecurityGroup createSecurityGroup(String groupName, String groupDesc) {
        EC2SecurityGroup sg = new EC2SecurityGroup();
        try {
            CloudStackSecurityGroup grp = getApi().createSecurityGroup(groupName, null, groupDesc, null);
            if (grp != null && grp.getId() != null) {
              sg.setId(grp.getId());
            }
        } catch( Exception e ) {
            logger.error( "EC2 CreateSecurityGroup - ", e);
            handleException(e);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.