use of com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroups in project cloudbreak by hortonworks.
the class AzurePlatformResources method securityGroups.
@Override
public CloudSecurityGroups securityGroups(CloudCredential cloudCredential, Region region, Map<String, String> filters) {
AzureClient client = azureClientService.getClient(cloudCredential);
Map<String, Set<CloudSecurityGroup>> result = new HashMap<>();
for (NetworkSecurityGroup securityGroup : client.getSecurityGroups().list()) {
String actualRegion = securityGroup.region().label();
if (regionMatch(actualRegion, region)) {
Map<String, Object> properties = new HashMap<>();
properties.put("resourceGroupName", securityGroup.resourceGroupName());
properties.put("networkInterfaceIds", securityGroup.networkInterfaceIds());
CloudSecurityGroup cloudSecurityGroup = new CloudSecurityGroup(securityGroup.name(), securityGroup.id(), properties);
result.computeIfAbsent(actualRegion, s -> new HashSet<>()).add(cloudSecurityGroup);
}
}
if (result.isEmpty() && Objects.nonNull(region)) {
result.put(region.value(), new HashSet<>());
}
return new CloudSecurityGroups(result);
}
Aggregations