private void initSecurityGroup(TemplateBuilderSpec spec, String securityGroup) { if (!isEC2) { return; } // in case of AWS, we are going to create the security group, if it doesn't exist AWSEC2Api ec2Api = compute.getContext().unwrapApi(AWSEC2Api.class); SecurityGroupApi securityGroupApi = ec2Api.getSecurityGroupApi().get(); String region = spec.getLocationId(); if (region == null) { region = "us-east-1"; } Set<SecurityGroup> securityGroups = securityGroupApi.describeSecurityGroupsInRegion(region, securityGroup); if (!securityGroups.isEmpty()) { LOGGER.info("Security group: '" + securityGroup + "' is found in region '" + region + '\''); return; } LOGGER.info("Security group: '" + securityGroup + "' is not found in region '" + region + "', creating it on the fly"); securityGroupApi.createSecurityGroupInRegion(region, securityGroup, securityGroup); for (Map.Entry<Integer, Integer> portRangeEntry : portRangeMap.entrySet()) { int startPort = portRangeEntry.getKey(); int endPort = portRangeEntry.getValue(); securityGroupApi.authorizeSecurityGroupIngressInRegion(region, securityGroup, TCP, startPort, endPort, CIDR_RANGE); } }
"Using default location.", spec.getBlobStoreLocationId()); } else if (spec.getTemplate().getLocationId() != null) { if (loc.getId().equals(spec.getTemplate().getLocationId())) { computeIsoCodes = loc.getIso3166Codes(); break; "Using default blob store location.", spec.getTemplate().getLocationId()); } else { for (Location loc : context.getBlobStore().listAssignableLocations()) {
"Using default location.", spec.getBlobStoreLocationId()); } else if (spec.getTemplate().getLocationId() != null) { if (loc.getId().equals(spec.getTemplate().getLocationId())) { computeIsoCodes = loc.getIso3166Codes(); break; "Using default blob store location.", spec.getTemplate().getLocationId()); } else { for (Location loc : context.getBlobStore().listAssignableLocations()) {
String region = spec.getLocationId(); if (region == null) { region = "us-east-1";
.getSecurityGroupExtensionForZone(clusterSpec.getTemplate().getLocationId());