Package org.openstack.model.compute

Examples of org.openstack.model.compute.CreateSecurityGroupRuleRequest


          } else {
            throw new OpsException("Error creating security group", e);
          }
        }
        {
          CreateSecurityGroupRuleRequest newRule = new CreateSecurityGroupRuleRequest();
          newRule.setCidr("0.0.0.0/0");
          newRule.setFromPort(22);
          newRule.setToPort(22);
          newRule.setIpProtocol("tcp");
          newRule.setParentGroupId(createdSecurityGroup.getId());

          try {
            log.info("Creating security group rule for port: " + newRule.getToPort());
            SecurityGroupRule createdRule = computeClient.root().securityGroupRules().create(newRule);
          } catch (OpenstackException e) {
            String message = e.getMessage();
            if (message != null && message.contains("This rule already exists")) {
              log.warn("Ignoring 'rule already exists': " + e.getMessage());
View Full Code Here


      SecurityGroupRule matchingRule = findMatchingRule(securityGroup);

      if (OpsContext.isConfigure()) {
        if (matchingRule == null) {
          CreateSecurityGroupRuleRequest rule = new CreateSecurityGroupRuleRequest();
          rule.setCidr("0.0.0.0/0");
          rule.setIpProtocol("tcp");
          rule.setFromPort(model.publicPort);
          rule.setToPort(model.publicPort);
          rule.setParentGroupId(securityGroup.getId());

          openstackComputeClient.root().securityGroupRules().create(rule);
        }
      }
View Full Code Here

TOP

Related Classes of org.openstack.model.compute.CreateSecurityGroupRuleRequest

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.