Package io.fathom.cloud.protobuf.CloudModel

Examples of io.fathom.cloud.protobuf.CloudModel.SecurityGroupData


    private List<Long> buildSecurityGroups() throws CloudException {
        List<Long> securityGroupIds = Lists.newArrayList();

        String securityGroupName = "__system__";
        SecurityGroupData securityGroup = securityGroups.find(project, securityGroupName);
        if (securityGroup == null) {
            log.info("Creating security group: {}", securityGroupName);

            SecurityGroupData.Builder b = SecurityGroupData.newBuilder();
            b.setName(securityGroupName);
            b.setProjectId(project.getId());
            securityGroup = securityGroups.create(project, b);
        } else {
            log.info("Found security group: {}", securityGroupName);
        }

        if (securityGroup.getRulesCount() == 0) {
            SecurityGroupRuleData.Builder sgb = SecurityGroupRuleData.newBuilder();
            sgb.setFromSecurityGroup(securityGroup.getId());
            securityGroups.addRule(auth, project, securityGroup.getId(), sgb);
        }

        securityGroupIds.add(securityGroup.getId());
        return securityGroupIds;
    }
View Full Code Here

TOP

Related Classes of io.fathom.cloud.protobuf.CloudModel.SecurityGroupData

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.